go: organize GOARCH and GOOS

This commit is contained in:
ryan4729 2018-11-11 14:37:12 -08:00
parent 5302222337
commit b46f5e1277

View File

@ -131,13 +131,16 @@ stdenv.mkDerivation rec {
substituteInPlace "src/cmd/link/internal/ld/lib.go" --replace dsymutil ${llvm}/bin/llvm-dsymutil substituteInPlace "src/cmd/link/internal/ld/lib.go" --replace dsymutil ${llvm}/bin/llvm-dsymutil
''; '';
GOOS = if stdenv.isDarwin then "darwin" else "linux"; GOOS = stdenv.hostPlatform.parsed.kernel.name;
GOARCH = if stdenv.isDarwin then "amd64" GOARCH = {
else if stdenv.hostPlatform.isi686 then "386" "i686" = "386";
else if stdenv.hostPlatform.isx86_64 then "amd64" "x86_64" = "amd64";
else if stdenv.hostPlatform.isAarch32 then "arm" "aarch64" = "arm64";
else if stdenv.hostPlatform.isAarch64 then "arm64" "arm" = "arm";
else throw "Unsupported system"; "armv5tel" = "arm";
"armv6l" = "arm";
"armv7l" = "arm";
}.${stdenv.hostPlatform.parsed.cpu.name} or (throw "Unsupported system");
GOARM = toString (stdenv.lib.intersectLists [(stdenv.hostPlatform.parsed.cpu.version or "")] ["5" "6" "7"]); GOARM = toString (stdenv.lib.intersectLists [(stdenv.hostPlatform.parsed.cpu.version or "")] ["5" "6" "7"]);
GO386 = 387; # from Arch: don't assume sse2 on i686 GO386 = 387; # from Arch: don't assume sse2 on i686
CGO_ENABLED = 1; CGO_ENABLED = 1;