2011-07-05 18:51:42 +00:00
|
|
|
# Template file for 'go'
|
|
|
|
pkgname=go
|
2014-08-20 06:57:26 +00:00
|
|
|
version=1.3.1
|
2014-08-20 20:21:34 +00:00
|
|
|
revision=2
|
2012-07-29 05:59:11 +00:00
|
|
|
wrksrc=go
|
2014-07-01 10:12:22 +00:00
|
|
|
hostmakedepends="mercurial ca-certificates"
|
|
|
|
depends="perl"
|
2011-07-05 18:51:42 +00:00
|
|
|
short_desc="The Go Programming Language"
|
2014-07-01 14:18:30 +00:00
|
|
|
maintainer="Dominik Honnef <dominik@honnef.co>"
|
2011-07-05 18:51:42 +00:00
|
|
|
homepage="http://golang.org/"
|
|
|
|
license="BSD"
|
2014-06-19 17:40:18 +00:00
|
|
|
distfiles="http://golang.org/dl/go${version}.src.tar.gz"
|
2014-08-20 06:57:26 +00:00
|
|
|
checksum=fdfa148cc12f1e4ea45a5565261bf43d8a2e7d1fad4a16aed592d606223b93a8
|
2011-07-05 18:51:42 +00:00
|
|
|
|
2014-03-05 16:53:19 +00:00
|
|
|
nostrip=yes
|
|
|
|
noverifyrdeps=yes
|
|
|
|
|
2014-08-20 20:21:34 +00:00
|
|
|
_go_targetarch() {
|
2014-03-05 16:53:19 +00:00
|
|
|
case "$XBPS_MACHINE" in
|
2014-08-20 20:21:34 +00:00
|
|
|
arm*) export hostarch=arm;;
|
|
|
|
i686*) export hostarch=386;;
|
|
|
|
x86_64*) export hostarch=amd64;;
|
2014-03-05 16:53:19 +00:00
|
|
|
esac
|
2014-07-01 10:12:22 +00:00
|
|
|
case "$XBPS_TARGET_MACHINE" in
|
|
|
|
arm*) targetarch=arm;;
|
|
|
|
i686*) targetarch=386;;
|
|
|
|
x86_64*) targetarch=amd64;;
|
2014-08-20 20:21:34 +00:00
|
|
|
*) targetarch=$hostarch;;
|
2014-03-05 16:53:19 +00:00
|
|
|
esac
|
2014-08-20 20:21:34 +00:00
|
|
|
echo $targetarch
|
|
|
|
}
|
2014-03-05 16:53:19 +00:00
|
|
|
|
2014-08-20 20:21:34 +00:00
|
|
|
do_build() {
|
|
|
|
unset GCC CC CXX LD CFLAGS
|
|
|
|
|
|
|
|
targetarch=$(_go_targetarch)
|
2014-07-01 10:12:22 +00:00
|
|
|
export GOROOT=$PWD
|
2012-07-29 05:59:11 +00:00
|
|
|
export GOROOT_FINAL="/usr/lib/go"
|
2014-07-01 14:24:49 +00:00
|
|
|
export GOOS=
|
|
|
|
export GOARCH=
|
2014-07-01 10:12:22 +00:00
|
|
|
export GOPATH=/tmp
|
|
|
|
mkdir -p $GOPATH/src
|
2014-03-05 16:53:19 +00:00
|
|
|
|
2012-07-29 05:59:11 +00:00
|
|
|
cd src
|
2011-07-05 18:51:42 +00:00
|
|
|
|
2014-07-01 14:24:49 +00:00
|
|
|
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
|
2014-07-01 09:16:18 +00:00
|
|
|
done
|
2014-07-01 10:12:22 +00:00
|
|
|
|
2014-07-01 14:24:49 +00:00
|
|
|
GOOS=linux
|
2014-07-01 10:12:22 +00:00
|
|
|
GOARCH=$targetarch
|
|
|
|
|
2014-08-20 06:57:26 +00:00
|
|
|
hg clone -u release-branch.go$(echo "$version" | cut -d "." -f "1-2") \
|
2014-07-01 10:12:22 +00:00
|
|
|
--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
|
2011-07-05 18:51:42 +00:00
|
|
|
}
|
|
|
|
|
2011-10-14 17:24:20 +00:00
|
|
|
do_install() {
|
2012-07-29 05:59:11 +00:00
|
|
|
vinstall LICENSE 644 usr/share/licenses/go
|
2014-07-01 10:12:22 +00:00
|
|
|
|
|
|
|
# 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.
|
2012-07-29 05:59:11 +00:00
|
|
|
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 \
|
2013-05-30 09:07:25 +00:00
|
|
|
ftplugin/go/fmt.vim ftplugin/go/import.vim \
|
2012-07-29 05:59:11 +00:00
|
|
|
syntax/go.vim syntax/godoc.vim plugin/godoc.vim; do
|
|
|
|
vinstall misc/vim/$f 644 usr/share/vim/vimfiles
|
2011-07-05 18:51:42 +00:00
|
|
|
done
|
2012-07-29 05:59:11 +00:00
|
|
|
|
2014-01-05 09:51:35 +00:00
|
|
|
install -d ${DESTDIR}/{etc/profile.d,usr/{share/go,lib/go,lib/go/src,lib/go/site/src}}
|
2012-07-29 05:59:11 +00:00
|
|
|
|
|
|
|
cp -r doc misc -t ${DESTDIR}/usr/share/go
|
|
|
|
ln -s /usr/share/go/doc ${DESTDIR}/usr/lib/go/doc
|
2014-03-05 16:53:19 +00:00
|
|
|
|
|
|
|
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
|
2014-08-20 20:21:34 +00:00
|
|
|
cp -d --preserve=all ${bindir}/* ${DESTDIR}/usr/bin || true
|
2012-07-29 05:59:11 +00:00
|
|
|
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/
|
2014-01-05 09:51:35 +00:00
|
|
|
cp -a include ${DESTDIR}/usr/lib/go/
|
2012-07-29 05:59:11 +00:00
|
|
|
|
|
|
|
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
|
2011-07-05 18:51:42 +00:00
|
|
|
}
|
2014-08-20 20:21:34 +00:00
|
|
|
|
|
|
|
go-cross-linux_package() {
|
|
|
|
nostrip=yes
|
2014-08-20 20:34:15 +00:00
|
|
|
noverifyrdeps=yes
|
2014-08-20 20:21:34 +00:00
|
|
|
depends="${sourcepkg}-${version}_${revision}"
|
|
|
|
short_desc+=" - Cross compilers for Linux"
|
|
|
|
pkg_install() {
|
|
|
|
targetarch=$(_go_targetarch)
|
|
|
|
mkdir -p $PKGDESTDIR/usr/lib/go/pkg/tool/
|
|
|
|
cd ${DESTDIR}/usr/lib/go/pkg/tool/
|
|
|
|
for i in linux_*; do
|
|
|
|
if [ "$i" != "linux_${targetarch}" ]; then
|
|
|
|
mv "$i" $PKGDESTDIR/usr/lib/go/pkg/tool/
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
mkdir -p $PKGDESTDIR/usr/lib/go/pkg/
|
|
|
|
cd ${DESTDIR}/usr/lib/go/pkg/
|
|
|
|
for i in linux_*; do
|
|
|
|
if [ "$i" != "linux_${targetarch}" ]; then
|
|
|
|
mv "$i" $PKGDESTDIR/usr/lib/go/pkg/
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
mkdir -p $PKGDESTDIR/usr/lib/go/src/pkg/runtime/
|
|
|
|
cd ${DESTDIR}/usr/lib/go/src/pkg/runtime/
|
|
|
|
for i in zasm_linux_*.h; do
|
|
|
|
if [ "$i" != "zasm_linux_${targetarch}.h" ]; then
|
|
|
|
mv "$i" $PKGDESTDIR/usr/lib/go/src/pkg/runtime/
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
go-cross-darwin_package() {
|
|
|
|
nostrip=yes
|
2014-08-20 20:34:15 +00:00
|
|
|
noverifyrdeps=yes
|
2014-08-20 20:21:34 +00:00
|
|
|
depends="${sourcepkg}-${version}_${revision}"
|
|
|
|
short_desc+=" - Cross compilers for Darwin"
|
|
|
|
pkg_install() {
|
|
|
|
vmove "usr/lib/go/pkg/tool/darwin_*"
|
|
|
|
vmove "usr/lib/go/pkg/darwin_*"
|
|
|
|
vmove "usr/lib/go/src/pkg/runtime/zasm_darwin_*.h"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
go-cross-freebsd_package() {
|
|
|
|
nostrip=yes
|
2014-08-20 20:34:15 +00:00
|
|
|
noverifyrdeps=yes
|
2014-08-20 20:21:34 +00:00
|
|
|
depends="${sourcepkg}-${version}_${revision}"
|
|
|
|
short_desc+=" - Cross compilers for FreeBSD"
|
|
|
|
pkg_install() {
|
|
|
|
vmove "usr/lib/go/pkg/tool/freebsd_*"
|
|
|
|
vmove "usr/lib/go/pkg/freebsd_*"
|
|
|
|
vmove "usr/lib/go/src/pkg/runtime/zasm_freebsd_*.h"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
go-cross-windows_package() {
|
|
|
|
nostrip=yes
|
2014-08-20 20:34:15 +00:00
|
|
|
noverifyrdeps=yes
|
2014-08-20 20:21:34 +00:00
|
|
|
depends="${sourcepkg}-${version}_${revision}"
|
|
|
|
short_desc+=" - Cross compilers for Windows"
|
|
|
|
pkg_install() {
|
|
|
|
vmove "usr/lib/go/pkg/tool/windows_*"
|
|
|
|
vmove "usr/lib/go/pkg/windows_*"
|
|
|
|
vmove "usr/lib/go/src/pkg/runtime/zasm_windows_*.h"
|
|
|
|
}
|
|
|
|
}
|