about summary refs log tree commit diff
path: root/pkgs/development/compilers
diff options
context:
space:
mode:
authorZef Hemel <zef@zef.me>2013-09-10 14:47:43 +0200
committerVladimír Čunát <vcunat@gmail.com>2013-09-14 15:13:26 +0200
commit8d001c1a08f2f4d39a7dff13183efed5a589c504 (patch)
tree3787129b33cc85bdd6f265b88307cec592403c49 /pkgs/development/compilers
parent44d37c8526d517541202106c7df6006d184f11e8 (diff)
downloadnixlib-8d001c1a08f2f4d39a7dff13183efed5a589c504.tar
nixlib-8d001c1a08f2f4d39a7dff13183efed5a589c504.tar.gz
nixlib-8d001c1a08f2f4d39a7dff13183efed5a589c504.tar.bz2
nixlib-8d001c1a08f2f4d39a7dff13183efed5a589c504.tar.lz
nixlib-8d001c1a08f2f4d39a7dff13183efed5a589c504.tar.xz
nixlib-8d001c1a08f2f4d39a7dff13183efed5a589c504.tar.zst
nixlib-8d001c1a08f2f4d39a7dff13183efed5a589c504.zip
Darwin support for Go 1.1 (close #952)
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r--pkgs/development/compilers/go/1.1-darwin.nix74
1 files changed, 74 insertions, 0 deletions
diff --git a/pkgs/development/compilers/go/1.1-darwin.nix b/pkgs/development/compilers/go/1.1-darwin.nix
new file mode 100644
index 000000000000..2cbb8d49611f
--- /dev/null
+++ b/pkgs/development/compilers/go/1.1-darwin.nix
@@ -0,0 +1,74 @@
+{ 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"
+    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;
+  };
+}