void-packages/srcpkgs/go/template
2014-07-01 16:24:49 +02:00

142 lines
4 KiB
Text

# Template file for 'go'
pkgname=go
version=1.3
revision=2
wrksrc=go
hostmakedepends="mercurial ca-certificates"
depends="perl"
short_desc="The Go Programming Language"
maintainer="Dominik Honnef <dominik@honnef.co>"
homepage="http://golang.org/"
license="BSD"
distfiles="http://golang.org/dl/go${version}.src.tar.gz"
checksum=eb983e6c5b2b9838f482c5442b1ac1856f610f2b21f3c123b3fedb48ffc35382
nostrip=yes
noverifyrdeps=yes
do_build() {
unset GCC CC CXX LD CFLAGS
case "$XBPS_MACHINE" in
arm*) export GOHOSTARCH=arm;;
i686*) export GOHOSTARCH=386;;
x86_64*) export GOHOSTARCH=amd64;;
esac
case "$XBPS_TARGET_MACHINE" in
arm*) targetarch=arm;;
i686*) targetarch=386;;
x86_64*) targetarch=amd64;;
*) targetarch=$GOHOSTARCH;;
esac
case "$XBPS_TARGET_MACHINE" in
armv6l*) export GOARM=6;;
armv7l*) export GOARM=7;;
esac
export GOROOT=$PWD
export GOROOT_FINAL="/usr/lib/go"
export GOOS=
export GOARCH=
export GOPATH=/tmp
mkdir -p $GOPATH/src
cd src
GOOS=linux
GOARCH=arm
bash make.bash --no-clean
for os in darwin freebsd linux windows; do
for arch in 386 amd64; do
GOARCH=$arch
GOOS=$os
bash make.bash --no-clean
done
done
GOOS=linux
GOARCH=$targetarch
hg clone -u release-branch.go${version} \
--config web.cacerts=/etc/ssl/certs/ca-certificates.crt \
https://code.google.com/p/go.tools/ \
$GOPATH/src/code.google.com/p/go.tools
for tool in godoc vet cover; do
$GOROOT/bin/go install code.google.com/p/go.tools/cmd/${tool}
done
}
do_install() {
vinstall LICENSE 644 usr/share/licenses/go
# TODO Beginning with Go 1.4, there will be no editor or shell
# integration in the Go distribution anymore (see
# https://codereview.appspot.com/105470043) - While the emacs
# integration has a canonical upstream at
# https://github.com/dominikh/go-mode.el, neither vim, bash nor
# zsh have one (yet). In any case, there'll need to be made a
# decision between pulling 3rd party integration into this
# package, providing extra packages, or doing nothing at all.
vinstall misc/bash/go 644 usr/share/bash-completion/completions
vinstall misc/emacs/go-mode-load.el 644 usr/share/emacs/site-lisp
vinstall misc/emacs/go-mode.el 644 usr/share/emacs/site-lisp
vinstall misc/zsh/go 644 usr/share/zsh/site-functions _go
for f in ftdetect/gofiletype.vim autoload/go/complete.vim indent/go.vim \
ftplugin/go/fmt.vim ftplugin/go/import.vim \
syntax/go.vim syntax/godoc.vim plugin/godoc.vim; do
vinstall misc/vim/$f 644 usr/share/vim/vimfiles
done
install -d ${DESTDIR}/{etc/profile.d,usr/{share/go,lib/go,lib/go/src,lib/go/site/src}}
cp -r doc misc -t ${DESTDIR}/usr/share/go
ln -s /usr/share/go/doc ${DESTDIR}/usr/lib/go/doc
if [ "$CROSS_BUILD" ]; then
case "$XBPS_TARGET_MACHINE" in
arm*) bindir=bin/linux_arm;;
i686*) bindir=bin/linux_386;;
x86_64*) bindir=bin/linux_amd64;;
esac
else
bindir=bin
fi
vmkdir usr/bin
cp -a ${bindir}/* ${DESTDIR}/usr/bin
cp -a pkg ${DESTDIR}/usr/lib/go
cp -a src/pkg ${DESTDIR}/usr/lib/go/src/
cp -a src/cmd ${DESTDIR}/usr/lib/go/src/cmd
cp -a src/lib9 ${DESTDIR}/usr/lib/go/src/
cp -a lib ${DESTDIR}/usr/lib/go/
cp -a include ${DESTDIR}/usr/lib/go/
install -Dm644 src/Make.* ${DESTDIR}/usr/lib/go/src
# Remove object files from target src dir
find ${DESTDIR}/usr/lib/go/src/ -type f -name '*.[ao]' -delete
find ${DESTDIR}/usr/lib/go/src/pkg -type f -executable -delete
# Headers for C modules
vinstall src/pkg/runtime/runtime.h 644 usr/lib/go/src/pkg/runtime
vinstall src/pkg/runtime/cgocall.h 644 usr/lib/go/src/pkg/runtime
# For packages that source /etc/profile.d/go.sh
vinstall ${FILESDIR}/go.sh 755 etc/profile.d
# This is to make go get code.google.com/p/go-tour/gotour and
# then running the gotour executable work out of the box.
#
# Also, /usr/bin is the place for system-wide executables,
# not /usr/lib/go/bin. Users should use different paths by
# setting the appropriate environment variables.
#
ln -sf /usr/bin ${DESTDIR}/usr/lib/go/bin
# For godoc
vinstall favicon.ico 644 usr/lib/go
rm -f ${DESTDIR}/usr/share/go/doc/articles/wiki/get.bin
}