196 lines
5.8 KiB
Markdown
196 lines
5.8 KiB
Markdown
# Building installable apps
|
||
|
||
You can ship **Scribd PDF Downloader** as a standalone app on Windows and macOS. Each platform must be built **on that OS** (you cannot build a Mac `.app` from Windows).
|
||
|
||
| Platform | Output | Build machine |
|
||
|----------|--------|---------------|
|
||
| Windows | `dist/Scribd PDF Downloader/Scribd PDF Downloader.exe` + zip | Windows PC |
|
||
| macOS | `dist/Scribd PDF Downloader.app` + zip | MacBook Pro / any Mac |
|
||
| Linux | `dist/Scribd PDF Downloader/` + `.tar.gz` | Linux PC |
|
||
|
||
The app bundles **Python + Chromium** (~200–850 MB). No separate Python install is required on the target machine.
|
||
|
||
---
|
||
|
||
## CI builds (Gitea / GitHub Actions)
|
||
|
||
Automated builds for **Windows, macOS, and Linux** run from the repo root.
|
||
|
||
| Workflow | Trigger | Output |
|
||
|----------|---------|--------|
|
||
| **Build Scribd** | Push to `main`, PR, or manual | Artifacts per OS |
|
||
| **Release Scribd** | Tag `v*` (e.g. `v1.0.0`) | Gitea Release with all zips |
|
||
|
||
### Enable on Gitea (git.masengr.com)
|
||
|
||
1. **Site admin:** enable **Actions** for the instance.
|
||
2. **Repo → Settings → Actions:** allow workflows.
|
||
3. Register **act runners** with the right labels.
|
||
|
||
#### Runners (match your other repos)
|
||
|
||
**Build Scribd** on your **Linux runner** (`ubuntu-latest`) runs three jobs:
|
||
|
||
| Job | Artifact | How |
|
||
|-----|----------|-----|
|
||
| **Linux** | `Scribd-PDF-Downloader-Linux.tar.gz` | Native PyInstaller |
|
||
| **Windows (.exe)** | `Scribd-PDF-Downloader-Windows.zip` | **Docker + Wine** cross-build |
|
||
| **Windows portable** | `Scribd-PDF-Downloader-Windows-Portable.zip` | Source + install `.bat` (fallback) |
|
||
|
||
### Windows `.exe` from Linux (Docker + Wine)
|
||
|
||
CI runs `build/ci/docker-build-windows.sh`, which:
|
||
|
||
1. Builds image `build/docker/Dockerfile.cross-win` (Ubuntu + Wine + Windows Python 3.12)
|
||
2. Installs dependencies and Playwright **Windows** Chromium inside Wine
|
||
3. Runs **PyInstaller** inside Wine → real `Scribd PDF Downloader.exe`
|
||
|
||
**Runner requirement:** Docker must be available to the act runner (socket mounted, user in `docker` group).
|
||
|
||
Test locally on Linux:
|
||
|
||
```bash
|
||
cd Scribd
|
||
chmod +x build/ci/docker-build-windows.sh
|
||
./build/ci/docker-build-windows.sh
|
||
```
|
||
|
||
This is **experimental** — Wine builds can be slow (~20–40 min) or fail on some packages. If it fails, use **scribd-windows-portable** or build on Windows with `.\build\windows\build.ps1`.
|
||
|
||
### macOS from Linux?
|
||
|
||
**Not supported.** macOS `.app` bundles require Xcode/tooling on real macOS (or a `macos-latest` runner).
|
||
|
||
### Windows portable zip (fallback)
|
||
|
||
1. Download artifact **`scribd-windows-portable`**
|
||
2. Extract on a Windows PC
|
||
3. Run **`Install Scribd Downloader.bat`** (installs Python deps + Chromium once, then opens GUI)
|
||
|
||
### Linux CI artifact
|
||
|
||
```bash
|
||
tar -xzf Scribd-PDF-Downloader-Linux.tar.gz
|
||
./Scribd\ PDF\ Downloader/Scribd\ PDF\ Downloader
|
||
```
|
||
|
||
4. Open **Actions** → **Build Scribd** on push to `main`.
|
||
|
||
### Workflows (repo root)
|
||
|
||
```
|
||
.gitea/workflows/build-scribd.yml # Windows + macOS + Linux on push
|
||
.gitea/workflows/release-scribd.yml # all platforms on tag v*
|
||
.github/workflows/build-scribd.yml # GitHub mirror
|
||
```
|
||
|
||
CI scripts live in `Scribd/build/ci/` (`build-windows.ps1`, `build-unix.sh`).
|
||
|
||
### Create a release
|
||
|
||
```bash
|
||
git tag v1.0.0
|
||
git push origin v1.0.0
|
||
```
|
||
|
||
Optional: add repo secret **`GITEA_TOKEN`** (releases scope) for `release-scribd.yml`.
|
||
|
||
### Artifact names
|
||
|
||
| Artifact | File |
|
||
|----------|------|
|
||
| `scribd-linux` | `Scribd-PDF-Downloader-Linux.tar.gz` |
|
||
| `scribd-windows` | `Scribd-PDF-Downloader-Windows.zip` (`.exe` inside folder) |
|
||
| `scribd-windows-portable` | `Scribd-PDF-Downloader-Windows-Portable.zip` |
|
||
|
||
> **Note:** Each archive is large (~500–900 MB) because Chromium is bundled. Hosted runners may hit artifact size limits; self-hosted runners avoid that.
|
||
|
||
---
|
||
|
||
## Windows (.exe)
|
||
|
||
1. Open **PowerShell** in the project folder.
|
||
2. Run:
|
||
|
||
```powershell
|
||
.\build\windows\build.ps1
|
||
```
|
||
|
||
3. When finished:
|
||
- **Folder:** `dist\Scribd PDF Downloader\`
|
||
- **Zip:** `dist\Scribd-PDF-Downloader-Windows.zip`
|
||
|
||
Copy the whole folder (or unzip the archive) to any Windows PC and run **Scribd PDF Downloader.exe**.
|
||
|
||
---
|
||
|
||
## macOS (.app)
|
||
|
||
On your **MacBook Pro** (or any Mac):
|
||
|
||
```bash
|
||
chmod +x build/macos/build.sh
|
||
./build/macos/build.sh
|
||
```
|
||
|
||
Outputs:
|
||
|
||
- **App:** `dist/Scribd PDF Downloader.app`
|
||
- **Zip:** `dist/Scribd-PDF-Downloader-macOS.zip`
|
||
|
||
### First launch on Mac
|
||
|
||
macOS may block unsigned apps:
|
||
|
||
1. Right-click the app → **Open** → **Open** again, or
|
||
2. **System Settings → Privacy & Security → Open Anyway**
|
||
|
||
### Optional: ad-hoc sign (reduces warnings)
|
||
|
||
```bash
|
||
codesign --force --deep --sign - "dist/Scribd PDF Downloader.app"
|
||
```
|
||
|
||
For distribution outside your Mac, use an **Apple Developer ID** certificate and notarize the app.
|
||
|
||
---
|
||
|
||
## Linux
|
||
|
||
```bash
|
||
chmod +x build/ci/build-unix.sh
|
||
./build/ci/build-unix.sh
|
||
```
|
||
|
||
Output: `dist/Scribd-PDF-Downloader-Linux.tar.gz`
|
||
|
||
Extract and run:
|
||
|
||
```bash
|
||
tar -xzf dist/Scribd-PDF-Downloader-Linux.tar.gz -C dist
|
||
./dist/Scribd\ PDF\ Downloader/Scribd\ PDF\ Downloader
|
||
```
|
||
|
||
Requires a desktop environment (GUI uses tkinter).
|
||
|
||
---
|
||
|
||
## Troubleshooting builds
|
||
|
||
| Issue | Fix |
|
||
|-------|-----|
|
||
| `pyinstaller` not found | Run build script again (installs `requirements-build.txt`) |
|
||
| Chromium missing at runtime | Rebuild after `PLAYWRIGHT_BROWSERS_PATH=0 playwright install chromium` |
|
||
| Windows SmartScreen | Expected for unsigned exe; click **More info → Run anyway** |
|
||
| Mac “damaged” message | Run `xattr -cr "dist/Scribd PDF Downloader.app"` or ad-hoc sign above |
|
||
|
||
---
|
||
|
||
## What gets built
|
||
|
||
- **GUI only** (`gui.py`) — same as **Start Scribd Downloader.bat**
|
||
- **config.ini** copied next to the executable
|
||
- **session.json** and downloaded PDFs are saved in the same folder as the `.exe` / `.app`
|
||
|
||
Command-line use (`main.py`) is not included in the frozen build; use the source project with `.venv` for CLI.
|