mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-06 17:13:24 -05:00
Build on the initial LLVM Flang wrapper work by exposing the needed clang passthru and teaching cc-wrapper about flang-specific flag handling. Co-authored-by: stove <stove@rivosinc.com> Co-authored-by: acture <acture@gmail.com> Co-authored-by: Emily <hello@emily.moe> Co-authored-by: Philip Taron <philip.taron@gmail.com>
41 lines
1.2 KiB
Bash
41 lines
1.2 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
|
|
|
|
if [[ "@darwinMinVersion@" ]] && [ "@isFlang@" != 1 ]; then
|
|
extraBefore+=(-Werror=unguarded-availability)
|
|
fi
|