Skip to content

Recipes and stages ​

Every field of a recipe, a recipe repository descriptor and a bootstrap stage file, as the schema in crates/laft-build/stav/prelude/recipe.stav declares it. Writing recipes explains how they are used.

Types are Stav types, as in the system configuration reference. Pkg is a package reference, Spdx an SPDX license identifier written as a symbol, and Path a path literal relative to the recipe file, which must stay inside the recipe's directory or common/.

What a recipe can import ​

ModuleProvides
std/buildgnu_mirrors(path), github_archive(repo, tag, name), github_release(repo, tag, file) and kernel_org(path), which build source URLs.
laft/targetThe target of the evaluation: variant, arch, cpu, triple and libc. Every package is built for x86_64-v3. The dynamic variant uses the triple x86_64-laft-linux-gnu and glibc, and the static variant is cross compiled against musl as x86_64-laft-linux-musl.
common/...Modules of the recipe repository that several recipes share.

The package block ​

A recipe file holds one package block whose label is the package name and the name of its directory.

Package ​

One upstream project built into one or more packages. Block label: the package name.

FieldTypeDefaultMeaning
versionStr where matches(r"^[A-Za-z0-9._~]+$")The upstream version.
revInt where 1..=10000001The Laft revision.
summaryStr where matches(r"^[^\n]{0,79}[^.\n]$")One line of at most 80 characters, without a final period.
descriptionOption<Str>A longer description.
homepageOption<Str where matches(r"^https://.*")>The project's web site.
licenseList<Spdx> where nonEmptyEvery SPDX license or exception that applies.
license_filesOption<List<Str>>License files relative to $SRC. none: every top level COPYING*, LICENSE*, LICENCE*, NOTICE* or COPYRIGHT* file.
maintainersList<Str>[]Free form, usually "Name <email>".
variantsSet<Variant> where nonEmpty[dynamic]The variants this recipe builds.
archOption<Set<Str>>The architectures to build for. none: every architecture of the repository.
emptyBoolfalseA meta package without payload.
sourcesMap<Str, Source>{}Sources. Block label: the source name, main for the primary one. Written as source blocks.
vendorsMap<VendorKind, Vendor>{}Vendored dependencies. Block label: the vendoring tool. Written as vendor blocks.
patchesList<Path>[]Patches applied in order in $SRC after extraction.
patch_stripInt where 0..=101The -p value for patch.
build_depsSet<Pkg>[]Tools that run during the build, always the dynamic variant.
link_depsSet<Pkg>[]Libraries the package compiles and links against.
check_depsSet<Pkg>[]Packages present only when the check phase runs.
depsSet<Pkg>[]Runtime dependencies in addition to the detected ones.
providesSet<Str where matches(r"^virtual:[a-z0-9][a-z0-9._-]*$")>[]Extra virtual capabilities.
conflictsSet<Pkg>[]Packages that cannot be in the same view.
replacesSet<Pkg>[]Package names this package supersedes.
ignore_depsList<Str>[]Globs of payload paths excluded from dependency detection.
buildBuildThe build style.
shellShellshThe shell of the phase scripts: POSIX sh, or bash for a build that needs it, which adds bash to build_deps. Say why in a comment. The kernel style always uses bash.
phasesPhasesPhases {}Phase replacements, hooks and the start directory.
envMap<Str, Str>{}Extra environment variables for every phase.
cflagsList<Str>[]Appended to the default CFLAGS.
cxxflagsList<Str>[]Appended to the default CXXFLAGS.
ldflagsList<Str>[]Appended to the default LDFLAGS.
rustflagsList<Str>[]Appended to the default RUSTFLAGS.
goflagsList<Str>[]Appended to the default GOFLAGS.
hardening_disableSet<Hardening>[]Default hardening to turn off.
ltoBoolfalseLink time optimization.
checkBooltrueRun the check phase.
parallelBooltrueBuild with more than one job.
stripBooltrueStrip ELF files.
debug_splitBooltrueSplit debug info into the -dbg subpackage.
static_pieBooltrueStatic variant only: link executables with -static-pie.
keep_archivesBoolfalseDynamic variant only: keep usr/lib/*.a.
keep_dirsList<Str>[]Empty directories to keep in the payload.
abi_epochInt where 0..=10000000The ABI generation of this package's libraries. It never decreases.
splitSet<Split>[dev, doc, dbg]Automatic subpackages to create.
subpackagesMap<Str, Subpackage>{}Explicit subpackages. Block label: the suffix. Written as subpackage blocks.
alternativesMap<Str, Alternative>{}Alternative groups. Block label: the group name. Written as alternative blocks.
setuidSet<Str>[]Payload paths that request a setuid or setgid bit.
capsMap<Str, Str>{}Payload paths with requested file capabilities.
ownershipMap<Str, Str>{}Payload globs with their "user:group" owner.
smokeOption<Str>A script run in a view with only this package and its runtime dependencies.
updateOption<Update>How new upstream versions are found.
cpeList<Str>[]CPE 2.3 product prefixes for CVE matching.
ciCiCi {}The CI runner and time limit.

Build styles ​

The build field takes one of these variants, written as a block whose label is the style and whose body sets its arguments, such as build configure { args = ["--disable-nls"] }.

StyleArguments
customnone: every phase comes from phases
configureargs = [], standard_args = true, autoreconf = false, out_of_tree = false, make_args = [], check_target = "check", install_args = []
makemake_args = [], check_target = "check", install_args = []
mesonoptions = [], auto_features = disabled
cmakedefines = [], generator = ninja
cargofeatures = [], default_features = true, package, bins, args = []
gopackages = ["."], ldflags = [], tags = [], cgo = false
python-pep517check_cmd
kernelconfig (a path), localversion, flavor, make_args = []

Value types ​

Variant: A build configuration of a package. dynamic | static

Libc: A C library. glibc | musl

Split: An automatic subpackage. dev | doc | dbg | locale

VendorKind: A tool that vendors dependencies. cargo | go

Hardening: A default hardening flag that a recipe can turn off. fortify | pie | relro | now | stack-clash | cf-protection | format | plt

Runner: The class of machine a package builds on. standard | big

Feature: The meson auto_features setting. enabled | disabled | auto

Generator: The build tool cmake generates files for. ninja | make

Shell: The shell that runs the phase scripts. sh | bash

Source ​

A source of a package. Exactly one of url and git is set.

Git sources are planned

The schema already has git, commit and submodules, but this version of laft-build cannot fetch a git source. Every command that evaluates a recipe with one refuses it with R009, before anything is fetched:

console
$ laft-build --recipes . lint
hello:
error[R009]: source "main" of hello is a git source, which this version of laft-build cannot fetch; use a url source of a release tarball
  --> /tmp/laft-demo/recipes/hello/package.stav:7:14
laft-build: some recipes have errors
FieldTypeDefaultMeaning
urlOption<List<Str>>Download locations, tried in order. https:// only.
gitOption<Str where matches(r"^https://.*")>A clone URL. https:// only.
commitOption<Str where matches(r"^[0-9a-f]{40}$")>The full commit hash of a git source.
submodulesBoolfalseFetch git submodules at their recorded commits.
sha256Option<Str where matches(r"^sha256:[0-9a-f]{64}$")>The SHA-256 hash of the file, or of the tarball made from a git checkout.
fileOption<Str>The name of the downloaded file. none: the last URL path segment.
extractOption<Bool>Whether to extract the file. none: by its extension.
strip_componentsOption<Int where 0..=16>Leading path components to drop. none: one when the archive holds a single directory.
destOption<Str>The directory under $SRC. none: "" for main, the label otherwise.

Vendor ​

Vendored dependencies, produced by running the vendoring tool on a source.

FieldTypeDefaultMeaning
sha256Str where matches(r"^sha256:[0-9a-f]{64}$")The hash of the normalized vendor tarball.
dirStr""The directory under $SRC holding Cargo.lock or go.mod.
sourceStr"main"The source the lock file comes from.

Phases ​

Phase replacements, hooks and the start directory.

FieldTypeDefaultMeaning
subdirOption<Str>The directory under $SRC every phase starts in.
prepareOption<Str>Replaces the prepare script.
configureOption<Str>Replaces the configure script.
buildOption<Str>Replaces the build script.
checkOption<Str>Replaces the check script.
installOption<Str>Replaces the install script.
post_installOption<Str>Runs as its own phase after install.
pre_configureOption<Str>Runs before the configure script.
post_configureOption<Str>Runs after the configure script.
pre_buildOption<Str>Runs before the build script.
post_buildOption<Str>Runs after the build script.
pre_checkOption<Str>Runs before the check script.
post_checkOption<Str>Runs after the check script.
pre_installOption<Str>Runs before the install script.

Subpackage ​

An explicit subpackage. Block label: the suffix.

FieldTypeDefaultMeaning
summaryOption<Str>none: the package summary followed by the suffix in parentheses.
filesList<Str> where nonEmptyGlobs of the payload paths it contains.
excludeList<Str>[]Globs removed from the match.
depsSet<Pkg>[]Runtime dependencies of this subpackage.
providesSet<Str>[]Capabilities of this subpackage.
conflictsSet<Pkg>[]Conflicts of this subpackage.
replacesSet<Pkg>[]Package names this subpackage supersedes.
depends_on_mainBoolfalseAdd an exact dependency on the main package.
licenseOption<List<Spdx>>none: the package's licenses.
keep_emptyBoolfalseEmit the subpackage even when no file matched.

Alternative ​

Membership in an alternative group. Block label: the group name.

FieldTypeDefaultMeaning
pathsList<Str> where nonEmptyPayload paths the package ships for this group.
priorityInt where -1000000..=10000000Higher wins when neither the configuration nor the repository default chooses.
subpackageOption<Str>The subpackage that contains the paths. none: the main package.

Ci ​

The CI runner and time limit.

FieldTypeDefaultMeaning
runnerRunnerstandardThe class of machine.
timeout_minutesInt where 1..=1440360The longest a build may take.

Update ​

How new upstream versions are found.

FieldTypeDefaultMeaning
githubOption<Str where matches(r"^[^/]+/[^/]+$")>"owner/repo" on GitHub.
gitlabOption<Str>"host/group/project" on a GitLab instance.
anityaOption<Int where 1..=100000000>A project id on release-monitoring.org.
urlOption<Str where matches(r"^https://.*")>A page to fetch. Requires pattern.
patternOption<Str>A regular expression with one capture group for the version.
tag_prefixOption<Str>A prefix stripped from tags.
trackOption<Str>Only versions with this prefix.
ignoreList<Str>["alpha", "beta", "rc", "pre", "dev", "snapshot"]Candidates containing any of these are dropped.
prereleaseBoolfalseKeep prereleases.
automergeBoolfalseBump changes may merge automatically.
disabledOption<Str>Why the package is never reported as outdated.

The repository descriptor ​

recipes.stav at the top of a recipe repository holds exactly one recipe_repo block, labeled with the repository name.

RecipeRepo ​

The identity of a recipe repository.

FieldTypeDefaultMeaning
archSet<Str> where nonEmpty["x86_64-v3"]Architectures this repository builds for.
extendsList<Str>[]Recipe repositories whose recipes this one overrides or depends on.
toolchain_epochInt where 0..=10000000Incrementing it forces a rebuild of every package in the repository.
source_mirrorsList<Str>[]Content addressed source mirrors, tried after a source's own URLs.

Stage files ​

A stage file holds one stage block, which laft-build stage runs.

Stage ​

A stage of a bootstrap: steps that build packages from one recipe repository into a root directory or the build-side store, or run scripts, in order.

FieldTypeDefaultMeaning
recipesStrThe recipe repository of the packages, relative to the stage file.
installInstalldirectdirect installs every build straight into the root and makes no package. packages makes Laft packages, keeps them in the output directory of the build root and unpacks them into the root, all but the debug info. store builds every package in a sandbox with a build view of the build-side store, which its packages enter for the builds after it. A store stage has no root.
pathList<Str>[]Directories below the root that steps on the host search for programs before the host's own, such as the bin directory of a cross toolchain.
stepsList<Step> where nonEmptyThe steps, in the order they run.

Step ​

One step of a stage. Exactly one of packages and script is set.

FieldTypeDefaultMeaning
nameStr where matches(r"^[a-z0-9][a-z0-9-]*$")The name in progress reports and logs, unique in the stage.
placePlacehostOn the host, inside the root entered as a chroot, or, for a script of a store stage, in a sandbox whose /usr is a view of the build-side store that holds the packages of view.
packagesList<Pkg>[]Packages built in this order and installed into the root or the store.
scriptOption<Str>A POSIX shell script, such as a checkpoint. It stops at the first command that fails, like a phase. It runs once, and again when it or an earlier step changes. $ROOT is the root as the script sees it, unset in a view.
envMap<Str, Str>{}Extra environment variables of the script.
viewList<Pkg>[]The packages of the view a script with place = view runs in. Their runtime dependencies come with them.

Place: Where a step of a stage runs. host | root | view

Install: How the packages of a stage reach its root. direct | packages | store

Released under the MIT or Apache 2.0 license, at your option.