diff options
author | Michael Roitzsch <reactorcontrol@icloud.com> | 2021-02-15 20:15:48 +0100 |
---|---|---|
committer | Michael Roitzsch <reactorcontrol@icloud.com> | 2021-05-10 10:24:24 +0200 |
commit | 270ee17d414469783daccba718a20e31407c6729 (patch) | |
tree | fbc07fa4a2fa025bc141525ffe67c0b8b13b20e9 /pkgs/os-specific | |
parent | 50dd350c4cdc007db52032fbff7c5bf13a11b8a9 (diff) |
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
Diffstat (limited to 'pkgs/os-specific')
-rw-r--r-- | pkgs/os-specific/linux/kernel/generate-config.pl | 2 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/generic.nix | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/pkgs/os-specific/linux/kernel/generate-config.pl b/pkgs/os-specific/linux/kernel/generate-config.pl index 6a2aec809a1bc..82e1cb66e2be4 100644 --- a/pkgs/os-specific/linux/kernel/generate-config.pl +++ b/pkgs/os-specific/linux/kernel/generate-config.pl @@ -40,7 +40,7 @@ close ANSWERS; sub runConfig { # Run `make config'. - my $pid = open2(\*IN, \*OUT, "make -C $ENV{SRC} O=$buildRoot config SHELL=bash ARCH=$ENV{ARCH}"); + my $pid = open2(\*IN, \*OUT, "make -C $ENV{SRC} O=$buildRoot config SHELL=bash ARCH=$ENV{ARCH} CC=$ENV{CC} HOSTCC=$ENV{HOSTCC} HOSTCXX=$ENV{HOSTCXX}"); # Parse the output, look for questions and then send an # appropriate answer. diff --git a/pkgs/os-specific/linux/kernel/generic.nix b/pkgs/os-specific/linux/kernel/generic.nix index ac9d6fbb2b594..e2171a96ab0e2 100644 --- a/pkgs/os-specific/linux/kernel/generic.nix +++ b/pkgs/os-specific/linux/kernel/generic.nix @@ -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..." |