Skip to content

Commit d4d35f7

Browse files
committed
go: fix cross compile
1 parent b3556f1 commit d4d35f7

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

srcpkgs/go/template

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Template file for 'go'
22
pkgname=go
33
version=1.21.4
4-
revision=1
4+
revision=2
55
create_wrksrc=yes
66
build_wrksrc=go
77
hostmakedepends="go1.17-bootstrap"
@@ -18,14 +18,20 @@ noverifyrdeps=yes
1818
# on CI it tries to use `git submodule`, which is not part of chroot-git
1919
make_check=ci-skip
2020

21+
# keep in sync with common/environment/build-style/go.sh
2122
case "${XBPS_TARGET_MACHINE}" in
22-
aarch64*) _goarch=arm64 ;;
23-
arm*) _goarch=arm ;;
24-
i686*) _goarch=386 ;;
25-
x86_64*) _goarch=amd64 ;;
26-
ppc64le*) _goarch=ppc64le ;;
27-
mips*) _goarch=mips ;;
28-
riscv64*) _goarch=riscv64 ;;
23+
aarch64*) export GOARCH=arm64;;
24+
armv5*) export GOARCH=arm; export GOARM=5;;
25+
armv6*) export GOARCH=arm; export GOARM=6;;
26+
armv7*) export GOARCH=arm; export GOARM=7;;
27+
i686*) export GOARCH=386;;
28+
x86_64*) export GOARCH=amd64;;
29+
ppc64le*) export GOARCH=ppc64le;;
30+
ppc64*) export GOARCH=ppc64;;
31+
ppc*) export GOARCH=ppc;;
32+
mipsel*) export GOARCH=mipsle;;
33+
mips*) export GOARCH=mips;;
34+
riscv64*) export GOARCH=riscv64;;
2935
*) broken="Unsupported architecture ${XBPS_TARGET_MACHINE}" ;;
3036
esac
3137

@@ -56,7 +62,6 @@ do_build() {
5662

5763
export GOROOT_BOOTSTRAP="/usr/lib/go1.17.13"
5864
export GOROOT=$PWD
59-
export GOARCH=${_goarch}
6065

6166
cd "src"
6267

@@ -76,7 +81,7 @@ do_install() {
7681
local bindir
7782

7883
if [ "$CROSS_BUILD" ]; then
79-
bindir=bin/linux_${_goarch}
84+
bindir=bin/linux_${GOARCH}
8085
else
8186
bindir=bin
8287
fi

0 commit comments

Comments
 (0)