app-build/scripts/build-go.sh
Philip Peterson b3c34b1592 app-build: build in-house apps as RPMs for x86_64 and aarch64
Moved out of each app's repo (layer-wizard, dnf-package-store,
swap-watchdog), which each had a copy of the same build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 21:04:39 -09:00

20 lines
803 B
Bash
Executable file

#!/usr/bin/env bash
# Builds a Go app's GO_PACKAGES into /src/bin/ for this machine's
# architecture (cgo included: it builds natively, or under emulation for
# arm64), then packages it. Version 0: Go apps don't declare one.
source /scripts/common.sh
# shellcheck disable=SC2086 # DNF_PACKAGES is a list
dnf install -y --setopt=install_weak_deps=False golang git rpm-build $DNF_PACKAGES
# A go.mod newer than Fedora's Go: GOTOOLCHAIN=auto fetches it (into the
# module cache, so once).
export GOTOOLCHAIN=auto GOMODCACHE=/cache/go/mod GOCACHE=/cache/go/build GOFLAGS=-buildvcs=false
git_safe
cd /src
[ -n "$GO_PACKAGES" ] || { echo "go-packages is empty" >&2; exit 1; }
rm -rf bin && mkdir bin
# shellcheck disable=SC2086 # GO_PACKAGES is a list
go build -trimpath -o bin/ $GO_PACKAGES
package_rpm 0