Files
fds-os/tools/build-workstation-binaries
2026-09-24 14:51:56 +08:00

17 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Native Linux host binaries; independent of the Pi and Void build container.
set -euo pipefail
[[ $# == 0 ]] || { printf 'Usage: tools/build-workstation-binaries\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
install -m755 "target/$fds_host_target/release/fds-flash" out/workstation/fds-flash
printf 'Built native Linux tools in out/workstation/\n'