From 19040edfd027b86ac60139557cc5dee5dbd7fc04 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 20 Oct 2010 10:42:17 -0400 Subject: dumper: Differentiate between "external" and "internal" linking The previous commit aea515709 broke scanning for libraries not in the current directory, such as scanning Gio from gobject-introspection. In this case, it's wrong to add -L., and to move the other -L behind the library. Instead, we should just do a "normal" link using pkg-config --libs with few games. https://bugzilla.gnome.org/show_bug.cgi?id=632701 --- giscanner/dumper.py | 46 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 12 deletions(-) (limited to 'giscanner/dumper.py') diff --git a/giscanner/dumper.py b/giscanner/dumper.py index e44f4f4a..9b4033c7 100644 --- a/giscanner/dumper.py +++ b/giscanner/dumper.py @@ -214,6 +214,29 @@ class DumpCompiler(object): # likely to be uninstalled yet and we want the uninstalled RPATHs have # priority (or we might run with installed library that is older) + if not self._options.external_library: + self._add_link_internal_args(args, libtool) + else: + self._add_link_external_args(args) + + for source in sources: + if not os.path.exists(source): + raise CompilerError( + "Could not find object file: %s" % (source, )) + args.extend(list(sources)) + + if not self._options.quiet: + print "g-ir-scanner: link: %s" % ( + subprocess.list2cmdline(args), ) + try: + subprocess.check_call(args) + except subprocess.CalledProcessError, e: + raise LinkerError(e) + + def _add_link_internal_args(self, args, libtool): + # An "internal" link is where the library to be introspected + # is being built in the current directory. + # Search the current directory first args.append('-L.') @@ -231,19 +254,18 @@ class DumpCompiler(object): args.append('-L' + library_path) args.extend(self._run_pkgconfig('--libs')) - for source in sources: - if not os.path.exists(source): - raise CompilerError( - "Could not find object file: %s" % (source, )) - args.extend(list(sources)) - if not self._options.quiet: - print "g-ir-scanner: link: %s" % ( - subprocess.list2cmdline(args), ) - try: - subprocess.check_call(args) - except subprocess.CalledProcessError, e: - raise LinkerError(e) + def _add_link_external_args(self, args): + # An "external" link is where the library to be introspected + # is installed on the system; this case is used for the scanning + # of GLib in gobject-introspection itself. + + args.extend(self._run_pkgconfig('--libs')) + for library in self._options.libraries: + if library.endswith(".la"): # explicitly specified libtool library + args.append(library) + else: + args.append('-l' + library) def compile_introspection_binary(options, get_type_functions): dc = DumpCompiler(options, get_type_functions) -- cgit v1.2.1