From 513dfb969c2317377eb0f0ec150767a8d95c6d2e Mon Sep 17 00:00:00 2001 From: Clemens Lang Date: Mon, 10 Feb 2014 18:44:06 -0500 Subject: scanner: Improve compatibility with OS X MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- giscanner/shlibs.py | 8 ++++++-- giscanner/utils.py | 31 +++++++++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 4 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 when lib 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("(?