Building¶
./scripts/build.sh 3.14.2 # build specific version
./scripts/build.sh --all # build all versions
./scripts/build.sh 3.14.2 --cosmoext # with C extension support
./scripts/build.sh 3.14.2 --clean # clean rebuild
./scripts/build.sh --help # show all options
Environment Variables¶
| Variable | Default | Description |
|---|---|---|
WORK_DIR |
./work |
Build working directory (sources, objects) |
DIST_DIR |
./dist |
Output directory for built binaries |
COSMO_DIR |
/tmp/cosmo |
Cosmopolitan toolchain installation path |
DEPS_DIR |
$WORK_DIR/deps |
Compiled dependencies (openssl, libffi, etc.) |
SKIP_SIGSTORE |
(unset) | Set to 1 to skip Python sigstore verification |
Example:
Build Process¶
The build system is organized into phases:
- Setup (
scripts/setup.sh) — Install Cosmopolitan toolchain - Dependencies (
scripts/build-deps.sh) — Build all libraries (OpenSSL, SQLite, etc.) - Python (
scripts/python/build.sh) — Download, patch, compile, and package Python
Each dependency has its own build script in scripts/:
bzip2.sh,gdbm.sh,libffi.sh,ncurses.shopenssl.sh,readline.sh,sqlite.shxz.sh,zstd.sh,cacert.sh
Caching¶
The GitHub Actions workflow caches:
- Dependencies: Keyed by
upstream.cdx.json+ script hashes - Python binaries: Keyed per-version by
upstream.cdx.json+ python script hashes
This means PR builds populate the cache, and release builds get cache hits.
Adding a New Python Version¶
When a new Python minor version is released (e.g., 3.15):
- Add version to
upstream.cdx.jsonwith SHA256 and sigstore info - Create
scripts/python/patches/3.15/directory if patches needed - Test build:
./scripts/build.sh 3.15.0 - Run smoke tests:
./scripts/smoke.sh dist/python-3.15.0-cosmo.com - Update
python.latestinupstream.cdx.json