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.
This commit is contained in:
Lluis Batlle 2012-08-26 23:15:02 +02:00
parent ba47bf7258
commit e5bf4de6b6

View file

@ -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.