X-Original-To: alpine-aports@mail.alpinelinux.org Delivered-To: alpine-aports@mail.alpinelinux.org Received: from mail.alpinelinux.org (dallas-a1.alpinelinux.org [127.0.0.1]) by mail.alpinelinux.org (Postfix) with ESMTP id 04444DC028D for ; Fri, 14 Aug 2015 20:51:40 +0000 (UTC) Received: from lithium.8pit.net (lithium.8pit.net [141.101.32.65]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.alpinelinux.org (Postfix) with ESMTPS id 5172ADC0175; Fri, 14 Aug 2015 20:51:38 +0000 (UTC) Received: from localhost (ip5f5ac946.dynamic.kabel-deutschland.de [95.90.201.70]); by lithium.8pit.net (OpenSMTPD) with ESMTPSA id 4805a0d6; TLS version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Fri, 14 Aug 2015 22:51:36 +0200 (CEST) From: =?UTF-8?q?S=C3=B6ren=20Tempel?= To: alpine-aports@lists.alpinelinux.org Subject: [alpine-aports] [PATCH] main/go: add cross subpackage Date: Fri, 14 Aug 2015 22:51:31 +0200 Message-Id: <1439585491-27955-1-git-send-email-soeren+git@soeren-tempel.net> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1439582904-22151-1-git-send-email-soeren+git@soeren-tempel.net> References: <1439582904-22151-1-git-send-email-soeren+git@soeren-tempel.net> X-Virus-Scanned: ClamAV using ClamSMTP X-Mailinglist: alpine-aports Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: 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). --- main/go/APKBUILD | 43 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/main/go/APKBUILD b/main/go/APKBUILD index d875802..46a829c 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 -- 2.5.0 --- Unsubscribe: alpine-aports+unsubscribe@lists.alpinelinux.org Help: alpine-aports+help@lists.alpinelinux.org ---