go_1_21/buildGo121Module: remove (#344622)
This commit is contained in:
@@ -168,7 +168,7 @@ in
|
||||
type = lib.types.package;
|
||||
default = pkgs.go;
|
||||
defaultText = lib.literalExpression "pkgs.go";
|
||||
example = "pkgs.go_1_21";
|
||||
example = "pkgs.go_1_23";
|
||||
description = ''
|
||||
The Go package used by Athens at runtime.
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
{ lib
|
||||
, buildGoModule
|
||||
, buildGo121Module
|
||||
, buildGo122Module
|
||||
, fetchFromGitHub
|
||||
, nixosTests
|
||||
@@ -61,17 +60,7 @@ rec {
|
||||
|
||||
nomad_1_5 = throwUnsupportaed "nomad_1_5";
|
||||
|
||||
nomad_1_6 = generic {
|
||||
buildGoModule = buildGo121Module;
|
||||
version = "1.6.10";
|
||||
sha256 = "sha256-kiMdpJzjF0S7lrTX3sBFkWm0Gac9a+qlwCPcMKeVXXQ=";
|
||||
vendorHash = "sha256-qnsPPV/NWTrqUa1v1CL16WfCH7B0zW9ZSnEmtqvotqI=";
|
||||
license = lib.licenses.mpl20;
|
||||
passthru.tests.nomad = nixosTests.nomad;
|
||||
preCheck = ''
|
||||
export PATH="$PATH:$NIX_BUILD_TOP/go/bin"
|
||||
'';
|
||||
};
|
||||
nomad_1_6 = throwUnsupportaed "nomad_1_6";
|
||||
|
||||
nomad_1_7 = generic {
|
||||
buildGoModule = buildGo122Module;
|
||||
|
||||
@@ -1,189 +0,0 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchurl
|
||||
, tzdata
|
||||
, substituteAll
|
||||
, iana-etc
|
||||
, Security
|
||||
, Foundation
|
||||
, xcbuild
|
||||
, mailcap
|
||||
, buildPackages
|
||||
, pkgsBuildTarget
|
||||
, threadsCross
|
||||
, testers
|
||||
, skopeo
|
||||
, buildGo121Module
|
||||
}:
|
||||
|
||||
let
|
||||
goBootstrap = buildPackages.callPackage ./bootstrap121.nix { };
|
||||
|
||||
skopeoTest = skopeo.override { buildGoModule = buildGo121Module; };
|
||||
|
||||
goarch = platform: {
|
||||
"aarch64" = "arm64";
|
||||
"arm" = "arm";
|
||||
"armv5tel" = "arm";
|
||||
"armv6l" = "arm";
|
||||
"armv7l" = "arm";
|
||||
"i686" = "386";
|
||||
"mips" = "mips";
|
||||
"mips64el" = "mips64le";
|
||||
"mipsel" = "mipsle";
|
||||
"powerpc64" = "ppc64";
|
||||
"powerpc64le" = "ppc64le";
|
||||
"riscv64" = "riscv64";
|
||||
"s390x" = "s390x";
|
||||
"x86_64" = "amd64";
|
||||
}.${platform.parsed.cpu.name} or (throw "Unsupported system: ${platform.parsed.cpu.name}");
|
||||
|
||||
# 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;
|
||||
|
||||
isCross = stdenv.buildPlatform != stdenv.targetPlatform;
|
||||
in
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "go";
|
||||
version = "1.21.13";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://go.dev/dl/go${finalAttrs.version}.src.tar.gz";
|
||||
hash = "sha256-cfsxYGod5I0SnVkehxemPgxVZf+6CaJOqfiZoTIUw00=";
|
||||
};
|
||||
|
||||
strictDeps = true;
|
||||
buildInputs = [ ]
|
||||
++ lib.optionals stdenv.hostPlatform.isLinux [ stdenv.cc.libc.out ]
|
||||
++ lib.optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ];
|
||||
|
||||
depsTargetTargetPropagated = lib.optionals stdenv.targetPlatform.isDarwin [ Foundation Security xcbuild ];
|
||||
|
||||
depsBuildTarget = lib.optional isCross targetCC;
|
||||
|
||||
depsTargetTarget = lib.optional stdenv.targetPlatform.isWindows threadsCross.package;
|
||||
|
||||
postPatch = ''
|
||||
patchShebangs .
|
||||
'';
|
||||
|
||||
patches = [
|
||||
(substituteAll {
|
||||
src = ./iana-etc-1.17.patch;
|
||||
iana = iana-etc;
|
||||
})
|
||||
# Patch the mimetype database location which is missing on NixOS.
|
||||
# but also allow static binaries built with NixOS to run outside nix
|
||||
(substituteAll {
|
||||
src = ./mailcap-1.17.patch;
|
||||
inherit mailcap;
|
||||
})
|
||||
# prepend the nix path to the zoneinfo files but also leave the original value for static binaries
|
||||
# that run outside a nix server
|
||||
(substituteAll {
|
||||
src = ./tzdata-1.19.patch;
|
||||
inherit tzdata;
|
||||
})
|
||||
./remove-tools-1.11.patch
|
||||
./go_no_vendor_checks-1.21.patch
|
||||
];
|
||||
|
||||
GOOS = stdenv.targetPlatform.parsed.kernel.name;
|
||||
GOARCH = goarch stdenv.targetPlatform;
|
||||
# GOHOSTOS/GOHOSTARCH must match the building system, not the host system.
|
||||
# Go will nevertheless build a for host system that we will copy over in
|
||||
# the install phase.
|
||||
GOHOSTOS = stdenv.buildPlatform.parsed.kernel.name;
|
||||
GOHOSTARCH = goarch stdenv.buildPlatform;
|
||||
|
||||
# {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 isCross then
|
||||
"${targetCC}/bin/${targetCC.targetPrefix}cc"
|
||||
else
|
||||
null;
|
||||
CXX_FOR_TARGET =
|
||||
if isCross then
|
||||
"${targetCC}/bin/${targetCC.targetPrefix}c++"
|
||||
else
|
||||
null;
|
||||
|
||||
GOARM = toString (lib.intersectLists [ (stdenv.hostPlatform.parsed.cpu.version or "") ] [ "5" "6" "7" ]);
|
||||
GO386 = "softfloat"; # from Arch: don't assume sse2 on i686
|
||||
CGO_ENABLED = 1;
|
||||
|
||||
GOROOT_BOOTSTRAP = "${goBootstrap}/share/go";
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
export GOCACHE=$TMPDIR/go-cache
|
||||
# this is compiled into the binary
|
||||
export GOROOT_FINAL=$out/share/go
|
||||
|
||||
export PATH=$(pwd)/bin:$PATH
|
||||
|
||||
${lib.optionalString isCross ''
|
||||
# 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
|
||||
|
||||
pushd src
|
||||
./make.bash
|
||||
popd
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
preInstall = ''
|
||||
# Contains the wrong perl shebang when cross compiling,
|
||||
# since it is not used for anything we can deleted as well.
|
||||
rm src/regexp/syntax/make_perl_groups.pl
|
||||
'' + (if (stdenv.buildPlatform.system != stdenv.hostPlatform.system) then ''
|
||||
mv bin/*_*/* bin
|
||||
rmdir bin/*_*
|
||||
${lib.optionalString (!(finalAttrs.GOHOSTARCH == finalAttrs.GOARCH && finalAttrs.GOOS == finalAttrs.GOHOSTOS)) ''
|
||||
rm -rf pkg/${finalAttrs.GOHOSTOS}_${finalAttrs.GOHOSTARCH} pkg/tool/${finalAttrs.GOHOSTOS}_${finalAttrs.GOHOSTARCH}
|
||||
''}
|
||||
'' else lib.optionalString (stdenv.hostPlatform.system != stdenv.targetPlatform.system) ''
|
||||
rm -rf bin/*_*
|
||||
${lib.optionalString (!(finalAttrs.GOHOSTARCH == finalAttrs.GOARCH && finalAttrs.GOOS == finalAttrs.GOHOSTOS)) ''
|
||||
rm -rf pkg/${finalAttrs.GOOS}_${finalAttrs.GOARCH} pkg/tool/${finalAttrs.GOOS}_${finalAttrs.GOARCH}
|
||||
''}
|
||||
'');
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $GOROOT_FINAL
|
||||
cp -a bin pkg src lib misc api doc go.env $GOROOT_FINAL
|
||||
mkdir -p $out/bin
|
||||
ln -s $GOROOT_FINAL/bin/* $out/bin
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
disallowedReferences = [ goBootstrap ];
|
||||
|
||||
passthru = {
|
||||
inherit goBootstrap skopeoTest;
|
||||
tests = {
|
||||
skopeo = testers.testVersion { package = skopeoTest; };
|
||||
version = testers.testVersion {
|
||||
package = finalAttrs.finalPackage;
|
||||
command = "go version";
|
||||
version = "go${finalAttrs.version}";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
changelog = "https://go.dev/doc/devel/release#go${lib.versions.majorMinor finalAttrs.version}";
|
||||
description = "Go Programming language";
|
||||
homepage = "https://go.dev/";
|
||||
license = licenses.bsd3;
|
||||
maintainers = teams.golang.members;
|
||||
platforms = platforms.darwin ++ platforms.linux ++ platforms.freebsd;
|
||||
mainProgram = "go";
|
||||
};
|
||||
})
|
||||
@@ -1,23 +0,0 @@
|
||||
Starting from go1.14, go verifes that vendor/modules.txt matches the requirements
|
||||
and replacements listed in the main module go.mod file, and it is a hard failure if
|
||||
vendor/modules.txt is missing.
|
||||
|
||||
Relax module consistency checks and switch back to pre go1.14 behaviour if
|
||||
vendor/modules.txt is missing regardless of go version requirement in go.mod.
|
||||
|
||||
This has been ported from FreeBSD: https://reviews.freebsd.org/D24122
|
||||
See https://github.com/golang/go/issues/37948 for discussion.
|
||||
|
||||
diff --git a/src/cmd/go/internal/modload/vendor.go b/src/cmd/go/internal/modload/vendor.go
|
||||
index ffc79bb93f..2d0311975d 100644
|
||||
--- a/src/cmd/go/internal/modload/vendor.go
|
||||
+++ b/src/cmd/go/internal/modload/vendor.go
|
||||
@@ -144,7 +144,7 @@ func checkVendorConsistency(index *modFileIndex, modFile *modfile.File) {
|
||||
readVendorList(MainModules.mustGetSingleMainModule())
|
||||
|
||||
pre114 := false
|
||||
- if gover.Compare(index.goVersion, "1.14") < 0 {
|
||||
+ if gover.Compare(index.goVersion, "1.14") < 0 || (os.Getenv("GO_NO_VENDOR_CHECKS") == "1" && len(vendorMeta) == 0) {
|
||||
// Go versions before 1.14 did not include enough information in
|
||||
// vendor/modules.txt to check for consistency.
|
||||
// If we know that we're on an earlier version, relax the consistency check.
|
||||
@@ -1,102 +1,34 @@
|
||||
{ buildBazelPackage
|
||||
, bazel_5
|
||||
, fetchFromGitHub
|
||||
, git
|
||||
, go_1_21
|
||||
, python3
|
||||
, lib, stdenv
|
||||
{
|
||||
lib,
|
||||
fetchFromGitHub,
|
||||
buildGoModule,
|
||||
testers,
|
||||
bazel-watcher,
|
||||
}:
|
||||
|
||||
let
|
||||
patches = [
|
||||
./use-go-in-path.patch
|
||||
];
|
||||
|
||||
# Patch the protoc alias so that it always builds from source.
|
||||
rulesProto = fetchFromGitHub {
|
||||
owner = "bazelbuild";
|
||||
repo = "rules_proto";
|
||||
rev = "4.0.0";
|
||||
hash = "sha256-WVPZx14thneAC4PdiDhBibnPwlCKEF9c93CHR0t1Efo=";
|
||||
postFetch = ''
|
||||
sed -i 's|name = "protoc"|name = "_protoc_original"|' $out/proto/private/BUILD.release
|
||||
cat <<EOF >>$out/proto/private/BUILD.release
|
||||
alias(name = "protoc", actual = "@com_github_protocolbuffers_protobuf//:protoc", visibility = ["//visibility:public"])
|
||||
EOF
|
||||
'';
|
||||
};
|
||||
|
||||
in
|
||||
buildBazelPackage rec {
|
||||
buildGoModule rec {
|
||||
pname = "bazel-watcher";
|
||||
version = "0.25.2";
|
||||
version = "0.25.3";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "bazelbuild";
|
||||
repo = "bazel-watcher";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-lreGKA0DZiOd1bJq8NNQ+80cyDwiughoXCkKu1RaZmc=";
|
||||
hash = "sha256-5cRj04e5VVG4NSe4LOLkZIrerT4laLEDeXCqTiJj6MM=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ go_1_21 git python3 ];
|
||||
removeRulesCC = false;
|
||||
vendorHash = "sha256-0I/bvuyosN55oNSMuom4C8rVjxneUaqV19l9OMiwWhU=";
|
||||
|
||||
bazel = bazel_5;
|
||||
bazelFlags = [ "--override_repository=rules_proto=${rulesProto}" ];
|
||||
bazelBuildFlags = lib.optionals stdenv.cc.isClang [ "--cxxopt=-x" "--cxxopt=c++" "--host_cxxopt=-x" "--host_cxxopt=c++" ];
|
||||
bazelTargets = [ "//cmd/ibazel" ];
|
||||
CGO_ENABLED = "0";
|
||||
ldflags = [
|
||||
"-s"
|
||||
"-X main.Version=${version}"
|
||||
];
|
||||
|
||||
fetchConfigured = false; # we want to fetch all dependencies, regardless of the current system
|
||||
fetchAttrs = {
|
||||
inherit patches;
|
||||
subPackages = [ "cmd/ibazel" ];
|
||||
|
||||
preBuild = ''
|
||||
patchShebangs .
|
||||
|
||||
echo ${bazel_5.version} > .bazelversion
|
||||
'';
|
||||
|
||||
preInstall = ''
|
||||
# Remove the go_sdk (it's just a copy of the go derivation) and all
|
||||
# references to it from the marker files. Bazel does not need to download
|
||||
# this sdk because we have patched the WORKSPACE file to point to the one
|
||||
# currently present in PATH. Without removing the go_sdk from the marker
|
||||
# file, the hash of it will change anytime the Go derivation changes and
|
||||
# that would lead to impurities in the marker files which would result in
|
||||
# a different hash for the fetch phase.
|
||||
rm -rf $bazelOut/external/{go_sdk,\@go_sdk.marker}
|
||||
sed -e '/^FILE:@go_sdk.*/d' -i $bazelOut/external/\@*.marker
|
||||
|
||||
# Retains go build input markers
|
||||
chmod -R 755 $bazelOut/external/{bazel_gazelle_go_repository_cache,@\bazel_gazelle_go_repository_cache.marker}
|
||||
rm -rf $bazelOut/external/{bazel_gazelle_go_repository_cache,@\bazel_gazelle_go_repository_cache.marker}
|
||||
|
||||
# Remove the gazelle tools, they contain go binaries that are built
|
||||
# non-deterministically. As long as the gazelle version matches the tools
|
||||
# should be equivalent.
|
||||
rm -rf $bazelOut/external/{bazel_gazelle_go_repository_tools,\@bazel_gazelle_go_repository_tools.marker}
|
||||
sed -e '/^FILE:@bazel_gazelle_go_repository_tools.*/d' -i $bazelOut/external/\@*.marker
|
||||
|
||||
# remove com_google_protobuf because it had files with different permissions on linux and darwin
|
||||
rm -rf $bazelOut/external/com_google_protobuf
|
||||
'';
|
||||
|
||||
sha256 = "sha256-B2KVD/FmkAa7MNhLaH286gF3uA20qjN3CoA83KRB9E8=";
|
||||
};
|
||||
|
||||
buildAttrs = {
|
||||
inherit patches;
|
||||
|
||||
preBuild = ''
|
||||
patchShebangs .
|
||||
|
||||
substituteInPlace cmd/ibazel/BUILD.bazel --replace '{STABLE_GIT_VERSION}' ${version}
|
||||
echo ${bazel_5.version} > .bazelversion
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
install -Dm755 bazel-bin/cmd/ibazel/ibazel_/ibazel $out/bin/ibazel
|
||||
'';
|
||||
passthru = {
|
||||
tests.version = testers.testVersion { package = bazel-watcher; };
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
diff --git a/WORKSPACE b/WORKSPACE
|
||||
index 51273b6..fcf9ffb 100644
|
||||
--- a/WORKSPACE
|
||||
+++ b/WORKSPACE
|
||||
@@ -61,7 +61,7 @@ load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_depe
|
||||
|
||||
go_rules_dependencies()
|
||||
|
||||
-go_register_toolchains(version = "1.19.4")
|
||||
+go_register_toolchains(go_version = "host")
|
||||
|
||||
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{ buildGo121Module, fetchFromGitHub, lib }:
|
||||
{ buildGo122Module, fetchFromGitHub, lib }:
|
||||
|
||||
let
|
||||
generic = { subPackages, pname, postInstall ? "", mainProgram }:
|
||||
buildGo121Module rec {
|
||||
buildGo122Module rec {
|
||||
inherit pname;
|
||||
version = "6.11.0";
|
||||
shortRev = "9587df6"; # for internal version info
|
||||
|
||||
@@ -55,5 +55,8 @@ buildGoModule rec {
|
||||
homepage = "https://zincsearch-docs.zinc.dev/";
|
||||
license = licenses.asl20;
|
||||
maintainers = with maintainers; [ dit7ya ];
|
||||
# Doesn't build with Go version later v1.21 (which is EOL).
|
||||
# Upstream issue: https://github.com/zincsearch/zincsearch/issues/975
|
||||
broken = true;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, cmake
|
||||
, buildGo121Module
|
||||
, buildGoModule
|
||||
, makeWrapper
|
||||
, fetchFromGitHub
|
||||
, pythonPackages
|
||||
@@ -37,7 +37,7 @@ let
|
||||
cmakeFlags = ["-DBUILD_DEMO=OFF" "-DDISABLE_PYTHON2=ON"];
|
||||
};
|
||||
|
||||
in buildGo121Module rec {
|
||||
in buildGoModule rec {
|
||||
pname = "datadog-agent";
|
||||
inherit src version;
|
||||
|
||||
|
||||
@@ -14147,7 +14147,7 @@ with pkgs;
|
||||
zip = callPackage ../tools/archivers/zip { };
|
||||
|
||||
zincsearch = callPackage ../servers/search/zincsearch {
|
||||
buildGoModule = buildGo121Module;
|
||||
buildGoModule = buildGo122Module;
|
||||
};
|
||||
|
||||
zkfuse = callPackage ../tools/filesystems/zkfuse { };
|
||||
@@ -23972,17 +23972,6 @@ with pkgs;
|
||||
buildGoModule = buildGo122Module;
|
||||
buildGoPackage = buildGo122Package;
|
||||
|
||||
# requires a newer Apple SDK
|
||||
go_1_21 = darwin.apple_sdk_11_0.callPackage ../development/compilers/go/1.21.nix {
|
||||
inherit (darwin.apple_sdk_11_0.frameworks) Foundation Security;
|
||||
};
|
||||
buildGo121Module = darwin.apple_sdk_11_0.callPackage ../build-support/go/module.nix {
|
||||
go = buildPackages.go_1_21;
|
||||
};
|
||||
buildGo121Package = darwin.apple_sdk_11_0.callPackage ../build-support/go/package.nix {
|
||||
go = buildPackages.go_1_21;
|
||||
};
|
||||
|
||||
# requires a newer Apple SDK
|
||||
go_1_22 = darwin.apple_sdk_11_0.callPackage ../development/compilers/go/1.22.nix {
|
||||
inherit (darwin.apple_sdk_11_0.frameworks) Foundation Security;
|
||||
|
||||
Reference in New Issue
Block a user