Add Docker+Wine Windows cross-build from Linux CI
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
2e36b189cf
commit
56f1f058ae
8 files changed
+184
-24
No files matched your search
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build a real Windows .exe from Linux using Docker + Wine.
|
||||
# Requires: docker, run from Scribd/ project root (or repo sets working-directory).
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
IMAGE="scribd-cross-win-builder"
|
||||
|
||||
echo "=== Docker: build Windows image ==="
|
||||
docker build -f build/docker/Dockerfile.cross-win -t "$IMAGE" .
|
||||
|
||||
echo "=== Docker: run Windows cross-build ==="
|
||||
docker run --rm --platform linux/amd64 \
|
||||
-v "$ROOT:/src" \
|
||||
-w /src \
|
||||
"$IMAGE"
|
||||
|
||||
if [[ ! -f "$ROOT/dist/Scribd-PDF-Downloader-Windows.zip" ]]; then
|
||||
echo "ERROR: dist/Scribd-PDF-Downloader-Windows.zip was not created"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Done: $ROOT/dist/Scribd-PDF-Downloader-Windows.zip"
|
||||
@@ -0,0 +1,41 @@
|
||||
#!/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"
|
||||
@@ -0,0 +1,34 @@
|
||||
# Build Windows PyInstaller bundle from Linux using Wine + Windows Python.
|
||||
# Used by: build/ci/docker-build-windows.sh
|
||||
|
||||
FROM ubuntu:22.04
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV WINEARCH=win64
|
||||
ENV WINEPREFIX=/root/.wine
|
||||
ENV WINEDEBUG=-all
|
||||
|
||||
RUN dpkg --add-architecture i386 \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
wine64 wine32 winbind \
|
||||
wget curl ca-certificates unzip zip \
|
||||
python3 python3-pip python3-venv \
|
||||
xvfb \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Initialize Wine (needed for silent Python install)
|
||||
RUN wineboot --init && sleep 10 || true
|
||||
|
||||
# Install Windows Python 3.12 into the Wine prefix
|
||||
RUN wget -q https://www.python.org/ftp/python/3.12.7/python-3.12.7-amd64.exe -O /tmp/python-installer.exe \
|
||||
&& wine64 /tmp/python-installer.exe /quiet InstallAllUsers=0 PrependPath=0 Include_pip=1 TargetDir=C:\\Python312 \
|
||||
&& rm /tmp/python-installer.exe
|
||||
|
||||
ENV WIN_PY="wine64 C:\\Python312\\python.exe"
|
||||
|
||||
WORKDIR /src
|
||||
COPY build/ci/docker-entrypoint-win.sh /docker-entrypoint-win.sh
|
||||
RUN chmod +x /docker-entrypoint-win.sh
|
||||
|
||||
ENTRYPOINT ["/docker-entrypoint-win.sh"]
|
||||
Reference in new issue
Block a user