From e468c04383061590d949f2fcb360926cc88085c7 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sun, 18 Mar 2018 17:28:06 +0100 Subject: [PATCH] gobjectIntrospection: fix incorrect GIR shared library paths When a library path contained the library name it was eagerly matched libfwupd.so.2 => /build/fwupd-1.0.5/build/libfwupd/libfwupd.so.2 (0x00007ffff7bbd000) ^^^^^^^^^^^^^^^^^^^^^^ libgweather-3.so.15 => /build/libgweather-3.28.0/build/libgweather/libgweather-3.so.15 (0x00007ffff7bae000) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ which lead to a broken shared library path in the generated GIR file. This patch allows the soname on the left-hand side of the arrow to be matched to avoid the trap of the right-hand side. A negative lookahead had to be added to select the store path, since only the first match is taken into account. libglib-2.0.so.0 => /nix/store/dqlc8y4phlg1hmdbwkhqfwhnxcac88d1-glib-2.56.0/lib/libglib-2.0.so.0 (0x00007ffff6400000) This will not fix non-GNU platforms, where the soname is not printed first, but we cannot do much without structured ldd output. Closes: https://github.com/NixOS/nixpkgs/issues/34988 --- .../absolute_shlib_path.patch | 73 ++++++++----------- 1 file changed, 32 insertions(+), 41 deletions(-) diff --git a/pkgs/development/libraries/gobject-introspection/absolute_shlib_path.patch b/pkgs/development/libraries/gobject-introspection/absolute_shlib_path.patch index 75d9281dfb0..6a112aedcc0 100644 --- a/pkgs/development/libraries/gobject-introspection/absolute_shlib_path.patch +++ b/pkgs/development/libraries/gobject-introspection/absolute_shlib_path.patch @@ -1,8 +1,6 @@ -diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py -index 89ec193..54f1d2e 100755 --- a/giscanner/scannermain.py +++ b/giscanner/scannermain.py -@@ -94,6 +94,39 @@ def get_windows_option_group(parser): +@@ -100,6 +100,39 @@ return group @@ -42,7 +40,7 @@ index 89ec193..54f1d2e 100755 def _get_option_parser(): parser = optparse.OptionParser('%prog [options] sources') parser.add_option('', "--quiet", -@@ -200,6 +233,10 @@ match the namespace prefix.""") +@@ -209,6 +242,10 @@ parser.add_option("", "--filelist", action="store", dest="filelist", default=[], help="file containing headers and sources to be scanned") @@ -53,57 +51,50 @@ index 89ec193..54f1d2e 100755 group = get_preprocessor_option_group(parser) parser.add_option_group(group) -diff --git a/giscanner/shlibs.py b/giscanner/shlibs.py -index 838d343..ca7fc0d 100644 --- a/giscanner/shlibs.py +++ b/giscanner/shlibs.py -@@ -53,10 +53,27 @@ def _resolve_libtool(options, binary, libraries): - # Match absolute paths on OS X to conform to how libraries are usually - # referenced on OS X systems. - def _ldd_library_pattern(library_name): -+ nix_store_dir = re.escape('@nixStoreDir@'.rstrip('/')) - pattern = "(? 0: -+ match = os.path.join(options.fallback_libpath, match) -+ shlibs.append(match) ++ shlibs.append(os.path.join(options.fallback_libpath, m.group(1))) break if len(patterns) > 0: -diff --git a/giscanner/utils.py b/giscanner/utils.py -index 660081e..c9c767a 100644 --- a/giscanner/utils.py +++ b/giscanner/utils.py -@@ -109,17 +109,11 @@ def extract_libtool_shlib(la_file): +@@ -113,17 +113,11 @@ if dlname is None: return None