summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilliam A. Kennington III <william@wkennington.com>2015-08-19 17:33:33 -0700
committerWilliam A. Kennington III <william@wkennington.com>2015-08-19 20:49:11 -0700
commitd730646832ccf228e019900c6185308e6b47a15d (patch)
tree4659ae37ea59d65e63cdef55c2040add8c1e2a83
parent15a7e0ab71ebb756e2a1211300550895ced52011 (diff)
downloadnixlib-d730646832ccf228e019900c6185308e6b47a15d.tar
nixlib-d730646832ccf228e019900c6185308e6b47a15d.tar.gz
nixlib-d730646832ccf228e019900c6185308e6b47a15d.tar.bz2
nixlib-d730646832ccf228e019900c6185308e6b47a15d.tar.lz
nixlib-d730646832ccf228e019900c6185308e6b47a15d.tar.xz
nixlib-d730646832ccf228e019900c6185308e6b47a15d.tar.zst
nixlib-d730646832ccf228e019900c6185308e6b47a15d.zip
go1.5: Fix pcre and port the remove-tools patch
-rw-r--r--pkgs/development/compilers/go/1.5.nix22
-rw-r--r--pkgs/development/compilers/go/remove-tools-1.5.patch60
2 files changed, 72 insertions, 10 deletions
diff --git a/pkgs/development/compilers/go/1.5.nix b/pkgs/development/compilers/go/1.5.nix
index a6084ae1289d..8abafe0d117c 100644
--- a/pkgs/development/compilers/go/1.5.nix
+++ b/pkgs/development/compilers/go/1.5.nix
@@ -1,11 +1,9 @@
-{ stdenv, lib, fetchurl, bison, glibc, bash, coreutils, makeWrapper, tzdata, iana_etc, perl
-, go_1_4, runCommand, which, patch
+{ stdenv, lib, fetchurl, tzdata, iana_etc, go_1_4, runCommand
+, perl, which, pkgconfig, patch
+, pcre
 , Security }:
 
 let
-  loader386 = "${glibc}/lib/ld-linux.so.2";
-  loaderAmd64 = "${glibc}/lib/ld-linux-x86-64.so.2";
-  loaderArm = "${glibc}/lib/ld-linux.so.3";
   goBootstrap = runCommand "go-bootstrap" {} ''
     mkdir $out
     cp -rf ${go_1_4}/* $out/
@@ -25,9 +23,8 @@ stdenv.mkDerivation rec {
   };
 
   # perl is used for testing go vet
-  buildInputs = [ bison bash makeWrapper perl which patch ]
-             ++ lib.optionals stdenv.isLinux [ glibc ];
-
+  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
@@ -59,9 +56,14 @@ stdenv.mkDerivation rec {
     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
+    # 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 ''
@@ -73,9 +75,9 @@ stdenv.mkDerivation rec {
     touch $TMPDIR/group $TMPDIR/hosts $TMPDIR/passwd
   '';
 
-  # TODO: port tools patch
   patches = [
     ./cacert-1.5.patch
+    ./remove-tools-1.5.patch
   ];
 
   GOOS = if stdenv.isDarwin then "darwin" else "linux";
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 000000000000..00f4fac7476a
--- /dev/null
+++ b/pkgs/development/compilers/go/remove-tools-1.5.patch
@@ -0,0 +1,60 @@
+diff --git a/src/cmd/go/pkg.go b/src/cmd/go/pkg.go
+index 61e3d8d..f8475f4 100644
+--- a/src/cmd/go/pkg.go
++++ b/src/cmd/go/pkg.go
+@@ -665,7 +665,7 @@ var goTools = map[string]targetDir{
+ 	"cmd/asm":                              toTool,
+ 	"cmd/compile":                          toTool,
+ 	"cmd/cgo":                              toTool,
+-	"cmd/cover":                            toTool,
++	"nixos.org/x/tools/cmd/cover":          toTool,
+ 	"cmd/dist":                             toTool,
+ 	"cmd/doc":                              toTool,
+ 	"cmd/fix":                              toTool,
+@@ -676,9 +676,9 @@ var goTools = map[string]targetDir{
+ 	"cmd/pack":                             toTool,
+ 	"cmd/pprof":                            toTool,
+ 	"cmd/trace":                            toTool,
+-	"cmd/vet":                              toTool,
++	"nixos.org/x/tools/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".