home / docs / recipe format

Recipe format

The spec for kama packages.

A recipe is a plain POSIX shell script describing how to compile and install one piece of software. The syntax splits into two tiers:

  • Easy — declare a few variables, fill in build and install, done. Covers ~90% of packages (autotools/cmake/meson).
  • Advanced — full control when you need it: custom fetch/extract, staging layout, packaging hooks, multi-arch, verification. Everything the easy tier does is sugar over this.

In both tiers, Kama sources the recipe and runs the functions you define.


Easy tier — most packages only need this

name=busybox version=1.36.1 url=https://busybox.net/downloads/busybox-1.36.1.tar.bz2 deps=() # build-time deps, purged after (AUR-style) build() { # configure + compile make defconfig make } install() { # install into $pkgdir (staging), not $ROOT make install CONFIG_PREFIX="$pkgdir" }

That's it. Kama supplies the conventional pkg_fetch (download + extract — auto-detects .tar.xz/.gz/.bz2/.zip, strips the top directory) and pkg_clean.


Advanced tier — override any step

name=busybox version=1.36.1 url=https://busybox.net/downloads/busybox-1.36.1.tar.bz2 deps=(gcc musl-headers) # temp build deps (AUR-style) runtime_deps=(musl) # stays installed license=(GPL-2.0) provides=(sh) # capability this package provides conflicts=(dash) # mutual exclusion arch=(x86_64) # if non-empty, restrict to archs noextract=() # URLs to download but NOT auto-extract # override auto extract (e.g. patching before configure) pkg_fetch() { default_fetch # run the easy-tier default cd "$src" patch -p1 < ../my.patch } build() { ./configure --prefix=/usr "$@" && make; } install() { make install DESTDIR="$pkgdir"; }

Fields

FieldPurpose
namePackage name. Required.
versionRelease version. Required for fetch.
urlUpstream source (or list).
depsBuild-time dependencies — compiled, installed, then purged (AUR-style).
runtime_depsDependencies that stay installed.
licenseSPDX license identifiers.
providesCapabilities this package provides (virtuals).
conflictsMutual exclusions.
archArchitecture allow-list; empty means any.
noextractURLs downloaded but not auto-extracted.

Hooks and functions

FunctionRole
build()Configure + compile, run in the extracted source dir.
install()Install into the staging dir ($pkgdir/DESTDIR), not the live root.
pkg_fetch()Override download/extract (can call default_fetch).
pkg_clean()Override source cleanup.
pkg_post()Post-install hook, called after staging.
pkg_split()Optional splitting of staged output into subpackages.
The full spec lives in the repo at docs/recipe-format.md. The web version mirrors it; the canonical source is the repository.

The recipe concept · ← Kama