diff options
Diffstat (limited to 'mesonbuild/modules/gnome.py')
-rw-r--r-- | mesonbuild/modules/gnome.py | 26 |
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): |