2013-03-19 11:46:47 +01:00
|
|
|
{ stdenv, fetchurl, bison, glibc, bash, coreutils, makeWrapper, tzdata}:
|
2009-11-14 21:14:28 +01:00
|
|
|
|
|
|
|
let
|
2010-06-12 13:21:20 +02:00
|
|
|
loader386 = "${glibc}/lib/ld-linux.so.2";
|
|
|
|
loaderAmd64 = "${glibc}/lib/ld-linux-x86-64.so.2";
|
2012-08-24 16:00:18 +02:00
|
|
|
loaderArm = "${glibc}/lib/ld-linux.so.3";
|
2009-11-14 21:14:28 +01:00
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
2012-10-09 17:01:55 +02:00
|
|
|
name = "go-1.0.3";
|
2009-11-14 21:14:28 +01:00
|
|
|
|
2012-07-29 17:24:19 +02:00
|
|
|
src = fetchurl {
|
2012-10-09 17:01:55 +02:00
|
|
|
url = http://go.googlecode.com/files/go1.0.3.src.tar.gz;
|
|
|
|
sha256 = "1pz31az3icwqfqfy3avms05jnqr0qrbrx9yqsclkdwbjs4rkbfkz";
|
2009-11-14 21:14:28 +01:00
|
|
|
};
|
|
|
|
|
2012-07-29 17:24:19 +02:00
|
|
|
buildInputs = [ bison glibc bash makeWrapper ];
|
|
|
|
|
|
|
|
# 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
|
|
|
|
'';
|
2009-11-14 21:14:28 +01:00
|
|
|
|
|
|
|
prePatch = ''
|
2012-08-26 23:15:02 +02:00
|
|
|
cd ..
|
|
|
|
if [ ! -d go ]; then
|
|
|
|
mv * go
|
|
|
|
fi
|
|
|
|
cd go
|
|
|
|
|
2009-11-14 21:14:28 +01:00
|
|
|
patchShebangs ./ # replace /bin/bash
|
|
|
|
# !!! substituteInPlace does not seems to be effective.
|
2010-06-12 13:21:20 +02:00
|
|
|
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
|
2012-08-24 16:00:18 +02:00
|
|
|
sed -i 's,/lib64/ld-linux-x86-64.so.3,${loaderArm},' src/cmd/5l/asm.c
|
2013-03-19 11:46:47 +01:00
|
|
|
sed -i 's,/usr/share/zoneinfo/,${tzdata}/share/zoneinfo/,' src/pkg/time/zoneinfo_unix.go
|
2010-06-12 13:21:20 +02:00
|
|
|
|
2012-07-29 17:24:19 +02:00
|
|
|
#sed -i -e 's,/bin/cat,${coreutils}/bin/cat,' \
|
|
|
|
# -e 's,/bin/echo,${coreutils}/bin/echo,' \
|
|
|
|
# src/pkg/exec/exec_test.go
|
2010-06-12 13:21:20 +02:00
|
|
|
|
2010-06-12 13:45:30 +02:00
|
|
|
# Disabling the 'os/http/net' tests (they want files not available in
|
|
|
|
# chroot builds)
|
2012-07-29 17:24:19 +02:00
|
|
|
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 the hostname test
|
|
|
|
sed -i '/TestHostname/areturn' src/pkg/os/os_test.go
|
2009-11-14 21:14:28 +01:00
|
|
|
'';
|
|
|
|
|
2012-08-03 22:55:10 +02:00
|
|
|
patches = [ ./cacert.patch ];
|
2012-07-29 17:24:19 +02:00
|
|
|
|
2009-11-14 21:14:28 +01:00
|
|
|
GOOS = "linux";
|
2012-12-28 19:54:15 +01:00
|
|
|
GOARCH = if stdenv.system == "i686-linux" then "386"
|
|
|
|
else if stdenv.system == "x86_64-linux" then "amd64"
|
|
|
|
else if stdenv.system == "armv5tel-linux" then "arm"
|
2010-06-12 13:21:20 +02:00
|
|
|
else throw "Unsupported system";
|
2012-08-24 16:00:18 +02:00
|
|
|
GOARM = stdenv.lib.optionalString (stdenv.system == "armv5tel-linux") "5";
|
2009-11-14 21:14:28 +01:00
|
|
|
|
|
|
|
installPhase = ''
|
2012-01-18 21:16:00 +01:00
|
|
|
mkdir -p "$out/bin"
|
2009-11-14 21:14:28 +01:00
|
|
|
export GOROOT="$(pwd)/"
|
|
|
|
export GOBIN="$out/bin"
|
|
|
|
export PATH="$GOBIN:$PATH"
|
|
|
|
cd ./src
|
|
|
|
./all.bash
|
|
|
|
cd -
|
2009-11-16 19:42:43 +01:00
|
|
|
|
2012-07-29 17:24:19 +02:00
|
|
|
# Wrap the tools to define the location of the
|
2009-11-16 19:42:43 +01:00
|
|
|
# libraries.
|
2012-07-29 17:24:19 +02:00
|
|
|
for a in go gofmt godoc; do
|
|
|
|
wrapProgram "$out/bin/$a" \
|
2012-08-26 23:15:02 +02:00
|
|
|
--set "GOROOT" $out/share/go \
|
2012-12-28 19:54:15 +01:00
|
|
|
${if stdenv.system == "armv5tel-linux" then "--set GOARM $GOARM" else ""}
|
2012-07-29 17:24:19 +02:00
|
|
|
done
|
2009-11-16 19:42:43 +01:00
|
|
|
|
|
|
|
# Copy the emacs configuration for Go files.
|
2012-01-18 21:16:00 +01:00
|
|
|
mkdir -p "$out/share/emacs/site-lisp"
|
2012-07-29 17:24:19 +02:00
|
|
|
cp ./misc/emacs/* $out/share/emacs/site-lisp/
|
2009-11-14 21:14:28 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = http://golang.org/;
|
|
|
|
description = "The Go Programming language";
|
|
|
|
license = "BSD";
|
2010-06-12 13:21:20 +02:00
|
|
|
maintainers = with stdenv.lib.maintainers; [ pierron viric ];
|
|
|
|
platforms = stdenv.lib.platforms.linux;
|
2009-11-14 21:14:28 +01:00
|
|
|
};
|
|
|
|
}
|