go: split cross compilers into separate packages

add one package per officially supported operating system, that contains
the cross compilers for all officially supported architectures on that
OS.
This commit is contained in:
Dominik Honnef 2014-08-20 22:21:34 +02:00
parent 762a54bd3a
commit b0d4a3975f
5 changed files with 83 additions and 13 deletions

1
srcpkgs/go-cross-darwin Symbolic link
View file

@ -0,0 +1 @@
go

1
srcpkgs/go-cross-freebsd Symbolic link
View file

@ -0,0 +1 @@
go

1
srcpkgs/go-cross-linux Symbolic link
View file

@ -0,0 +1 @@
go

1
srcpkgs/go-cross-windows Symbolic link
View file

@ -0,0 +1 @@
go

View file

@ -1,7 +1,7 @@
# Template file for 'go'
pkgname=go
version=1.3.1
revision=1
revision=2
wrksrc=go
hostmakedepends="mercurial ca-certificates"
depends="perl"
@ -15,25 +15,25 @@ checksum=fdfa148cc12f1e4ea45a5565261bf43d8a2e7d1fad4a16aed592d606223b93a8
nostrip=yes
noverifyrdeps=yes
do_build() {
unset GCC CC CXX LD CFLAGS
_go_targetarch() {
case "$XBPS_MACHINE" in
arm*) export GOHOSTARCH=arm;;
i686*) export GOHOSTARCH=386;;
x86_64*) export GOHOSTARCH=amd64;;
arm*) export hostarch=arm;;
i686*) export hostarch=386;;
x86_64*) export hostarch=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;;
*) targetarch=$hostarch;;
esac
echo $targetarch
}
do_build() {
unset GCC CC CXX LD CFLAGS
targetarch=$(_go_targetarch)
export GOROOT=$PWD
export GOROOT_FINAL="/usr/lib/go"
export GOOS=
@ -105,7 +105,7 @@ do_install() {
fi
vmkdir usr/bin
cp -a ${bindir}/* ${DESTDIR}/usr/bin
cp -d --preserve=all ${bindir}/* ${DESTDIR}/usr/bin || true
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
@ -140,3 +140,69 @@ do_install() {
rm -f ${DESTDIR}/usr/share/go/doc/articles/wiki/get.bin
}
go-cross-linux_package() {
nostrip=yes
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
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
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
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"
}
}