aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibault Saunier <thibault.saunier@osg.samsung.com>2016-11-17 12:38:52 -0300
committerJussi Pakkanen <jpakkane@gmail.com>2016-12-03 23:07:00 +0200
commit9c0997dafdc7669d37aacc166f9940fd777e8f3e (patch)
tree82dcc633ed69c2b16662b17d01e47e173eaab3b7
parent8e8f75005db38daf2e54bc76c4542b74f2f7cefe (diff)
downloadmeson-9c0997dafdc7669d37aacc166f9940fd777e8f3e.zip
meson-9c0997dafdc7669d37aacc166f9940fd777e8f3e.tar.gz
meson-9c0997dafdc7669d37aacc166f9940fd777e8f3e.tar.bz2
gnome: Use g-ir-scanner --extra-library option when avalaible
When generating the .gir file we need g-ir-scanner to link the introspector binary against the right dependencies, for that we used to use the --library option but this has a special meaning and the libs passed in there end up being the ones in the .gir file itself, which is not what we want. A new --extra-library option is beeing added in goject-introspection (https://bugzilla.gnome.org/show_bug.cgi?id=774625) to handle our use case (ie. not using libtool which allows g-ir-scanner to know about those) and we should make use of it. Closes #981
-rw-r--r--mesonbuild/modules/gnome.py26
1 files changed, 23 insertions, 3 deletions
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
index d7b05eb..241a531 100644
--- a/mesonbuild/modules/gnome.py
+++ b/mesonbuild/modules/gnome.py
@@ -36,6 +36,20 @@ gresource_dep_needed_version = '>= 2.52.0'
native_glib_version = None
girwarning_printed = False
gresource_warning_printed = False
+_gir_has_extra_lib_arg = None
+
+def gir_has_extra_lib_arg():
+ global _gir_has_extra_lib_arg
+ if _gir_has_extra_lib_arg is not None:
+ return _gir_has_extra_lib_arg
+
+ _gir_has_extra_lib_arg = False
+ try:
+ scanner_options = subprocess.check_output(['g-ir-scanner', '--help']).decode()
+ _gir_has_extra_lib_arg = '--extra-library' in scanner_options
+ except (FileNotFound, subprocess.CalledProcessError):
+ pass
+ return _gir_has_extra_lib_arg
def find_program(program_name, target_name):
program = dependencies.ExternalProgram(program_name)
@@ -241,9 +255,13 @@ can not be used with the current version of glib-compiled-resources, due to
return dep_files, depends, subdirs
- @staticmethod
- def _get_link_args(state, lib, depends=None):
- link_command = ['-l%s' % lib.name]
+
+ def _get_link_args(self, state, lib, depends=None):
+ if gir_has_extra_lib_arg():
+ link_command = ['--extra-library=%s' % lib.name]
+ else:
+ link_command = ['-l%s' % lib.name]
+ print('lib: %s - %s' % (lib.name, link_command))
if isinstance(lib, build.SharedLibrary):
link_command += ['-L%s' %
os.path.join(state.environment.get_build_dir(),
@@ -323,6 +341,8 @@ can not be used with the current version of glib-compiled-resources, due to
# Hack to avoid passing some compiler options in
if lib.startswith("-W"):
continue
+ if gir_has_extra_lib_arg():
+ lib = lib.replace('-l', '--extra-library=')
ldflags.update([lib])
if isinstance(dep, dependencies.PkgConfigDependency):