diff options
author | Thibault Saunier <thibault.saunier@osg.samsung.com> | 2016-11-17 12:01:14 -0300 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2016-12-10 10:44:23 -0500 |
commit | eea2447c4e4c1c98fda3ba212a9a9bbcc8655c90 (patch) | |
tree | d1f6e49563bdb0b8e9a497e1f3142d019992e681 | |
parent | 36d1a22eefa5020ba75002a2b0c348017c7ab2e3 (diff) | |
download | gobject-introspection-eea2447c4e4c1c98fda3ba212a9a9bbcc8655c90.tar.gz |
scanner: Add a way to specify extra libraries to link against
Currently the only way to get a library to link against the dumper
program is through '--link' which implies that library will be defined
in the 'libraries' field of the .gir. When using libtool, we
link against dependencies of that library as the .la defines that, but
when using --no-libtool that won't happen and the user needs to be
able to define to what other libraries the program needs to be link
against, and this is what the new --extra-library argument is about.
https://bugzilla.gnome.org/show_bug.cgi?id=774625
-rw-r--r-- | giscanner/ccompiler.py | 6 | ||||
-rw-r--r-- | giscanner/dumper.py | 1 | ||||
-rwxr-xr-x | giscanner/scannermain.py | 3 |
3 files changed, 7 insertions, 3 deletions
diff --git a/giscanner/ccompiler.py b/giscanner/ccompiler.py index 57df9d6a..11bc9fc4 100644 --- a/giscanner/ccompiler.py +++ b/giscanner/ccompiler.py @@ -108,14 +108,14 @@ class CCompiler(object): self._cflags_no_deprecation_warnings = "-Wno-deprecated-declarations" - def get_internal_link_flags(self, args, libtool, libraries, libpaths): + def get_internal_link_flags(self, args, libtool, libraries, extra_libraries, libpaths): # An "internal" link is where the library to be introspected # is being built in the current directory. if not libtool: # non-libtool case: prepare distutils use if self.check_is_msvc(): - for library in libraries: + for library in libraries + extra_libraries: # MSVC Builds don't use libtool, so no .la libraries, # so just add the library directly. self.compiler.add_library(library) @@ -136,7 +136,7 @@ class CCompiler(object): if sys.platform != 'darwin': args.append('-Wl,--no-as-needed') - for library in libraries: + for library in libraries + extra_libraries: self.compiler.add_library(library) if not self.check_is_msvc(): for library_path in libpaths: diff --git a/giscanner/dumper.py b/giscanner/dumper.py index 3f721598..9077d205 100644 --- a/giscanner/dumper.py +++ b/giscanner/dumper.py @@ -259,6 +259,7 @@ class DumpCompiler(object): self._compiler.get_internal_link_flags(args, libtool, self._options.libraries, + self._options.extra_libraries, self._options.library_paths) args.extend(pkg_config_libs) diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py index 633496fc..095a43fb 100755 --- a/giscanner/scannermain.py +++ b/giscanner/scannermain.py @@ -140,6 +140,9 @@ def _get_option_parser(): parser.add_option("-l", "--library", action="append", dest="libraries", default=[], help="libraries of this unit") + parser.add_option("", "--extra-library", + action="append", dest="extra_libraries", default=[], + help="Extra libraries to link the binary against") parser.add_option("-L", "--library-path", action="append", dest="library_paths", default=[], help="directories to search for libraries") |