diff options
Diffstat (limited to 'giscanner/shlibs.py')
-rw-r--r-- | giscanner/shlibs.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/giscanner/shlibs.py b/giscanner/shlibs.py index 9579e7e6..21fcafd0 100644 --- a/giscanner/shlibs.py +++ b/giscanner/shlibs.py @@ -20,13 +20,13 @@ # import os -import re import platform +import re import subprocess -import os from .utils import get_libtool_command, extract_libtool_shlib + # For .la files, the situation is easy. def _resolve_libtool(options, binary, libraries): shlibs = [] @@ -37,6 +37,7 @@ def _resolve_libtool(options, binary, libraries): return shlibs + # Assume ldd output is something vaguely like # # libpangoft2-1.0.so.0 => /usr/lib/libpangoft2-1.0.so.0 (0x006c1000) @@ -48,9 +49,14 @@ def _resolve_libtool(options, binary, libraries): # The negative lookbehind at the start is to avoid problems if someone # is crazy enough to name a library liblib<foo> when lib<foo> exists. # +# Match absolute paths on OS X to conform to how libraries are usually +# referenced on OS X systems. def _ldd_library_pattern(library_name): - return re.compile("(?<![A-Za-z0-9_-])(lib*%s[^A-Za-z0-9_-][^\s\(\)]*)" - % re.escape(library_name)) + pattern = "(?<![A-Za-z0-9_-])(lib*%s[^A-Za-z0-9_-][^\s\(\)]*)" + if platform.system() == 'Darwin': + pattern = "([^\s]*lib*%s[^A-Za-z0-9_-][^\s\(\)]*)" + return re.compile(pattern % re.escape(library_name)) + # This is a what we do for non-la files. We assume that we are on an # ELF-like system where ldd exists and the soname extracted with ldd is @@ -69,7 +75,7 @@ def _resolve_non_libtool(options, binary, libraries): if not libraries: return [] - if os.uname()[0] == 'OpenBSD': + if platform.platform().startswith('OpenBSD'): # Hack for OpenBSD when using the ports' libtool which uses slightly # different directories to store the libraries in. So rewite binary.args[0] # by inserting '.libs/'. @@ -119,6 +125,7 @@ def _resolve_non_libtool(options, binary, libraries): return shlibs + # We want to resolve a set of library names (the <foo> of -l<foo>) # against a library to find the shared library name. The shared # library name is suppose to be what you pass to dlopen() (or |