64 lines
2.1 KiB
Bash
Executable File
64 lines
2.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Compila jlauncher a un binario standalone con Nuitka y empaqueta un tar.gz de release.
|
|
# Requisitos del sistema: python3-dev, gcc, patchelf (ver README).
|
|
set -euo pipefail
|
|
|
|
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
cd "$HERE"
|
|
|
|
VERSION="$(sed -n 's/^__version__[[:space:]]*=[[:space:]]*"\([^"]*\)".*/\1/p' jlauncher/__init__.py | head -n1)"
|
|
if [ -z "$VERSION" ]; then
|
|
echo "[build] no se pudo leer __version__ de jlauncher/__init__.py" >&2
|
|
exit 1
|
|
fi
|
|
ARCH="$(uname -m)"
|
|
OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
|
|
RELEASE_NAME="jlauncher-v${VERSION}-${OS}-${ARCH}"
|
|
|
|
if [ ! -d .venv ]; then
|
|
echo "[build] creando venv…"
|
|
python3 -m venv .venv
|
|
.venv/bin/pip install --quiet --upgrade pip
|
|
fi
|
|
|
|
echo "[build] sincronizando dependencias…"
|
|
.venv/bin/pip install --quiet -r requirements.txt
|
|
|
|
if ! .venv/bin/python -c "import nuitka" 2>/dev/null; then
|
|
echo "[build] instalando nuitka en el venv…"
|
|
.venv/bin/pip install --quiet "nuitka[onefile]"
|
|
fi
|
|
|
|
# zstandard habilita la compresión del onefile (binario mucho más pequeño).
|
|
if ! .venv/bin/python -c "import zstandard" 2>/dev/null; then
|
|
echo "[build] instalando zstandard (compresión onefile)…"
|
|
.venv/bin/pip install --quiet zstandard
|
|
fi
|
|
|
|
echo "[build] versión: v${VERSION}"
|
|
echo "[build] limpiando artefactos previos…"
|
|
rm -rf dist build app.build app.dist app.onefile-build
|
|
|
|
echo "[build] compilando (PySide6 onefile; puede tardar varios minutos)…"
|
|
.venv/bin/python -m nuitka \
|
|
--onefile \
|
|
--assume-yes-for-downloads \
|
|
--enable-plugin=pyside6 \
|
|
--include-package=jlauncher \
|
|
--output-dir=dist \
|
|
--output-filename=jlauncher \
|
|
--remove-output \
|
|
--lto=yes \
|
|
app.py
|
|
|
|
echo "[build] copiando games.toml junto al binario…"
|
|
cp games.toml dist/games.toml
|
|
|
|
echo "[build] empaquetando release ${RELEASE_NAME}.tar.gz…"
|
|
tar -czf "dist/${RELEASE_NAME}.tar.gz" -C dist jlauncher games.toml
|
|
|
|
echo "[build] hecho:"
|
|
ls -lh "dist/jlauncher" "dist/games.toml" "dist/${RELEASE_NAME}.tar.gz"
|
|
echo "[build] el binario crea jlauncher_data/ y settings.json junto a sí mismo."
|
|
echo "[build] distribuir: descomprimir el tar.gz (jlauncher + games.toml juntos)."
|