Merge pull request #99511 from r-burns/go-cross

go: fix cross, enable ppc64le
This commit is contained in:
John Ericson 2020-10-05 11:37:09 -04:00 committed by GitHub
commit 0794fb0419
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 6 deletions

View File

@ -1,7 +1,8 @@
{ stdenv, fetchurl, tzdata, iana-etc, runCommand
, perl, which, pkgconfig, patch, procps, pcre, cacert, Security, Foundation
, mailcap, runtimeShell
, buildPackages, pkgsTargetTarget
, buildPackages
, pkgsBuildTarget
, fetchpatch
}:
@ -25,8 +26,12 @@ let
"armv5tel" = "arm";
"armv6l" = "arm";
"armv7l" = "arm";
"powerpc64le" = "ppc64le";
}.${platform.parsed.cpu.name} or (throw "Unsupported system");
# We need a target compiler which is still runnable at build time,
# to handle the cross-building case where build != host == target
targetCC = pkgsBuildTarget.targetPackages.stdenv.cc;
in
stdenv.mkDerivation rec {
@ -166,11 +171,11 @@ stdenv.mkDerivation rec {
# {CC,CXX}_FOR_TARGET must be only set for cross compilation case as go expect those
# to be different from CC/CXX
CC_FOR_TARGET = if (stdenv.buildPlatform != stdenv.targetPlatform) then
"${pkgsTargetTarget.stdenv.cc}/bin/${pkgsTargetTarget.stdenv.cc.targetPrefix}cc"
"${targetCC}/bin/${targetCC.targetPrefix}cc"
else
null;
CXX_FOR_TARGET = if (stdenv.buildPlatform != stdenv.targetPlatform) then
"${pkgsTargetTarget.stdenv.cc}/bin/${pkgsTargetTarget.stdenv.cc.targetPrefix}c++"
"${targetCC}/bin/${targetCC.targetPrefix}c++"
else
null;

View File

@ -1,7 +1,8 @@
{ stdenv, fetchurl, tzdata, iana-etc, runCommand
, perl, which, pkgconfig, patch, procps, pcre, cacert, Security, Foundation
, mailcap, runtimeShell
, buildPackages, pkgsTargetTarget
, buildPackages
, pkgsBuildTarget
, fetchpatch
}:
@ -25,8 +26,12 @@ let
"armv5tel" = "arm";
"armv6l" = "arm";
"armv7l" = "arm";
"powerpc64le" = "ppc64le";
}.${platform.parsed.cpu.name} or (throw "Unsupported system");
# We need a target compiler which is still runnable at build time,
# to handle the cross-building case where build != host == target
targetCC = pkgsBuildTarget.targetPackages.stdenv.cc;
in
stdenv.mkDerivation rec {
@ -169,11 +174,11 @@ stdenv.mkDerivation rec {
# {CC,CXX}_FOR_TARGET must be only set for cross compilation case as go expect those
# to be different from CC/CXX
CC_FOR_TARGET = if (stdenv.buildPlatform != stdenv.targetPlatform) then
"${pkgsTargetTarget.stdenv.cc}/bin/${pkgsTargetTarget.stdenv.cc.targetPrefix}cc"
"${targetCC}/bin/${targetCC.targetPrefix}cc"
else
null;
CXX_FOR_TARGET = if (stdenv.buildPlatform != stdenv.targetPlatform) then
"${pkgsTargetTarget.stdenv.cc}/bin/${pkgsTargetTarget.stdenv.cc.targetPrefix}c++"
"${targetCC}/bin/${targetCC.targetPrefix}c++"
else
null;