From 146ebe26dce3289eb440bed7d5d0a7988ff5f5c9 Mon Sep 17 00:00:00 2001 From: Sylvain Defresne Date: Fri, 18 Sep 2015 22:18:57 +0200 Subject: [PATCH] [Backport] Fallback to '.tbd' for system missing '.dylib'. With Xcode 7 the '.dylib' for system libraries are no longer present but instead only '.tbd' are shipped maybe in an effort to reduce the size of the SDK download. Change XcodeSettings._AdjustLibrary() to look for a '.tbd' file for system libraries (those whose path starts by "$(SDKROOT)"). Only do the substitution if the '.dylib' cannot be found and a '.tbd' file with the same path exists. BUG=517914 R=justincohen@chromium.org, mark@chromium.org Review URL: https://codereview.chromium.org/1275133004 . Patch from Sylvain Defresne . Change-Id: I8e81340b1258501a2e5f4952c606ae7204b0d74f Reviewed-by: Kai Koehne --- chromium/tools/gyp/pylib/gyp/xcode_emulation.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/chromium/tools/gyp/pylib/gyp/xcode_emulation.py b/chromium/tools/gyp/pylib/gyp/xcode_emulation.py index ac5ffea..14bd7a9 100644 --- src/3rdparty/chromium/tools/gyp/pylib/gyp/xcode_emulation.py +++ src/3rdparty/chromium/tools/gyp/pylib/gyp/xcode_emulation.py @@ -1006,7 +1006,23 @@ class XcodeSettings(object): sdk_root = self._SdkPath(config_name) if not sdk_root: sdk_root = '' - return l.replace('$(SDKROOT)', sdk_root) + # Xcode 7 started shipping with ".tbd" (text based stubs) files instead of + # ".dylib" without providing a real support for them. What it does, for + # "/usr/lib" libraries, is do "-L/usr/lib -lname" which is dependent on the + # library order and cause collision when building Chrome. + # + # Instead substitude ".tbd" to ".dylib" in the generated project when the + # following conditions are both true: + # - library is referenced in the gyp file as "$(SDKROOT)/**/*.dylib", + # - the ".dylib" file does not exists but a ".tbd" file do. + library = l.replace('$(SDKROOT)', sdk_root) + if l.startswith('$(SDKROOT)'): + basename, ext = os.path.splitext(library) + if ext == '.dylib' and not os.path.exists(library): + tbd_library = basename + '.tbd' + if os.path.exists(tbd_library): + library = tbd_library + return library def AdjustLibraries(self, libraries, config_name=None): """Transforms entries like 'Cocoa.framework' in libraries into entries like -- 2.4.9 (Apple Git-60)