summary refs log tree commit diff
path: root/pkgs/development/compilers/go/default.nix
diff options
context:
space:
mode:
authorLluis Batlle <viriketo@gmail.com>2012-08-26 23:15:02 +0200
committerLluis Batlle <viriketo@gmail.com>2012-08-26 23:16:29 +0200
commite5bf4de6b650a3a3a39a6a646391a223aec7da9f (patch)
treea9ab8be49078e7a33243d6b0431a96b57da1fa19 /pkgs/development/compilers/go/default.nix
parentba47bf725813e205ce1e28bf20cecdfdd425d48c (diff)
downloadnixpkgs-e5bf4de6b650a3a3a39a6a646391a223aec7da9f.tar
nixpkgs-e5bf4de6b650a3a3a39a6a646391a223aec7da9f.tar.gz
nixpkgs-e5bf4de6b650a3a3a39a6a646391a223aec7da9f.tar.bz2
nixpkgs-e5bf4de6b650a3a3a39a6a646391a223aec7da9f.tar.lz
nixpkgs-e5bf4de6b650a3a3a39a6a646391a223aec7da9f.tar.xz
nixpkgs-e5bf4de6b650a3a3a39a6a646391a223aec7da9f.tar.zst
nixpkgs-e5bf4de6b650a3a3a39a6a646391a223aec7da9f.zip
go: improving the expression so it works if overriden by hg src
Users might want to override the 'src' and 'name' of go from 'hg'.
I make the expression compatible with that.

Aside, I also set GOARM in the wrapper for it to build programs fine on
armv5tel by default.
Diffstat (limited to 'pkgs/development/compilers/go/default.nix')
-rw-r--r--pkgs/development/compilers/go/default.nix9
1 files changed, 8 insertions, 1 deletions
diff --git a/pkgs/development/compilers/go/default.nix b/pkgs/development/compilers/go/default.nix
index 0ced1da95d4..1d9765539bf 100644
--- a/pkgs/development/compilers/go/default.nix
+++ b/pkgs/development/compilers/go/default.nix
@@ -24,6 +24,12 @@ stdenv.mkDerivation {
   '';
 
   prePatch = ''
+    cd ..
+    if [ ! -d go ]; then
+      mv * go
+    fi
+    cd go
+
     patchShebangs ./ # replace /bin/bash
     # !!! substituteInPlace does not seems to be effective.
     sed -i 's,/lib/ld-linux.so.2,${loader386},' src/cmd/8l/asm.c
@@ -67,7 +73,8 @@ stdenv.mkDerivation {
     # libraries.
     for a in go gofmt godoc; do
 	    wrapProgram "$out/bin/$a" \
-	      --set "GOROOT" "$out/share/go/"
+	      --set "GOROOT" $out/share/go \
+        ${if (stdenv.system == "armv5tel-linux") then "--set GOARM $GOARM" else ""}
     done
 
     # Copy the emacs configuration for Go files.