Ticket #62391: patch-fix-rpath-gir-typelib.diff
File patch-fix-rpath-gir-typelib.diff, 2.1 KB (added by VinDuv, 4 years ago) |
---|
-
giscanner/shlibs.py
old new 19 19 # 20 20 21 21 import os 22 import sys23 22 import platform 24 23 import re 25 24 import subprocess … … 104 103 output = subprocess.check_output(args) 105 104 if isinstance(output, bytes): 106 105 output = output.decode("utf-8", "replace") 107 108 106 shlibs = resolve_from_ldd_output(libraries, output) 109 return list(map(sanitize_shlib_path, shlibs)) 110 107 libdir = '' 108 # for Darwin purposes, assume libraries get installed into 109 # the first non-build library path 110 if platform.system() == 'Darwin': 111 for lpath in options.library_paths: 112 if lpath.startswith('/') and not lpath.startswith(os.getcwd()): 113 libdir = lpath 114 break 115 if libdir == '': 116 # no way to resolve @rpath and the like, since we can't 117 # make a reasonable assumpion of the install libdir 118 libdir = '@MP_LIB@' 119 else: 120 libdir = libdir + '/' 121 outlibs = [] 122 for lib in shlibs: 123 outlibs.append(sanitize_shlib_path(lib,libdir)) 124 return list (outlibs) 111 125 112 def sanitize_shlib_path(lib ):126 def sanitize_shlib_path(lib,libdir): 113 127 # Use absolute paths on OS X to conform to how libraries are usually 114 128 # referenced on OS X systems, and file names everywhere else. 115 129 # In case we get relative paths on macOS (like @rpath) then we fall 116 130 # back to the basename as well: 117 131 # https://gitlab.gnome.org/GNOME/gobject-introspection/issues/222 118 if sys.platform == "darwin":132 if platform.system() == 'Darwin': 119 133 if not os.path.isabs(lib): 120 return os.path.basename(lib) 121 return lib 134 lib = os.path.basename(lib) 135 # prepend the libdir 136 lib = libdir + lib 122 137 else: 123 returnos.path.basename(lib)124 138 lib = os.path.basename(lib) 139 return lib 125 140 126 141 def resolve_from_ldd_output(libraries, output): 127 142 patterns = {}