Files
PDF-Downloaders/Scribd/BUILD.md
T

173 lines
5.1 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.
#### Runners (match your other repos)
**Build Scribd** runs three jobs in parallel:
| Job | `runs-on` label | Artifact |
|-----|-----------------|----------|
| Linux | `ubuntu-latest` | `Scribd-PDF-Downloader-Linux.tar.gz` |
| Windows | `windows-latest` | `Scribd-PDF-Downloader-Windows.zip` |
| macOS | `macos-latest` | `Scribd-PDF-Downloader-macOS.zip` |
Your runner `b0c969454d0f` currently lists `ubuntu-latest` only. If other repos build all OSes on the same host, add the same labels there (Gitea **Admin → Actions → Runners → edit labels**, or in `act_runner` config):
```yaml
# Example act_runner config (same pattern as your other repos)
labels:
- "ubuntu-latest:docker://node:20-bookworm"
- "windows-latest:docker://..." # Windows container image your infra uses
- "macos-latest:docker://..." # macOS VM or remote runner
```
Use the **exact label names** that work on your other repositories.
4. Open **Actions** → **Build Scribd** (runs on every push to `main` under `Scribd/`).
Download artifacts: `scribd-windows`, `scribd-macos`, `scribd-linux`.
### 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-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.