go: cross build support.

This commit is contained in:
Juan RP 2014-03-05 17:53:19 +01:00
parent ba9e78889d
commit 7d2b60418b
1 changed files with 35 additions and 16 deletions

View File

@ -3,7 +3,6 @@ pkgname=go
version=1.2.1
revision=1
wrksrc=go
nostrip=yes
makedepends="ed bison"
depends="perl gawk"
short_desc="The Go Programming Language"
@ -13,29 +12,37 @@ license="BSD"
distfiles="http://go.googlecode.com/files/go${version}.src.tar.gz"
checksum=1655a9367bec083df57cacc29add280c279791801e102fd851c00d8babd12a55
nostrip=yes
noverifyrdeps=yes
do_build() {
cd ${wrksrc}
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
armv6l*) export GOARM=6;;
armv7l*) export GOARM=7;;
esac
export GOROOT_FINAL="/usr/lib/go"
export GOOS=linux
cd src
# ARM build
export GOARCH=arm
cd src
bash make.bash
cd ${wrksrc}
export GOROOT_FINAL="/usr/lib/go"
export GOOS=linux
# x86 build
export GOARCH=386
cd src
bash make.bash
if [ "${XBPS_MACHINE}" = "x86_64" ]; then
cd ${wrksrc}
export GOROOT_FINAL="/usr/lib/go"
export GOOS=linux
export GOARCH=amd64
cd src
bash make.bash
fi
# x86_64 build
export GOARCH=amd64
bash make.bash
}
do_install() {
@ -55,7 +62,19 @@ do_install() {
cp -r doc misc -t ${DESTDIR}/usr/share/go
ln -s /usr/share/go/doc ${DESTDIR}/usr/lib/go/doc
cp -a bin ${DESTDIR}/usr
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