home / docs / recipe authoring

Recipe authoring

Writing a kama recipe, top to bottom.

Every package in a Keru system is described by a recipe: a plain POSIX shell script in kama-packages. Writing one is closer to filling a form than engineering a build.

The template

kama-packages/TEMPLATE.sh is the canonical starting point. Copy it, fill the easy tier:

name=hello # required version=2.12.1 # required for fetch url=https://ftp.gnu.org/gnu/hello/hello-2.12.1.tar.gz deps=() # build-time deps, compiled then purged build() { ./configure --prefix=/usr make -j"$JOBS" } install() { make install DESTDIR="$pkgdir" # stage, never $ROOT }

A real, complete recipe

This is the entire busybox recipe currently in the repo:

name=busybox version=1.36.1 url=https://busybox.net/downloads/busybox-1.36.1.tar.bz2 deps=() build() { make defconfig make -j"$JOBS" } install() { make install CONFIG_PREFIX="$pkgdir" }

That's it. Kama downloads, extracts, strips the top dir, builds, stages, and installs.

Stepping up

NeedField / function
Colliding with another packageprovides=(...) conflicts=(...)
Build deps that must stayruntime_deps=(...)
Arch-restrictedarch=(x86_64)
Repo or vcs sourcesnoextract=("$url") + own build()
Custom fetch (patch first)pkg_fetch() { default_fetch; patch ...; }
Post-install workpkg_post() · pkg_split() for subpackages

Rules of the road

  • Stage, don't touch. install() installs into $pkgdir. Kama commits the staging dir to $ROOT only after a successful build.
  • Add pure build deps to deps. They're purged automatically after the build (AUR-style). Keeps the door clean.
  • Declare the license. license=(SPDX) — supply chain cleanliness starts here.
  • Pin exactly. A fixed url + version, never a moving "latest".

Checking your work

sh -n recipe.sh # syntax check kama info <pkgname> # metadata parses (name from the recipe) make recipe-check # lint the whole kama-packages repo kama make <pkgname> # build it for real
The behavioral spec lives at recipe format. For hands-on, mirror the recipe concept page and start with busybox.sh, the smallest real recipe.

← Recipe format · The repos