mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 08:23:09 +00:00
{bintools-wrapper,cc-wrapper}: allow paths relative to the Darwin SDK
`-L` and `-I` are interpreted relative to the `$SDKROOT` by the Darwin toolchain, so we have to avoid filtering out such paths in the purity filter hacks in order to not break e.g. the .NET Core build system. It’s also just the correct thing to do for the platform.
This commit is contained in:
parent
9142a07030
commit
e047c69ed4
@ -44,9 +44,9 @@ if [[ "${NIX_ENFORCE_PURITY:-}" = 1 && -n "${NIX_STORE:-}"
|
|||||||
while (( "$n" < "$nParams" )); do
|
while (( "$n" < "$nParams" )); do
|
||||||
p=${params[n]}
|
p=${params[n]}
|
||||||
p2=${params[n+1]:-} # handle `p` being last one
|
p2=${params[n+1]:-} # handle `p` being last one
|
||||||
if [ "${p:0:3}" = -L/ ] && badPath "${p:2}"; then
|
if [ "${p:0:3}" = -L/ ] && badPathWithDarwinSdk "${p:2}"; then
|
||||||
skip "${p:2}"
|
skip "${p:2}"
|
||||||
elif [ "$p" = -L ] && badPath "$p2"; then
|
elif [ "$p" = -L ] && badPathWithDarwinSdk "$p2"; then
|
||||||
n+=1; skip "$p2"
|
n+=1; skip "$p2"
|
||||||
elif [ "$p" = -rpath ] && badPath "$p2"; then
|
elif [ "$p" = -rpath ] && badPath "$p2"; then
|
||||||
n+=1; skip "$p2"
|
n+=1; skip "$p2"
|
||||||
|
@ -103,7 +103,7 @@ if [[ "${NIX_ENFORCE_PURITY:-}" = 1 && -n "$NIX_STORE" ]]; then
|
|||||||
-[IL] | -isystem) path=$p2 skipNext=true ;;
|
-[IL] | -isystem) path=$p2 skipNext=true ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ -n $path ]] && badPath "$path"; then
|
if [[ -n $path ]] && badPathWithDarwinSdk "$path"; then
|
||||||
skip "$path"
|
skip "$path"
|
||||||
$skipNext && n+=1
|
$skipNext && n+=1
|
||||||
continue
|
continue
|
||||||
|
@ -118,6 +118,21 @@ badPath() {
|
|||||||
"${p#"${TEMPDIR:-/tmp}"}" = "$p"
|
"${p#"${TEMPDIR:-/tmp}"}" = "$p"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Like `badPath`, but handles paths that may be interpreted relative to
|
||||||
|
# `$SDKROOT` on Darwin. For example, `-L/usr/lib/swift` is interpreted
|
||||||
|
# as `-L$SDKROOT/usr/lib/swift` when `$SDKROOT` is set and
|
||||||
|
# `$SDKROOT/usr/lib/swift` exists.
|
||||||
|
badPathWithDarwinSdk() {
|
||||||
|
path=$1
|
||||||
|
if [[ "@darwinMinVersion@" ]]; then
|
||||||
|
sdkPath=$SDKROOT/$path
|
||||||
|
if [[ -e $sdkPath ]]; then
|
||||||
|
path=$sdkPath
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
badPath "$path"
|
||||||
|
}
|
||||||
|
|
||||||
expandResponseParams() {
|
expandResponseParams() {
|
||||||
declare -ga params=("$@")
|
declare -ga params=("$@")
|
||||||
local arg
|
local arg
|
||||||
|
Loading…
Reference in New Issue
Block a user