Add cross-compilation support for Linux and Windows

- Add Docker-based build system for cross-compiling on Apple Silicon
- Create Dockerfiles for Linux x86_64 and ARM64, Windows x86_64
- Add build-all.sh script for automated multi-platform builds
- Configure cargo-deb and cargo-generate-rpm for Linux packaging
- Update README with cross-compilation instructions

Supported outputs:
- Linux x86_64: .deb, .rpm, .tar.gz
- Windows x86_64: .zip

Note: Linux ARM64 disabled due to upstream zune-jpeg NEON bug
This commit is contained in:
cottongin
2026-02-05 08:21:42 -05:00
parent 054deb873d
commit cde8ae5626
8 changed files with 239 additions and 0 deletions

View File

@@ -85,6 +85,51 @@ Three test files are included:
- `Highlander-IMustFlipSmaller-OG.gif` - Animated GIF without transparency
- `BTS-240-art.gif` - Animated GIF with transparency (1-bit alpha)
## Cross-Compilation (Build for Linux/Windows from macOS)
Build distributable packages for multiple platforms from a single machine.
### Prerequisites
```bash
# Install build tools
cargo install cross cargo-deb cargo-generate-rpm
# Ensure Docker Desktop is installed and running
docker info
```
### Docker Configuration (Apple Silicon Mac)
Before cross-compiling, configure Docker Desktop to share the Homebrew path:
1. Open Docker Desktop
2. Go to **Settings****Resources****File Sharing**
3. Add `/opt/homebrew` to the shared paths
4. Click **Apply & Restart**
### Building
```bash
# First-time setup: Build Docker images
./scripts/build-all.sh --setup-docker
# Build all targets
./scripts/build-all.sh
```
### Output
After building, packages are in `dist/<version>/`:
| Platform | Files | Notes |
|----------|-------|-------|
| Linux x86_64 | `.deb`, `.rpm`, `.tar.gz` | Cross-compiled |
| Linux ARM64 | `.tar.gz` | Build natively on ARM64 Linux |
| Windows x86_64 | `.zip` | Cross-compiled |
**Note:** Linux ARM64 cross-compilation is disabled due to an upstream `zune-jpeg` NEON bug. Build ARM64 natively on a Linux ARM64 system.
## Architecture
```
@@ -105,6 +150,9 @@ avif-maker/
│ ├── drop_zone.rs # Drag-and-drop area
│ ├── settings.rs # Settings panel
│ └── queue.rs # Job queue display
├── docker/ # Cross-compilation Dockerfiles
├── scripts/
│ └── build-all.sh # Build script for all platforms
└── Cargo.toml
```