summaryrefslogtreecommitdiff
path: root/giscanner/shlibs.py
diff options
context:
space:
mode:
authorClemens Lang <cal@macports.org>2014-02-10 18:44:06 -0500
committerColin Walters <walters@verbum.org>2014-02-10 18:46:28 -0500
commit513dfb969c2317377eb0f0ec150767a8d95c6d2e (patch)
tree60e40df901c64f2fb181ce9defd5fadeeea3bd72 /giscanner/shlibs.py
parentb58425b5499a08dbfac6a3ddb6103af3245deda9 (diff)
downloadgobject-introspection-513dfb969c2317377eb0f0ec150767a8d95c6d2e.tar.gz
scanner: Improve compatibility with OS X
While gobject-introspection works on OS X, a few circumstances are handled a little different there. For one, libraries are linked using absolute paths. The current gobject-introspection code however strips any path components and just uses the filename in the .gir file – while this doesn't cause failure, the generated typlibs will only work in presence of a correctly set DYLD_LIBRARY_PATH or DYLD_FALLBACK_LIBRARY_PATH environment variable. Setting DYLD_LIBRARY_PATH on OS X often is a bad idea due to the side-effects: Doing so causes the directory parts of libraries referenced using an absolute path to be ignored if there is a equally named file in the directory listed in $DYLD_LIBRARY_PATH, possibly overriding referenced system libraries with incompatible versions. Setting DYLD_FALLBACK_LIBRARY_PATH is the better solution for this problem; however because this variable has an implicit default value it's not simple to do so correctly. The best solution to the problem is referencing libraries from .girs using absolute paths, just as all other binaries on OS X. The attached patches against 2.38.0 implement that. Another quirk one needs to be aware of on OS X is that Apple ships a program called libtool, which is not GNU libtool and incompatible with it. GNU libtool, if present, is usually called glibtool on OS X. The patches also fix this. https://bugzilla.gnome.org/show_bug.cgi?id=709583
Diffstat (limited to 'giscanner/shlibs.py')
-rw-r--r--giscanner/shlibs.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/giscanner/shlibs.py b/giscanner/shlibs.py
index 1241827d..21fcafd0 100644
--- a/giscanner/shlibs.py
+++ b/giscanner/shlibs.py
@@ -49,9 +49,13 @@ 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