linux: improve cross compilation with clang

set HOST* variables for host build tools
* do not assume the host compiler is gcc
* pass all build tools to make
This commit is contained in:
Michael Roitzsch
2021-05-10 10:24:24 +02:00
parent 50dd350c4c
commit 270ee17d41
2 changed files with 8 additions and 4 deletions
+7 -3
View File
@@ -131,12 +131,16 @@ let
buildPhase = ''
export buildRoot="''${buildRoot:-build}"
export HOSTCC=$CC_FOR_BUILD
export HOSTCXX=$CXX_FOR_BUILD
export HOSTAR=$AR_FOR_BUILD
export HOSTLD=$LD_FOR_BUILD
# Get a basic config file for later refinement with $generateConfig.
make -C . O="$buildRoot" $kernelBaseConfig \
make -C . O="$buildRoot" $kernelBaseConfig \
ARCH=$kernelArch \
HOSTCC=${buildPackages.stdenv.cc.targetPrefix}gcc \
HOSTCXX=${buildPackages.stdenv.cc.targetPrefix}g++
HOSTCC=$HOSTCC HOSTCXX=$HOSTCXX HOSTAR=$HOSTAR HOSTLD=$HOSTLD \
CC=$CC OBJCOPY=$OBJCOPY OBJDUMP=$OBJDUMP READELF=$READELF
# Create the config file.
echo "generating kernel configuration..."