45 lines
1.5 KiB
Bash
45 lines
1.5 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
VER="${1:?version folder, e.g., v4}"
|
|
BINPATH="${2:-server-ui/target/release/avidaed_onefile}"
|
|
case "$VER" in
|
|
v3) APP_ASSET_DIR="apps/v3/Avida-ED" ;;
|
|
v4) APP_ASSET_DIR="apps/v4/Avida-ED-Eco" ;;
|
|
*) echo "error: unsupported version: $VER" >&2; exit 2 ;;
|
|
esac
|
|
|
|
if ! command -v appimagetool >/dev/null 2>&1; then
|
|
echo "error: appimagetool is required to build the Linux AppImage" >&2
|
|
echo "Install appimagetool or run only 'make VER=${VER} build-linux' to build the Linux binary." >&2
|
|
exit 127
|
|
fi
|
|
|
|
if [ ! -x "$BINPATH" ]; then
|
|
echo "error: Linux binary not found or not executable: $BINPATH" >&2
|
|
exit 2
|
|
fi
|
|
|
|
APPDIR="AvidaED-${VER}.AppDir"
|
|
rm -rf "$APPDIR"; mkdir -p "$APPDIR/usr/bin" "$APPDIR/usr/share/icons/hicolor/256x256/apps"
|
|
cp "$BINPATH" "$APPDIR/usr/bin/avidaed_onefile"
|
|
cp "$(dirname "$0")/AppRun" "$APPDIR/AppRun"
|
|
chmod +x "$APPDIR/AppRun"
|
|
cp "$(dirname "$0")/desktop/avidaed.desktop" "$APPDIR/avidaed.desktop"
|
|
|
|
if [ -f "$APP_ASSET_DIR/avida-ed-icon.png" ]; then
|
|
cp "$APP_ASSET_DIR/avida-ed-icon.png" "$APPDIR/avidaed.png"
|
|
else
|
|
convert -size 256x256 xc:white "$APPDIR/avidaed.png" 2>/dev/null || true
|
|
fi
|
|
cp "$APPDIR/avidaed.png" "$APPDIR/usr/share/icons/hicolor/256x256/apps/avidaed.png"
|
|
|
|
APPIMAGETOOL_ARGS=()
|
|
if [ -n "${APPIMAGETOOL_RUNTIME_FILE:-}" ]; then
|
|
APPIMAGETOOL_ARGS+=(--runtime-file "$APPIMAGETOOL_RUNTIME_FILE")
|
|
fi
|
|
|
|
OUTFILE="Avida-ED-${VER}-Linux-x86_64.AppImage"
|
|
rm -f "$OUTFILE"
|
|
appimagetool "${APPIMAGETOOL_ARGS[@]}" "$APPDIR" "$OUTFILE"
|
|
echo "Wrote $OUTFILE"
|