#!/usr/bin/env bash # Runs inside Dockerfile.cross-win — produces dist/Scribd-PDF-Downloader-Windows.zip set -euo pipefail export DISPLAY="${DISPLAY:-:99}" Xvfb "$DISPLAY" -screen 0 1280x720x24 & XVFB_PID=$! trap "kill $XVFB_PID 2>/dev/null || true" EXIT cd /src WIN_PY='wine64 C:\\Python312\\python.exe' echo "=== Upgrading pip (Wine / Windows Python) ===" $WIN_PY -m pip install --upgrade pip wheel setuptools echo "=== Installing build dependencies (Windows wheels via Wine pip) ===" $WIN_PY -m pip install -r requirements-build.txt echo "=== Installing Chromium for Windows (inside Wine) ===" export PLAYWRIGHT_BROWSERS_PATH=0 $WIN_PY -m playwright install chromium echo "=== Running PyInstaller (Windows .exe) ===" $WIN_PY -m PyInstaller --noconfirm --clean build/scribd_gui.spec DIST_DIR="/src/dist/Scribd PDF Downloader" ZIP="/src/dist/Scribd-PDF-Downloader-Windows.zip" if [[ ! -d "$DIST_DIR" ]]; then echo "ERROR: Expected output folder not found: $DIST_DIR" ls -la /src/dist/ || true exit 1 fi cp -f /src/config.ini "$DIST_DIR/" 2>/dev/null || true rm -f "$ZIP" (cd /src/dist && zip -r "$(basename "$ZIP")" "Scribd PDF Downloader") echo "=== SUCCESS: $ZIP ===" ls -lh "$ZIP"