Files
nixpkgs/pkgs/build-support/cc-wrapper/add-clang-cc-cflags-before.sh
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

38 lines
1.1 KiB
Bash

targetPassed=false
targetValue=""
declare -i n=0
nParams=${#params[@]}
while (("$n" < "$nParams")); do
p=${params[n]}
v=${params[n + 1]:-} # handle `p` being last one
n+=1
case "$p" in
-target)
if [ -z "$v" ]; then
echo "Error: -target requires an argument" >&2
exit 1
fi
targetPassed=true
targetValue=$v
# skip parsing the value of -target
n+=1
;;
--target=*)
targetPassed=true
targetValue="${p#*=}"
;;
esac
done
if $targetPassed && [[ "$targetValue" != "@defaultTarget@" ]] && (( "${NIX_CC_WRAPPER_SUPPRESS_TARGET_WARNING:-0}" < 1 )); then
echo "Warning: supplying the --target $targetValue != @defaultTarget@ argument to a nix-wrapped compiler may not work correctly - cc-wrapper is currently not designed with multi-target compilers in mind. You may want to use an un-wrapped compiler instead." >&2
elif [[ $0 != *cpp ]]; then
extraBefore+=(-target @defaultTarget@ @machineFlags@)
if [[ "@explicitAbiValue@" != "" ]]; then
extraBefore+=(-mabi=@explicitAbiValue@)
fi
fi