49 lines
1.4 KiB
Bash
49 lines
1.4 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
source "$ROOT/scripts/_build-dirs.sh"
|
|
cd "$ROOT"
|
|
|
|
case "$(uname -s)" in
|
|
Linux) ;;
|
|
*) echo "wrong platform: $(uname -s) — use cargo xtask build" >&2; exit 1;;
|
|
esac
|
|
|
|
# pick winit backend(s), defaulting to both x11 and wayland unless ACORD_FEATURES overrides.
|
|
detect_features() {
|
|
if [ -n "${ACORD_FEATURES:-}" ]; then
|
|
echo "$ACORD_FEATURES"
|
|
return
|
|
fi
|
|
echo ""
|
|
}
|
|
|
|
FEATURES="$(detect_features)"
|
|
echo "build: XDG_CURRENT_DESKTOP=${XDG_CURRENT_DESKTOP:-<unset>}, WAYLAND_DISPLAY=${WAYLAND_DISPLAY:-<unset>}"
|
|
|
|
if [ -n "$FEATURES" ]; then
|
|
echo "build: forcing features = $FEATURES"
|
|
cargo build --release -p acord-linux --no-default-features --features "$FEATURES"
|
|
else
|
|
echo "build: linking both x11 and wayland backends"
|
|
cargo build --release -p acord-linux
|
|
fi
|
|
|
|
STAGE="$ROOT/build/bin"
|
|
mkdir -p "$STAGE"
|
|
|
|
cp "$CARGO_TARGET_DIR/release/acord" "$STAGE/Acord"
|
|
chmod +x "$STAGE/Acord"
|
|
|
|
# rasterize the SVG icon next to the binary.
|
|
if command -v rsvg-convert >/dev/null 2>&1 && [ -f "$ROOT/assets/Acord.svg" ]; then
|
|
rsvg-convert --width 256 --height 256 "$ROOT/assets/Acord.svg" -o "$STAGE/icon.png"
|
|
else
|
|
echo "rsvg-convert not found or assets/Acord.svg missing — skipping icon"
|
|
fi
|
|
|
|
[ -f "$ROOT/LICENCE" ] && cp "$ROOT/LICENCE" "$STAGE/LICENCE"
|
|
|
|
echo "Built: $STAGE/Acord"
|