Files
zenbook/build-rust-runtime.sh
2026-09-26 17:37:13 +02:00

64 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
SCRIPT_PATH="${BASH_SOURCE[0]:-${0}}"
SCRIPT_DIR="$(cd "$(dirname "${SCRIPT_PATH}")" && pwd)"
TAURI_DIR="${SCRIPT_DIR}/ui-tauri-react/src-tauri"
RUNTIME_BINS=(
zenbook-duo-daemon
zenbook-duo-session-agent
zenbook-duo-lifecycle
zenbook-duo-usb-remap-helper
)
usage() {
cat <<'EOF'
build-rust-runtime.sh - compile Zenbook Duo background service binaries
Usage:
./build-rust-runtime.sh
Builds release binaries under ui-tauri-react/src-tauri/target/release/.
Install them with ./install-rust-runtime.sh --install-only
EOF
}
need_cmd() {
command -v "$1" >/dev/null 2>&1 || {
echo "ERROR: Missing required command: $1" >&2
exit 1
}
}
if [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ]; then
usage
exit 0
fi
if [ "$#" -gt 0 ]; then
echo "ERROR: unknown argument: $1" >&2
usage >&2
exit 1
fi
need_cmd cargo
if [ ! -f "${TAURI_DIR}/Cargo.toml" ]; then
echo "ERROR: Could not find Tauri crate at ${TAURI_DIR}" >&2
exit 1
fi
echo "Building Rust runtime binaries..."
cargo build --release \
--manifest-path "${TAURI_DIR}/Cargo.toml" \
--bin "${RUNTIME_BINS[0]}" \
--bin "${RUNTIME_BINS[1]}" \
--bin "${RUNTIME_BINS[2]}" \
--bin "${RUNTIME_BINS[3]}"
echo "Built runtime binaries:"
for binary in "${RUNTIME_BINS[@]}"; do
echo " ${TAURI_DIR}/target/release/${binary}"
done