diff options
author | Vladimír Čunát <vcunat@gmail.com> | 2015-10-03 13:33:13 +0200 |
---|---|---|
committer | Vladimír Čunát <vcunat@gmail.com> | 2015-10-03 13:33:37 +0200 |
commit | 5227fb1dd53fcb5918b9342dff4868f4ad68427e (patch) | |
tree | d6cd521e3f67944031216a27f740f28f22b73b41 /pkgs/development/compilers/go | |
parent | d6dd3b8bd1eaeeb21dfdb5051cd4732c748ce5d7 (diff) | |
parent | 33373d939a19f465228ddede6d38ce9032b5916b (diff) | |
download | nixpkgs-5227fb1dd53fcb5918b9342dff4868f4ad68427e.tar nixpkgs-5227fb1dd53fcb5918b9342dff4868f4ad68427e.tar.gz nixpkgs-5227fb1dd53fcb5918b9342dff4868f4ad68427e.tar.bz2 nixpkgs-5227fb1dd53fcb5918b9342dff4868f4ad68427e.tar.lz nixpkgs-5227fb1dd53fcb5918b9342dff4868f4ad68427e.tar.xz nixpkgs-5227fb1dd53fcb5918b9342dff4868f4ad68427e.tar.zst nixpkgs-5227fb1dd53fcb5918b9342dff4868f4ad68427e.zip |
Merge commit staging+systemd into closure-size
Many non-conflict problems weren't (fully) resolved in this commit yet.
Diffstat (limited to 'pkgs/development/compilers/go')
-rw-r--r-- | pkgs/development/compilers/go/1.1-darwin.nix | 79 | ||||
-rw-r--r-- | pkgs/development/compilers/go/1.4.nix | 87 | ||||
-rw-r--r-- | pkgs/development/compilers/go/1.5.nix | 124 | ||||
-rw-r--r-- | pkgs/development/compilers/go/1_0-gcc-bug.patch | 19 | ||||
-rw-r--r-- | pkgs/development/compilers/go/1_0-opt-error.patch | 12 | ||||
-rw-r--r-- | pkgs/development/compilers/go/cacert-1.2.patch | 15 | ||||
-rw-r--r-- | pkgs/development/compilers/go/cacert-1.5.patch | 8 | ||||
-rw-r--r-- | pkgs/development/compilers/go/cacert.patch | 15 | ||||
-rw-r--r-- | pkgs/development/compilers/go/gox.nix | 28 | ||||
-rw-r--r-- | pkgs/development/compilers/go/remove-tools-1.4.patch | 81 | ||||
-rw-r--r-- | pkgs/development/compilers/go/remove-tools-1.5.patch | 48 |
11 files changed, 306 insertions, 210 deletions
diff --git a/pkgs/development/compilers/go/1.1-darwin.nix b/pkgs/development/compilers/go/1.1-darwin.nix deleted file mode 100644 index 5b17f56ac37..00000000000 --- a/pkgs/development/compilers/go/1.1-darwin.nix +++ /dev/null @@ -1,79 +0,0 @@ -{ stdenv, fetchurl, bison, bash, makeWrapper }: - -stdenv.mkDerivation { - name = "go-1.1.2"; - - src = fetchurl { - url = http://go.googlecode.com/files/go1.1.2.src.tar.gz; - sha256 = "0w7bchhb4b053az3wjp6z342rs9lp9nxf4w2mnfd1b89d6sb7izz"; - }; - - buildInputs = [ bison bash makeWrapper ]; - - preUnpack = '' - mkdir -p $out/share - cd $out/share - ''; - - prePatch = '' - cd .. - if [ ! -d go ]; then - mv * go - fi - cd go - - patchShebangs ./ # replace /bin/bash - rm src/pkg/net/{multicast_test.go,parse_test.go,port_test.go} - # The os test wants to read files in an existing path. Just it don't be /usr/bin. - sed -i 's,/usr/bin,'"`pwd`", src/pkg/os/os_test.go - sed -i 's,/bin/pwd,'"`type -P pwd`", src/pkg/os/os_test.go - # Disable some tests - sed -i '/TestHostname/areturn' src/pkg/os/os_test.go - sed -i '/TestShutdownUnix/areturn' src/pkg/net/net_test.go - - ''; - - # Unfortunately we have to use Mac OS X's own GCC - preBuild = '' - export PATH=/usr/bin:$PATH - ''; - - #patches = [ ./cacert.patch ]; - - GOOS = "darwin"; - GOARCH = if stdenv.system == "x86_64-darwin" then "amd64" else "386"; - - installPhase = '' - mkdir -p "$out/bin" - - # CGO is broken on Maverick. See: http://code.google.com/p/go/issues/detail?id=5926 - # Reevaluate once go 1.1.3 is out - export CGO_ENABLED=0 - - export GOROOT="$(pwd)/" - export GOBIN="$out/bin" - export PATH="$GOBIN:$PATH" - cd ./src - ./all.bash - cd - - - # Wrap the tools to define the location of the - # libraries. - for a in go gofmt godoc; do - wrapProgram "$out/bin/$a" \ - --set "GOROOT" $out/share/go - done - - # Copy the emacs configuration for Go files. - mkdir -p "$out/share/emacs/site-lisp" - cp ./misc/emacs/* $out/share/emacs/site-lisp/ - ''; - - meta = { - homepage = http://golang.org/; - description = "The Go Programming language"; - license = "BSD"; - maintainers = with stdenv.lib.maintainers; [ zef ]; - platforms = stdenv.lib.platforms.darwin; - }; -} diff --git a/pkgs/development/compilers/go/1.4.nix b/pkgs/development/compilers/go/1.4.nix index ccf76dc7554..ad995042864 100644 --- a/pkgs/development/compilers/go/1.4.nix +++ b/pkgs/development/compilers/go/1.4.nix @@ -1,31 +1,24 @@ -{ stdenv, lib, fetchurl, fetchgit, bison, glibc, bash, coreutils, makeWrapper, tzdata, iana_etc, perl, Security }: +{ stdenv, lib, fetchurl, tzdata, iana_etc, libcCross +, pkgconfig +, pcre +, Security }: let - loader386 = "${glibc.out}/lib/ld-linux.so.2"; - loaderAmd64 = "${glibc.out}/lib/ld-linux-x86-64.so.2"; - loaderArm = "${glibc.out}/lib/ld-linux.so.3"; - srcs = { - golang = fetchurl { - url = https://github.com/golang/go/archive/go1.4.2.tar.gz; - sha256 = "3e5d07bc5214a1ffe187cf6406c5b5a80ee44f12f6bca97a5463db0afee2f6ac"; - }; - tools = fetchgit { - url = https://github.com/golang/tools.git; - rev = "c836fe615a448dbf9ff5448c1aa657479a0d0aeb"; - sha256 = "0q9jnhmgmm3xzjss7ndsi6nyykmmb1y984n98118c2sipi183xp5"; - }; - }; + libc = if stdenv ? "cross" then libcCross else stdenv.cc.libc; in -stdenv.mkDerivation { - name = "go-1.4.2"; +stdenv.mkDerivation rec { + name = "go-${version}"; + version = "1.4.2"; - src = srcs.golang; + src = fetchurl { + url = "https://github.com/golang/go/archive/go${version}.tar.gz"; + sha256 = "3e5d07bc5214a1ffe187cf6406c5b5a80ee44f12f6bca97a5463db0afee2f6ac"; + }; - # perl is used for testing go vet - buildInputs = [ bison bash makeWrapper perl ] - ++ lib.optionals stdenv.isLinux [ glibc ] - ++ lib.optionals stdenv.isDarwin [ Security ]; + nativeBuildInputs = [ pkgconfig ]; + buildInputs = [ pcre ]; + propagatedBuildInputs = lib.optional stdenv.isDarwin Security; # I'm not sure what go wants from its 'src', but the go installation manual # describes an installation keeping the src. @@ -41,9 +34,6 @@ stdenv.mkDerivation { mv * go fi - mkdir -p $out/share/go/src/golang.org/x - cp -r --no-preserve=mode,ownership ${srcs.tools} $out/share/go/src/golang.org/x/tools - cd go patchShebangs ./ # replace /bin/bash @@ -58,23 +48,43 @@ stdenv.mkDerivation { sed -i '/TestShutdownUnix/areturn' src/net/net_test.go # Disable the hostname test sed -i '/TestHostname/areturn' src/os/os_test.go - sed -i 's,/etc/protocols,${iana_etc}/etc/protocols,' src/net/lookup_unix.go # ParseInLocation fails the test sed -i '/TestParseInSydney/areturn' src/time/format_test.go + + sed -i 's,/etc/protocols,${iana_etc}/etc/protocols,' src/net/lookup_unix.go '' + lib.optionalString stdenv.isLinux '' sed -i 's,/usr/share/zoneinfo/,${tzdata}/share/zoneinfo/,' src/time/zoneinfo_unix.go - sed -i 's,/lib/ld-linux.so.3,${loaderArm},' src/cmd/5l/asm.c - sed -i 's,/lib64/ld-linux-x86-64.so.2,${loaderAmd64},' src/cmd/6l/asm.c - sed -i 's,/lib/ld-linux.so.2,${loader386},' src/cmd/8l/asm.c + + # Find the loader dynamically + LOADER="$(find ${libc.out or libc}/lib -name ld-linux\* | head -n 1)" + + # Replace references to the loader + find src/cmd -name asm.c -exec sed -i "s,/lib/ld-linux.*\.so\.[0-9],$LOADER," {} \; + '' + lib.optionalString stdenv.isDarwin '' + sed -i 's,"/etc","'"$TMPDIR"'",' src/os/os_test.go + sed -i 's,/_go_os_test,'"$TMPDIR"'/_go_os_test,' src/os/path_test.go + sed -i '/TestRead0/areturn' src/os/os_test.go + sed -i '/TestSystemRoots/areturn' src/crypto/x509/root_darwin_test.go + sed -i '/TestDialDualStackLocalhost/areturn' src/net/dial_test.go + + # remove IP resolving tests, on darwin they can find fe80::1%lo while expecting ::1 + sed -i '/TestResolveIPAddr/areturn' src/net/ipraw_test.go + sed -i '/TestResolveTCPAddr/areturn' src/net/tcp_test.go + sed -i '/TestResolveUDPAddr/areturn' src/net/udp_test.go + + touch $TMPDIR/group $TMPDIR/hosts $TMPDIR/passwd ''; - patches = [ ./cacert-1.4.patch ]; + patches = [ + ./cacert-1.4.patch + ./remove-tools-1.4.patch + ]; GOOS = if stdenv.isDarwin then "darwin" else "linux"; GOARCH = if stdenv.isDarwin then "amd64" else if stdenv.system == "i686-linux" then "386" else if stdenv.system == "x86_64-linux" then "amd64" - else if stdenv.system == "armv5tel-linux" then "arm" + else if stdenv.isArm then "arm" else throw "Unsupported system"; GOARM = stdenv.lib.optionalString (stdenv.system == "armv5tel-linux") "5"; GO386 = 387; # from Arch: don't assume sse2 on i686 @@ -91,23 +101,16 @@ stdenv.mkDerivation { export PATH="$GOBIN:$PATH" cd ./src ./all.bash - cd - - - # Build extra tooling - # TODO: Fix godoc tests - TOOL_ROOT=golang.org/x/tools/cmd - go install -v $TOOL_ROOT/cover $TOOL_ROOT/vet $TOOL_ROOT/godoc - go test -v $TOOL_ROOT/cover $TOOL_ROOT/vet # $TOOL_ROOT/godoc ''; setupHook = ./setup-hook.sh; - meta = { + meta = with stdenv.lib; { branch = "1.4"; homepage = http://golang.org/; description = "The Go Programming language"; - license = "BSD"; - maintainers = with stdenv.lib.maintainers; [ cstrahan ]; - platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin; + license = licenses.bsd3; + maintainers = with maintainers; [ cstrahan wkennington ]; + platforms = platforms.linux ++ platforms.darwin; }; } diff --git a/pkgs/development/compilers/go/1.5.nix b/pkgs/development/compilers/go/1.5.nix new file mode 100644 index 00000000000..3858d2566f4 --- /dev/null +++ b/pkgs/development/compilers/go/1.5.nix @@ -0,0 +1,124 @@ +{ stdenv, lib, fetchurl, tzdata, iana_etc, go_1_4, runCommand +, perl, which, pkgconfig, patch +, pcre +, Security }: + +let + goBootstrap = runCommand "go-bootstrap" {} '' + mkdir $out + cp -rf ${go_1_4}/* $out/ + chmod -R u+w $out + find $out -name "*.c" -delete + cp -rf $out/bin/* $out/share/go/bin/ + ''; +in + +stdenv.mkDerivation rec { + name = "go-${version}"; + version = "1.5.1"; + + src = fetchurl { + url = "https://github.com/golang/go/archive/go${version}.tar.gz"; + sha256 = "1xd1nd1li7pdl72vq8zkh6m7ms3ajgyqz9a5d61gagm0cgj8zilz"; + }; + + # perl is used for testing go vet + nativeBuildInputs = [ perl which pkgconfig patch ]; + buildInputs = [ pcre ]; + propagatedBuildInputs = lib.optional stdenv.isDarwin Security; + + # I'm not sure what go wants from its 'src', but the go installation manual + # describes an installation keeping the src. + preUnpack = '' + mkdir -p $out/share + cd $out/share + ''; + + prePatch = '' + # Ensure that the source directory is named go + cd .. + if [ ! -d go ]; then + mv * go + fi + + cd go + patchShebangs ./ # replace /bin/bash + + # Disabling the 'os/http/net' tests (they want files not available in + # chroot builds) + rm src/net/{listen_test.go,parse_test.go,port_test.go} + rm src/syscall/exec_linux_test.go + # !!! substituteInPlace does not seems to be effective. + # The os test wants to read files in an existing path. Just don't let it be /usr/bin. + sed -i 's,/usr/bin,'"`pwd`", src/os/os_test.go + sed -i 's,/bin/pwd,'"`type -P pwd`", src/os/os_test.go + # Disable the unix socket test + sed -i '/TestShutdownUnix/areturn' src/net/net_test.go + # Disable the hostname test + sed -i '/TestHostname/areturn' src/os/os_test.go + # ParseInLocation fails the test + sed -i '/TestParseInSydney/areturn' src/time/format_test.go + # Remove the api check as it never worked + sed -i '/src\/cmd\/api\/run.go/ireturn nil' src/cmd/dist/test.go + # Remove the coverage test as we have removed this utility + sed -i '/TestCoverageWithCgo/areturn' src/cmd/go/go_test.go + + sed -i 's,/etc/protocols,${iana_etc}/etc/protocols,' src/net/lookup_unix.go + '' + lib.optionalString stdenv.isLinux '' + sed -i 's,/usr/share/zoneinfo/,${tzdata}/share/zoneinfo/,' src/time/zoneinfo_unix.go + '' + lib.optionalString stdenv.isDarwin '' + sed -i 's,"/etc","'"$TMPDIR"'",' src/os/os_test.go + sed -i 's,/_go_os_test,'"$TMPDIR"'/_go_os_test,' src/os/path_test.go + sed -i '/TestRead0/areturn' src/os/os_test.go + sed -i '/TestSystemRoots/areturn' src/crypto/x509/root_darwin_test.go + + touch $TMPDIR/group $TMPDIR/hosts $TMPDIR/passwd + ''; + + patches = [ + ./cacert-1.5.patch + ./remove-tools-1.5.patch + ]; + + GOOS = if stdenv.isDarwin then "darwin" else "linux"; + GOARCH = if stdenv.isDarwin then "amd64" + else if stdenv.system == "i686-linux" then "386" + else if stdenv.system == "x86_64-linux" then "amd64" + else if stdenv.isArm then "arm" + else throw "Unsupported system"; + GOARM = stdenv.lib.optionalString (stdenv.system == "armv5tel-linux") "5"; + GO386 = 387; # from Arch: don't assume sse2 on i686 + CGO_ENABLED = 1; + GOROOT_BOOTSTRAP = "${goBootstrap}/share/go"; + + # The go build actually checks for CC=*/clang and does something different, so we don't + # just want the generic `cc` here. + CC = if stdenv.isDarwin then "clang" else "cc"; + + installPhase = '' + mkdir -p "$out/bin" + export GOROOT="$(pwd)/" + export GOBIN="$out/bin" + export PATH="$GOBIN:$PATH" + cd ./src + echo Building + ./all.bash + ''; + + preFixup = '' + rm -r $out/share/go/pkg/bootstrap + ''; + + setupHook = ./setup-hook.sh; + + disallowedReferences = [ go_1_4 ]; + + meta = with stdenv.lib; { + branch = "1.5"; + homepage = http://golang.org/; + description = "The Go Programming language"; + license = licenses.bsd3; + maintainers = with maintainers; [ cstrahan wkennington ]; + platforms = platforms.linux ++ platforms.darwin; + }; +} diff --git a/pkgs/development/compilers/go/1_0-gcc-bug.patch b/pkgs/development/compilers/go/1_0-gcc-bug.patch deleted file mode 100644 index 34cf7ab7456..00000000000 --- a/pkgs/development/compilers/go/1_0-gcc-bug.patch +++ /dev/null @@ -1,19 +0,0 @@ -http://code.google.com/p/go/source/detail?r=8b13b2ec6b18 ---- a/src/cmd/cgo/gcc.go 2014-07-02 12:00:12.171796197 +0200 -+++ b/src/cmd/cgo/gcc.go 2014-07-02 12:01:57.844472754 +0200 -@@ -840,6 +840,15 @@ - func (p *Package) gccErrors(stdin []byte) string { - // TODO(rsc): require failure - args := p.gccCmd() -+ -+ // GCC 4.8.0 has a bug: it sometimes does not apply -+ // -Wunused-value to values that are macros defined in system -+ // headers. See issue 5118. Adding -Wsystem-headers avoids -+ // that problem. This will produce additional errors, but it -+ // doesn't matter because we will ignore all errors that are -+ // not marked for the cgo-test file. -+ args = append(args, "-Wsystem-headers") -+ - if *debugGcc { - fmt.Fprintf(os.Stderr, "$ %s <<EOF\n", strings.Join(args, " ")) - os.Stderr.Write(stdin) diff --git a/pkgs/development/compilers/go/1_0-opt-error.patch b/pkgs/development/compilers/go/1_0-opt-error.patch deleted file mode 100644 index d3fcd40449a..00000000000 --- a/pkgs/development/compilers/go/1_0-opt-error.patch +++ /dev/null @@ -1,12 +0,0 @@ -https://code.google.com/p/go-wiki/wiki/OlderVersions ---- a/src/cmd/cc/funct.c 2014-07-02 11:54:42.230663598 +0200 -+++ b/src/cmd/cc/funct.c 2014-07-02 11:55:01.653790128 +0200 -@@ -269,7 +269,7 @@ - goto bad; - - f = alloc(sizeof(*f)); -- for(o=0; o<sizeof(f->sym); o++) -+ for(o=0; o<nelem(f->sym); o++) - f->sym[o] = S; - - t->funct = f; diff --git a/pkgs/development/compilers/go/cacert-1.2.patch b/pkgs/development/compilers/go/cacert-1.2.patch deleted file mode 100644 index 1ad6910915f..00000000000 --- a/pkgs/development/compilers/go/cacert-1.2.patch +++ /dev/null @@ -1,15 +0,0 @@ -Go comes with hardcoded cacert. We add the usual in NixOS, -for easier NixOS life. - -diff --git a/src/pkg/crypto/x509/root_unix.go b/src/pkg/crypto/x509/root_unix.go -index 76e79f4..6ef1dd3 100644 ---- a/src/pkg/crypto/x509/root_unix.go -+++ b/src/pkg/crypto/x509/root_unix.go -@@ -15,6 +15,7 @@ var certFiles = []string{ - "/etc/ssl/ca-bundle.pem", // OpenSUSE - "/etc/ssl/cert.pem", // OpenBSD - "/usr/local/share/certs/ca-root-nss.crt", // FreeBSD/DragonFly -+ "/etc/ssl/certs/ca-bundle.crt", // NixOS - } - - func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) { diff --git a/pkgs/development/compilers/go/cacert-1.5.patch b/pkgs/development/compilers/go/cacert-1.5.patch new file mode 100644 index 00000000000..32c322a104e --- /dev/null +++ b/pkgs/development/compilers/go/cacert-1.5.patch @@ -0,0 +1,8 @@ +--- a/src/crypto/x509/root_linux.go 2015-08-19 23:06:11.115133174 +0200 ++++ b/src/crypto/x509/root_linux.go 2015-08-19 23:07:04.238507161 +0200 +@@ -10,4 +10,5 @@ + "/etc/pki/tls/certs/ca-bundle.crt", // Fedora/RHEL + "/etc/ssl/ca-bundle.pem", // OpenSUSE + "/etc/pki/tls/cacert.pem", // OpenELEC ++ "/etc/ssl/certs/ca-bundle.crt", // NixOS + } diff --git a/pkgs/development/compilers/go/cacert.patch b/pkgs/development/compilers/go/cacert.patch deleted file mode 100644 index 42a44313835..00000000000 --- a/pkgs/development/compilers/go/cacert.patch +++ /dev/null @@ -1,15 +0,0 @@ -Go comes with hardcoded cacert. We add the usual in NixOS, -for easier NixOS life. - -diff --git a/src/pkg/crypto/x509/root_unix.go b/src/pkg/crypto/x509/root_unix.go -index 76e79f4..6ef1dd3 100644 ---- a/src/pkg/crypto/x509/root_unix.go -+++ b/src/pkg/crypto/x509/root_unix.go -@@ -15,6 +15,7 @@ var certFiles = []string{ - "/etc/ssl/ca-bundle.pem", // OpenSUSE - "/etc/ssl/cert.pem", // OpenBSD - "/usr/local/share/certs/ca-root-nss.crt", // FreeBSD -+ "/etc/ssl/certs/ca-bundle.crt", // NixOS - } - - func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) { diff --git a/pkgs/development/compilers/go/gox.nix b/pkgs/development/compilers/go/gox.nix deleted file mode 100644 index 1833ca37d0e..00000000000 --- a/pkgs/development/compilers/go/gox.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ lib, goPackages, fetchFromGitHub }: - -with goPackages; - -buildGoPackage rec { - rev = "c7329055e2aeb253a947e5cc876586ff4ca19199"; - name = "gox-${lib.strings.substring 0 7 rev}"; - goPackagePath = "github.com/mitchellh/gox"; - src = fetchFromGitHub { - inherit rev; - owner = "mitchellh"; - repo = "gox"; - sha256 = "0zhb88jjxqn3sdc4bpzvajqvgi9igp5gk03q12gaksaxhy2wl4jy"; - }; - - buildInputs = [ iochan ]; - - propagatedBuildInputs = [ go ]; - - dontInstallSrc = true; - - meta = with lib; { - description = "A simple, no-frills tool for Go cross compilation that behaves a lot like standard go build"; - homepage = https://github.com/mitchellh/gox; - maintainers = with maintainers; [ cstrahan ]; - platforms = platforms.unix; - }; -} diff --git a/pkgs/development/compilers/go/remove-tools-1.4.patch b/pkgs/development/compilers/go/remove-tools-1.4.patch new file mode 100644 index 00000000000..807ab8e089c --- /dev/null +++ b/pkgs/development/compilers/go/remove-tools-1.4.patch @@ -0,0 +1,81 @@ +diff --git a/misc/makerelease/makerelease.go b/misc/makerelease/makerelease.go +index 3b511b1..a46ebd8 100644 +--- a/misc/makerelease/makerelease.go ++++ b/misc/makerelease/makerelease.go +@@ -65,9 +65,6 @@ const ( + // These must be the command that cmd/go knows to install to $GOROOT/bin + // or $GOROOT/pkg/tool. + var toolPaths = []string{ +- "golang.org/x/tools/cmd/cover", +- "golang.org/x/tools/cmd/godoc", +- "golang.org/x/tools/cmd/vet", + } + + var preBuildCleanFiles = []string{ +diff --git a/src/cmd/dist/build.c b/src/cmd/dist/build.c +index b6c61b4..2006bc2 100644 +--- a/src/cmd/dist/build.c ++++ b/src/cmd/dist/build.c +@@ -210,7 +210,9 @@ init(void) + workdir = xworkdir(); + xatexit(rmworkdir); + +- bpathf(&b, "%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch); ++ xgetenv(&b, "GOTOOLDIR"); ++ if (b.len == 0) ++ bpathf(&b, "%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch); + tooldir = btake(&b); + + bfree(&b); +diff --git a/src/cmd/go/pkg.go b/src/cmd/go/pkg.go +index b71feb7..8468ea8 100644 +--- a/src/cmd/go/pkg.go ++++ b/src/cmd/go/pkg.go +@@ -401,9 +401,9 @@ var goTools = map[string]targetDir{ + "cmd/pack": toTool, + "cmd/pprof": toTool, + "cmd/yacc": toTool, +- "golang.org/x/tools/cmd/cover": toTool, +- "golang.org/x/tools/cmd/godoc": toBin, +- "golang.org/x/tools/cmd/vet": toTool, ++ "nixos.org/x/tools/cmd/cover": toTool, ++ "nixos.org/x/tools/cmd/godoc": toBin, ++ "nixos.org/x/tools/cmd/vet": toTool, + "code.google.com/p/go.tools/cmd/cover": stalePath, + "code.google.com/p/go.tools/cmd/godoc": stalePath, + "code.google.com/p/go.tools/cmd/vet": stalePath, +diff --git a/src/go/build/build.go b/src/go/build/build.go +index 311ecb0..f151d8f 100644 +--- a/src/go/build/build.go ++++ b/src/go/build/build.go +@@ -1367,7 +1367,7 @@ func init() { + } + + // ToolDir is the directory containing build tools. +-var ToolDir = filepath.Join(runtime.GOROOT(), "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH) ++var ToolDir = runtime.GOTOOLDIR() + + // IsLocalImport reports whether the import path is + // a local import path, like ".", "..", "./foo", or "../foo". +diff --git a/src/runtime/extern.go b/src/runtime/extern.go +index 6cc5df8..9a9a964 100644 +--- a/src/runtime/extern.go ++++ b/src/runtime/extern.go +@@ -152,6 +152,17 @@ func GOROOT() string { + return defaultGoroot + } + ++// GOTOOLDIR returns the root of the Go tree. ++// It uses the GOTOOLDIR environment variable, if set, ++// or else the root used during the Go build. ++func GOTOOLDIR() string { ++ s := gogetenv("GOTOOLDIR") ++ if s != "" { ++ return s ++ } ++ return GOROOT() + "/pkg/tool/" + GOOS + "_" + GOARCH ++} ++ + // Version returns the Go tree's version string. + // It is either the commit hash and date at the time of the build or, + // when possible, a release tag like "go1.3". diff --git a/pkgs/development/compilers/go/remove-tools-1.5.patch b/pkgs/development/compilers/go/remove-tools-1.5.patch new file mode 100644 index 00000000000..5aad4b4abc3 --- /dev/null +++ b/pkgs/development/compilers/go/remove-tools-1.5.patch @@ -0,0 +1,48 @@ +diff --git a/src/cmd/go/pkg.go b/src/cmd/go/pkg.go +index 61e3d8d..b8422ad 100644 +--- a/src/cmd/go/pkg.go ++++ b/src/cmd/go/pkg.go +@@ -678,7 +678,7 @@ var goTools = map[string]targetDir{ + "cmd/trace": toTool, + "cmd/vet": toTool, + "cmd/yacc": toTool, +- "golang.org/x/tools/cmd/godoc": toBin, ++ "nixos.org/x/tools/cmd/godoc": toBin, + "code.google.com/p/go.tools/cmd/cover": stalePath, + "code.google.com/p/go.tools/cmd/godoc": stalePath, + "code.google.com/p/go.tools/cmd/vet": stalePath, +diff --git a/src/go/build/build.go b/src/go/build/build.go +index 496fe11..8c81dbd 100644 +--- a/src/go/build/build.go ++++ b/src/go/build/build.go +@@ -1388,7 +1388,7 @@ func init() { + } + + // ToolDir is the directory containing build tools. +-var ToolDir = filepath.Join(runtime.GOROOT(), "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH) ++var ToolDir = runtime.GOTOOLDIR() + + // IsLocalImport reports whether the import path is + // a local import path, like ".", "..", "./foo", or "../foo". +diff --git a/src/runtime/extern.go b/src/runtime/extern.go +index d346362..fb22b6e 100644 +--- a/src/runtime/extern.go ++++ b/src/runtime/extern.go +@@ -194,6 +194,17 @@ func GOROOT() string { + return defaultGoroot + } + ++// GOTOOLDIR returns the root of the Go tree. ++// It uses the GOTOOLDIR environment variable, if set, ++// or else the root used during the Go build. ++func GOTOOLDIR() string { ++ s := gogetenv("GOTOOLDIR") ++ if s != "" { ++ return s ++ } ++ return GOROOT() + "/pkg/tool/" + GOOS + "_" + GOARCH ++} ++ + // Version returns the Go tree's version string. + // It is either the commit hash and date at the time of the build or, + // when possible, a release tag like "go1.3". |