Skip to content
pi-c Artifact [e6ee631ba3]
Login

Artifact [e6ee631ba3]

Artifact e6ee631ba32bc168e1ecedfa192e79dffc918d2607c2e32f8714aef05a9e59e2:


# Vendoring

pic's dependencies are vendored and compiled in, each pinned file by file (`vendor/*/SHA256SUMS`):
SQLite with libfossil, zlib, BearSSL, Nayuki's QR Code generator (`vendor/qrcodegen`, release
v1.8.0, for `/remote-control`) and Bellard's QuickJS (`vendor/quickjs`, release 2026-06-04, for the
codemode tool). Each `ORIGIN` says where its files came from; they are replaced, never edited. The
binary links only libc, libm and pthread.

## QuickJS

The engine's files of a release tarball from bellard.org/quickjs, and nothing of `quickjs-libc.c`,
`qjs.c` or `qjsc.c`: a script gets no files, network, timers or OS calls. To update, unpack the new
release, copy the files `ORIGIN` lists over `vendor/quickjs`, rewrite `ORIGIN` (release, tarball and
its SHA-256) and `SHA256SUMS`, then run `make test-pic` and [Fil-C](filc.md). The Makefile builds it
as its own Makefile does, with `-fwrapv`, `_GNU_SOURCE` and `CONFIG_VERSION` from `VERSION`,
warnings off; `tools/amalgamation.sh` writes the two defines into the bundle's copies, and the
bundle's line carries `-fwrapv`. It adds about 950 KB to the release binary. It runs only in the
codemode worker, an exec of pic itself, never in the process that holds the journal
([codemode](../manual/codemode.md)).

Under [Fil-C](filc.md) (0.687) the release as vendored stops in `JS_NewContext`: QuickJS keeps a
context pointer and a 2-bit id in one integer (`realm_and_id`, the lazily made properties), and
Fil-C refuses to read through the pointer made back from it. musl (zig cc, static, aarch64) builds
and runs it unchanged.

## Micro QuickJS

The no-OS build's engine (`vendor/mquickjs`, commit 7dbcb77 of github.com/bellard/mquickjs, MIT),
in `make pic-micro` (`build/pic/micro/pic`), which compiles `src/jsengine_micro.c` in place of
`src/jsengine_quickjs.c` and runs codemode's scripts in pic's own process. Its standard library is
C tables that `vendor/mquickjs/mquickjs_build.c` makes at build time from
`tools/codemode-mqjs-stdlib.c` (the vendored `mqjs_stdlib.c` without console, print, load, gc and
timers, with codemode's `__host`), as mquickjs's own Makefile does; `mquickjs_atom.h` comes from the
same tool. It adds about 320 KB to the binary. To update, copy the files `ORIGIN` lists, rewrite
`ORIGIN` and `SHA256SUMS`, carry any change to `mqjs_stdlib.c` into the derived file, and run
`make test-pic`. It supports ES5 with `for...of` over arrays, `**` and getters; not `let`, `const`,
arrow functions, template literals, destructuring, spread, classes, promises or `async`
([codemode](../manual/codemode.md#on-a-build-without-processes)). Like QuickJS, it stops under Fil-C
at its tagged values (in `JS_NewContext`).

## libfossil and SQLite

Re-vendor on every libfossil cut:

```sh
sh tools/vendor-libfossil.sh [CUT_DIR]   # default ~/libfossil-builds/current
```

It copies the amalgamations, SQLite's shell.c and the license into `vendor/libfossil`, refuses a cut
whose shell.c and sqlite3.c come from different SQLite check-ins, rewrites SHA256SUMS and the first
line of README.md, and prints what changed. It does not commit: run `make test-pic` and
[Fil-C](filc.md), then land the branch.

The tests use pic's own `build/pic/sqlite3`, built from the vendored shell.c, never the host's.

## Other generated sources

- `src/ca_bundle.inc`: the built-in CA roots, from `tools/ca-bundle.sh`.
- `src/model_catalog.inc`: the built-in model catalog snapshot, from `tools/model-catalog.sh`.