Skip to content

Commit

Permalink
tools: patch gyp to avoid xcrun errors
Browse files Browse the repository at this point in the history
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 <info@bnoordhuis.nl>
Fixes: nodejs/node#12531

PR-URL: nodejs/node#21520
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
ryzokuken authored and rvagg committed Aug 9, 2018
1 parent ea9aff4 commit e8ea74e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions gyp/pylib/gyp/xcode_emulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ def _IsIosWatchKitExtension(self):
def _IsIosWatchApp(self):
return int(self.spec.get('ios_watch_app', 0)) != 0

def _IsXCTest(self):
return int(self.spec.get('mac_xctest_bundle', 0)) != 0

def GetFrameworkVersion(self):
"""Returns the framework version of the current target. Only valid for
bundles."""
Expand Down Expand Up @@ -568,6 +571,11 @@ def GetCflags(self, configname, arch=None):

cflags += self._Settings().get('WARNING_CFLAGS', [])

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
else:
Expand Down Expand Up @@ -831,6 +839,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))

if self._IsXCTest():
platform_root = self._XcodePlatformPath(configname)
if platform_root:
cflags.append('-F' + platform_root + '/Developer/Library/Frameworks/')

is_extension = self._IsIosAppExtension() or self._IsIosWatchKitExtension()
if sdk_root and is_extension:
# Adds the link flags for extensions. These flags are common for all
Expand Down

0 comments on commit e8ea74e

Please sign in to comment.