- packaging/stockfish.sh fetches the pinned official universal build (SHA-256 checked) for Linux and Windows and the source archive for the release. - deb/rpm/Arch, AppImage, Flatpak, tarball and Windows zip ship it unmodified (AppImage: added after linuxdeploy, packed with appimagetool). - The app resolves the built-in engine at run time (EngineConfig::builtin), adds it on first start (or a system stockfish), and offers engines found on the computer in Settings > Engines. - install.sh installs Stockfish into ~/.local/lib/chesspenguin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
43 lines
2 KiB
Bash
Executable file
43 lines
2 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Builds ChessPenguin-<version>-x86_64.AppImage from target/release/chesspenguin and the
|
|
# Stockfish fetched by `packaging/stockfish.sh linux build/stockfish`.
|
|
# Usage (repository root): VERSION=0.1.0 packaging/build-appimage.sh dist/
|
|
set -euo pipefail
|
|
|
|
app_id="io.github.vrubelroman.chessPenguin"
|
|
out_dir="${1:-dist}"
|
|
version="${VERSION:?set VERSION}"
|
|
work="$(mktemp -d)"
|
|
trap 'rm -rf "${work}"' EXIT
|
|
|
|
curl -fsSL -o "${work}/linuxdeploy" \
|
|
https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
|
|
curl -fsSL -o "${work}/appimagetool" \
|
|
https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
|
|
chmod +x "${work}/linuxdeploy" "${work}/appimagetool"
|
|
|
|
appdir="${work}/AppDir"
|
|
install -Dm755 target/release/chesspenguin "${appdir}/usr/bin/chesspenguin"
|
|
# AppStream metadata is left out: appimagetool validates its screenshot URLs over the network.
|
|
for size in 16 24 32 48 64 128 256 512; do
|
|
install -Dm644 "packaging/icons/hicolor/${size}x${size}/apps/${app_id}.png" \
|
|
"${appdir}/usr/share/icons/hicolor/${size}x${size}/apps/${app_id}.png"
|
|
done
|
|
|
|
# 1. linuxdeploy fills the AppDir (dependencies, AppRun, desktop entry, icon).
|
|
APPIMAGE_EXTRACT_AND_RUN=1 "${work}/linuxdeploy" \
|
|
--appdir "${appdir}" \
|
|
--desktop-file "packaging/${app_id}.desktop" \
|
|
--icon-file "packaging/icons/hicolor/256x256/apps/${app_id}.png"
|
|
|
|
# 2. Stockfish is added afterwards: linuxdeploy would rewrite its RUNPATH, and the bundled
|
|
# engine must stay the unmodified official binary.
|
|
install -Dm755 build/stockfish/stockfish "${appdir}/usr/lib/chesspenguin/stockfish"
|
|
install -Dm644 build/stockfish/Copying.txt "${appdir}/usr/share/licenses/chesspenguin/stockfish-Copying.txt"
|
|
|
|
# 3. appimagetool packs the AppDir as is.
|
|
mkdir -p "${out_dir}"
|
|
output="${out_dir}/ChessPenguin-${version}-x86_64.AppImage"
|
|
ARCH=x86_64 VERSION="${version}" APPIMAGE_EXTRACT_AND_RUN=1 \
|
|
"${work}/appimagetool" --no-appstream "${appdir}" "${output}"
|
|
echo "Built ${output}"
|