Merge pull request #7255 from Bo98/xcrun

shims/mac/super/xcrun: use Homebrew's chosen SDK and DEVELOPER_DIR
This commit is contained in:
Mike McQuaid 2020-04-02 08:26:30 +01:00 committed by GitHub
commit 91223b3011
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 3 deletions

View File

@ -109,6 +109,11 @@ module Superenv
def setup_build_environment(formula = nil)
generic_setup_build_environment(formula)
self["HOMEBREW_SDKROOT"] = effective_sysroot
self["HOMEBREW_DEVELOPER_DIR"] = if MacOS::CLT.installed? && MacOS::CLT.provides_sdk?
MacOS::CLT::PKG_PATH
else
MacOS::Xcode.prefix
end
# Filter out symbols known not to be defined since GNU Autotools can't
# reliably figure this out with Xcode 8 and above.

View File

@ -1,10 +1,20 @@
#!/bin/sh
#!/bin/bash
# Historically, xcrun has had various bugs, and in some cases it didn't
# work at all (e.g. CLT-only in the Xcode 4.3 era). This script emulates
# it and attempts to avoid these issues.
# Some build tools set DEVELOPER_DIR, so discard it
unset DEVELOPER_DIR
# SDKROOT is not used if `--sdk` is supplied.
# We however don't want to interrupt other uses like `xcrun --find clang`.
if [[ "$*" =~ (^| )-?-sdk ]]; then
export DEVELOPER_DIR=$HOMEBREW_DEVELOPER_DIR
else
# Some build tools set DEVELOPER_DIR, so discard it
unset DEVELOPER_DIR
fi
if [ -z "$SDKROOT" ]; then
export SDKROOT=$HOMEBREW_SDKROOT
fi
if [ $# -eq 0 ]; then
exec /usr/bin/xcrun "$@"