git » go-1.20.git » commit 5047812

Enabled crosscompiling for ARM, closing FS#30287

author Alexander Rødseth
2012-11-15 01:53:27 UTC
committer Alexander Rødseth
2012-11-15 01:53:27 UTC
parent e9a3dd3580ff52fe7caf6223c0e5f66d9765b81d

Enabled crosscompiling for ARM, closing FS#30287

PKGBUILD +14 -4

diff --git a/PKGBUILD b/PKGBUILD
index 89bcbba..a5e56fa 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -9,7 +9,7 @@
 
 pkgname=go
 pkgver=1.0.3
-pkgrel=2
+pkgrel=3
 epoch=2
 pkgdesc='Google Go compiler and tools'
 arch=('x86_64' 'i686')
@@ -26,6 +26,8 @@ sha256sums=('7fba3533d172f13629d3d8a79e57c620632b0bd075abe11d7698b338be0ae3df'
             'a03db71d323ed2794123bb31b5c8ad5febd551c490b5c0b341052c8e5f0ba892')
 
 build() {
+  cd $srcdir/$pkgname
+
   if [ "$CARCH" == 'x86_64' ]; then
     export GOARCH=amd64
   fi
@@ -33,18 +35,26 @@ build() {
     export GOARCH=386
   fi
 
-  # Set GOARCH to arm for crosscompilation (currently doesn't work)
-
-  cd $srcdir/$pkgname
   export GOROOT_FINAL=/usr/lib/go
   export GOOS=linux
   cd src
   bash make.bash
+
+  # Enable ARM crosscompilation
+  export GOARCH=arm
+  bash make.bash
 }
 
 check() {
   cd $srcdir/$pkgname
 
+  if [ "$CARCH" == 'x86_64' ]; then
+    export GOARCH=amd64
+  fi
+  if [ "$CARCH" == 'i686' ]; then
+    export GOARCH=386
+  fi
+
   export GOROOT=$srcdir/$pkgname
   export PATH=$srcdir/$pkgname/bin:$PATH