at v192 3.5 kB view raw
1diff -Naur a/tools/gyp/pylib/gyp/xcode_emulation.py b/tools/gyp/pylib/gyp/xcode_emulation.py 2--- a/tools/gyp/pylib/gyp/xcode_emulation.py 2014-01-23 06:05:51.000000000 +0100 3+++ b/tools/gyp/pylib/gyp/xcode_emulation.py 2014-02-04 17:49:48.000000000 +0100 4@@ -302,10 +302,17 @@ 5 6 def _XcodeSdkPath(self, sdk_root): 7 if sdk_root not in XcodeSettings._sdk_path_cache: 8- sdk_path = self._GetSdkVersionInfoItem(sdk_root, 'Path') 9- XcodeSettings._sdk_path_cache[sdk_root] = sdk_path 10- if sdk_root: 11- XcodeSettings._sdk_root_cache[sdk_path] = sdk_root 12+ try: 13+ sdk_path = self._GetSdkVersionInfoItem(sdk_root, 'Path') 14+ XcodeSettings._sdk_path_cache[sdk_root] = sdk_path 15+ if sdk_root: 16+ XcodeSettings._sdk_root_cache[sdk_path] = sdk_root 17+ except: 18+ # if this fails it's because xcodebuild failed, which means 19+ # the user is probably on a CLT-only system, where there 20+ # is no valid SDK root 21+ XcodeSettings._sdk_path_cache[sdk_root] = None 22+ 23 return XcodeSettings._sdk_path_cache[sdk_root] 24 25 def _AppendPlatformVersionMinFlags(self, lst): 26@@ -420,10 +427,12 @@ 27 framework_root = sdk_root 28 else: 29 framework_root = '' 30- config = self.spec['configurations'][self.configname] 31- framework_dirs = config.get('mac_framework_dirs', []) 32- for directory in framework_dirs: 33- cflags.append('-F' + directory.replace('$(SDKROOT)', framework_root)) 34+ 35+ if 'SDKROOT' in self._Settings(): 36+ config = self.spec['configurations'][self.configname] 37+ framework_dirs = config.get('mac_framework_dirs', []) 38+ for directory in framework_dirs: 39+ cflags.append('-F' + directory.replace('$(SDKROOT)', framework_root)) 40 41 self.configname = None 42 return cflags 43@@ -673,10 +682,12 @@ 44 sdk_root = self._SdkPath() 45 if not sdk_root: 46 sdk_root = '' 47- config = self.spec['configurations'][self.configname] 48- framework_dirs = config.get('mac_framework_dirs', []) 49- for directory in framework_dirs: 50- ldflags.append('-F' + directory.replace('$(SDKROOT)', sdk_root)) 51+ 52+ if 'SDKROOT' in self._Settings(): 53+ config = self.spec['configurations'][self.configname] 54+ framework_dirs = config.get('mac_framework_dirs', []) 55+ for directory in framework_dirs: 56+ ldflags.append('-F' + directory.replace('$(SDKROOT)', sdk_root)) 57 58 self.configname = None 59 return ldflags 60@@ -863,7 +874,11 @@ 61 sdk_root = self._SdkPath(config_name) 62 if not sdk_root: 63 sdk_root = '' 64- return l.replace('$(SDKROOT)', sdk_root) 65+ 66+ if self._SdkPath(): 67+ return l.replace('$(SDKROOT)', sdk_root) 68+ else: 69+ return l 70 71 def AdjustLibraries(self, libraries, config_name=None): 72 """Transforms entries like 'Cocoa.framework' in libraries into entries like 73@@ -1018,12 +1033,16 @@ 74 # Since the value returned by this function is only used when ARCHS is not 75 # set, then on iOS we return "i386", as the default xcode project generator 76 # does not set ARCHS if it is not set in the .gyp file. 77- if self.isIOS: 78+ 79+ try: 80+ if self.isIOS: 81+ return 'i386' 82+ version, build = self._XcodeVersion() 83+ if version >= '0500': 84+ return 'x86_64' 85 return 'i386' 86- version, build = self._XcodeVersion() 87- if version >= '0500': 88+ except: 89 return 'x86_64' 90- return 'i386' 91 92 class MacPrefixHeader(object): 93 """A class that helps with emulating Xcode's GCC_PREFIX_HEADER feature.