From 4608d268e9ad0bc6d663897263db247555360a7f Mon Sep 17 00:00:00 2001 From: Ujjwal Sharma Date: Mon, 25 Jun 2018 16:17:16 +0530 Subject: [PATCH] tools: patch gyp to avoid xcrun errors Previously running ./configure with only the Xcode Command Line Tools installed would give: xcrun: error: unable to lookup item 'PlatformPath' from command line tools installation xcrun: error: unable to lookup item 'PlatformPath' in SDK '/' Co-authored-by: Ben Noordhuis Fixes: https://github.com/nodejs/node/issues/12531 PR-URL: https://github.com/nodejs/node/pull/21520 Reviewed-By: Ben Noordhuis Reviewed-By: Joyee Cheung Reviewed-By: Gibson Fahnestock Reviewed-By: Refael Ackermann Reviewed-By: James M Snell (cherry picked from commit 51812ff12b9e10549725bcda57167148428e256c) --- tools/gyp/pylib/gyp/xcode_emulation.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tools/gyp/pylib/gyp/xcode_emulation.py b/tools/gyp/pylib/gyp/xcode_emulation.py index 9082b9da3589a6..c303313a30fceb 100644 --- a/tools/gyp/pylib/gyp/xcode_emulation.py +++ b/tools/gyp/pylib/gyp/xcode_emulation.py @@ -645,9 +645,10 @@ def GetCflags(self, configname, arch=None): cflags += self._Settings().get('WARNING_CFLAGS', []) - platform_root = self._XcodePlatformPath(configname) - if platform_root and self._IsXCTest(): - cflags.append('-F' + platform_root + '/Developer/Library/Frameworks/') + if self._IsXCTest(): + platform_root = self._XcodePlatformPath(configname) + if platform_root: + cflags.append('-F' + platform_root + '/Developer/Library/Frameworks/') if sdk_root: framework_root = sdk_root @@ -913,10 +914,11 @@ def GetLdflags(self, configname, product_dir, gyp_to_build_path, arch=None): for directory in framework_dirs: ldflags.append('-F' + directory.replace('$(SDKROOT)', sdk_root)) - platform_root = self._XcodePlatformPath(configname) - if sdk_root and platform_root and self._IsXCTest(): - ldflags.append('-F' + platform_root + '/Developer/Library/Frameworks/') - ldflags.append('-framework XCTest') + if self._IsXCTest(): + platform_root = self._XcodePlatformPath(configname) + if sdk_root and platform_root: + ldflags.append('-F' + platform_root + '/Developer/Library/Frameworks/') + ldflags.append('-framework XCTest') is_extension = self._IsIosAppExtension() or self._IsIosWatchKitExtension() if sdk_root and is_extension: