[GTK] doc rebasing does not respect DESTDIR
authorkov@webkit.org <kov@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Feb 2012 02:28:31 +0000 (02:28 +0000)
committerkov@webkit.org <kov@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Feb 2012 02:28:31 +0000 (02:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=78177

Reviewed by Martin Robinson.

* GNUmakefile.am: Pass DESTDIR on to generate-gtkdoc, when
calling it for rebasing.
* gtk/generate-gtkdoc:
(get_common_options): Handle the new --virtual-root option.
* gtk/gtkdoc.py:
(GTKDoc.rebase_installed_docs): If a virtual-root has been given, pass
it on to gtkdoc-rebase as dest-dir, and prefix the htmldir with it.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107164 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/GNUmakefile.am
Tools/gtk/generate-gtkdoc
Tools/gtk/gtkdoc.py

index 1456888..154c35b 100644 (file)
@@ -1,3 +1,18 @@
+2012-02-08  Gustavo Noronha Silva  <gns@gnome.org>
+
+        [GTK] doc rebasing does not respect DESTDIR
+        https://bugs.webkit.org/show_bug.cgi?id=78177
+
+        Reviewed by Martin Robinson.
+
+        * GNUmakefile.am: Pass DESTDIR on to generate-gtkdoc, when
+        calling it for rebasing.
+        * gtk/generate-gtkdoc:
+        (get_common_options): Handle the new --virtual-root option.
+        * gtk/gtkdoc.py:
+        (GTKDoc.rebase_installed_docs): If a virtual-root has been given, pass
+        it on to gtkdoc-rebase as dest-dir, and prefix the htmldir with it.
+
 2012-02-08  Adam Barth  <abarth@webkit.org>
 
         Remove Python 2.5 support from WebKit
index 23d8112..fc8ed6b 100644 (file)
@@ -326,7 +326,7 @@ if ENABLE_WEBKIT2
          fi; \
        fi
 endif
-       $(srcdir)/Tools/gtk/generate-gtkdoc --rebase
+       $(srcdir)/Tools/gtk/generate-gtkdoc --rebase --virtual-root=$${DESTDIR}
 
 uninstall-local:
        @DOC_MODULE_VERSION=`cat ./Documentation/webkitgtk/version.xml`; \
index 996b91a..04f0bda 100755 (executable)
@@ -50,10 +50,19 @@ def get_gtkdoc_module_paths(xref_dep_packages):
 
 
 def get_common_options():
+    # TODO: We should consider using an arguments parsing library if
+    # we need more of these complex ones.
+    virtual_root = ''
+    for argument in sys.argv:
+        if argument.startswith('--virtual-root='):
+            virtual_root = argument.split('=')[1]
+            break
+
     return {
         'decorator': 'WEBKIT_API',
         'deprecation_guard': 'WEBKIT_DISABLE_DEPRECATED',
         'library_path' : common.build_path('.libs'),
+        'virtual_root' : virtual_root,
     }
 
 def get_common_xref_deps():
index ffaa832..a2586ac 100644 (file)
@@ -74,6 +74,11 @@ class GTKDoc(object):
     interactive        -- Whether or not errors or warnings should prompt the user
                           to continue or not. When this value is false, generation
                           will continue despite warnings. (default False)
+
+    virtual_root       -- A temporary installation directory which is used as the root
+                          where the actual installation prefix lives; this is mostly
+                          useful for packagers, and should be set to what is given to
+                          make install as DESTDIR.
     """
 
     def __init__(self, args):
@@ -356,13 +361,15 @@ class GTKDoc(object):
         self._run_command(args, cwd=self.output_dir, ignore_warnings=True)
 
     def rebase_installed_docs(self):
-        html_dir = os.path.join(self.prefix, 'share', 'gtk-doc', 'html', self.module_name)
+        html_dir = os.path.join(self.virtual_root + self.prefix, 'share', 'gtk-doc', 'html', self.module_name)
         if not os.path.isdir(html_dir):
             return
         args = ['gtkdoc-rebase',
                 '--relative',
                 '--html-dir=%s' % html_dir]
         args.extend(['--other-dir=%s' % extra_dir for extra_dir in self.cross_reference_deps])
+        if self.virtual_root:
+            args.extend(['--dest-dir=%s' % self.virtual_root])
         self._run_command(args, cwd=self.output_dir)