Package workstation tools, reuse emulator sessions, and derive build versions
This commit is contained in:
+18
-10
@@ -1,15 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
# Native Linux host binaries; independent of the Pi and Void build container.
|
||||
# Build an installable Arch package without installing host packages implicitly.
|
||||
set -euo pipefail
|
||||
[[ $# == 0 ]] || { printf 'Usage: tools/build-workstation\n' >&2; exit 2; }
|
||||
[[ $(uname -s) == Linux ]] || { printf 'A Linux workstation is required\n' >&2; exit 2; }
|
||||
(( EUID != 0 )) || { printf 'Build as an ordinary user\n' >&2; exit 2; }
|
||||
cd "$(dirname -- "${BASH_SOURCE[0]}")/.."
|
||||
command -v cargo >/dev/null || { printf 'Install Rust with Cargo before building workstation tools\n' >&2; exit 2; }
|
||||
fds_host_target=$(rustc -vV | sed -n 's/^host: //p')
|
||||
[[ $fds_host_target == *-linux-* ]] || { printf 'Rust must target the native Linux host\n' >&2; exit 2; }
|
||||
cargo build --locked --release --target "$fds_host_target" -p fds-workstation
|
||||
mkdir -p out/workstation
|
||||
install -m755 "target/$fds_host_target/release/fds-cartridge" out/workstation/fds-cartridge
|
||||
install -m755 "target/$fds_host_target/release/fds-emulator" out/workstation/fds-emulator
|
||||
printf 'Built native Linux tools in out/workstation/\n'
|
||||
for tool in makepkg pacman cargo rustc python3 git; do
|
||||
command -v "$tool" >/dev/null || { printf 'Missing %s; see docs/workstation.md\n' "$tool" >&2; exit 1; }
|
||||
done
|
||||
export FDS_SOURCE_DIR="$PWD"
|
||||
mkdir -p out/workstation out/workstation-package
|
||||
exec 9>out/.workstation-package.lock
|
||||
flock -n 9 || { printf 'Another workstation package build is running\n' >&2; exit 1; }
|
||||
cp packaging/arch/PKGBUILD out/workstation-package/PKGBUILD
|
||||
export PKGDEST="$PWD/out/workstation"
|
||||
cd out/workstation-package
|
||||
# Dependencies are checked by their actual build commands. Runtime features
|
||||
# are optional, and package installation is a separate explicit Make target.
|
||||
makepkg --nodeps --force
|
||||
mapfile -t packages < <(makepkg --packagelist)
|
||||
(( ${#packages[@]} == 1 )) && [[ -s ${packages[0]} ]] || { printf 'Expected one fds-tools package\n' >&2; exit 1; }
|
||||
printf '%s\n' "${packages[0]}" >../workstation/package-path.txt
|
||||
printf 'Built Arch package: %s\nInstall with make workstation-install\n' "${packages[0]}"
|
||||
|
||||
Reference in New Issue
Block a user