add installer to build package

This commit is contained in:
olcxja 2026-09-25 20:38:23 +02:00
commit ada55faf13
88 changed files with 10828 additions and 25 deletions

View file

@ -7,30 +7,47 @@ OUT="build/PLWL-$VERSION.tar.gz"
bash tools/svg2png.sh renderer/plwl.svg renderer/plwl.png 256
rm -rf build/dist
mkdir -p build/dist/PLWL build/files
cp -r src renderer tools files package.json build/dist/PLWL/
cp -r files/translations build/files/ 2>/dev/null || true
# 1. Electron runtime is the base of the release (the binary detects
# resources/app.asar automatically, so the whole app lives inside the asar).
if [ ! -d node_modules/electron/dist ]; then
npm install
fi
mkdir -p build/dist/PLWL/node_modules/electron
cp -r node_modules/electron/dist build/dist/PLWL/node_modules/electron/
cp node_modules/electron/package.json build/dist/PLWL/node_modules/electron/
cp package.json build/dist/PLWL/
cp package-lock.json build/dist/PLWL/ 2>/dev/null || true
cat > build/dist/PLWL/run.sh << 'EOF'
rm -rf build/dist
mkdir -p build/dist/PLWL
cp -r node_modules/electron/dist build/dist/PLWL/electron
# 2. Pack the app payload (code + renderer + bundled files) into app.asar.
STAGE=build/dist/.app-stage
mkdir -p "$STAGE"
cp -r src renderer files package.json "$STAGE/"
npx asar pack "$STAGE" build/dist/PLWL/electron/resources/app.asar
rm -rf "$STAGE"
# 3. Launcher, desktop entry and installer.
cat > build/dist/PLWL/plwl << 'EOF'
#!/usr/bin/env bash
set -e
cd "$(dirname "$0")"
bash tools/svg2png.sh renderer/plwl.svg renderer/plwl.png 256
exec ./node_modules/electron/dist/electron . "$@"
exec ./electron/electron . "$@"
EOF
chmod +x build/dist/PLWL/run.sh
chmod +x build/dist/PLWL/plwl
cat > build/dist/PLWL/plwl.desktop << 'EOF'
[Desktop Entry]
Type=Application
Name=PLWL
Comment=Portable Linux Wine Launcher
Exec=plwl
Icon=plwl
Terminal=false
Categories=Game;
EOF
cp tools/install.sh build/dist/PLWL/install.sh
chmod +x build/dist/PLWL/install.sh
# 4. Tarball.
mkdir -p build
tar -czf "$OUT" -C build/dist PLWL
rm -rf build/dist