Merge pull request #130200 from maxeaubrey/21.05_go_backports
This commit is contained in:
commit
292d8209ed
@ -1,6 +1,20 @@
|
|||||||
{ lib, stdenv, fetchurl, tzdata, iana-etc, runCommand
|
{ lib
|
||||||
, perl, which, pkg-config, patch, procps, pcre, cacert, Security, Foundation
|
, stdenv
|
||||||
, mailcap, runtimeShell
|
, fetchurl
|
||||||
|
, tzdata
|
||||||
|
, iana-etc
|
||||||
|
, runCommand
|
||||||
|
, perl
|
||||||
|
, which
|
||||||
|
, pkg-config
|
||||||
|
, patch
|
||||||
|
, procps
|
||||||
|
, pcre
|
||||||
|
, cacert
|
||||||
|
, Security
|
||||||
|
, Foundation
|
||||||
|
, mailcap
|
||||||
|
, runtimeShell
|
||||||
, buildPackages
|
, buildPackages
|
||||||
, pkgsBuildTarget
|
, pkgsBuildTarget
|
||||||
, fetchpatch
|
, fetchpatch
|
||||||
@ -8,14 +22,9 @@
|
|||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
inherit (lib) optionals optionalString;
|
|
||||||
|
|
||||||
version = "1.14.15";
|
|
||||||
|
|
||||||
go_bootstrap = buildPackages.callPackage ./bootstrap.nix { };
|
go_bootstrap = buildPackages.callPackage ./bootstrap.nix { };
|
||||||
|
|
||||||
goBootstrap = runCommand "go-bootstrap" {} ''
|
goBootstrap = runCommand "go-bootstrap" { } ''
|
||||||
mkdir $out
|
mkdir $out
|
||||||
cp -rf ${go_bootstrap}/* $out/
|
cp -rf ${go_bootstrap}/* $out/
|
||||||
chmod -R u+w $out
|
chmod -R u+w $out
|
||||||
@ -41,7 +50,7 @@ in
|
|||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "go";
|
pname = "go";
|
||||||
inherit version;
|
version = "1.14.15";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://dl.google.com/go/go${version}.src.tar.gz";
|
url = "https://dl.google.com/go/go${version}.src.tar.gz";
|
||||||
@ -51,10 +60,10 @@ stdenv.mkDerivation rec {
|
|||||||
# perl is used for testing go vet
|
# perl is used for testing go vet
|
||||||
nativeBuildInputs = [ perl which pkg-config patch procps ];
|
nativeBuildInputs = [ perl which pkg-config patch procps ];
|
||||||
buildInputs = [ cacert pcre ]
|
buildInputs = [ cacert pcre ]
|
||||||
++ optionals stdenv.isLinux [ stdenv.cc.libc.out ]
|
++ lib.optionals stdenv.isLinux [ stdenv.cc.libc.out ]
|
||||||
++ optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ];
|
++ lib.optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ];
|
||||||
|
|
||||||
depsTargetTargetPropagated = optionals stdenv.isDarwin [ Security Foundation ];
|
depsTargetTargetPropagated = lib.optionals stdenv.isDarwin [ Security Foundation ];
|
||||||
|
|
||||||
hardeningDisable = [ "all" ];
|
hardeningDisable = [ "all" ];
|
||||||
|
|
||||||
@ -106,14 +115,14 @@ stdenv.mkDerivation rec {
|
|||||||
# Disable cgo lookup tests not works, they depend on resolver
|
# Disable cgo lookup tests not works, they depend on resolver
|
||||||
rm src/net/cgo_unix_test.go
|
rm src/net/cgo_unix_test.go
|
||||||
|
|
||||||
'' + optionalString stdenv.isLinux ''
|
'' + lib.optionalString stdenv.isLinux ''
|
||||||
# prepend the nix path to the zoneinfo files but also leave the original value for static binaries
|
# prepend the nix path to the zoneinfo files but also leave the original value for static binaries
|
||||||
# that run outside a nix server
|
# that run outside a nix server
|
||||||
sed -i 's,\"/usr/share/zoneinfo/,"${tzdata}/share/zoneinfo/\"\,\n\t&,' src/time/zoneinfo_unix.go
|
sed -i 's,\"/usr/share/zoneinfo/,"${tzdata}/share/zoneinfo/\"\,\n\t&,' src/time/zoneinfo_unix.go
|
||||||
|
|
||||||
'' + optionalString stdenv.isAarch32 ''
|
'' + lib.optionalString stdenv.isAarch32 ''
|
||||||
echo '#!${runtimeShell}' > misc/cgo/testplugin/test.bash
|
echo '#!${runtimeShell}' > misc/cgo/testplugin/test.bash
|
||||||
'' + optionalString stdenv.isDarwin ''
|
'' + lib.optionalString stdenv.isDarwin ''
|
||||||
substituteInPlace src/race.bash --replace \
|
substituteInPlace src/race.bash --replace \
|
||||||
"sysctl machdep.cpu.extfeatures | grep -qv EM64T" true
|
"sysctl machdep.cpu.extfeatures | grep -qv EM64T" true
|
||||||
sed -i 's,strings.Contains(.*sysctl.*,true {,' src/cmd/dist/util.go
|
sed -i 's,strings.Contains(.*sysctl.*,true {,' src/cmd/dist/util.go
|
||||||
@ -183,16 +192,18 @@ 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 = if (stdenv.buildPlatform != stdenv.targetPlatform) then
|
CC_FOR_TARGET =
|
||||||
|
if (stdenv.buildPlatform != stdenv.targetPlatform) then
|
||||||
"${targetCC}/bin/${targetCC.targetPrefix}cc"
|
"${targetCC}/bin/${targetCC.targetPrefix}cc"
|
||||||
else
|
else
|
||||||
null;
|
null;
|
||||||
CXX_FOR_TARGET = if (stdenv.buildPlatform != stdenv.targetPlatform) then
|
CXX_FOR_TARGET =
|
||||||
|
if (stdenv.buildPlatform != stdenv.targetPlatform) then
|
||||||
"${targetCC}/bin/${targetCC.targetPrefix}c++"
|
"${targetCC}/bin/${targetCC.targetPrefix}c++"
|
||||||
else
|
else
|
||||||
null;
|
null;
|
||||||
|
|
||||||
GOARM = toString (lib.intersectLists [(stdenv.hostPlatform.parsed.cpu.version or "")] ["5" "6" "7"]);
|
GOARM = toString (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;
|
||||||
# Hopefully avoids test timeouts on Hydra
|
# Hopefully avoids test timeouts on Hydra
|
||||||
@ -202,7 +213,7 @@ stdenv.mkDerivation rec {
|
|||||||
# Some tests assume things like home directories and users exists
|
# Some tests assume things like home directories and users exists
|
||||||
GO_BUILDER_NAME = "nix";
|
GO_BUILDER_NAME = "nix";
|
||||||
|
|
||||||
GOROOT_BOOTSTRAP="${goBootstrap}/share/go";
|
GOROOT_BOOTSTRAP = "${goBootstrap}/share/go";
|
||||||
|
|
||||||
postConfigure = ''
|
postConfigure = ''
|
||||||
export GOCACHE=$TMPDIR/go-cache
|
export GOCACHE=$TMPDIR/go-cache
|
||||||
@ -211,7 +222,7 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
export PATH=$(pwd)/bin:$PATH
|
export PATH=$(pwd)/bin:$PATH
|
||||||
|
|
||||||
${optionalString (stdenv.buildPlatform != stdenv.targetPlatform) ''
|
${lib.optionalString (stdenv.buildPlatform != stdenv.targetPlatform) ''
|
||||||
# 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
|
||||||
@ -239,12 +250,12 @@ stdenv.mkDerivation rec {
|
|||||||
'' + (if (stdenv.buildPlatform != stdenv.hostPlatform) then ''
|
'' + (if (stdenv.buildPlatform != stdenv.hostPlatform) then ''
|
||||||
mv bin/*_*/* bin
|
mv bin/*_*/* bin
|
||||||
rmdir bin/*_*
|
rmdir bin/*_*
|
||||||
${optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) ''
|
${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) ''
|
||||||
rm -rf pkg/${GOHOSTOS}_${GOHOSTARCH} pkg/tool/${GOHOSTOS}_${GOHOSTARCH}
|
rm -rf pkg/${GOHOSTOS}_${GOHOSTARCH} pkg/tool/${GOHOSTOS}_${GOHOSTARCH}
|
||||||
''}
|
''}
|
||||||
'' else if (stdenv.hostPlatform != stdenv.targetPlatform) then ''
|
'' else if (stdenv.hostPlatform != stdenv.targetPlatform) then ''
|
||||||
rm -rf bin/*_*
|
rm -rf bin/*_*
|
||||||
${optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) ''
|
${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) ''
|
||||||
rm -rf pkg/${GOOS}_${GOARCH} pkg/tool/${GOOS}_${GOARCH}
|
rm -rf pkg/${GOOS}_${GOARCH} pkg/tool/${GOOS}_${GOARCH}
|
||||||
''}
|
''}
|
||||||
'' else "");
|
'' else "");
|
||||||
|
@ -1,6 +1,20 @@
|
|||||||
{ lib, stdenv, fetchurl, tzdata, iana-etc, runCommand
|
{ lib
|
||||||
, perl, which, pkg-config, patch, procps, pcre, cacert, Security, Foundation
|
, stdenv
|
||||||
, mailcap, runtimeShell
|
, fetchurl
|
||||||
|
, tzdata
|
||||||
|
, iana-etc
|
||||||
|
, runCommand
|
||||||
|
, perl
|
||||||
|
, which
|
||||||
|
, pkg-config
|
||||||
|
, patch
|
||||||
|
, procps
|
||||||
|
, pcre
|
||||||
|
, cacert
|
||||||
|
, Security
|
||||||
|
, Foundation
|
||||||
|
, mailcap
|
||||||
|
, runtimeShell
|
||||||
, buildPackages
|
, buildPackages
|
||||||
, pkgsBuildTarget
|
, pkgsBuildTarget
|
||||||
, fetchpatch
|
, fetchpatch
|
||||||
@ -8,14 +22,9 @@
|
|||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
inherit (lib) optionals optionalString;
|
|
||||||
|
|
||||||
version = "1.15.13";
|
|
||||||
|
|
||||||
go_bootstrap = buildPackages.callPackage ./bootstrap.nix { };
|
go_bootstrap = buildPackages.callPackage ./bootstrap.nix { };
|
||||||
|
|
||||||
goBootstrap = runCommand "go-bootstrap" {} ''
|
goBootstrap = runCommand "go-bootstrap" { } ''
|
||||||
mkdir $out
|
mkdir $out
|
||||||
cp -rf ${go_bootstrap}/* $out/
|
cp -rf ${go_bootstrap}/* $out/
|
||||||
chmod -R u+w $out
|
chmod -R u+w $out
|
||||||
@ -41,20 +50,20 @@ in
|
|||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "go";
|
pname = "go";
|
||||||
inherit version;
|
version = "1.15.14";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://dl.google.com/go/go${version}.src.tar.gz";
|
url = "https://dl.google.com/go/go${version}.src.tar.gz";
|
||||||
sha256 = "sha256-mQaeciNHnM5FU/hPh0uTRfb0BF8nz1CJSJtUbaYZokQ=";
|
sha256 = "sha256-YKSlxI1j0KE+yohJAJtiRin/QpyLxdGmqMPE2p805wo=";
|
||||||
};
|
};
|
||||||
|
|
||||||
# perl is used for testing go vet
|
# perl is used for testing go vet
|
||||||
nativeBuildInputs = [ perl which pkg-config patch procps ];
|
nativeBuildInputs = [ perl which pkg-config patch procps ];
|
||||||
buildInputs = [ cacert pcre ]
|
buildInputs = [ cacert pcre ]
|
||||||
++ optionals stdenv.isLinux [ stdenv.cc.libc.out ]
|
++ lib.optionals stdenv.isLinux [ stdenv.cc.libc.out ]
|
||||||
++ optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ];
|
++ lib.optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ];
|
||||||
|
|
||||||
depsTargetTargetPropagated = optionals stdenv.isDarwin [ Security Foundation ];
|
depsTargetTargetPropagated = lib.optionals stdenv.isDarwin [ Security Foundation ];
|
||||||
|
|
||||||
hardeningDisable = [ "all" ];
|
hardeningDisable = [ "all" ];
|
||||||
|
|
||||||
@ -114,14 +123,14 @@ stdenv.mkDerivation rec {
|
|||||||
# Disable cgo lookup tests not works, they depend on resolver
|
# Disable cgo lookup tests not works, they depend on resolver
|
||||||
rm src/net/cgo_unix_test.go
|
rm src/net/cgo_unix_test.go
|
||||||
|
|
||||||
'' + optionalString stdenv.isLinux ''
|
'' + lib.optionalString stdenv.isLinux ''
|
||||||
# prepend the nix path to the zoneinfo files but also leave the original value for static binaries
|
# prepend the nix path to the zoneinfo files but also leave the original value for static binaries
|
||||||
# that run outside a nix server
|
# that run outside a nix server
|
||||||
sed -i 's,\"/usr/share/zoneinfo/,"${tzdata}/share/zoneinfo/\"\,\n\t&,' src/time/zoneinfo_unix.go
|
sed -i 's,\"/usr/share/zoneinfo/,"${tzdata}/share/zoneinfo/\"\,\n\t&,' src/time/zoneinfo_unix.go
|
||||||
|
|
||||||
'' + optionalString stdenv.isAarch32 ''
|
'' + lib.optionalString stdenv.isAarch32 ''
|
||||||
echo '#!${runtimeShell}' > misc/cgo/testplugin/test.bash
|
echo '#!${runtimeShell}' > misc/cgo/testplugin/test.bash
|
||||||
'' + optionalString stdenv.isDarwin ''
|
'' + lib.optionalString stdenv.isDarwin ''
|
||||||
substituteInPlace src/race.bash --replace \
|
substituteInPlace src/race.bash --replace \
|
||||||
"sysctl machdep.cpu.extfeatures | grep -qv EM64T" true
|
"sysctl machdep.cpu.extfeatures | grep -qv EM64T" true
|
||||||
sed -i 's,strings.Contains(.*sysctl.*,true {,' src/cmd/dist/util.go
|
sed -i 's,strings.Contains(.*sysctl.*,true {,' src/cmd/dist/util.go
|
||||||
@ -186,16 +195,18 @@ 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 = if (stdenv.buildPlatform != stdenv.targetPlatform) then
|
CC_FOR_TARGET =
|
||||||
|
if (stdenv.buildPlatform != stdenv.targetPlatform) then
|
||||||
"${targetCC}/bin/${targetCC.targetPrefix}cc"
|
"${targetCC}/bin/${targetCC.targetPrefix}cc"
|
||||||
else
|
else
|
||||||
null;
|
null;
|
||||||
CXX_FOR_TARGET = if (stdenv.buildPlatform != stdenv.targetPlatform) then
|
CXX_FOR_TARGET =
|
||||||
|
if (stdenv.buildPlatform != stdenv.targetPlatform) then
|
||||||
"${targetCC}/bin/${targetCC.targetPrefix}c++"
|
"${targetCC}/bin/${targetCC.targetPrefix}c++"
|
||||||
else
|
else
|
||||||
null;
|
null;
|
||||||
|
|
||||||
GOARM = toString (lib.intersectLists [(stdenv.hostPlatform.parsed.cpu.version or "")] ["5" "6" "7"]);
|
GOARM = toString (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;
|
||||||
# Hopefully avoids test timeouts on Hydra
|
# Hopefully avoids test timeouts on Hydra
|
||||||
@ -205,7 +216,7 @@ stdenv.mkDerivation rec {
|
|||||||
# Some tests assume things like home directories and users exists
|
# Some tests assume things like home directories and users exists
|
||||||
GO_BUILDER_NAME = "nix";
|
GO_BUILDER_NAME = "nix";
|
||||||
|
|
||||||
GOROOT_BOOTSTRAP="${goBootstrap}/share/go";
|
GOROOT_BOOTSTRAP = "${goBootstrap}/share/go";
|
||||||
|
|
||||||
postConfigure = ''
|
postConfigure = ''
|
||||||
export GOCACHE=$TMPDIR/go-cache
|
export GOCACHE=$TMPDIR/go-cache
|
||||||
@ -214,7 +225,7 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
export PATH=$(pwd)/bin:$PATH
|
export PATH=$(pwd)/bin:$PATH
|
||||||
|
|
||||||
${optionalString (stdenv.buildPlatform != stdenv.targetPlatform) ''
|
${lib.optionalString (stdenv.buildPlatform != stdenv.targetPlatform) ''
|
||||||
# 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
|
||||||
@ -242,12 +253,12 @@ stdenv.mkDerivation rec {
|
|||||||
'' + (if (stdenv.buildPlatform != stdenv.hostPlatform) then ''
|
'' + (if (stdenv.buildPlatform != stdenv.hostPlatform) then ''
|
||||||
mv bin/*_*/* bin
|
mv bin/*_*/* bin
|
||||||
rmdir bin/*_*
|
rmdir bin/*_*
|
||||||
${optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) ''
|
${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) ''
|
||||||
rm -rf pkg/${GOHOSTOS}_${GOHOSTARCH} pkg/tool/${GOHOSTOS}_${GOHOSTARCH}
|
rm -rf pkg/${GOHOSTOS}_${GOHOSTARCH} pkg/tool/${GOHOSTOS}_${GOHOSTARCH}
|
||||||
''}
|
''}
|
||||||
'' else if (stdenv.hostPlatform != stdenv.targetPlatform) then ''
|
'' else if (stdenv.hostPlatform != stdenv.targetPlatform) then ''
|
||||||
rm -rf bin/*_*
|
rm -rf bin/*_*
|
||||||
${optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) ''
|
${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) ''
|
||||||
rm -rf pkg/${GOOS}_${GOARCH} pkg/tool/${GOOS}_${GOARCH}
|
rm -rf pkg/${GOOS}_${GOARCH} pkg/tool/${GOOS}_${GOARCH}
|
||||||
''}
|
''}
|
||||||
'' else "");
|
'' else "");
|
||||||
|
@ -1,21 +1,30 @@
|
|||||||
{ lib, stdenv, fetchurl, tzdata, iana-etc, runCommand
|
{ lib
|
||||||
, perl, which, pkg-config, patch, procps, pcre, cacert, Security, Foundation, xcbuild
|
, stdenv
|
||||||
, mailcap, runtimeShell
|
, fetchurl
|
||||||
|
, tzdata
|
||||||
|
, iana-etc
|
||||||
|
, runCommand
|
||||||
|
, perl
|
||||||
|
, which
|
||||||
|
, pkg-config
|
||||||
|
, patch
|
||||||
|
, procps
|
||||||
|
, pcre
|
||||||
|
, cacert
|
||||||
|
, Security
|
||||||
|
, Foundation
|
||||||
|
, xcbuild
|
||||||
|
, mailcap
|
||||||
|
, runtimeShell
|
||||||
, buildPackages
|
, buildPackages
|
||||||
, pkgsBuildTarget
|
, pkgsBuildTarget
|
||||||
, fetchpatch
|
|
||||||
, callPackage
|
, callPackage
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
inherit (lib) optionals optionalString;
|
|
||||||
|
|
||||||
version = "1.16.5";
|
|
||||||
|
|
||||||
go_bootstrap = buildPackages.callPackage ./bootstrap.nix { };
|
go_bootstrap = buildPackages.callPackage ./bootstrap.nix { };
|
||||||
|
|
||||||
goBootstrap = runCommand "go-bootstrap" {} ''
|
goBootstrap = runCommand "go-bootstrap" { } ''
|
||||||
mkdir $out
|
mkdir $out
|
||||||
cp -rf ${go_bootstrap}/* $out/
|
cp -rf ${go_bootstrap}/* $out/
|
||||||
chmod -R u+w $out
|
chmod -R u+w $out
|
||||||
@ -41,22 +50,22 @@ in
|
|||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "go";
|
pname = "go";
|
||||||
inherit version;
|
version = "1.16.6";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://dl.google.com/go/go${version}.src.tar.gz";
|
url = "https://dl.google.com/go/go${version}.src.tar.gz";
|
||||||
sha256 = "sha256-e/p+WQjHzJ512l3fMGbXy88/2fpRlFhRMl7rwX9QuoA=";
|
sha256 = "sha256-o6XUvEAbUdsGXk+TtSM0ek00OuDAsIplw0I7BaE4A30=";
|
||||||
};
|
};
|
||||||
|
|
||||||
# perl is used for testing go vet
|
# perl is used for testing go vet
|
||||||
nativeBuildInputs = [ perl which pkg-config patch procps ];
|
nativeBuildInputs = [ perl which pkg-config patch procps ];
|
||||||
buildInputs = [ cacert pcre ]
|
buildInputs = [ cacert pcre ]
|
||||||
++ optionals stdenv.isLinux [ stdenv.cc.libc.out ]
|
++ lib.optionals stdenv.isLinux [ stdenv.cc.libc.out ]
|
||||||
++ optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ];
|
++ lib.optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ];
|
||||||
|
|
||||||
propagatedBuildInputs = optionals stdenv.isDarwin [ xcbuild ];
|
propagatedBuildInputs = lib.optionals stdenv.isDarwin [ xcbuild ];
|
||||||
|
|
||||||
depsTargetTargetPropagated = optionals stdenv.isDarwin [ Security Foundation ];
|
depsTargetTargetPropagated = lib.optionals stdenv.isDarwin [ Security Foundation ];
|
||||||
|
|
||||||
hardeningDisable = [ "all" ];
|
hardeningDisable = [ "all" ];
|
||||||
|
|
||||||
@ -116,14 +125,14 @@ stdenv.mkDerivation rec {
|
|||||||
# Disable cgo lookup tests not works, they depend on resolver
|
# Disable cgo lookup tests not works, they depend on resolver
|
||||||
rm src/net/cgo_unix_test.go
|
rm src/net/cgo_unix_test.go
|
||||||
|
|
||||||
'' + optionalString stdenv.isLinux ''
|
'' + lib.optionalString stdenv.isLinux ''
|
||||||
# prepend the nix path to the zoneinfo files but also leave the original value for static binaries
|
# prepend the nix path to the zoneinfo files but also leave the original value for static binaries
|
||||||
# that run outside a nix server
|
# that run outside a nix server
|
||||||
sed -i 's,\"/usr/share/zoneinfo/,"${tzdata}/share/zoneinfo/\"\,\n\t&,' src/time/zoneinfo_unix.go
|
sed -i 's,\"/usr/share/zoneinfo/,"${tzdata}/share/zoneinfo/\"\,\n\t&,' src/time/zoneinfo_unix.go
|
||||||
|
|
||||||
'' + optionalString stdenv.isAarch32 ''
|
'' + lib.optionalString stdenv.isAarch32 ''
|
||||||
echo '#!${runtimeShell}' > misc/cgo/testplugin/test.bash
|
echo '#!${runtimeShell}' > misc/cgo/testplugin/test.bash
|
||||||
'' + optionalString stdenv.isDarwin ''
|
'' + lib.optionalString stdenv.isDarwin ''
|
||||||
substituteInPlace src/race.bash --replace \
|
substituteInPlace src/race.bash --replace \
|
||||||
"sysctl machdep.cpu.extfeatures | grep -qv EM64T" true
|
"sysctl machdep.cpu.extfeatures | grep -qv EM64T" true
|
||||||
sed -i 's,strings.Contains(.*sysctl.*,true {,' src/cmd/dist/util.go
|
sed -i 's,strings.Contains(.*sysctl.*,true {,' src/cmd/dist/util.go
|
||||||
@ -181,16 +190,18 @@ 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 = if (stdenv.buildPlatform != stdenv.targetPlatform) then
|
CC_FOR_TARGET =
|
||||||
|
if (stdenv.buildPlatform != stdenv.targetPlatform) then
|
||||||
"${targetCC}/bin/${targetCC.targetPrefix}cc"
|
"${targetCC}/bin/${targetCC.targetPrefix}cc"
|
||||||
else
|
else
|
||||||
null;
|
null;
|
||||||
CXX_FOR_TARGET = if (stdenv.buildPlatform != stdenv.targetPlatform) then
|
CXX_FOR_TARGET =
|
||||||
|
if (stdenv.buildPlatform != stdenv.targetPlatform) then
|
||||||
"${targetCC}/bin/${targetCC.targetPrefix}c++"
|
"${targetCC}/bin/${targetCC.targetPrefix}c++"
|
||||||
else
|
else
|
||||||
null;
|
null;
|
||||||
|
|
||||||
GOARM = toString (lib.intersectLists [(stdenv.hostPlatform.parsed.cpu.version or "")] ["5" "6" "7"]);
|
GOARM = toString (lib.intersectLists [ (stdenv.hostPlatform.parsed.cpu.version or "") ] [ "5" "6" "7" ]);
|
||||||
GO386 = "softfloat"; # from Arch: don't assume sse2 on i686
|
GO386 = "softfloat"; # from Arch: don't assume sse2 on i686
|
||||||
CGO_ENABLED = 1;
|
CGO_ENABLED = 1;
|
||||||
# Hopefully avoids test timeouts on Hydra
|
# Hopefully avoids test timeouts on Hydra
|
||||||
@ -200,7 +211,7 @@ stdenv.mkDerivation rec {
|
|||||||
# Some tests assume things like home directories and users exists
|
# Some tests assume things like home directories and users exists
|
||||||
GO_BUILDER_NAME = "nix";
|
GO_BUILDER_NAME = "nix";
|
||||||
|
|
||||||
GOROOT_BOOTSTRAP="${goBootstrap}/share/go";
|
GOROOT_BOOTSTRAP = "${goBootstrap}/share/go";
|
||||||
|
|
||||||
postConfigure = ''
|
postConfigure = ''
|
||||||
export GOCACHE=$TMPDIR/go-cache
|
export GOCACHE=$TMPDIR/go-cache
|
||||||
@ -209,7 +220,7 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
export PATH=$(pwd)/bin:$PATH
|
export PATH=$(pwd)/bin:$PATH
|
||||||
|
|
||||||
${optionalString (stdenv.buildPlatform != stdenv.targetPlatform) ''
|
${lib.optionalString (stdenv.buildPlatform != stdenv.targetPlatform) ''
|
||||||
# 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
|
||||||
@ -237,12 +248,12 @@ stdenv.mkDerivation rec {
|
|||||||
'' + (if (stdenv.buildPlatform != stdenv.hostPlatform) then ''
|
'' + (if (stdenv.buildPlatform != stdenv.hostPlatform) then ''
|
||||||
mv bin/*_*/* bin
|
mv bin/*_*/* bin
|
||||||
rmdir bin/*_*
|
rmdir bin/*_*
|
||||||
${optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) ''
|
${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) ''
|
||||||
rm -rf pkg/${GOHOSTOS}_${GOHOSTARCH} pkg/tool/${GOHOSTOS}_${GOHOSTARCH}
|
rm -rf pkg/${GOHOSTOS}_${GOHOSTARCH} pkg/tool/${GOHOSTOS}_${GOHOSTARCH}
|
||||||
''}
|
''}
|
||||||
'' else if (stdenv.hostPlatform != stdenv.targetPlatform) then ''
|
'' else if (stdenv.hostPlatform != stdenv.targetPlatform) then ''
|
||||||
rm -rf bin/*_*
|
rm -rf bin/*_*
|
||||||
${optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) ''
|
${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) ''
|
||||||
rm -rf pkg/${GOOS}_${GOARCH} pkg/tool/${GOOS}_${GOARCH}
|
rm -rf pkg/${GOOS}_${GOARCH} pkg/tool/${GOOS}_${GOARCH}
|
||||||
''}
|
''}
|
||||||
'' else "");
|
'' else "");
|
||||||
|
@ -1,19 +1,29 @@
|
|||||||
{ pkgs, lib, stdenv, fetchurl, fetchgit, tzdata, iana-etc, runCommand
|
{ lib
|
||||||
, perl, which, pkg-config, patch, procps, pcre, cacert, Security, Foundation
|
, stdenv
|
||||||
, mailcap, runtimeShell
|
, fetchgit
|
||||||
|
, tzdata
|
||||||
|
, iana-etc
|
||||||
|
, runCommand
|
||||||
|
, perl
|
||||||
|
, which
|
||||||
|
, pkg-config
|
||||||
|
, patch
|
||||||
|
, procps
|
||||||
|
, pcre
|
||||||
|
, cacert
|
||||||
|
, Security
|
||||||
|
, Foundation
|
||||||
|
, mailcap
|
||||||
|
, runtimeShell
|
||||||
, buildPackages
|
, buildPackages
|
||||||
, pkgsBuildTarget
|
, pkgsBuildTarget
|
||||||
, fetchpatch
|
|
||||||
, callPackage
|
, callPackage
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
inherit (lib) optionals optionalString;
|
|
||||||
|
|
||||||
go_bootstrap = buildPackages.callPackage ./bootstrap.nix { };
|
go_bootstrap = buildPackages.callPackage ./bootstrap.nix { };
|
||||||
|
|
||||||
goBootstrap = runCommand "go-bootstrap" {} ''
|
goBootstrap = runCommand "go-bootstrap" { } ''
|
||||||
mkdir $out
|
mkdir $out
|
||||||
cp -rf ${go_bootstrap}/* $out/
|
cp -rf ${go_bootstrap}/* $out/
|
||||||
chmod -R u+w $out
|
chmod -R u+w $out
|
||||||
@ -42,7 +52,7 @@ stdenv.mkDerivation rec {
|
|||||||
version = "2021-04-13";
|
version = "2021-04-13";
|
||||||
|
|
||||||
src = fetchgit {
|
src = fetchgit {
|
||||||
url = https://go.googlesource.com/go;
|
url = "https://go.googlesource.com/go";
|
||||||
rev = "9cd52cf2a93a958e8e001aea36886e7846c91f2f";
|
rev = "9cd52cf2a93a958e8e001aea36886e7846c91f2f";
|
||||||
sha256 = "sha256:0hybm93y4i4j7bs86y7h73nc1wqnspkq75if7n1032zf9bs8sm96";
|
sha256 = "sha256:0hybm93y4i4j7bs86y7h73nc1wqnspkq75if7n1032zf9bs8sm96";
|
||||||
};
|
};
|
||||||
@ -50,10 +60,10 @@ stdenv.mkDerivation rec {
|
|||||||
# perl is used for testing go vet
|
# perl is used for testing go vet
|
||||||
nativeBuildInputs = [ perl which pkg-config patch procps ];
|
nativeBuildInputs = [ perl which pkg-config patch procps ];
|
||||||
buildInputs = [ cacert pcre ]
|
buildInputs = [ cacert pcre ]
|
||||||
++ optionals stdenv.isLinux [ stdenv.cc.libc.out ]
|
++ lib.optionals stdenv.isLinux [ stdenv.cc.libc.out ]
|
||||||
++ optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ];
|
++ lib.optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ];
|
||||||
|
|
||||||
depsTargetTargetPropagated = optionals stdenv.isDarwin [ Security Foundation ];
|
depsTargetTargetPropagated = lib.optionals stdenv.isDarwin [ Security Foundation ];
|
||||||
|
|
||||||
hardeningDisable = [ "all" ];
|
hardeningDisable = [ "all" ];
|
||||||
|
|
||||||
@ -114,14 +124,14 @@ stdenv.mkDerivation rec {
|
|||||||
# Disable cgo lookup tests not works, they depend on resolver
|
# Disable cgo lookup tests not works, they depend on resolver
|
||||||
rm src/net/cgo_unix_test.go
|
rm src/net/cgo_unix_test.go
|
||||||
|
|
||||||
'' + optionalString stdenv.isLinux ''
|
'' + lib.optionalString stdenv.isLinux ''
|
||||||
# prepend the nix path to the zoneinfo files but also leave the original value for static binaries
|
# prepend the nix path to the zoneinfo files but also leave the original value for static binaries
|
||||||
# that run outside a nix server
|
# that run outside a nix server
|
||||||
sed -i 's,\"/usr/share/zoneinfo/,"${tzdata}/share/zoneinfo/\"\,\n\t&,' src/time/zoneinfo_unix.go
|
sed -i 's,\"/usr/share/zoneinfo/,"${tzdata}/share/zoneinfo/\"\,\n\t&,' src/time/zoneinfo_unix.go
|
||||||
|
|
||||||
'' + optionalString stdenv.isAarch32 ''
|
'' + lib.optionalString stdenv.isAarch32 ''
|
||||||
echo '#!${runtimeShell}' > misc/cgo/testplugin/test.bash
|
echo '#!${runtimeShell}' > misc/cgo/testplugin/test.bash
|
||||||
'' + optionalString stdenv.isDarwin ''
|
'' + lib.optionalString stdenv.isDarwin ''
|
||||||
substituteInPlace src/race.bash --replace \
|
substituteInPlace src/race.bash --replace \
|
||||||
"sysctl machdep.cpu.extfeatures | grep -qv EM64T" true
|
"sysctl machdep.cpu.extfeatures | grep -qv EM64T" true
|
||||||
sed -i 's,strings.Contains(.*sysctl.*,true {,' src/cmd/dist/util.go
|
sed -i 's,strings.Contains(.*sysctl.*,true {,' src/cmd/dist/util.go
|
||||||
@ -178,16 +188,18 @@ 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 = if (stdenv.buildPlatform != stdenv.targetPlatform) then
|
CC_FOR_TARGET =
|
||||||
|
if (stdenv.buildPlatform != stdenv.targetPlatform) then
|
||||||
"${targetCC}/bin/${targetCC.targetPrefix}cc"
|
"${targetCC}/bin/${targetCC.targetPrefix}cc"
|
||||||
else
|
else
|
||||||
null;
|
null;
|
||||||
CXX_FOR_TARGET = if (stdenv.buildPlatform != stdenv.targetPlatform) then
|
CXX_FOR_TARGET =
|
||||||
|
if (stdenv.buildPlatform != stdenv.targetPlatform) then
|
||||||
"${targetCC}/bin/${targetCC.targetPrefix}c++"
|
"${targetCC}/bin/${targetCC.targetPrefix}c++"
|
||||||
else
|
else
|
||||||
null;
|
null;
|
||||||
|
|
||||||
GOARM = toString (lib.intersectLists [(stdenv.hostPlatform.parsed.cpu.version or "")] ["5" "6" "7"]);
|
GOARM = toString (lib.intersectLists [ (stdenv.hostPlatform.parsed.cpu.version or "") ] [ "5" "6" "7" ]);
|
||||||
GO386 = "softfloat"; # from Arch: don't assume sse2 on i686
|
GO386 = "softfloat"; # from Arch: don't assume sse2 on i686
|
||||||
CGO_ENABLED = 1;
|
CGO_ENABLED = 1;
|
||||||
# Hopefully avoids test timeouts on Hydra
|
# Hopefully avoids test timeouts on Hydra
|
||||||
@ -197,7 +209,7 @@ stdenv.mkDerivation rec {
|
|||||||
# Some tests assume things like home directories and users exists
|
# Some tests assume things like home directories and users exists
|
||||||
GO_BUILDER_NAME = "nix";
|
GO_BUILDER_NAME = "nix";
|
||||||
|
|
||||||
GOROOT_BOOTSTRAP="${goBootstrap}/share/go";
|
GOROOT_BOOTSTRAP = "${goBootstrap}/share/go";
|
||||||
|
|
||||||
postConfigure = ''
|
postConfigure = ''
|
||||||
export GOCACHE=$TMPDIR/go-cache
|
export GOCACHE=$TMPDIR/go-cache
|
||||||
@ -206,7 +218,7 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
export PATH=$(pwd)/bin:$PATH
|
export PATH=$(pwd)/bin:$PATH
|
||||||
|
|
||||||
${optionalString (stdenv.buildPlatform != stdenv.targetPlatform) ''
|
${lib.optionalString (stdenv.buildPlatform != stdenv.targetPlatform) ''
|
||||||
# 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
|
||||||
@ -234,12 +246,12 @@ stdenv.mkDerivation rec {
|
|||||||
'' + (if (stdenv.buildPlatform != stdenv.hostPlatform) then ''
|
'' + (if (stdenv.buildPlatform != stdenv.hostPlatform) then ''
|
||||||
mv bin/*_*/* bin
|
mv bin/*_*/* bin
|
||||||
rmdir bin/*_*
|
rmdir bin/*_*
|
||||||
${optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) ''
|
${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) ''
|
||||||
rm -rf pkg/${GOHOSTOS}_${GOHOSTARCH} pkg/tool/${GOHOSTOS}_${GOHOSTARCH}
|
rm -rf pkg/${GOHOSTOS}_${GOHOSTARCH} pkg/tool/${GOHOSTOS}_${GOHOSTARCH}
|
||||||
''}
|
''}
|
||||||
'' else if (stdenv.hostPlatform != stdenv.targetPlatform) then ''
|
'' else if (stdenv.hostPlatform != stdenv.targetPlatform) then ''
|
||||||
rm -rf bin/*_*
|
rm -rf bin/*_*
|
||||||
${optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) ''
|
${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) ''
|
||||||
rm -rf pkg/${GOOS}_${GOARCH} pkg/tool/${GOOS}_${GOARCH}
|
rm -rf pkg/${GOOS}_${GOARCH} pkg/tool/${GOOS}_${GOARCH}
|
||||||
''}
|
''}
|
||||||
'' else "");
|
'' else "");
|
||||||
|
@ -29,6 +29,7 @@ stdenv.mkDerivation rec {
|
|||||||
dontStrip = stdenv.hostPlatform.isDarwin;
|
dontStrip = stdenv.hostPlatform.isDarwin;
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
mkdir -p $out/share/go $out/bin
|
mkdir -p $out/share/go $out/bin
|
||||||
mv bin/* $out/bin
|
mv bin/* $out/bin
|
||||||
cp -r . $out/share/go
|
cp -r . $out/share/go
|
||||||
@ -37,5 +38,6 @@ stdenv.mkDerivation rec {
|
|||||||
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
|
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
|
||||||
$out/bin/go
|
$out/bin/go
|
||||||
'')}
|
'')}
|
||||||
'' ;
|
runHook postInstall
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user