summaryrefslogtreecommitdiff
path: root/giscanner/dumper.py
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2010-10-20 10:42:17 -0400
committerColin Walters <walters@verbum.org>2010-11-11 17:12:53 -0500
commit19040edfd027b86ac60139557cc5dee5dbd7fc04 (patch)
tree3f9cb80eef2a20f8259d497b02a340a6162da6d0 /giscanner/dumper.py
parent57ef2d4fe73c5cdf8500c5761c700638943d1c7d (diff)
downloadgobject-introspection-19040edfd027b86ac60139557cc5dee5dbd7fc04.tar.gz
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
Diffstat (limited to 'giscanner/dumper.py')
-rw-r--r--giscanner/dumper.py46
1 files changed, 34 insertions, 12 deletions
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)