|
|
@ -18,8 +18,12 @@ |
|
|
|
, buildPackages |
|
|
|
, buildPackages |
|
|
|
, pkgsBuildTarget |
|
|
|
, pkgsBuildTarget |
|
|
|
, callPackage |
|
|
|
, callPackage |
|
|
|
|
|
|
|
, threadsCross ? null # for MinGW |
|
|
|
}: |
|
|
|
}: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# threadsCross is just for MinGW |
|
|
|
|
|
|
|
assert threadsCross != null -> stdenv.targetPlatform.isWindows; |
|
|
|
|
|
|
|
|
|
|
|
let |
|
|
|
let |
|
|
|
go_bootstrap = buildPackages.callPackage ./bootstrap.nix { }; |
|
|
|
go_bootstrap = buildPackages.callPackage ./bootstrap.nix { }; |
|
|
|
|
|
|
|
|
|
|
@ -50,6 +54,8 @@ let |
|
|
|
# We need a target compiler which is still runnable at build time, |
|
|
|
# We need a target compiler which is still runnable at build time, |
|
|
|
# to handle the cross-building case where build != host == target |
|
|
|
# to handle the cross-building case where build != host == target |
|
|
|
targetCC = pkgsBuildTarget.targetPackages.stdenv.cc; |
|
|
|
targetCC = pkgsBuildTarget.targetPackages.stdenv.cc; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
isCross = stdenv.buildPlatform != stdenv.targetPlatform; |
|
|
|
in |
|
|
|
in |
|
|
|
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec { |
|
|
|
stdenv.mkDerivation rec { |
|
|
@ -71,6 +77,10 @@ stdenv.mkDerivation rec { |
|
|
|
|
|
|
|
|
|
|
|
depsTargetTargetPropagated = lib.optionals stdenv.isDarwin [ Security Foundation ]; |
|
|
|
depsTargetTargetPropagated = lib.optionals stdenv.isDarwin [ Security Foundation ]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
depsBuildTarget = lib.optional isCross targetCC; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
depsTargetTarget = lib.optional (threadsCross != null) threadsCross; |
|
|
|
|
|
|
|
|
|
|
|
hardeningDisable = [ "all" ]; |
|
|
|
hardeningDisable = [ "all" ]; |
|
|
|
|
|
|
|
|
|
|
|
prePatch = '' |
|
|
|
prePatch = '' |
|
|
@ -194,12 +204,12 @@ stdenv.mkDerivation rec { |
|
|
|
# {CC,CXX}_FOR_TARGET must be only set for cross compilation case as go expect those |
|
|
|
# {CC,CXX}_FOR_TARGET must be only set for cross compilation case as go expect those |
|
|
|
# to be different from CC/CXX |
|
|
|
# to be different from CC/CXX |
|
|
|
CC_FOR_TARGET = |
|
|
|
CC_FOR_TARGET = |
|
|
|
if (stdenv.buildPlatform != stdenv.targetPlatform) then |
|
|
|
if isCross then |
|
|
|
"${targetCC}/bin/${targetCC.targetPrefix}cc" |
|
|
|
"${targetCC}/bin/${targetCC.targetPrefix}cc" |
|
|
|
else |
|
|
|
else |
|
|
|
null; |
|
|
|
null; |
|
|
|
CXX_FOR_TARGET = |
|
|
|
CXX_FOR_TARGET = |
|
|
|
if (stdenv.buildPlatform != stdenv.targetPlatform) then |
|
|
|
if isCross then |
|
|
|
"${targetCC}/bin/${targetCC.targetPrefix}c++" |
|
|
|
"${targetCC}/bin/${targetCC.targetPrefix}c++" |
|
|
|
else |
|
|
|
else |
|
|
|
null; |
|
|
|
null; |
|
|
@ -223,7 +233,7 @@ stdenv.mkDerivation rec { |
|
|
|
|
|
|
|
|
|
|
|
export PATH=$(pwd)/bin:$PATH |
|
|
|
export PATH=$(pwd)/bin:$PATH |
|
|
|
|
|
|
|
|
|
|
|
${lib.optionalString (stdenv.buildPlatform != stdenv.targetPlatform) '' |
|
|
|
${lib.optionalString isCross '' |
|
|
|
# Independent from host/target, CC should produce code for the building system. |
|
|
|
# Independent from host/target, CC should produce code for the building system. |
|
|
|
# We only set it when cross-compiling. |
|
|
|
# We only set it when cross-compiling. |
|
|
|
export CC=${buildPackages.stdenv.cc}/bin/cc |
|
|
|
export CC=${buildPackages.stdenv.cc}/bin/cc |
|
|
|