Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkgs/build-support/cc-wrapper/add-clang-cc-cflags-before.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@ if $targetPassed && [[ "$targetValue" != "@defaultTarget@" ]] && (( "${NIX_CC_WR
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
26 changes: 20 additions & 6 deletions pkgs/build-support/cc-wrapper/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,14 @@ let
getLib
getName
getVersion
hasPrefix
mapAttrsToList
optional
optionalAttrs
optionals
optionalString
removePrefix
removeSuffix
replaceStrings
toList
versionAtLeast
Expand Down Expand Up @@ -900,12 +902,24 @@ stdenvNoCC.mkDerivation {
## General Clang support
## Needs to go after ^ because the for loop eats \n and makes this file an invalid script
##
+ optionalString isClang ''
# Escape twice: once for this script, once for the one it gets substituted into.
export machineFlags=${escapeShellArg (escapeShellArgs machineFlags)}
export defaultTarget=${targetPlatform.config}
substituteAll ${./add-clang-cc-cflags-before.sh} $out/nix-support/add-local-cc-cflags-before.sh
''
+ optionalString isClang (
let
hasUnsupportedGnuSuffix = hasPrefix "gnuabielfv" targetPlatform.parsed.abi.name;
clangCompatibleConfig =
if hasUnsupportedGnuSuffix then
removeSuffix (removePrefix "gnu" targetPlatform.parsed.abi.name) targetPlatform.config
else
targetPlatform.config;
explicitAbiValue = if hasUnsupportedGnuSuffix then targetPlatform.parsed.abi.abi else "";
in
''
# Escape twice: once for this script, once for the one it gets substituted into.
export machineFlags=${escapeShellArg (escapeShellArgs machineFlags)}
export defaultTarget=${clangCompatibleConfig}
export explicitAbiValue=${explicitAbiValue}
substituteAll ${./add-clang-cc-cflags-before.sh} $out/nix-support/add-local-cc-cflags-before.sh
''
)

##
## Extra custom steps
Expand Down
Loading