catacomb/docs/PACKAGING.md
Luna 91ca20d687 Per-distro packaging: .deb / .rpm / AppImage + CI (1.8)
Ships beyond the Arch PKGBUILD so non-Arch users can install without a
Rust toolchain.

## Package metadata (Cargo.toml)

- [package.metadata.deb] for cargo-deb: declares the runtime subprocess
  deps (yt-dlp, ffmpeg, mpv, xdg-utils) that auto-detection can't find,
  plus libxcb1/libc6 link deps and libnotify4 as recommended.
- [package.metadata.generate-rpm] for cargo-generate-rpm with the
  RPM-distro dep names.
- Filled in license / repository / authors / readme package fields.

## scripts/package.sh

One entry point: `scripts/package.sh [deb|rpm|appimage|all]`. Builds the
release binary once and reuses it. Installs cargo-deb / cargo-generate-rpm
on demand; downloads appimagetool to dist/tools/ on first AppImage build.
Per-format failures are isolated and summarized at the end rather than
aborting the run. Output to dist/ (gitignored).

AppImage is hand-rolled (AppDir + AppRun + root desktop/icon) and bundles
only the GUI binary's shared-lib closure — yt-dlp/ffmpeg/mpv stay host
PATH deps, same as the package declarations.

## CI

.forgejo/workflows/release.yml builds all formats on a v* tag push and
attaches them to the Codeberg release via actions/forgejo-release. Manual
workflow_dispatch builds without uploading for smoke testing. Sets
APPIMAGE_EXTRACT_AND_RUN since CI containers lack FUSE.

## docs/PACKAGING.md

Per-format build + install instructions, the Arch PKGBUILD pointer, and
an honest Windows/macOS section: both are blocked on the Linux-only tray
(ksni) + file-picker (rfd xdg-portal) deps needing per-OS abstraction.
The rest of the stack already cross-compiles.

Verified .deb (dpkg control + payload correct) and .rpm (payload correct)
build cleanly through the script on this host.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-31 16:46:57 -07:00

3.4 KiB

Packaging yt-offline

This document covers building distributable packages. The one-liner:

scripts/package.sh all     # .deb + .rpm + .AppImage into dist/
scripts/package.sh deb     # just the .deb
scripts/package.sh rpm     # just the .rpm
scripts/package.sh appimage

The script builds the release binary once and reuses it for every format. Output lands in dist/ (gitignored).

Linux formats

.deb (Debian / Ubuntu / Mint)

Built by cargo-deb, driven by [package.metadata.deb] in Cargo.toml. The script installs cargo-deb on demand. Runtime deps declared: yt-dlp, ffmpeg, mpv, xdg-utils, libxcb1, libc6 (and libnotify4 recommended).

scripts/package.sh deb
sudo apt install ./dist/yt-offline_*_amd64.deb

.rpm (Fedora / RHEL / openSUSE)

Built by cargo-generate-rpm, driven by [package.metadata.generate-rpm]. It packages the already-built (and release-profile-stripped) binary.

scripts/package.sh rpm
sudo dnf install ./dist/yt-offline-*.x86_64.rpm

Note: ffmpeg on Fedora lives in RPM Fusion; the dependency is declared but the user may need that repo enabled.

AppImage (any Linux)

A hand-rolled AppDir + appimagetool (downloaded to dist/tools/ on first run). The image bundles the GUI binary and its shared-library closure only — yt-dlp/ffmpeg/mpv are still expected on the host PATH, same as the package deps. Bundling them would balloon the image and tangle the licensing.

scripts/package.sh appimage
chmod +x dist/yt-offline-*-x86_64.AppImage
./dist/yt-offline-*-x86_64.AppImage

Arch Linux

Use the PKGBUILD in the repo root (not this script). It builds from a fresh git clone, so run it from a clean directory:

mkdir build && cd build
cp /path/to/repo/PKGBUILD .
makepkg -si

For repeated builds after pushing new commits, always pass -C (cleanbuild) so makepkg re-checks out the latest source instead of reusing a stale cached clone.

Windows — experimental

Windows is not currently a first-class target. Two Linux-only dependencies block a clean --target x86_64-pc-windows-gnu build:

  • ksni (system tray) — talks to the freedesktop StatusNotifierItem D-Bus spec, which doesn't exist on Windows. Needs replacing with tray-icon behind #[cfg(windows)], or stubbing src/tray.rs to a no-op on non-Unix.
  • rfd xdg-portal backend — the file picker uses the XDG desktop portal. The rfd crate does support a native Windows backend, but the feature flags in Cargo.toml would need to be made target-conditional.

Once those are addressed, the rest (eframe, axum, rusqlite-bundled) is already cross-platform — bundled_ytdlp_path() and friends already have cfg!(windows) branches. The path to a Windows .exe/.msi (via cargo-wix) is then mechanical.

Tracked as a follow-up; PRs welcome.

macOS

Same shape as Windows: the tray needs a macOS backend. eframe runs fine on macOS otherwise. A .app bundle + .dmg would follow once the tray is abstracted behind a trait with per-OS implementations.

CI

.forgejo/workflows/release.yml runs scripts/package.sh all on every pushed tag (v*) and attaches the resulting .deb/.rpm/.AppImage to the Codeberg release. See that file for the runner setup.