114 lines
3.1 KiB
Bash
114 lines
3.1 KiB
Bash
# Template file for 'go'
|
|
pkgname=go
|
|
version=1.22.5
|
|
revision=1
|
|
create_wrksrc=yes
|
|
build_wrksrc=go
|
|
hostmakedepends="go1.22-bootstrap"
|
|
checkdepends="iana-etc clang gcc-fortran"
|
|
short_desc="Go Programming Language"
|
|
maintainer="Michael Aldridge <maldridge@voidlinux.org>"
|
|
license="BSD-3-Clause"
|
|
homepage="https://go.dev/"
|
|
changelog="https://go.dev/doc/devel/release.html"
|
|
distfiles="https://go.dev/dl/go${version}.src.tar.gz"
|
|
checksum=ac9c723f224969aee624bc34fd34c9e13f2a212d75c71c807de644bb46e112f6
|
|
nostrip=yes
|
|
noverifyrdeps=yes
|
|
# on CI it tries to use `git submodule`, which is not part of chroot-git
|
|
make_check=ci-skip
|
|
|
|
# keep in sync with common/environment/build-style/go.sh
|
|
case "${XBPS_TARGET_MACHINE}" in
|
|
aarch64*) export GOARCH=arm64 ;;
|
|
armv5*) export GOARCH=arm; export GOARM=5 ;;
|
|
armv6*) export GOARCH=arm; export GOARM=6 ;;
|
|
armv7*) export GOARCH=arm; export GOARM=7 ;;
|
|
i686*) export GOARCH=386 ;;
|
|
x86_64*) export GOARCH=amd64 ;;
|
|
ppc64le*) export GOARCH=ppc64le ;;
|
|
ppc64*) export GOARCH=ppc64 ;;
|
|
ppc*) export GOARCH=ppc ;;
|
|
mipsel*) export GOARCH=mipsle ;;
|
|
mips*) export GOARCH=mips ;;
|
|
riscv64*) export GOARCH=riscv64 ;;
|
|
*) broken="Unsupported architecture ${XBPS_TARGET_MACHINE}" ;;
|
|
esac
|
|
|
|
if [ "$CROSS_BUILD" ]; then
|
|
if [ "${XBPS_MACHINE%%-musl}" = "${XBPS_TARGET_MACHINE%%-musl}" ]; then
|
|
broken="Cross-compiling to different libc is not supported"
|
|
fi
|
|
fi
|
|
|
|
# Workaround for go-1.19 compilation error on i686
|
|
# runtime/cgo(.text): unknown symbol __stack_chk_fail_local in pcrel
|
|
if [ "$XBPS_MACHINE" = i686 ]; then
|
|
export CGO_CFLAGS="-fno-stack-protector"
|
|
fi
|
|
|
|
post_extract() {
|
|
if [ "$(df . --output=fstype | tail -1)" = zfs ]; then
|
|
# https://github.com/golang/go/issues/39905
|
|
rm -v go/src/cmd/link/internal/ld/fallocate_test.go
|
|
fi
|
|
}
|
|
|
|
do_build() {
|
|
unset GCC CC CXX LD CFLAGS
|
|
# FIXME: work around leaking go build-style vars when built as a
|
|
# dependency
|
|
unset CGO_CXXFLAGS CGO_ENABLED # CGO_CFLAGS
|
|
|
|
export GOROOT_BOOTSTRAP="/usr/lib/go1.22.0"
|
|
export GOROOT=$PWD
|
|
|
|
cd "src"
|
|
|
|
bash make.bash -v
|
|
}
|
|
|
|
do_check() {
|
|
if [ "$XBPS_LIBC" = musl ]; then
|
|
# https://github.com/golang/go/issues/39857
|
|
./bin/go tool dist test -v -run "!^cgo_test$"
|
|
else
|
|
./bin/go tool dist test -v
|
|
fi
|
|
}
|
|
|
|
do_install() {
|
|
local bindir
|
|
|
|
if [ "$CROSS_BUILD" ]; then
|
|
bindir=bin/linux_${GOARCH}
|
|
else
|
|
bindir=bin
|
|
fi
|
|
|
|
vmkdir usr/bin
|
|
vmkdir usr/lib/go
|
|
vmkdir usr/lib/go/bin
|
|
vmkdir usr/share/go
|
|
cp -d --preserve=all ${bindir}/* ${DESTDIR}/usr/lib/go/bin
|
|
cp -a pkg src lib ${DESTDIR}/usr/lib/go
|
|
cp -r doc misc -t ${DESTDIR}/usr/share/go
|
|
ln -s /usr/share/go/doc ${DESTDIR}/usr/lib/go/doc
|
|
cp VERSION ${DESTDIR}/usr/lib/go/VERSION
|
|
# GOROOT_FINAL doesn't work anymore, see: https://github.com/golang/go/issues/61921
|
|
ln -sfr ${DESTDIR}/usr/lib/go/bin/* ${DESTDIR}/usr/bin
|
|
|
|
# <dominikh> sigh. well, someone fix the template and add
|
|
# a symlink, usr/lib/go/misc -> /usr/share/go/misc
|
|
ln -sfr ${DESTDIR}/usr/share/go/misc ${DESTDIR}/usr/lib/go/misc
|
|
|
|
rm -f ${DESTDIR}/usr/share/go/doc/articles/wiki/get.bin
|
|
rm -f ${DESTDIR}/usr/lib/go/pkg/tool/*/api
|
|
rm -rf ${DESTDIR}/usr/lib/go/pkg/bootstrap
|
|
rm -rf ${DESTDIR}/usr/lib/go/pkg/obj
|
|
|
|
vinstall go.env 644 usr/lib/go
|
|
|
|
vlicense LICENSE
|
|
}
|