28 lines
940 B
Bash
Executable File
28 lines
940 B
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
SOURCE_DIR="${RUSTPROXY_SOURCE_DIR:-$ROOT/app}"
|
|
TARGET="x86_64-unknown-freebsd"
|
|
|
|
if [[ ! -f "$SOURCE_DIR/Cargo.toml" ]]; then
|
|
echo "RustProxy source not found. Set RUSTPROXY_SOURCE_DIR to the dynamically fetched checkout." >&2
|
|
exit 1
|
|
fi
|
|
if ! command -v docker >/dev/null 2>&1; then
|
|
echo "Docker is required for cross mode." >&2
|
|
exit 1
|
|
fi
|
|
if ! command -v cross >/dev/null 2>&1; then
|
|
echo "cross is not installed. Install it with: cargo install cross --locked" >&2
|
|
exit 1
|
|
fi
|
|
|
|
cd "$SOURCE_DIR"
|
|
cross build --locked --release --target "$TARGET"
|
|
mkdir -p "$ROOT/dist/cross/$TARGET"
|
|
cp "target/$TARGET/release/rust-proxy" "$ROOT/dist/cross/$TARGET/rust-proxy"
|
|
|
|
echo "Cross-built binary: $ROOT/dist/cross/$TARGET/rust-proxy"
|
|
echo "Do not publish this as the production OPNsense package without validation on the target FreeBSD ABI."
|