about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/build-support/fetchhg/default.nix8
-rw-r--r--pkgs/development/compilers/go/cgo-set-local-to-match-gcc-error-messages.patch13
-rw-r--r--pkgs/development/compilers/go/default.nix41
-rw-r--r--pkgs/development/compilers/go/disable-system-dependent-tests.patch30
-rw-r--r--pkgs/top-level/all-packages.nix2
5 files changed, 32 insertions, 62 deletions
diff --git a/pkgs/build-support/fetchhg/default.nix b/pkgs/build-support/fetchhg/default.nix
index a80835cc71fbb..a3a2ec4d561cb 100644
--- a/pkgs/build-support/fetchhg/default.nix
+++ b/pkgs/build-support/fetchhg/default.nix
@@ -1,17 +1,17 @@
-{stdenv, mercurial, nix}: {url, tag ? null, md5}:
+{stdenv, mercurial, nix}: {name ? null, url, tag ? null, md5 ? null, sha256 ? null}:
 
 # TODO: statically check if mercurial as the https support if the url starts woth https.
 stdenv.mkDerivation {
-  name = "fetchhg";
+  name = "fetchhg" + (if (name != null) then "-${name}" else "");
   builder = ./builder.sh;
   buildInputs = [mercurial nix];
 
   # Nix <= 0.7 compatibility.
   id = md5;
 
-  outputHashAlgo = "md5";
+  outputHashAlgo = if (md5 != null) then "md5" else "sha256";
   outputHashMode = "recursive";
-  outputHash = md5;
+  outputHash = if (md5 != null) then md5 else sha256;
   
   inherit url tag;
 }
diff --git a/pkgs/development/compilers/go/cgo-set-local-to-match-gcc-error-messages.patch b/pkgs/development/compilers/go/cgo-set-local-to-match-gcc-error-messages.patch
deleted file mode 100644
index c0da4541a67de..0000000000000
--- a/pkgs/development/compilers/go/cgo-set-local-to-match-gcc-error-messages.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff -r 21cae7efdcc6 src/cmd/cgo/main.go
---- a/src/cmd/cgo/main.go	Sat Nov 14 12:23:24 2009 -0800
-+++ b/src/cmd/cgo/main.go	Sun Nov 15 00:00:09 2009 +0100
-@@ -52,6 +52,9 @@
- 		fatal("unknown architecture %s", arch)
- 	}
- 
-+	// Define the language of gcc error messages.
-+	os.Setenv("LC_ALL", "C");
-+
- 	p := openProg(input);
- 	for _, cref := range p.Crefs {
- 		// Convert C.ulong to C.unsigned long, etc.
diff --git a/pkgs/development/compilers/go/default.nix b/pkgs/development/compilers/go/default.nix
index d5314a976a23f..7ea6632719379 100644
--- a/pkgs/development/compilers/go/default.nix
+++ b/pkgs/development/compilers/go/default.nix
@@ -1,37 +1,50 @@
-{stdenv, fetchhg, bison, glibc, ed, which, bash, makeWrapper, ...}:
+{stdenv, fetchhg, bison, glibc, ed, which, bash, makeWrapper, perl, ...}:
 
 let
-  version = "2009-11-12";
-  md5 = "66e5803c8dc2855b339151918b6b0de5";
+  version = "2010-06-09";
+  sha256 = "b607879b333ef100466c726a13cc69ed143566a3c1af59f6d33a6e90b9d0c917";
+
+  loader386 = "${glibc}/lib/ld-linux.so.2";
+  loaderAmd64 = "${glibc}/lib/ld-linux-x86-64.so.2";
 in
 
 stdenv.mkDerivation {
-  name = "Go-" + version;
+  name = "go-" + version;
 
   # No tarball yet.
   src = fetchhg {
     url = https://go.googlecode.com/hg/;
     tag = "release." + version;
-    inherit md5;
+    inherit sha256;
   };
 
   buildInputs = [ bison glibc ed which bash makeWrapper ];
 
-  patches = [
-    ./disable-system-dependent-tests.patch
-    ./cgo-set-local-to-match-gcc-error-messages.patch
-  ];
-
   prePatch = ''
     patchShebangs ./ # replace /bin/bash
     # only for 386 build
     # !!! substituteInPlace does not seems to be effective.
-    sed -i 's,/lib/ld-linux.so.2,${glibc}/lib/ld-linux.so.2,' src/cmd/8l/asm.c
+    sed -i 's,/lib/ld-linux.so.2,${loader386},' src/cmd/8l/asm.c
+    sed -i 's,/lib64/ld-linux-x86-64.so.2,${loaderAmd64},' src/cmd/6l/asm.c
     sed -i 's,/usr/share/zoneinfo/,${glibc}/share/zoneinfo/,' src/pkg/time/zoneinfo.go
+    sed -i 's,/bin/ed,${ed}/bin/ed,' src/cmd/6l/mkenam
+
+    sed -i -e 's,/bin/cat,${stdenv.coreutils}/bin/cat,' \
+      -e 's,/bin/echo,${stdenv.coreutils}/bin/echo,' \
+      src/pkg/exec/exec_test.go
+
+    # Disabling the 'os' test (it wants to call hostname, and I don't
+    # know if we have that ready in chroot builds)
+    sed -i -e '/^NOTEST=/a\\tos\\' src/pkg/Makefile
+
+    sed -i -e 's,/bin:/usr/bin:/usr/local/bin,'$PATH, test/run
+    sed -i -e 's,/usr/bin/perl,${perl}/bin/perl,' test/errchk
   '';
 
   GOOS = "linux";
-  GOARCH = "386";
+  GOARCH = if (stdenv.system == "i686-linux") then "386"
+          else if (stdenv.system == "x86_64-linux") then "amd64"
+          else throw "Unsupported system";
 
   installPhase = ''
     ensureDir "$out/bin"
@@ -64,13 +77,13 @@ stdenv.mkDerivation {
     # Copy the emacs configuration for Go files.
     ensureDir "$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; [ pierron ];
+    maintainers = with stdenv.lib.maintainers; [ pierron viric ];
+    platforms = stdenv.lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/compilers/go/disable-system-dependent-tests.patch b/pkgs/development/compilers/go/disable-system-dependent-tests.patch
deleted file mode 100644
index d9e7fa48c1fa1..0000000000000
--- a/pkgs/development/compilers/go/disable-system-dependent-tests.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-diff -r cb140bac9ab0 src/pkg/Makefile
---- a/src/pkg/Makefile	Thu Nov 12 14:55:26 2009 -0800
-+++ b/src/pkg/Makefile	Mon Nov 16 11:50:34 2009 +0100
-@@ -100,12 +100,15 @@
- 
- NOTEST=\
- 	debug/proc\
-+	exec\
- 	go/ast\
- 	go/doc\
- 	go/token\
- 	hash\
- 	image\
-+	log\
- 	malloc\
-+	os\
- 	rand\
- 	runtime\
- 	syscall\
-diff -r cb140bac9ab0 src/run.bash
---- a/src/run.bash	Thu Nov 12 14:55:26 2009 -0800
-+++ b/src/run.bash	Mon Nov 16 11:50:34 2009 +0100
-@@ -69,7 +69,3 @@
- ./timing.sh -test
- ) || exit $?
- 
--(xcd ../test
--./run
--) || exit $?
--
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index cceaca4dbd7d7..73533e2b75b78 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -2437,7 +2437,7 @@ let
   };
 
   go = import ../development/compilers/go {
-    inherit stdenv fetchhg glibc bison ed which bash makeWrapper;
+    inherit stdenv fetchhg glibc bison ed which bash makeWrapper perl;
   };
 
   gprolog = import ../development/compilers/gprolog {