Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

go_1_25: init at 1.25rc2

(cherry picked from commit 9bbcfea275cb154aa753ff794d12cb5214bb8484)

authored by zowoq and committed by Michael Daniels e3a37279 ffabe425

Changed files
+203
pkgs
development
top-level
+172
pkgs/development/compilers/go/1.25.nix
··· 1 + { 2 + lib, 3 + stdenv, 4 + fetchurl, 5 + apple-sdk_12, 6 + tzdata, 7 + replaceVars, 8 + iana-etc, 9 + mailcap, 10 + buildPackages, 11 + pkgsBuildTarget, 12 + targetPackages, 13 + testers, 14 + skopeo, 15 + buildGo125Module, 16 + }: 17 + 18 + let 19 + goBootstrap = buildPackages.callPackage ./bootstrap122.nix { }; 20 + 21 + skopeoTest = skopeo.override { buildGoModule = buildGo125Module; }; 22 + 23 + # We need a target compiler which is still runnable at build time, 24 + # to handle the cross-building case where build != host == target 25 + targetCC = pkgsBuildTarget.targetPackages.stdenv.cc; 26 + 27 + isCross = stdenv.buildPlatform != stdenv.targetPlatform; 28 + in 29 + stdenv.mkDerivation (finalAttrs: { 30 + pname = "go"; 31 + version = "1.25rc2"; 32 + 33 + src = fetchurl { 34 + url = "https://go.dev/dl/go${finalAttrs.version}.src.tar.gz"; 35 + hash = "sha256-5jFKMjTEwDuNAGvNHRRZTZKBcNGES23/3V+lojM0SeE="; 36 + }; 37 + 38 + strictDeps = true; 39 + buildInputs = 40 + [ ] 41 + ++ lib.optionals stdenv.hostPlatform.isLinux [ stdenv.cc.libc.out ] 42 + ++ lib.optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ]; 43 + 44 + depsTargetTargetPropagated = lib.optionals stdenv.targetPlatform.isDarwin [ 45 + apple-sdk_12 46 + ]; 47 + 48 + depsBuildTarget = lib.optional isCross targetCC; 49 + 50 + depsTargetTarget = lib.optional stdenv.targetPlatform.isWindows targetPackages.threads.package; 51 + 52 + postPatch = '' 53 + patchShebangs . 54 + ''; 55 + 56 + patches = [ 57 + (replaceVars ./iana-etc-1.25.patch { 58 + iana = iana-etc; 59 + }) 60 + # Patch the mimetype database location which is missing on NixOS. 61 + # but also allow static binaries built with NixOS to run outside nix 62 + (replaceVars ./mailcap-1.17.patch { 63 + inherit mailcap; 64 + }) 65 + # prepend the nix path to the zoneinfo files but also leave the original value for static binaries 66 + # that run outside a nix server 67 + (replaceVars ./tzdata-1.19.patch { 68 + inherit tzdata; 69 + }) 70 + ./remove-tools-1.11.patch 71 + ./go_no_vendor_checks-1.23.patch 72 + ]; 73 + 74 + inherit (stdenv.targetPlatform.go) GOOS GOARCH GOARM; 75 + # GOHOSTOS/GOHOSTARCH must match the building system, not the host system. 76 + # Go will nevertheless build a for host system that we will copy over in 77 + # the install phase. 78 + GOHOSTOS = stdenv.buildPlatform.go.GOOS; 79 + GOHOSTARCH = stdenv.buildPlatform.go.GOARCH; 80 + 81 + # {CC,CXX}_FOR_TARGET must be only set for cross compilation case as go expect those 82 + # to be different from CC/CXX 83 + CC_FOR_TARGET = if isCross then "${targetCC}/bin/${targetCC.targetPrefix}cc" else null; 84 + CXX_FOR_TARGET = if isCross then "${targetCC}/bin/${targetCC.targetPrefix}c++" else null; 85 + 86 + GO386 = "softfloat"; # from Arch: don't assume sse2 on i686 87 + # Wasi does not support CGO 88 + CGO_ENABLED = if stdenv.targetPlatform.isWasi then 0 else 1; 89 + 90 + GOROOT_BOOTSTRAP = "${goBootstrap}/share/go"; 91 + 92 + buildPhase = '' 93 + runHook preBuild 94 + export GOCACHE=$TMPDIR/go-cache 95 + 96 + export PATH=$(pwd)/bin:$PATH 97 + 98 + ${lib.optionalString isCross '' 99 + # Independent from host/target, CC should produce code for the building system. 100 + # We only set it when cross-compiling. 101 + export CC=${buildPackages.stdenv.cc}/bin/cc 102 + ''} 103 + ulimit -a 104 + 105 + pushd src 106 + ./make.bash 107 + popd 108 + runHook postBuild 109 + ''; 110 + 111 + preInstall = '' 112 + # Contains the wrong perl shebang when cross compiling, 113 + # since it is not used for anything we can deleted as well. 114 + rm src/regexp/syntax/make_perl_groups.pl 115 + '' 116 + + ( 117 + if (stdenv.buildPlatform.system != stdenv.hostPlatform.system) then 118 + '' 119 + mv bin/*_*/* bin 120 + rmdir bin/*_* 121 + ${lib.optionalString 122 + (!(finalAttrs.GOHOSTARCH == finalAttrs.GOARCH && finalAttrs.GOOS == finalAttrs.GOHOSTOS)) 123 + '' 124 + rm -rf pkg/${finalAttrs.GOHOSTOS}_${finalAttrs.GOHOSTARCH} pkg/tool/${finalAttrs.GOHOSTOS}_${finalAttrs.GOHOSTARCH} 125 + '' 126 + } 127 + '' 128 + else 129 + lib.optionalString (stdenv.hostPlatform.system != stdenv.targetPlatform.system) '' 130 + rm -rf bin/*_* 131 + ${lib.optionalString 132 + (!(finalAttrs.GOHOSTARCH == finalAttrs.GOARCH && finalAttrs.GOOS == finalAttrs.GOHOSTOS)) 133 + '' 134 + rm -rf pkg/${finalAttrs.GOOS}_${finalAttrs.GOARCH} pkg/tool/${finalAttrs.GOOS}_${finalAttrs.GOARCH} 135 + '' 136 + } 137 + '' 138 + ); 139 + 140 + installPhase = '' 141 + runHook preInstall 142 + mkdir -p $out/share/go 143 + cp -a bin pkg src lib misc api doc go.env VERSION $out/share/go 144 + mkdir -p $out/bin 145 + ln -s $out/share/go/bin/* $out/bin 146 + runHook postInstall 147 + ''; 148 + 149 + disallowedReferences = [ goBootstrap ]; 150 + 151 + passthru = { 152 + inherit goBootstrap skopeoTest; 153 + tests = { 154 + skopeo = testers.testVersion { package = skopeoTest; }; 155 + version = testers.testVersion { 156 + package = finalAttrs.finalPackage; 157 + command = "go version"; 158 + version = "go${finalAttrs.version}"; 159 + }; 160 + }; 161 + }; 162 + 163 + meta = with lib; { 164 + changelog = "https://go.dev/doc/devel/release#go${lib.versions.majorMinor finalAttrs.version}"; 165 + description = "Go Programming language"; 166 + homepage = "https://go.dev/"; 167 + license = licenses.bsd3; 168 + teams = [ teams.golang ]; 169 + platforms = platforms.darwin ++ platforms.linux ++ platforms.wasi ++ platforms.freebsd; 170 + mainProgram = "go"; 171 + }; 172 + })
+26
pkgs/development/compilers/go/iana-etc-1.25.patch
··· 1 + diff --git a/src/net/lookup_unix.go b/src/net/lookup_unix.go 2 + index 7416cb01f8..62722cab14 100644 3 + --- a/src/net/lookup_unix.go 4 + +++ b/src/net/lookup_unix.go 5 + @@ -15,7 +15,7 @@ import ( 6 + // readProtocolsOnce loads contents of /etc/protocols into protocols map 7 + // for quick access. 8 + var readProtocolsOnce = sync.OnceFunc(func() { 9 + - file, err := open("/etc/protocols") 10 + + file, err := open("@iana@/etc/protocols") 11 + if err != nil { 12 + return 13 + } 14 + diff --git a/src/net/port_unix.go b/src/net/port_unix.go 15 + index df73dbabb3..a5dcf2ca1c 100644 16 + --- a/src/net/port_unix.go 17 + +++ b/src/net/port_unix.go 18 + @@ -16,7 +16,7 @@ import ( 19 + var onceReadServices sync.Once 20 + 21 + func readServices() { 22 + - file, err := open("/etc/services") 23 + + file, err := open("@iana@/etc/services") 24 + if err != nil { 25 + return 26 + }
+5
pkgs/top-level/all-packages.nix
··· 10013 10013 go = buildPackages.go_1_24; 10014 10014 }; 10015 10015 10016 + go_1_25 = callPackage ../development/compilers/go/1.25.nix { }; 10017 + buildGo125Module = callPackage ../build-support/go/module.nix { 10018 + go = buildPackages.go_1_25; 10019 + }; 10020 + 10016 10021 ### DEVELOPMENT / HARE 10017 10022 10018 10023 hareHook = callPackage ../by-name/ha/hare/hook.nix { };