A Rust implementation of appimagetool for the Anylinux-AppImages project.
It takes a prepared AppDir and produces a finished .AppImage using DWARFS compression and the uruntime AppImage runtime. Single binary, no Python, no C++ deps.
appimagetool ./AppDirThat's it. The tool will:
- Validate the AppDir (checks for
AppRun,.DirIcon, one.desktopfile). - Download
mkdwarfsanduruntimeif they're not already cached. - Write
X-AppImage-*metadata into the desktop entry. - Build the DWARFS image with the runtime embedded as the ELF header.
- Generate a
.zsyncfile when update info is set, plus anappinfosidecar.
- DWARFS compression for small, delta-friendly AppImages.
- Drop-in uruntime integration with automatic download and ELF section patching.
- Optional profile-guided optimization (DWARFS hotness profiling) for faster launches.
- Built-in zsync generation, no
zsyncmakeshell-out. - No central repository, no daemon, no extra runtime deps.
appimagetool ./build/AppDir \
--output ./dist \
--update-info "gh-releases-zsync|org|repo|latest|*-x86_64.AppImage.zsync"If GITHUB_REPOSITORY is set, update info is auto-derived as
gh-releases-zsync|owner|repo|latest|*<arch>.AppImage.zsync. So in CI you usually just need:
VERSION=1.2.3 appimagetool ./AppDir --output ./distThe tool tracks two arches separately:
APPIMAGE_ARCHis the runtime arch. It picks whichmkdwarfsanduruntimebinaries to download, and shows up inX-AppImage-Archmetadata. Defaults to the host arch.ARCHis the display arch. It only affects the output filename. Falls back toAPPIMAGE_ARCHwhen unset.
This lets a project publish under an alias like amd64 while still pulling the correct x86_64 runtime:
APPIMAGE_ARCH=x86_64 ARCH=amd64 appimagetool ./AppDir
# produces MyApp-1.2.3-anylinux-amd64.AppImage with X-AppImage-Arch=x86_64Usage: appimagetool [OPTIONS] [APPDIR]
Arguments:
[APPDIR] Path to the AppDir directory [env: APPDIR] [default: ./AppDir]
Options:
-o, --output <OUTPUT> Output directory [env: OUTPATH] [default: .]
-n, --name <NAME> Output filename (auto-detected from .desktop) [env: OUTNAME]
--appimage-arch <ARCH> Runtime arch (download URL + X-AppImage-Arch) [env: APPIMAGE_ARCH]
--arch <ARCH> Display arch used in the output filename [env: ARCH]
--runtime <RUNTIME> Path to uruntime binary [env: RUNTIME]
--runtime-url <URL> URL to download uruntime from [env: URUNTIME_LINK]
-u, --update-info <UPINFO> Update information string [env: UPINFO]
--dwarfs-comp <COMP> DWARFS compression options [env: DWARFS_COMP]
--optimize-launch Enable DWARFS profile optimization (also via OPTIMIZE_LAUNCH=1)
--profile-timeout <SECS> Profiling timeout in seconds [env: OPTIMIZE_LAUNCH_TIMEOUT] [default: 10]
--keep-mount Keep the FUSE mount alive after exit (also via URUNTIME_PRELOAD=1)
--devel-release Tag the build as a nightly/devel release (also via DEVEL_RELEASE=1)
--dwarfs-profile <PROFILE> Path to DWARFS profile [env: DWARFSPROF]
--mkdwarfs <PATH> Path to mkdwarfs binary [env: DWARFS_CMD]
--dwarfs-url <URL> URL to download mkdwarfs from [env: DWARFS_LINK]
--tmpdir <TMPDIR> Temporary directory [env: TMPDIR] [default: /tmp]
-v, --verbose... Increase verbosity (-v, -vv)
-q, --quiet... Suppress informational output (-q, -qq)
-h, --help Print help
-V, --version Print version
Every CLI option has a matching env var (shown above). A few extra knobs that are env-only:
| Variable | Effect |
|---|---|
VERSION |
Version string baked into the AppImage filename and metadata. |
APPNAME |
Override the application name (defaults to the desktop entry's Name). |
GITHUB_REPOSITORY |
When set, auto-generates update_info as gh-releases-zsync|owner|repo|latest|... |
ADD_PERMA_ENV_VARS |
Permanent env vars to bake into the runtime, one per line. |
URUNTIME_PRELOAD |
Set to 1 to keep the FUSE mount after the app exits. |
DEVEL_RELEASE |
Set to 1 to tag the build as a nightly/devel release. |
OPTIMIZE_LAUNCH |
Set to 1 to enable the DWARFS profiling pass (same as --optimize-launch). |
OPTIMIZE_LAUNCH_TIMEOUT |
Profiling timeout in seconds (default 10). |
The AppDir must contain:
- An executable
AppRun. - A
.DirIconfile (PNG or SVG). - Exactly one
.desktopfile in the AppDir root.
By default:
<AppName>-<Version>-anylinux-<Arch>.AppImage
Where AppName comes from the .desktop Name key (or APPNAME), Version from VERSION (or ~/version), and Arch is the display arch (ARCH, falling back to APPIMAGE_ARCH).
You can also pin the filename outright with --name / OUTNAME.
cargo build --release# Unit + integration tests
cargo test --all-features
# Full end-to-end test (requires mkdwarfs + uruntime installed)
cargo test --all-features -- --ignoredsrc/
├── main.rs CLI entry point (clap)
├── lib.rs library root
├── appimage.rs build pipeline orchestration
├── config.rs CLI args + env var resolution
├── desktop.rs .desktop parsing and metadata
├── dwarfs.rs mkdwarfs resolution, image building, profiling
├── elf.rs ELF section read / write / patch
├── error.rs error types with actionable hints
├── log.rs verbosity-gated logger
├── uruntime.rs runtime download, caching, configuration
└── util.rs atomic downloads, sanitization, ELF detection