Overview
Recipes are TOML files that define how to download, build, and package software for Redox OS. Each recipe is stored inrecipes/<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:URL to the Git repository
Git branch to track (recommended for reproducibility)
Specific Git commit SHA (recommended for reproducible builds)
URL to upstream repository for reference
Use treeless clone for faster downloads (default: true if
rev specified)List of patch files to apply after cloning
Shell script to run after cloning and patching
Tar Source
Download from a tarball:URL to the tarball (supports .tar.gz, .tar.xz, .tar.bz2, .zip)
BLAKE3 checksum of the tarball (strongly recommended for reproducibility)
List of patch files to apply after extraction
Shell script to run after extraction and patching
Path Source
Use a local directory:Shared Source
Reuse another package’s source: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:Path to Cargo.toml relative to source root (default: “Cargo.toml”)
Additional flags passed to
cargo buildSpecific packages to build from a workspace
Example binaries to build and install
Configure Template
For autotools-based projects:Flags passed to the
./configure script- Runs
./configure --host=${TARGET} --prefix=/usr ${configureflags} - Runs
make -j${COOKBOOK_MAKE_JOBS} - Runs
make DESTDIR=${COOKBOOK_STAGE} install
CMake Template
For CMake-based projects:Flags passed to the
cmake commandMeson Template
For Meson build system:Flags passed to the
meson setup commandCustom Template
For projects requiring custom build logic:Shell script executed in the build directory
Build Dependencies
Libraries and tools required at build time:Runtime libraries and build tools required during compilation
Additional development tools (compilers, build systems, etc.)
Package Section
Metadata about the resulting package.Packages required at runtime
Package version (auto-detected from source if possible)
Brief description of the package
Optional Packages
Create additional packages from the same source:Suffix for the package name (creates
package-name-suffix)Additional dependencies for this optional package
File patterns to include (supports glob patterns)
Build Script Environment
Available environment variables in custom build scripts:Directory Variables
| Variable | Description |
|---|---|
COOKBOOK_SOURCE | Extracted source directory |
COOKBOOK_STAGE | Staging directory for installation (DESTDIR) |
COOKBOOK_SYSROOT | Sysroot with all dependencies |
COOKBOOK_BUILD | Build directory (usually same as pwd) |
Tool Variables
| Variable | Description |
|---|---|
COOKBOOK_CARGO | Path to cargo |
COOKBOOK_MAKE | Path to make |
COOKBOOK_MAKE_JOBS | Number of parallel jobs |
COOKBOOK_CONFIGURE | Path to configure script |
Target Variables
| Variable | Description | Example |
|---|---|---|
TARGET | Rust target triple | x86_64-unknown-redox |
GNU_TARGET | GNU-style target | x86_64-redox |
ARCH | Target architecture | x86_64 |
Compiler Variables
| Variable | Description |
|---|---|
CC | C compiler |
CXX | C++ compiler |
AR | Archiver |
RANLIB | ranlib tool |
STRIP | Strip tool |
CFLAGS | C compiler flags |
CXXFLAGS | C++ compiler flags |
LDFLAGS | Linker flags |
PKG_CONFIG | pkg-config tool |
PKG_CONFIG_PATH | pkg-config search path |
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: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
- Application Porting Guide - How to port software
- Cookbook System - Build system architecture
- Build System Reference - Full build system guide