115 lines
5.5 KiB
HTML
115 lines
5.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Recipe format — Keru OS</title>
|
|
<meta name="description" content="The formal spec for kama recipes: easy tier, advanced tier, fields, hooks, and packaging control.">
|
|
<link rel="stylesheet" href="assets/css/style.css">
|
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>ける</text></svg>">
|
|
</head>
|
|
<body>
|
|
|
|
<nav class="top" data-nav></nav>
|
|
|
|
<header class="pagehead">
|
|
<p class="crumbs"><a href="index.html">home</a> / <a href="docs.html">docs</a> / recipe format</p>
|
|
<h1>Recipe format</h1>
|
|
<p>The spec for kama packages.</p>
|
|
</header>
|
|
|
|
<section>
|
|
<div class="wrap">
|
|
<div class="prose">
|
|
<p>A recipe is a <strong>plain POSIX shell script</strong> describing how to compile and install one piece of software. The syntax splits into two tiers:</p>
|
|
|
|
<ul class="features">
|
|
<li><strong>Easy</strong> — declare a few variables, fill in <code>build</code> and <code>install</code>, done. Covers ~90% of packages (autotools/cmake/meson).</li>
|
|
<li><strong>Advanced</strong> — 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.</li>
|
|
</ul>
|
|
|
|
<p>In both tiers, Kama <em>sources</em> the recipe and runs the functions you define.</p>
|
|
|
|
<hr>
|
|
|
|
<h3>Easy tier — most packages only need this</h3>
|
|
<div class="code-block">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"
|
|
}</div>
|
|
|
|
<p>That's it. Kama supplies the conventional <code>pkg_fetch</code> (download + extract — auto-detects <code>.tar.xz/.gz/.bz2/.zip</code>, strips the top directory) and <code>pkg_clean</code>.</p>
|
|
|
|
<hr>
|
|
|
|
<h3>Advanced tier — override any step</h3>
|
|
<div class="code-block">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"; }</div>
|
|
|
|
<h3>Fields</h3>
|
|
<table>
|
|
<tr><th>Field</th><th>Purpose</th></tr>
|
|
<tr><td><code>name</code></td><td>Package name. Required.</td></tr>
|
|
<tr><td><code>version</code></td><td>Release version. Required for fetch.</td></tr>
|
|
<tr><td><code>url</code></td><td>Upstream source (or list).</td></tr>
|
|
<tr><td><code>deps</code></td><td>Build-time dependencies — compiled, installed, then purged (AUR-style).</td></tr>
|
|
<tr><td><code>runtime_deps</code></td><td>Dependencies that stay installed.</td></tr>
|
|
<tr><td><code>license</code></td><td>SPDX license identifiers.</td></tr>
|
|
<tr><td><code>provides</code></td><td>Capabilities this package provides (virtuals).</td></tr>
|
|
<tr><td><code>conflicts</code></td><td>Mutual exclusions.</td></tr>
|
|
<tr><td><code>arch</code></td><td>Architecture allow-list; empty means any.</td></tr>
|
|
<tr><td><code>noextract</code></td><td>URLs downloaded but not auto-extracted.</td></tr>
|
|
</table>
|
|
|
|
<h3>Hooks and functions</h3>
|
|
<table>
|
|
<tr><th>Function</th><th>Role</th></tr>
|
|
<tr><td><code>build()</code></td><td>Configure + compile, run in the extracted source dir.</td></tr>
|
|
<tr><td><code>install()</code></td><td>Install into the staging dir (<code>$pkgdir</code>/<code>DESTDIR</code>), not the live root.</td></tr>
|
|
<tr><td><code>pkg_fetch()</code></td><td>Override download/extract (can call <code>default_fetch</code>).</td></tr>
|
|
<tr><td><code>pkg_clean()</code></td><td>Override source cleanup.</td></tr>
|
|
<tr><td><code>pkg_post()</code></td><td>Post-install hook, called after staging.</td></tr>
|
|
<tr><td><code>pkg_split()</code></td><td>Optional splitting of staged output into subpackages.</td></tr>
|
|
</table>
|
|
|
|
<div class="callout">The full spec lives in the repo at <code>docs/recipe-format.md</code>. The web version mirrors it; the canonical source is the repository.</div>
|
|
|
|
<p><a href="kama-recipes.html">The recipe concept</a> · <a href="kama.html">← Kama</a></p>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<footer data-footer></footer>
|
|
|
|
<noscript><div style="text-align:center;padding:16px">See the <a href="sitemap.html">sitemap</a> for all pages.</div></noscript>
|
|
|
|
<script src="assets/js/include.js" data-base="."></script>
|
|
</body>
|
|
</html> |