From 1dba3c06eb97723dfb9a63bb211676ab6c283228 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Thu, 9 Nov 2017 03:48:26 +0100 Subject: [PATCH] meson: pass library install paths to g-ir-scanner MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We are patching g-ir-scanner to produce absolute paths in the GIR files. When an application uses an internal library placed in a non-standard path (e.g. $out/lib/gnome-shell), the scanner needs to be informed. For autotools-based apps, the full path was obtained from libtool-wrapped files; with Meson, this is no longer possible – we need to pass the path information in some other way. This commit channels the --fallback-library-path option added to g-ir-scanner in aforementioned patch. --- .../tools/build-managers/meson/default.nix | 9 +++++++++ .../build-managers/meson/gir-fallback-path.patch | 13 +++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 pkgs/development/tools/build-managers/meson/gir-fallback-path.patch diff --git a/pkgs/development/tools/build-managers/meson/default.nix b/pkgs/development/tools/build-managers/meson/default.nix index 8e4c5d4801a4..8092e9b16f1a 100644 --- a/pkgs/development/tools/build-managers/meson/default.nix +++ b/pkgs/development/tools/build-managers/meson/default.nix @@ -18,6 +18,15 @@ python3Packages.buildPythonApplication rec { popd ''; + patches = [ + # Unlike libtool, vanilla Meson does not pass any information + # about the path library will be installed to to g-ir-scanner, + # breaking the GIR when path other than ${!outputLib}/lib is used. + # We patch Meson to add a --fallback-library-path argument with + # library install_dir to g-ir-scanner. + ./gir-fallback-path.patch + ]; + postPatch = '' sed -i -e 's|e.fix_rpath(install_rpath)||' mesonbuild/scripts/meson_install.py ''; diff --git a/pkgs/development/tools/build-managers/meson/gir-fallback-path.patch b/pkgs/development/tools/build-managers/meson/gir-fallback-path.patch new file mode 100644 index 000000000000..d8d14f188a2f --- /dev/null +++ b/pkgs/development/tools/build-managers/meson/gir-fallback-path.patch @@ -0,0 +1,13 @@ +--- a/mesonbuild/modules/gnome.py ++++ b/mesonbuild/modules/gnome.py +@@ -427,6 +427,10 @@ + scan_command += ['--no-libtool', '--namespace=' + ns, '--nsversion=' + nsversion, '--warn-all', + '--output', '@OUTPUT@'] + ++ fallback_libpath = girtarget.get_custom_install_dir()[0] ++ if fallback_libpath is not None and isinstance(fallback_libpath, str) and len(fallback_libpath) > 0 and fallback_libpath[0] == "/": ++ scan_command += ['--fallback-library-path=' + fallback_libpath] ++ + header = kwargs.pop('header', None) + if header: + if not isinstance(header, str):