Add macOS packaging with .dmg and .app bundle

- Add cargo-bundle configuration for macOS app bundle
- Create placeholder app icon (blue with "A" letter)
- Update build-all.sh to create .dmg and .app.zip
- Update README with new build output table

macOS packages:
- .dmg: Disk image for drag-to-Applications install
- .app.zip: Zipped app bundle alternative
This commit is contained in:
cottongin
2026-02-05 09:58:26 -05:00
parent cde8ae5626
commit b9c0c4feda
4 changed files with 53 additions and 10 deletions

View File

@@ -55,3 +55,18 @@ assets = [
]
[package.metadata.generate-rpm.requires]
ffmpeg = "*"
[package.metadata.bundle]
name = "AVIF Maker"
identifier = "com.cottongin.avif-maker"
icon = ["resources/AppIcon.icns"]
version = "0.1.0"
copyright = "Copyright © 2026 cottongin. All rights reserved."
category = "public.app-category.graphics-design"
short_description = "Convert images and videos to AVIF format"
long_description = """
AVIF Maker is a native desktop application for converting images and videos
to the AVIF format. It supports PNG, JPEG, WebP, GIF (animated), and video
files. Features include quality settings, speed presets, and batch processing.
"""
osx_minimum_system_version = "10.14"

View File

@@ -85,23 +85,23 @@ 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)
## Building Distributable Packages
Build distributable packages for multiple platforms from a single machine.
Build distributable packages for multiple platforms from a single macOS machine.
### Prerequisites
```bash
# Install build tools
cargo install cross cargo-deb cargo-generate-rpm
cargo install cargo-bundle
# Ensure Docker Desktop is installed and running
# Ensure Docker Desktop is installed and running (for Linux/Windows builds)
docker info
```
### Docker Configuration (Apple Silicon Mac)
Before cross-compiling, configure Docker Desktop to share the Homebrew path:
Before cross-compiling Linux/Windows targets, configure Docker Desktop to share the Homebrew path:
1. Open Docker Desktop
2. Go to **Settings****Resources****File Sharing**
@@ -111,10 +111,10 @@ Before cross-compiling, configure Docker Desktop to share the Homebrew path:
### Building
```bash
# First-time setup: Build Docker images
# First-time setup: Build Docker images (for Linux/Windows targets)
./scripts/build-all.sh --setup-docker
# Build all targets
# Build all targets (macOS, Linux, Windows)
./scripts/build-all.sh
```
@@ -124,9 +124,10 @@ 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 |
| macOS | `.dmg`, `.app.zip` | Native build |
| Linux x86_64 | `.deb`, `.rpm`, `.tar.gz` | Cross-compiled via Docker |
| Linux ARM64 | — | Build natively on ARM64 Linux |
| Windows x86_64 | `.zip` | Cross-compiled via Docker |
**Note:** Linux ARM64 cross-compilation is disabled due to an upstream `zune-jpeg` NEON bug. Build ARM64 natively on a Linux ARM64 system.
@@ -150,6 +151,8 @@ avif-maker/
│ ├── drop_zone.rs # Drag-and-drop area
│ ├── settings.rs # Settings panel
│ └── queue.rs # Job queue display
├── resources/
│ └── AppIcon.icns # macOS app icon
├── docker/ # Cross-compilation Dockerfiles
├── scripts/
│ └── build-all.sh # Build script for all platforms

BIN
resources/AppIcon.icns Normal file

Binary file not shown.

View File

@@ -83,6 +83,31 @@ docker run --rm --platform linux/amd64 \
zip -j "$DIST_DIR/avif-maker-$VERSION-windows-x86_64.zip" \
target/x86_64-pc-windows-gnu/release/avif-maker.exe
# macOS (native build)
echo ""
echo "Building macOS..."
cargo build --release
# Create .app bundle
echo "Creating .app bundle..."
cargo bundle --release
# Find the .app bundle
APP_PATH="target/release/bundle/osx/AVIF Maker.app"
if [[ -d "$APP_PATH" ]]; then
# Create DMG
echo "Creating DMG..."
DMG_NAME="avif-maker-$VERSION-macos.dmg"
rm -f "$DIST_DIR/$DMG_NAME"
hdiutil create -volname "AVIF Maker" -srcfolder "$APP_PATH" -ov -format UDZO "$DIST_DIR/$DMG_NAME"
# Also create a zip of the .app for those who prefer it
echo "Creating .app zip..."
(cd "target/release/bundle/osx" && zip -r "../../../../$DIST_DIR/avif-maker-$VERSION-macos.app.zip" "AVIF Maker.app")
else
echo "Warning: .app bundle not found at expected path"
fi
echo ""
echo "================================"
echo "Build complete! Artifacts in $DIST_DIR/"