redox/recipes/wip/dev/lang/go/recipe.toml
2025-09-07 18:18:18 +00:00

41 lines
1.1 KiB
TOML

#TODO compiling, not tested further
[source]
git = "https://github.com/willnode/go"
branch = "go-1.25-redox"
shallow_clone = true
[build]
template = "custom"
script = """
export PATH=$HOME/go/bin:$PATH
rm -rf $HOME/.cache/go-build
export GOPATH=${COOKBOOK_BUILD}/gopath
if ! command -v go &> /dev/null; then
GO_TARBALL=go1.24.6.linux-$( [ "$(uname -m)" = "aarch64" ] && echo "arm64" || echo "amd64" ).tar.gz
GO_DOWNLOAD_URL="https://dl.google.com/go/${GO_TARBALL}"
echo "Installing Go..."
wget -q --show-progress "${GO_DOWNLOAD_URL}"
tar -C "$HOME" -xzf "${GO_TARBALL}"
fi
# Go does not support out-of-tree builds :(
rsync -a --delete "${COOKBOOK_SOURCE}/" ./
export GOOS=redox
case "${TARGET}" in
x86-unknown-redox) export GOARCH=386;;
x86_64-unknown-redox) export GOARCH=amd64;;
aarch64-unknown-redox) export GOARCH=arm64;;
riscv64-unknown-redox) export GOARCH=riscv64;;
esac
export CGO_ENABLED=1
export CC=x86_64-unknown-redox-gcc
export CCX=x86_64-unknown-redox-g++
(cd ./src && bash ./make.bash)
mkdir -p ${COOKBOOK_STAGE}/bin
rsync -a --delete "bin/redox_${GOARCH}/" ${COOKBOOK_STAGE}/bin
"""