|
1 | 1 | # Building FastFlix on Windows |
2 | 2 |
|
3 | | -This guide explains how to build FastFlix executables on Windows. |
| 3 | +This guide explains how to build FastFlix executables and the installer on Windows. |
4 | 4 |
|
5 | 5 | ## Prerequisites |
6 | 6 |
|
7 | 7 | 1. **Python 3.13 or higher** |
8 | 8 | - Download from [python.org](https://www.python.org/downloads/) |
9 | 9 | - Make sure to check "Add Python to PATH" during installation |
10 | 10 |
|
11 | | -2. **Git** (to clone/update the repository) |
12 | | - - Download from [git-scm.com](https://git-scm.com/download/win) |
| 11 | +2. **Go 1.22 or higher** |
| 12 | + - Download from [go.dev](https://go.dev/dl/) |
| 13 | + - Needed for the launcher, installer, and uninstaller binaries |
13 | 14 |
|
14 | | -## Build Steps |
| 15 | +3. **go-winres** (for embedding icons and manifests) |
| 16 | + ```bash |
| 17 | + go install github.com/tc-hib/go-winres@latest |
| 18 | + ``` |
15 | 19 |
|
16 | | -### 1. Open Command Prompt or PowerShell |
| 20 | +4. **uv** (Python package manager) |
| 21 | + ```bash |
| 22 | + pip install uv |
| 23 | + ``` |
17 | 24 |
|
18 | | -Navigate to where you want to clone/have the FastFlix repository: |
| 25 | +5. **Git** (to clone/update the repository) |
| 26 | + - Download from [git-scm.com](https://git-scm.com/download/win) |
19 | 27 |
|
20 | | -```bash |
21 | | -cd C:\path\to\your\projects |
22 | | -git clone https://github.com/cdgriffith/FastFlix.git |
23 | | -cd FastFlix |
24 | | -``` |
| 28 | +## Quick Build (Full Installer) |
25 | 29 |
|
26 | | -Or if you already have it: |
| 30 | +If you just want to build the installer from scratch: |
27 | 31 |
|
28 | 32 | ```bash |
29 | 33 | cd C:\path\to\FastFlix |
30 | | -``` |
31 | 34 |
|
32 | | -### 2. Create and Activate Virtual Environment |
| 35 | +# Install Python dependencies |
| 36 | +uv sync --frozen |
33 | 37 |
|
34 | | -```bash |
35 | | -python -m venv venv |
36 | | -venv\Scripts\activate |
37 | | -``` |
| 38 | +# Install zstandard for archive compression |
| 39 | +uv run pip install zstandard |
38 | 40 |
|
39 | | -You should see `(venv)` in your command prompt. |
| 41 | +# Build the full distribution + archive (downloads embeddable Python, installs deps, builds Go binaries) |
| 42 | +uv run python scripts/build_distribution.py --archive |
40 | 43 |
|
41 | | -### 3. Install Dependencies |
| 44 | +# Generate icon/manifest resources for the installer |
| 45 | +cd cmd\installer |
| 46 | +go-winres make |
| 47 | +cd ..\.. |
42 | 48 |
|
43 | | -```bash |
44 | | -pip install --upgrade pip |
45 | | -pip install -e ".[dev]" |
| 49 | +# Build the installer |
| 50 | +go build -ldflags="-s -w -H windowsgui -X main.Version=6.3.0" -o dist\FastFlix_installer.exe .\cmd\installer |
46 | 51 | ``` |
47 | 52 |
|
48 | | -This installs FastFlix in editable mode with all development dependencies including PyInstaller. |
| 53 | +The installer will be at `dist\FastFlix_installer.exe` (~87 MB). |
49 | 54 |
|
50 | | -### 4. Build the Executable |
| 55 | +## What the Build Script Does |
51 | 56 |
|
52 | | -You have two options: |
| 57 | +`scripts/build_distribution.py --archive` performs these steps automatically: |
53 | 58 |
|
54 | | -#### Option A: Single Executable (Recommended for distribution) |
| 59 | +1. Downloads the official Python 3.13 embeddable distribution (~11 MB) |
| 60 | +2. Configures the embeddable Python to find installed packages |
| 61 | +3. Builds a FastFlix wheel and installs it with all dependencies |
| 62 | +4. Builds the Go launcher (`FastFlix.exe`) and uninstaller (`uninstall.exe`) |
| 63 | +5. Trims unused PySide6 modules (~527 MB savings) |
| 64 | +6. Copies licenses and generates translated terms text |
| 65 | +7. Creates a compressed `tar.zst` archive (~83 MB) |
55 | 66 |
|
56 | | -```bash |
57 | | -pyinstaller FastFlix_Windows_OneFile.spec |
58 | | -``` |
| 67 | +The archive is then embedded into the Go installer binary via `go:embed`. |
59 | 68 |
|
60 | | -The executable will be in: `dist\FastFlix.exe` |
| 69 | +## Building Individual Components |
61 | 70 |
|
62 | | -#### Option B: Directory with Multiple Files (Faster startup) |
| 71 | +### Launcher Only |
63 | 72 |
|
64 | 73 | ```bash |
65 | | -pyinstaller FastFlix_Windows_Installer.spec |
| 74 | +go build -ldflags="-s -w -X main.Version=6.3.0" -o dist\FastFlix\FastFlix.exe .\cmd\launcher |
66 | 75 | ``` |
67 | 76 |
|
68 | | -The executable will be in: `dist\FastFlix\FastFlix.exe` |
| 77 | +### Uninstaller Only |
69 | 78 |
|
70 | | -### 5. Test the Build |
| 79 | +```bash |
| 80 | +cd cmd\uninstaller |
| 81 | +go-winres make |
| 82 | +cd ..\.. |
| 83 | +go build -ldflags="-s -w -H windowsgui" -o dist\FastFlix\uninstall.exe .\cmd\uninstaller |
| 84 | +``` |
| 85 | + |
| 86 | +### Installer Only (requires archive already built) |
71 | 87 |
|
72 | 88 | ```bash |
73 | | -cd dist |
74 | | -FastFlix.exe |
| 89 | +cd cmd\installer |
| 90 | +go-winres make |
| 91 | +cd ..\.. |
| 92 | +go build -ldflags="-s -w -H windowsgui -X main.Version=6.3.0" -o dist\FastFlix_installer.exe .\cmd\installer |
75 | 93 | ``` |
76 | 94 |
|
77 | | -Or for the installer version: |
| 95 | +## Testing the Build |
78 | 96 |
|
79 | 97 | ```bash |
80 | | -cd dist\FastFlix |
81 | | -FastFlix.exe |
| 98 | +# Test launcher |
| 99 | +dist\FastFlix\FastFlix.exe --version |
| 100 | +dist\FastFlix\FastFlix.exe --test |
| 101 | + |
| 102 | +# Launch the full app |
| 103 | +dist\FastFlix\FastFlix.exe |
| 104 | + |
| 105 | +# Test the installer |
| 106 | +dist\FastFlix_installer.exe |
82 | 107 | ``` |
83 | 108 |
|
84 | | -## Running Without Building (For Testing) |
| 109 | +## Running Without Building (For Development) |
85 | 110 |
|
86 | | -If you just want to test changes without building an executable: |
| 111 | +If you just want to test changes without building executables: |
87 | 112 |
|
88 | 113 | ```bash |
| 114 | +uv sync --frozen |
89 | 115 | python -m fastflix |
90 | 116 | ``` |
91 | 117 |
|
92 | 118 | ## Troubleshooting |
93 | 119 |
|
94 | | -### Missing Dependencies |
95 | | - |
96 | | -If you get import errors, try reinstalling: |
| 120 | +### Missing Go |
97 | 121 |
|
| 122 | +If `go build` fails with "go: command not found", ensure Go is installed and in your PATH: |
98 | 123 | ```bash |
99 | | -pip install --upgrade --force-reinstall -e ".[dev]" |
| 124 | +go version |
100 | 125 | ``` |
101 | 126 |
|
102 | | -### Build Errors |
| 127 | +### Missing go-winres |
103 | 128 |
|
104 | | -1. Make sure you're in the FastFlix root directory |
105 | | -2. Ensure the virtual environment is activated (you see `(venv)`) |
106 | | -3. Try deleting `build` and `dist` folders and rebuilding: |
| 129 | +The installer and uninstaller need `go-winres` to embed icons: |
| 130 | +```bash |
| 131 | +go install github.com/tc-hib/go-winres@latest |
| 132 | +``` |
| 133 | + |
| 134 | +### Missing licenses.txt or terms_translations.json |
107 | 135 |
|
| 136 | +These are generated by the build script. If building the installer manually: |
108 | 137 | ```bash |
109 | | -rmdir /s /q build dist |
110 | | -pyinstaller FastFlix_Windows_OneFile.spec |
| 138 | +copy docs\build-licenses.txt cmd\installer\licenses.txt |
| 139 | +uv run python scripts/build_distribution.py --archive |
111 | 140 | ``` |
112 | 141 |
|
| 142 | +### Build Errors |
| 143 | + |
| 144 | +1. Make sure you're in the FastFlix root directory |
| 145 | +2. Try deleting `dist` and rebuilding: |
| 146 | + ```bash |
| 147 | + rmdir /s /q dist |
| 148 | + uv run python scripts/build_distribution.py --archive |
| 149 | + ``` |
| 150 | + |
113 | 151 | ### FFmpeg Not Found |
114 | 152 |
|
115 | | -The FastFlix executable doesn't include FFmpeg. You need to: |
| 153 | +The FastFlix distribution doesn't include FFmpeg. You need to: |
116 | 154 |
|
117 | 155 | 1. Download FFmpeg from [ffmpeg.org](https://ffmpeg.org/download.html#build-windows) |
118 | 156 | 2. Extract it somewhere |
119 | 157 | 3. Add the `bin` folder to your PATH, or configure it in FastFlix settings |
120 | 158 |
|
121 | | -## Known Limitations |
| 159 | +## Architecture |
| 160 | + |
| 161 | +The Windows distribution uses three Go binaries instead of PyInstaller: |
| 162 | + |
| 163 | +| Binary | Purpose | Console | |
| 164 | +|--------|---------|---------| |
| 165 | +| `FastFlix.exe` | Go launcher — sets up Python environment and runs `python.exe -m fastflix` | Yes (for logs) | |
| 166 | +| `uninstall.exe` | Standalone uninstaller — registered with Windows Add/Remove Programs | No (GUI) | |
| 167 | +| `FastFlix_installer.exe` | Dark-themed installer with embedded distribution archive | No (GUI) | |
122 | 168 |
|
123 | | -### PGS to SRT OCR (PyInstaller builds) |
| 169 | +The installer supports two modes: |
| 170 | +- **Install for just me** — installs to `%LOCALAPPDATA%\Programs\FastFlix` (no admin required) |
| 171 | +- **Install for all users** — installs to `%ProgramFiles%\FastFlix` (triggers UAC) |
124 | 172 |
|
125 | | -Due to an upstream issue in pgsrip v0.1.12, PGS to SRT OCR conversion does not work in PyInstaller-built executables. The feature works perfectly when running from source (`python -m fastflix`). |
| 173 | +## Linux/macOS |
126 | 174 |
|
127 | | -If you need PGS OCR functionality, please run FastFlix from source instead of using the compiled executable. |
| 175 | +Linux and macOS builds still use PyInstaller: |
| 176 | + |
| 177 | +```bash |
| 178 | +uv run pyinstaller FastFlix_Nix_OneFile.spec |
| 179 | +``` |
128 | 180 |
|
129 | 181 | ## Notes |
130 | 182 |
|
131 | | -- The build process creates a `portable.py` file temporarily (it's removed after) |
132 | | -- The `.spec` files automatically collect all dependencies from `pyproject.toml` |
133 | | -- The icon is located at `fastflix\data\icon.ico` |
| 183 | +- The Go launcher is built as a **console app** (not GUI) so users can see log output |
| 184 | +- The installer and uninstaller are built with `-H windowsgui` (no console window) |
| 185 | +- Icons are embedded via `go-winres` — `.syso` files are gitignored |
| 186 | +- The distribution archive uses Zstandard compression (level 22) for best ratio |
| 187 | +- PySide6 trimming removes WebEngine (193 MB), Quick/QML, 3D, Designer, and other unused Qt modules |
0 commit comments