forked from rarias/bscpkgs
Compare commits
10 Commits
edf1424aef
...
1320a2dd59
Author | SHA1 | Date | |
---|---|---|---|
1320a2dd59 | |||
8e3d29d101 | |||
0efc78f6ed | |||
c3e215d2f7 | |||
1d3efc690c | |||
6bcc2e9a52 | |||
bbb421a340 | |||
105a80c8b5 | |||
3d9331eed3 | |||
5c2d9fe67c |
@ -46,14 +46,24 @@ let
|
||||
in (wrapCCWith {
|
||||
inherit cc;
|
||||
extraBuildCommands = ''
|
||||
echo "-isystem ${cc}/include" >> $out/nix-support/cc-cflags
|
||||
echo "-isystem ${cc}/include/intel64" >> $out/nix-support/cc-cflags
|
||||
|
||||
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
|
||||
echo "-L${cc}/lib" >> $out/nix-support/cc-ldflags
|
||||
|
||||
echo "--gcc-toolchain=${gcc.cc}" >> $out/nix-support/libcxx-cxxflags
|
||||
echo "--gcc-toolchain=${gcc.cc}" >> $out/nix-support/cc-cflags
|
||||
|
||||
# For some reason, If we don't resolve the realpath things go wrong
|
||||
for stddef in ${cc}/lib/clang/*/include/stddef.h ; do
|
||||
dir=$(dirname $(realpath "$stddef"))
|
||||
echo "-isystem $dir" >> $out/nix-support/cc-cflags
|
||||
done
|
||||
|
||||
echo "-isystem ${cc}/include" >> $out/nix-support/cc-cflags
|
||||
echo "-isystem ${cc}/include/intel64" >> $out/nix-support/cc-cflags
|
||||
|
||||
for dir in ${gcc.cc}/lib/gcc/${targetConfig}/*/include; do
|
||||
echo "-isystem $dir" >> $out/nix-support/cc-cflags
|
||||
done
|
||||
|
||||
for dir in ${gcc.cc}/include/c++/*; do
|
||||
echo "-isystem $dir" >> $out/nix-support/libcxx-cxxflags
|
||||
@ -68,12 +78,6 @@ let
|
||||
# Disable hardening by default
|
||||
echo "" > $out/nix-support/add-hardening.sh
|
||||
|
||||
# For some reason, If we don't resolve the realpath things go wrong
|
||||
for stddef in ${cc}/lib/clang/*/include/stddef.h ; do
|
||||
dir=$(dirname $(realpath "$stddef"))
|
||||
echo "-isystem $dir" >> $out/nix-support/cc-cflags
|
||||
done
|
||||
|
||||
'' + extraBuildCommands;
|
||||
} // (removeAttrs args ["cc" "extraBuildCommands" "extraInstall"])
|
||||
).overrideAttrs (old: {
|
||||
@ -147,6 +151,10 @@ stdenvNoCC.mkDerivation (finalAttrs: {
|
||||
ln -s $out/bin/icpx $out/bin/c++
|
||||
ln -s $out/bin/icx $out/bin/cc
|
||||
|
||||
# Use this to detect when a compiler subprocess is called
|
||||
# from icpx (--fsycl-host-compiler)
|
||||
echo 'export "NIX_CC_WRAPPER_INTEL=1"' >> $out/nix-support/cc-wrapper-hook
|
||||
|
||||
sed -i 's/.*isCxx=0/isCxx=1/' $out/bin/icpx
|
||||
|
||||
ln -s ${finalAttrs.finalPackage.pkgs.compiler}/lib $out/lib
|
||||
|
@ -3,6 +3,7 @@
|
||||
, lib
|
||||
, gcc
|
||||
, clangOmpss2Unwrapped
|
||||
, writeShellScript
|
||||
, openmp ? null
|
||||
, wrapCCWith
|
||||
, llvmPackages_latest
|
||||
@ -34,6 +35,22 @@ let
|
||||
targetConfig = stdenv.targetPlatform.config;
|
||||
inherit gcc;
|
||||
cc = clangOmpss2Unwrapped;
|
||||
|
||||
resetIntelCCFlags = let tconf = builtins.replaceStrings ["-"] ["_"] targetConfig;
|
||||
in writeShellScript "remove-intel.sh" ''
|
||||
if [ "$NIX_CC_WRAPPER_INTEL" = 1 ]; then
|
||||
unset NIX_CFLAGS_COMPILE_${tconf}
|
||||
unset NIX_CFLAGS_COMPILE_BEFORE_${tconf}
|
||||
unset NIX_CFLAGS_LINK_${tconf}
|
||||
unset NIX_CXXSTDLIB_COMPILE_${tconf}
|
||||
unset NIX_CXXSTDLIB_LINK_${tconf}
|
||||
unset NIX_GNATFLAGS_COMPILE_${tconf}
|
||||
|
||||
unset NIX_CC_WRAPPER_FLAGS_SET_${tconf}
|
||||
# unset NIX_BINTOOLS_WRAPPER_FLAGS_${tconf}
|
||||
fi
|
||||
'';
|
||||
|
||||
in wrapCCWith {
|
||||
inherit cc bintools;
|
||||
# extraPackages adds packages to depsTargetTargetPropagated
|
||||
@ -44,6 +61,9 @@ in wrapCCWith {
|
||||
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
|
||||
|
||||
for dir in ${gcc.cc}/lib/gcc/${targetConfig}/*/include; do
|
||||
echo "-isystem $dir" >> $out/nix-support/cc-cflags
|
||||
done
|
||||
for dir in ${gcc.cc}/include/c++/*; do
|
||||
echo "-isystem $dir" >> $out/nix-support/libcxx-cxxflags
|
||||
done
|
||||
@ -55,6 +75,11 @@ in wrapCCWith {
|
||||
|
||||
wrap clang++ $wrapper $ccPath/clang++
|
||||
|
||||
sed -i 's|# Flirting.*|&\nsource ${resetIntelCCFlags}|' $out/bin/clang
|
||||
sed -i 's|# Flirting.*|&\nsource ${resetIntelCCFlags}|' $out/bin/clang++
|
||||
|
||||
echo "" > $out/nix-support/add-hardening.sh
|
||||
|
||||
'' + lib.optionalString (openmp != null) ''
|
||||
echo "export OPENMP_RUNTIME=${ompname}" >> $out/nix-support/cc-wrapper-hook
|
||||
'' + lib.optionalString (ompss2rt != null) ''
|
||||
|
Loading…
x
Reference in New Issue
Block a user