diff options
author | Sören Tempel <soeren+git@soeren-tempel.net> | 2015-08-14 22:51:31 +0200 |
---|---|---|
committer | Francesco Colista <fcolista@alpinelinux.org> | 2015-08-17 09:34:37 +0000 |
commit | 2123a99ef11f2bb2705e02de04a209fb8285bd83 (patch) | |
tree | 12d5f874a13f0bf3dca4c3e74a043907306303a4 /main | |
parent | 702236e90ba080d8d7bf0f494c73df0475d6dc94 (diff) | |
download | aports-2123a99ef11f2bb2705e02de04a209fb8285bd83.tar.bz2 aports-2123a99ef11f2bb2705e02de04a209fb8285bd83.tar.xz |
main/go: add cross subpackage
The cross subpackages ships cross compilers for Darwin, FreeBSD, OpenBSD
and Microsoft Windows. Those are not all platforms theoretically
supported by go but I guess those are the most relevant once.
In the future it might be a good idea to add cross compilers for other
platforms and architectures as well but before doing so you probably
want to create one subpackage for each platform otherwise the cross
subpackage gets too big.
My computer is too slow to compile go for all these platforms and
architectures in a timely manner so I only compiled the go cross
compiler for OpenBSD amd64 and OpenBSD i386. In addition to that the
OpenBSD amd64 cross compiler was successfully used to cross compile a
small program.
If you have access to a faster computer then please test this on other
architectures (Darwin, FreeBSD and Microsoft Windows).
Diffstat (limited to 'main')
-rw-r--r-- | main/go/APKBUILD | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/main/go/APKBUILD b/main/go/APKBUILD index d875802a3c..46a829c679 100644 --- a/main/go/APKBUILD +++ b/main/go/APKBUILD @@ -4,7 +4,7 @@ pkgname=go pkgver=1.4.2 # This should be the latest commit on the corresponding release branch _toolsver="abf43428cc239218424c7a44dc9b5987cd351c3e" -pkgrel=1 +pkgrel=2 pkgdesc="Go programming language compiler" url="http://www.golang.org/" arch="x86 x86_64 armhf" @@ -14,7 +14,7 @@ depends_dev="" makedepends="bash perl" options="!strip" install="" -subpackages="$pkgname-tools:tools" +subpackages="$pkgname-tools:tools $pkgname-cross:cross" source=" http://golang.org/dl/go${pkgver}.src.tar.gz tools.tar.gz::https://github.com/golang/tools/archive/${_toolsver}.tar.gz @@ -44,20 +44,31 @@ build() { export GOROOT="$_builddir" export GOBIN="$GOROOT"/bin export GOROOT_FINAL=/usr/lib/go + # ccache breaks build for some reason unset CC case "$CARCH" in - x86) GOARCH=386;; - x86_64) GOARCH=amd64;; - arm*) GOARCH=arm; export GOARM=6;; - *) return 1;; + x86) + export GOARCH="386" ;; + x86_64) + export GOARCH="amd64" ;; + arm*) + export GOARCH="arm" + export GOARM="6" ;; + *) + return 1 ;; esac - export GOARCH cd "$_builddir/src" ./make.bash || return 1 + for os in darwin freebsd openbsd windows; do + for arch in "386" "amd64"; do + GOARCH=$arch GOOS=$os ./make.bash --no-clean || return 1 + done + done + # FIXME: race and bench tests fail: #PATH="$GOROOT/bin:$PATH" ./run.bash --no-rebuild --banner || return 1 @@ -116,6 +127,24 @@ tools() { done } +cross() { + pkgdesk="Go cross compilers" + depends="$pkgname" + + mkdir -p "$subpkgdir"/usr/lib/go/pkg/tool \ + "$subpkgdir"/usr/lib/go/src/runtime + + for os in darwin freebsd openbsd windows; do + mv "$pkgdir"/usr/lib/go/pkg/tool/${os}_* \ + "$subpkgdir"/usr/lib/go/pkg/tool || return 1 + mv "$pkgdir"/usr/lib/go/pkg/${os}_* \ + "$subpkgdir"/usr/lib/go/pkg || return 1 + mv "$pkgdir"/usr/lib/go/src/runtime/zasm_${os}*.h \ + "$subpkgdir"/usr/lib/go/src/runtime || return 1 + done + +} + md5sums="907f85c8fa765d31f7f955836fec4049 go1.4.2.src.tar.gz a8bc7ad3d0deff01bd45e4938cc3adb6 tools.tar.gz 65330c61f6d6c881033b0a95ca228edb no-werror.patch |