go: only set CC when cross-compiling

This avoids he default CC for cgo being hardcoded, when we only want to
overwrite it during compilation.
This commit is contained in:
Bouke van der Bijl 2020-06-23 12:52:33 +02:00 committed by zowoq
parent cee7631c08
commit 81a8b76b3a
2 changed files with 6 additions and 0 deletions

View file

@ -186,8 +186,11 @@ stdenv.mkDerivation rec {
export PATH=$(pwd)/bin:$PATH
${optionalString (stdenv.buildPlatform != stdenv.targetPlatform) ''
# Independent from host/target, CC should produce code for the building system.
# We only set it when cross-compiling.
export CC=${buildPackages.stdenv.cc}/bin/cc
''}
ulimit -a
'';

View file

@ -193,8 +193,11 @@ stdenv.mkDerivation rec {
export PATH=$(pwd)/bin:$PATH
${optionalString (stdenv.buildPlatform != stdenv.targetPlatform) ''
# Independent from host/target, CC should produce code for the building system.
# We only set it when cross-compiling.
export CC=${buildPackages.stdenv.cc}/bin/cc
''}
ulimit -a
'';