build-style/go: allow usage with gccgo compiler

This checks if gcc-go-tools have been specified in host deps
and if so, use gccgo to build (gcc-go-tools conflicts with go).

Also, since gccgo is not a multi-compiler, we need to override GCCGO
to get cross-builds. The gccgo for target is always installed, as
it's a part of our cross-toolchains.

[ci skip]
This commit is contained in:
q66 2019-11-11 03:03:14 +01:00 committed by Daniel Kolesa
parent f5e86977ee
commit 1b2bf53e82
1 changed files with 13 additions and 4 deletions

View File

@ -1,9 +1,18 @@
if [ -z "$archs" ]; then
archs="aarch64* armv[567]* i686* x86_64* ppc64le*"
if [ "${hostmakedepends##*gcc-go-tools*}" ]; then
# gc compiler
if [ -z "$archs" ]; then
archs="aarch64* armv[567]* i686* x86_64* ppc64le*"
fi
hostmakedepends+=" go"
nopie=yes
else
# gccgo compiler
if [ "$CROSS_BUILD" ]; then
# target compiler to use; otherwise it'll just call gccgo
export GCCGO="${XBPS_CROSS_TRIPLET}-gccgo"
fi
fi
hostmakedepends+=" go"
nostrip=yes
nopie=yes
case "$XBPS_TARGET_MACHINE" in
aarch64*) export GOARCH=arm64;;