Skip to main content

Overview

Recipes are TOML files that define how to download, build, and package software for Redox OS. Each recipe is stored in recipes/<category>/<package>/recipe.toml.

Recipe Structure

A recipe consists of up to four main sections:

Source Section

Defines where and how to download the source code.

Git Source

Clone from a Git repository:
Fields:
string
required
URL to the Git repository
string
Git branch to track (recommended for reproducibility)
string
Specific Git commit SHA (recommended for reproducible builds)
string
URL to upstream repository for reference
boolean
Use treeless clone for faster downloads (default: true if rev specified)
array
List of patch files to apply after cloning
string
Shell script to run after cloning and patching

Tar Source

Download from a tarball:
Fields:
string
required
URL to the tarball (supports .tar.gz, .tar.xz, .tar.bz2, .zip)
string
BLAKE3 checksum of the tarball (strongly recommended for reproducibility)
array
List of patch files to apply after extraction
string
Shell script to run after extraction and patching

Path Source

Use a local directory:
Path sources are primarily for testing. Production recipes should use Git or tar sources.

Shared Source

Reuse another package’s source:
Useful when building multiple packages from a single source tree.

No Source

For meta-packages with no source code:

Build Section

Defines how to compile the source code.

Template Field

All build sections must specify a template:

None Template

No build process (meta-packages):

Remote Template

Download pre-built binary package:
The build system automatically downloads packages from the official Redox package repository.

Cargo Template

For Rust projects using Cargo:
Fields:
string
Path to Cargo.toml relative to source root (default: “Cargo.toml”)
array
Additional flags passed to cargo build
array
Specific packages to build from a workspace
array
Example binaries to build and install
Example from coreutils:

Configure Template

For autotools-based projects:
Fields:
array
Flags passed to the ./configure script
The configure template automatically:
  1. Runs ./configure --host=${TARGET} --prefix=/usr ${configureflags}
  2. Runs make -j${COOKBOOK_MAKE_JOBS}
  3. Runs make DESTDIR=${COOKBOOK_STAGE} install

CMake Template

For CMake-based projects:
Fields:
array
Flags passed to the cmake command

Meson Template

For Meson build system:
Fields:
array
Flags passed to the meson setup command

Custom Template

For projects requiring custom build logic:
Fields:
string
required
Shell script executed in the build directory
Example from zstd:

Build Dependencies

Libraries and tools required at build time:
Fields:
array
Runtime libraries and build tools required during compilation
array
Additional development tools (compilers, build systems, etc.)

Package Section

Metadata about the resulting package.
Fields:
array
Packages required at runtime
string
Package version (auto-detected from source if possible)
string
Brief description of the package
Example from git:

Optional Packages

Create additional packages from the same source:
Fields:
string
required
Suffix for the package name (creates package-name-suffix)
array
Additional dependencies for this optional package
array
File patterns to include (supports glob patterns)

Build Script Environment

Available environment variables in custom build scripts:

Directory Variables

Tool Variables

Target Variables

Compiler Variables

Helper Functions

The Cookbook provides helper functions in build scripts:

DYNAMIC_INIT

Initialize for dynamic linking:

DYNAMIC_STATIC_INIT

Support both static and dynamic linking:

cookbook_cargo

Standard Cargo build and install:

cookbook_configure

Standard configure, make, install:

cookbook_meson

Standard Meson build:

Complete Examples

Minimal Rust Package

Library with Dependencies

Complex Build Script

Meta Package

Package Naming

Regular Packages

Package name is the directory name:

Optional Packages

Optional packages append the name:
Creates package zlib-dev.

Host Packages

Packages for the host system use -host suffix internally:

Validation

The recipe system validates:
Well-formed TOML syntax
Required fields present
Valid template names
Dependency packages exist

Best Practices

Always Use Checksums

Specify blake3 for all tarball sources to ensure reproducible builds.

Pin Git Revisions

Specify branch and rev for Git sources to enable reproducible builds.

Minimal Dependencies

Only list dependencies actually required - extras slow down builds.

Use Standard Templates

Prefer cargo, configure, cmake, or meson over custom when possible.

See Also