User:GYakovlev/go-bootstrap

From Gentoo Wiki
Jump to:navigation Jump to:search

script by williamh to produce go-bootstrap

#!/bin/bash
set -e

if [[ -z $1 || -z $2 ]]; then
	printf 'Usage: %s go_bootstrap_path go_build_path
' "$(basename $0)"
	exit 1
fi

bootstrap_path="$1"
build_path="$2"

tuples=(
	darwin-amd64
	darwin-arm64
	linux-386
	linux-amd64
	linux-arm
	linux-arm64
	linux-loong64
	linux-mips
	linux-mipsle
	linux-mips64
	linux-mips64le
	linux-ppc64
	linux-ppc64le
	linux-riscv64
	linux-s390x
	solaris-amd64
)

pushd "${build_path}"/src >& /dev/null
for tuple in ${tuples[@]}; do
	printf "Building go bootstrap tarball for $tuple
"
	CGO_ENABLED=0 \
	GO386=softfloat GOARM=5 \
	GOOS=${tuple%%-*} GOARCH=${tuple##*-} \
GOROOT_BOOTSTRAP="${bootstrap_path}" PATH="${bootstrap_path}"/bin:${PATH} \
	./bootstrap.bash
done
popd >& /dev/null