From 517267dbfc166a44ac63a32a5fe76af21c04b2fe Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 26 Nov 2008 15:47:35 +0000 Subject: Add --libtool option which we expect Automake-using people to pass svn path=/trunk/; revision=977 --- ChangeLog | 7 +++++++ docs/g-ir-scanner.1 | 3 +++ gir/Makefile.am | 5 +++++ giscanner/dumper.py | 19 ++++++++++++++----- tests/everything/Makefile.am | 1 + tests/offsets/Makefile.am | 1 + tests/scanner/Makefile.am | 6 ++++++ tools/g-ir-scanner | 3 +++ 8 files changed, 40 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index fd9c841c..2db4d82c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-11-25 Colin Walters + + * 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 * tests/scanner/Makefile.am: Remove hand-rolled generation of .tgir; easier diff --git a/docs/g-ir-scanner.1 b/docs/g-ir-scanner.1 index 315f678e..f3c13c15 100644 --- a/docs/g-ir-scanner.1 +++ b/docs/g-ir-scanner.1 @@ -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. diff --git a/gir/Makefile.am b/gir/Makefile.am index c795091d..1f5bb138 100644 --- a/gir/Makefile.am +++ b/gir/Makefile.am @@ -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 \ diff --git a/giscanner/dumper.py b/giscanner/dumper.py index 3511a7f9..3ed58554 100644 --- a/giscanner/dumper.py +++ b/giscanner/dumper.py @@ -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]) diff --git a/tests/everything/Makefile.am b/tests/everything/Makefile.am index 913cda9f..5055dca5 100644 --- a/tests/everything/Makefile.am +++ b/tests/everything/Makefile.am @@ -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 \ diff --git a/tests/offsets/Makefile.am b/tests/offsets/Makefile.am index 2c3cae20..d04b8015 100644 --- a/tests/offsets/Makefile.am +++ b/tests/offsets/Makefile.am @@ -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 \ diff --git a/tests/scanner/Makefile.am b/tests/scanner/Makefile.am index c2890f38..77586bf1 100644 --- a/tests/scanner/Makefile.am +++ b/tests/scanner/Makefile.am @@ -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 \ diff --git a/tools/g-ir-scanner b/tools/g-ir-scanner index ba9d8a64..f69bdeb6 100755 --- a/tools/g-ir-scanner +++ b/tools/g-ir-scanner @@ -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") -- cgit v1.2.1