<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">--- giscanner/shlibs.py.orig
+++ giscanner/shlibs.py
@@ -19,7 +19,6 @@
 #
 
 import os
-import sys
 import platform
 import re
 import subprocess
@@ -104,24 +103,40 @@
         output = subprocess.check_output(args)
         if isinstance(output, bytes):
             output = output.decode("utf-8", "replace")
-
         shlibs = resolve_from_ldd_output(libraries, output)
-        return list(map(sanitize_shlib_path, shlibs))
-
-
-def sanitize_shlib_path(lib):
+        libdir = ''
+        # for Darwin purposes, assume libraries get installed into
+        # the first non-build library path
+        if platform.system() == 'Darwin':
+            for lpath in options.library_paths:
+                if not lpath.startswith (os.getcwd()):
+                    libdir = lpath
+                    break
+            if libdir == '':
+                # no way to resolve @rpath and the like, since we can't
+                # make a reasonable assumpion of the install libdir
+                libdir = '@MP_LIB@'
+            else:
+                libdir = libdir + '/'
+        outlibs = []
+        for lib in shlibs:
+            outlibs.append(sanitize_shlib_path(lib,libdir))
+        return list (outlibs)
+
+def sanitize_shlib_path(lib,libdir):
     # Use absolute paths on OS X to conform to how libraries are usually
     # referenced on OS X systems, and file names everywhere else.
     # In case we get relative paths on macOS (like @rpath) then we fall
     # back to the basename as well:
     # https://gitlab.gnome.org/GNOME/gobject-introspection/issues/222
-    if sys.platform == "darwin":
+    if platform.system() == 'Darwin':
         if not os.path.isabs(lib):
-            return os.path.basename(lib)
-        return lib
+            lib = os.path.basename(lib)
+            # prepend the libdir
+            lib = libdir + lib
     else:
-        return os.path.basename(lib)
-
+        lib = os.path.basename(lib)
+    return lib
 
 def resolve_from_ldd_output(libraries, output):
     patterns = {}
</pre></body></html>