Add --libtool option which we expect Automake-using people to pass
authorColin Walters <walters@src.gnome.org>
Wed, 26 Nov 2008 15:47:35 +0000 (15:47 +0000)
committerColin Walters <walters@src.gnome.org>
Wed, 26 Nov 2008 15:47:35 +0000 (15:47 +0000)
svn path=/trunk/; revision=977

ChangeLog
docs/g-ir-scanner.1
gir/Makefile.am
giscanner/dumper.py
tests/everything/Makefile.am
tests/offsets/Makefile.am
tests/scanner/Makefile.am
tools/g-ir-scanner

index fd9c841..2db4d82 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2008-11-25  Colin Walters  <walters@verbum.org>
 
+       * tools/g-ir-scanner: Add --libtool option which we expect Automake-using
+       people to pass.
+       * giscanner/dumper.py: Implement it.
+       * gir/Makefile.am, tests/**/Makefile.am: Use it.
+
+2008-11-25  Colin Walters  <walters@verbum.org>
+
        * tests/scanner/Makefile.am: Remove hand-rolled generation of .tgir; easier
        to just use a Makefile rule and dependencies.  This corresponds with a change
        made to gir-repository to fix srcdir != builddir issues.
index 315f678..f3c13c1 100644 (file)
@@ -51,6 +51,9 @@ should be upper case. Examples: Gtk, Clutter, WebKit.
 Disable usage of libtool for compiling stub introspection binary.  Use this
 if your build system does not require libtool.
 .TP
+.B \---libtool
+Full path to libtool executable.  Typically used for Automake systems.
+.TP
 .B ---nsversion=VERSION
 The namespace version. For instance 1.0. This is usually the platform version,
 eg 2.0 for Gtk+, not 2.12.7.
index c795091..1f5bb13 100644 (file)
@@ -19,6 +19,7 @@ GLib-2.0.gir: $(SCANNER_BIN) $(SCANNER_LIBS) Makefile glib-2.0.c
            --noclosure \
            --output $@ \
            --strip-prefix=g \
+            --libtool="$(LIBTOOL)" \
            --library=$(GLIB_LIBRARY) \
            $(CPPFLAGS) \
            -I$(GLIB_INCLUDEDIR) \
@@ -49,6 +50,7 @@ GObject-2.0.gir: GLib-2.0.gir $(SCANNER_BIN) $(SCANNER_LIBS) Makefile
            --noclosure \
            --output $@ \
            --strip-prefix=g \
+            --libtool="$(LIBTOOL)" \
             --include=GLib-2.0 \
            --library=$(GOBJECT_LIBRARY) \
            -I$(GOBJECT_INCLUDEDIR) \
@@ -75,6 +77,7 @@ GModule-2.0.gir: GLib-2.0.gir $(SCANNER_BIN) $(SCANNER_LIBS)
            --noclosure \
            --output $@ \
            --strip-prefix=g \
+            --libtool="$(LIBTOOL)" \
             --include=GLib-2.0 \
            --library=$(GMODULE_LIBRARY) \
            -I$(GMODULE_INCLUDEDIR) \
@@ -106,6 +109,7 @@ Gio-2.0.gir: GObject-2.0.gir $(SCANNER_BIN) $(SCANNER_LIBS) Makefile $(srcdir)/g
            --noclosure \
            --output $@ \
            --strip-prefix=g \
+            --libtool="$(LIBTOOL)" \
             --include=GObject-2.0 \
            --library=$(GIO_LIBRARY) \
            -I$(GIO_INCLUDEDIR) \
@@ -130,6 +134,7 @@ GIRepository-2.0.gir: GObject-2.0.gir $(SCANNER_BIN) $(SCANNER_LIBS) $(GIREPOSIT
            --noclosure \
            --output $@ \
            --strip-prefix=g \
+            --libtool="$(LIBTOOL)" \
             --include=GObject-2.0 \
            --library=girepository \
            -I$(srcdir)/girepository \
index 3511a7f..3ed5855 100644 (file)
@@ -128,15 +128,22 @@ class DumpCompiler(object):
     def _use_libtool_infection(self):
         libtool_infection = not self._options.nolibtool
         if not libtool_infection:
-            return False
+            return None
+
+        if self._options.libtool_path:
+            # Automake by default sets:
+            # LIBTOOL = $(SHELL) $(top_builddir)/libtool
+            # To be strictly correct we would have to parse shell.  For now
+            # we simply split().
+            return self._options.libtool_path.split()
 
         try:
             subprocess.check_call(['libtool', '--version'])
         except subprocess.CalledProcessError, e:
             # If libtool's not installed, assume we don't need it
-            return False
+            return None
 
-        return True
+        return ['libtool']
 
     def _compile(self, output, *sources):
         args = [self._compiler_cmd]
@@ -159,8 +166,10 @@ class DumpCompiler(object):
 
     def _link(self, output, *sources):
         args = []
-        if self._use_libtool_infection():
-            args.extend(['libtool', '--mode=link'])
+        libtool = self._use_libtool_infection()
+        if libtool:
+            args.extend(libtool)
+            args.append('--mode=link')
 
         args.extend([self._linker_cmd, '-o', output])
 
index 913cda9..5055dca 100644 (file)
@@ -33,6 +33,7 @@ BUILT_SOURCES = $(TYPELIBS) $(TXMLS) $(GIRS)
 Everything-$(TYPELIB_VERSION).gir: libgirepository-everything.la everything.c everything.h $(SCANNER_BIN) $(SCANNER_LIBS)
        $(CHECK_DEBUG) $(SCANNER) \
        --include=GObject-2.0 \
+        --libtool="$(LIBTOOL)" \
        --library=girepository-everything \
        --namespace=Everything --nsversion=$(TYPELIB_VERSION) \
        --pkg gobject-2.0 \
index 2c3cae2..d04b801 100644 (file)
@@ -20,6 +20,7 @@ liboffsets_la_LDFLAGS = -avoid-version -rpath $(libdir)
 
 offsets-1.0.gir: liboffsets.la offsets.h $(SCANNER_BIN) $(SCANNER_LIBS) Makefile
        $(CHECK_DEBUG) $(SCANNER) \
+        --libtool="$(LIBTOOL)" \
        --library=offsets \
        --namespace=offsets \
        --nsversion=1.0 \
index c2890f3..77586bf 100644 (file)
@@ -42,6 +42,7 @@ annotation-1.0.gir: libannotation.la annotation.c annotation.h utility-1.0.gir $
         $(CHECK_DEBUG) $(SCANNER) \
        --include=GObject-2.0 \
        --include=utility-1.0 \
+        --libtool="$(LIBTOOL)" \
        --library=annotation \
        --namespace=annotation \
        --nsversion=1.0 \
@@ -54,6 +55,7 @@ drawable-1.0.gir: libdrawable.la drawable.c drawable.h utility-1.0.gir $(SCANNER
        $(CHECK_DEBUG) $(SCANNER) \
        --include=GObject-2.0 \
        --include=utility-1.0 \
+        --libtool="$(LIBTOOL)" \
        --library=drawable \
        --namespace=drawable \
        --nsversion=1.0 \
@@ -72,6 +74,7 @@ foo-1.0.gir: libfoo.la foo.c foo.h utility-1.0.gir $(SCANNER_BIN) $(SCANNER_LIBS
        $(CHECK_DEBUG) $(SCANNER) \
        --include=GObject-2.0 \
        --include=utility-1.0 \
+        --libtool="$(LIBTOOL)" \
        --library=foo \
        --namespace=foo \
        --nsversion=1.0 \
@@ -83,6 +86,7 @@ GIRS += foo-1.0.gir
 utility-1.0.gir: libutility.la utility.h $(SCANNER_BIN) $(SCANNER_LIBS) Makefile
        $(CHECK_DEBUG) $(SCANNER) \
        --include=GObject-2.0 \
+        --libtool="$(LIBTOOL)" \
        --library=utility \
        --namespace=utility \
        --nsversion=1.0 \
@@ -95,6 +99,7 @@ GIRS += utility-1.0.gir
 GtkFrob-1.0.gir: libgtkfrob.la gtkfrob.h $(SCANNER_BIN) $(SCANNER_LIBS) Makefile
        $(CHECK_DEBUG) $(SCANNER) \
        --include=GObject-2.0 \
+        --libtool="$(LIBTOOL)" \
        --library=gtkfrob \
        --namespace=GtkFrob \
        --strip-prefix=Gtk \
@@ -112,6 +117,7 @@ barapp_LDFLAGS = -export-dynamic
 BarApp-1.0.gir: barapp $(SCANNER_BIN) $(SCANNER_LIBS) Makefile
        $(SCANNER) \
        --include=GObject-2.0 \
+        --libtool="$(LIBTOOL)" \
        --program=./barapp \
        --namespace=BarApp \
        --strip-prefix=Bar \
index ba9d8a6..f69bdeb 100755 (executable)
@@ -67,6 +67,9 @@ def _get_option_parser():
     parser.add_option("", "--program-arg",
                       action="append", dest="program_args", default=[],
                       help="extra arguments to program")
+    parser.add_option("", "--libtool",
+                      action="store", dest="libtool_path", default=None,
+                      help="full path to libtool")
     parser.add_option("", "--no-libtool",
                       action="store_true", dest="nolibtool", default=False,
                       help="use libtool")