35 lines
861 B
Bash
Executable File
35 lines
861 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
cd "$ROOT"
|
|
|
|
case "$(uname -s)" in
|
|
Linux) ;;
|
|
*) echo "wrong platform: $(uname -s), use cargo xtask build" >&2; exit 1;;
|
|
esac
|
|
|
|
BUILD="$ROOT/build"
|
|
|
|
echo "Building Rust binary (release)..."
|
|
cargo build --release --bin yr_crystals
|
|
|
|
BIN="/tmp/yr_crystals-target/release/yr_crystals"
|
|
if [ ! -f "$BIN" ]; then
|
|
echo "ERROR: yr_crystals binary not found at $BIN" >&2
|
|
exit 1
|
|
fi
|
|
|
|
mkdir -p "$BUILD/bin" "$BUILD/icons"
|
|
cp "$BIN" "$BUILD/bin/yr_crystals"
|
|
|
|
SVG="$ROOT/assets/Icon.svg"
|
|
if [ -f "$SVG" ] && command -v rsvg-convert >/dev/null 2>&1; then
|
|
echo "Generating icon PNGs..."
|
|
for size in 32 64 128 256 512; do
|
|
rsvg-convert --width="$size" --height="$size" "$SVG" -o "$BUILD/icons/yr_crystals_${size}.png"
|
|
done
|
|
fi
|
|
|
|
echo "Built: $BUILD/bin/yr_crystals"
|