forked from rarias/jungle
Use nixSupport instead of extraBuildCommands
This commit is contained in:
parent
64b1019978
commit
9ef739bd99
@ -47,6 +47,7 @@ lib.makeOverridable (
|
|||||||
wrapIntel =
|
wrapIntel =
|
||||||
{
|
{
|
||||||
cc,
|
cc,
|
||||||
|
nixSupport ? { },
|
||||||
extraBuildCommands ? "",
|
extraBuildCommands ? "",
|
||||||
extraInstall ? "",
|
extraInstall ? "",
|
||||||
...
|
...
|
||||||
@ -57,37 +58,31 @@ lib.makeOverridable (
|
|||||||
(
|
(
|
||||||
wrapCCWith {
|
wrapCCWith {
|
||||||
inherit cc;
|
inherit cc;
|
||||||
|
|
||||||
|
nixSupport = lib.mergeAttrsConcatenateValues {
|
||||||
|
cc-ldflags = [
|
||||||
|
"-L${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}"
|
||||||
|
"-L${gcc.cc.lib}/lib"
|
||||||
|
"-L${cc}/lib"
|
||||||
|
];
|
||||||
|
cc-cflags = [
|
||||||
|
"--gcc-toolchain=${gcc.cc}"
|
||||||
|
"-isystem \"$(dirname $(realpath ${cc}/lib/clang/*/include/stddef.h))\""
|
||||||
|
"-isystem ${cc}/include"
|
||||||
|
"-isystem ${cc}/include/intel64"
|
||||||
|
"-isystem ${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}/include"
|
||||||
|
];
|
||||||
|
libcxx-cxxflags = [
|
||||||
|
# "--gcc-toolchain=${gcc.cc}"
|
||||||
|
"-isystem ${gcc.cc}/include/c++/${gcc.version}"
|
||||||
|
"-isystem ${gcc.cc}/include/c++/${gcc.version}/${targetConfig}"
|
||||||
|
];
|
||||||
|
} nixSupport;
|
||||||
|
|
||||||
extraBuildCommands = ''
|
extraBuildCommands = ''
|
||||||
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
|
|
||||||
done
|
|
||||||
for dir in ${gcc.cc}/include/c++/*/${targetConfig}; do
|
|
||||||
echo "-isystem $dir" >> $out/nix-support/libcxx-cxxflags
|
|
||||||
done
|
|
||||||
|
|
||||||
# FIXME: We should find a better way to modify the PATH instead of using
|
# FIXME: We should find a better way to modify the PATH instead of using
|
||||||
# this ugly hack. See https://jungle.bsc.es/git/rarias/bscpkgs/issues/9
|
# this ugly hack. See https://jungle.bsc.es/git/rarias/bscpkgs/issues/9
|
||||||
echo 'path_backup="${gcc.cc}/bin:$path_backup"' >> $out/nix-support/cc-wrapper-hook
|
echo 'path_backup="${gcc.cc}/bin:$path_backup"' >>$out/nix-support/cc-wrapper-hook
|
||||||
|
|
||||||
# Disable hardening by default
|
# Disable hardening by default
|
||||||
echo "" > $out/nix-support/add-hardening.sh
|
echo "" > $out/nix-support/add-hardening.sh
|
||||||
@ -98,6 +93,7 @@ lib.makeOverridable (
|
|||||||
"cc"
|
"cc"
|
||||||
"extraBuildCommands"
|
"extraBuildCommands"
|
||||||
"extraInstall"
|
"extraInstall"
|
||||||
|
"nixSupport"
|
||||||
])
|
])
|
||||||
).overrideAttrs
|
).overrideAttrs
|
||||||
(old: {
|
(old: {
|
||||||
@ -178,6 +174,7 @@ lib.makeOverridable (
|
|||||||
|
|
||||||
cc = wrapIntel {
|
cc = wrapIntel {
|
||||||
cc = finalAttrs.finalPackage.pkgs.compiler;
|
cc = finalAttrs.finalPackage.pkgs.compiler;
|
||||||
|
|
||||||
extraBuildCommands = ''
|
extraBuildCommands = ''
|
||||||
wrap icx $wrapper $ccPath/icx
|
wrap icx $wrapper $ccPath/icx
|
||||||
wrap icpx $wrapper $ccPath/icpx
|
wrap icpx $wrapper $ccPath/icpx
|
||||||
@ -186,11 +183,11 @@ lib.makeOverridable (
|
|||||||
ln -s $out/bin/icpx $out/bin/c++
|
ln -s $out/bin/icpx $out/bin/c++
|
||||||
ln -s $out/bin/icx $out/bin/cc
|
ln -s $out/bin/icx $out/bin/cc
|
||||||
|
|
||||||
|
sed -i 's/.*isCxx=0/isCxx=1/' $out/bin/icpx
|
||||||
|
|
||||||
# Use this to detect when a compiler subprocess is called
|
# Use this to detect when a compiler subprocess is called
|
||||||
# from icpx (--fsycl-host-compiler)
|
# from icpx (--fsycl-host-compiler)
|
||||||
echo 'export "NIX_CC_WRAPPER_INTEL=1"' >> $out/nix-support/cc-wrapper-hook
|
echo 'export NIX_CC_WRAPPER_INTEL=1' >>$out/nix-support/cc-wrapper-hook
|
||||||
|
|
||||||
sed -i 's/.*isCxx=0/isCxx=1/' $out/bin/icpx
|
|
||||||
|
|
||||||
# oneMath looks for sycl libraries in bin/../lib
|
# oneMath looks for sycl libraries in bin/../lib
|
||||||
ln -s ${finalAttrs.finalPackage.pkgs.compiler}/lib $out/lib
|
ln -s ${finalAttrs.finalPackage.pkgs.compiler}/lib $out/lib
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user