Files
PDF-Downloaders/Scribd/BUILD.md
T

169 lines
4.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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.
#### Your current runner
| Runner ID | Labels | Can build |
|-----------|--------|-----------|
| `b0c969454d0f` | `ubuntu-latest`, `ubuntu-24.04`, `ubuntu-22.04` | **Linux only** |
With this setup, **Build Scribd** runs only the **linux** job on push/PR (no stuck Windows/macOS jobs).
To add more platforms later, register runners with:
| Label | Platform |
|-------|----------|
| `windows-latest` | Windows `.zip` |
| `macos-latest` | macOS `.app` zip |
Then use **Run workflow** and enable **build_windows** / **build_macos**, or run **Build Scribd (all platforms)**.
4. Open **Actions** → **Build Scribd** → **Run workflow** (or push to `main`).
Download artifact **`scribd-linux`** → `Scribd-PDF-Downloader-Linux.tar.gz`.
### Workflows (repo root)
```
.gitea/workflows/build-scribd.yml # default CI (Linux on push)
.gitea/workflows/build-scribd-multiplatform.yml # manual: all 3 OS (needs 3 runners)
.gitea/workflows/release-scribd.yml # tagged releases
.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-windows` | `Scribd-PDF-Downloader-Windows.zip` |
| `scribd-macos` | `Scribd-PDF-Downloader-macOS.zip` |
| `scribd-linux` | `Scribd-PDF-Downloader-Linux.tar.gz` |
> **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.