forked from rarias/bscpkgs
Compare commits
7 Commits
bdbfd77446
...
9aa866ee76
Author | SHA1 | Date | |
---|---|---|---|
9aa866ee76 | |||
3f6950c1f0 | |||
53f556626e | |||
f3483e8a88 | |||
2d637cc88c | |||
8836ca4359 | |||
8ffb971348 |
@ -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
|
||||
@ -37,6 +38,22 @@ let
|
||||
inherit gcc;
|
||||
cc = clangOmpss2Unwrapped;
|
||||
gccVersion = with versions; let v = gcc.version; in concatStringsSep "." [(major v) (minor v) (patch v)];
|
||||
|
||||
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
|
||||
@ -47,6 +64,9 @@ in wrapCCWith {
|
||||
echo "-L${gcc.cc}/lib/gcc/${targetConfig}/${gccVersion}" >> $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
|
||||
@ -58,7 +78,12 @@ in wrapCCWith {
|
||||
|
||||
wrap clang++ $wrapper $ccPath/clang++
|
||||
|
||||
'' + optionalString (openmp != null) ''
|
||||
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
|
||||
'' + optionalString (ompss2rt != null) ''
|
||||
echo "export OMPSS2_RUNTIME=${rtname}" >> $out/nix-support/cc-wrapper-hook
|
||||
|
Loading…
x
Reference in New Issue
Block a user