bintools-wrapper: dont wrap ld if it doesn't exist

not all linkers have a ld binary in bin

also note the '${ld:-}' which allows users to set the ld path with a env
var

> '${foo:-val}' $foo, or val if unset (or null)
This commit is contained in:
Artturin 2023-02-17 04:56:48 +02:00
parent 3697ddeabe
commit b5abc3d090

View File

@ -184,7 +184,9 @@ stdenv.mkDerivation {
done
'' + (if !useMacosReexportHack then ''
wrap ${targetPrefix}ld ${./ld-wrapper.sh} ''${ld:-$ldPath/${targetPrefix}ld}
if [ -e ''${ld:-$ldPath/${targetPrefix}ld} ]; then
wrap ${targetPrefix}ld ${./ld-wrapper.sh} ''${ld:-$ldPath/${targetPrefix}ld}
fi
'' else ''
ldInner="${targetPrefix}ld-reexport-delegate"
wrap "$ldInner" ${./macos-sierra-reexport-hack.bash} ''${ld:-$ldPath/${targetPrefix}ld}