Skip to content

Commit 9a3f955

Browse files
committed
docs(readme): document gloam lock, --lock, and provenance
Add the `lock` subcommand and `--lock <MANIFEST>` to the command reference, note that --api is required only for generation, refresh the --fetch description (GitHub API + GITHUB_TOKEN), add .gloam/manifest.json to the quick-start output tree, and add a "Provenance and reproducible builds" section covering the header/manifest/--version provenance and the lock workflow. Examples verified against the binary. Signed-off-by: Steven Noonan <steven@uplinklabs.net>
1 parent 1798ec0 commit 9a3f955

1 file changed

Lines changed: 61 additions & 3 deletions

File tree

README.md

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ Output directory:
7171

7272
```
7373
generated/
74+
.gloam/
75+
manifest.json # provenance + output bill of materials
7476
include/
7577
gloam/
7678
gl.h # merged GL + GLES2 public header
@@ -101,7 +103,8 @@ only, `gles2` for GLES2 only, `vulkan` for Vulkan, etc.
101103
gloam [OPTIONS] <COMMAND>
102104
103105
Options:
104-
--api <SPEC> API specifiers (required). Comma-separated list of
106+
--api <SPEC> API specifiers (required for generation; not used by
107+
`gloam lock`). Comma-separated list of
105108
name[:profile][=major.minor] tokens. Profile is
106109
required for GL (core|compat). Version is optional
107110
(latest if omitted). Examples:
@@ -139,8 +142,15 @@ Options:
139142
output file. Required when combining gl and gles2.
140143
--out-path <DIR> Output directory [default: .]
141144
--quiet Suppress progress messages.
142-
--fetch Fetch XML specs from upstream Khronos URLs instead
143-
of the bundled copies. Any fetch failure is fatal.
145+
--fetch Resolve XML specs and headers from upstream (via the
146+
GitHub API) instead of the bundled copies, capturing
147+
full provenance. Set GITHUB_TOKEN to lift the API rate
148+
limit. Any fetch failure is fatal.
149+
--lock <MANIFEST> Pin upstream sources to the provenance recorded in a
150+
previous .gloam/manifest.json (or a `gloam lock`
151+
snapshot), for reproducible output. Requires either
152+
--fetch or a gloam build whose bundled files match the
153+
locked blobs. See "Provenance and reproducible builds".
144154
145155
Commands:
146156
c Generate a C loader.
@@ -157,6 +167,12 @@ Commands:
157167
following the same pattern as Volk. Auxiliary headers
158168
(vk_platform.h, vk_video/*) are not bundled in the
159169
output directory.
170+
171+
lock Write a provenance-only snapshot manifest (no loader output)
172+
pinning every supported upstream source — at the current bundle,
173+
or at upstream HEAD with --fetch. Reuse it later with --lock.
174+
--out <FILE>
175+
Output path for the snapshot [default: manifest.json].
160176
```
161177

162178
### Extension selection flags
@@ -170,6 +186,48 @@ The extension-related flags are orthogonal and compose freely:
170186
| `--predecessors` | *Selection*: adds predecessor extensions of the already-selected set |
171187
| `--baseline` | *Selection*: excludes extensions fully promoted into the baseline version |
172188

189+
## Provenance and reproducible builds
190+
191+
Every generated loader records exactly which upstream sources produced it. Each
192+
file's repository, `git describe` version, upstream commit, and git blob hash
193+
appear in three places:
194+
195+
- the comment header of every generated `.h`/`.c` file;
196+
- `gloam --version`, which lists the embedded bundle's provenance; and
197+
- `.gloam/manifest.json`, written to the root of every output tree — a
198+
machine-readable bill of materials (gloam version, the source provenance pin
199+
set, and a `git hash-object` blob hash for every emitted file). It contains no
200+
timestamps, so the same inputs and gloam version produce byte-identical
201+
output.
202+
203+
### Pinning sources with `gloam lock` and `--lock`
204+
205+
`gloam lock` writes a provenance-only snapshot manifest that pins every
206+
supported upstream source:
207+
208+
```sh
209+
gloam --fetch lock --out manifest.json # snapshot upstream HEAD (via the GitHub API)
210+
gloam lock --out manifest.json # snapshot the embedded bundle
211+
```
212+
213+
Feed that manifest — or any generated `.gloam/manifest.json` — back with
214+
`--lock` to regenerate against exactly those pinned sources:
215+
216+
```sh
217+
gloam --api gl:core=4.6 --lock manifest.json --out-path generated c --alias --loader
218+
```
219+
220+
A locked regeneration with otherwise identical arguments is byte-identical to
221+
the original (the `--lock` flag itself is excluded from the recorded command
222+
line). If the manifest lacks provenance for a file the new command requires,
223+
gloam refuses rather than silently substituting a different version. `--lock`
224+
needs either `--fetch` (to fetch the pinned blobs) or a gloam build whose
225+
bundled files already match the pinned blobs.
226+
227+
This is the mechanism used to generate several loaders from one consistent
228+
upstream snapshot: take a single `gloam lock` snapshot, then drive each
229+
generation with `--lock`.
230+
173231
## Generated output
174232

175233
### Context struct and dispatch

0 commit comments

Comments
 (0)