2020-07-01 17:58:29 +02:00
|
|
|
{
|
|
|
|
stdenv
|
|
|
|
, gcc
|
2020-09-16 12:22:55 +02:00
|
|
|
, iccUnwrapped
|
2020-07-01 17:58:29 +02:00
|
|
|
, wrapCCWith
|
2020-09-16 12:22:55 +02:00
|
|
|
, intelLicense
|
2020-07-01 10:25:33 +02:00
|
|
|
}:
|
|
|
|
|
2020-07-01 17:58:29 +02:00
|
|
|
let
|
|
|
|
targetConfig = stdenv.targetPlatform.config;
|
|
|
|
inherit gcc;
|
|
|
|
in wrapCCWith rec {
|
2020-09-16 12:22:55 +02:00
|
|
|
cc = iccUnwrapped;
|
2020-07-01 17:58:29 +02:00
|
|
|
extraBuildCommands = ''
|
|
|
|
echo "-B${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-cflags
|
2020-09-16 12:22:55 +02:00
|
|
|
echo "-isystem ${iccUnwrapped}/include" >> $out/nix-support/cc-cflags
|
|
|
|
echo "-isystem ${iccUnwrapped}/include/intel64" >> $out/nix-support/cc-cflags
|
2020-07-01 17:58:29 +02:00
|
|
|
echo "-L${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-ldflags
|
|
|
|
echo "-L${gcc.cc.lib}/lib" >> $out/nix-support/cc-ldflags
|
2020-07-01 10:25:33 +02:00
|
|
|
|
2020-09-16 12:22:55 +02:00
|
|
|
cat "${iccUnwrapped}/nix-support/propagated-build-inputs" >> \
|
2020-07-13 14:07:24 +02:00
|
|
|
$out/nix-support/propagated-build-inputs
|
|
|
|
|
2020-09-16 12:22:55 +02:00
|
|
|
echo "export INTEL_LICENSE_FILE=${intelLicense}" \
|
2020-07-01 17:58:29 +02:00
|
|
|
>> $out/nix-support/setup-hook
|
2020-07-01 13:08:05 +02:00
|
|
|
|
2020-07-01 17:58:29 +02:00
|
|
|
# Create the wrappers for icc and icpc
|
2022-11-09 23:39:57 +01:00
|
|
|
if [ -e $ccPath/icc ]; then
|
|
|
|
wrap icc $wrapper $ccPath/icc
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -e $ccPath/icpc ]; then
|
|
|
|
wrap icpc $wrapper $ccPath/icpc
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -e $ccPath/ifort ]; then
|
|
|
|
wrap ifort $wrapper $ccPath/ifort
|
|
|
|
fi
|
2020-07-01 13:08:05 +02:00
|
|
|
'';
|
2020-07-01 10:25:33 +02:00
|
|
|
}
|