English | 简体中文
Reader: a library author whose package should become one others can name in
their [dependencies].
The question this chapter answers: what steps take a tagged release to a resolvable package, and in which order they must happen.
Not here: what makes two packages the same package — SPEC-001 — and shipping compiled artifacts, which is 12. Before: 10 — Packaging an Application.
How a library becomes something [dependencies] can name. This is the
library author's chain; 92 - Releasing mcpp is about
releasing mcpp itself, and 10 - Packaging & Release
is about mcpp pack bundling an application.
the library repo merge → git tag → GitHub auto-generates the tag tarball
↓
gitcode mirror a byte-identical copy, for the CN region
↓
mcpplibs/mcpp-index pkgs/<x>/<name>.lua — GLOBAL + CN URLs + sha256
↓ publish-artifact.yml pushes a content-hash artifact
↓
consumers bump the version in their mcpp.toml
Each arrow is a gate. Skipping one does not fail loudly — it fails as "dependency not found" or a 404 in someone else's build, hours later.
The version in mcpp.toml and the tag must agree. GitHub generates
archive/refs/tags/<tag>.tar.gz automatically; that tarball is the
artifact — nothing needs uploading.
git tag 0.0.48 && git push origin 0.0.48
curl -fsSL -o pkg-0.0.48.tar.gz \
https://github.com/<owner>/<repo>/archive/refs/tags/0.0.48.tar.gz
sha256sum pkg-0.0.48.tar.gz # ← the digest the index will carry
The tarball extracts to <repo>-<tag>/, and mcpp looks for mcpp.toml inside
that wrapper directory. A repo that ships its own mcpp.toml needs no mcpp
field in the index entry.
The CN entry must be a byte-identical copy of the GitHub tarball, only
renamed. Anything else and the two regions disagree about what a pinned
sha256 means.
gtc release publish mcpp-res/<name> --tag 0.0.48 --asset pkg-0.0.48.tar.gz
Then verify it, because the upload reporting success is not the same as the asset being fetchable:
# GET, never HEAD — gitcode answers HEAD with 401 and GET with 302 → CDN 200
curl -fsSL -o cn.tar.gz \
https://gitcode.com/mcpp-res/<name>/releases/download/0.0.48/pkg-0.0.48.tar.gz
cmp cn.tar.gz pkg-0.0.48.tar.gz # must be identical, not merely present
In mcpplibs/mcpp-index, pkgs/<first-letter>/<name>.lua:
["0.0.48"] = {
url = {
GLOBAL = "https://github.com/<owner>/<repo>/archive/refs/tags/0.0.48.tar.gz",
CN = "https://gitcode.com/mcpp-res/<name>/releases/download/0.0.48/pkg-0.0.48.tar.gz",
},
sha256 = "<the digest from step 1>",
},
In all three platform blocks — linux, macosx, windows. A source
tarball is the same bytes on every platform, and an entry present in only one
of them fails on the others as "no such version", which reads like a typo in
the consumer's manifest.
A target that is none of the three reads the blocks its row names, in order, and never the build machine's (2026.10.30.1+):
| Target | Blocks, in order |
|---|---|
| Linux (Android and musl included), macOS, Windows | linux, macosx, windows respectively |
wasm32-emscripten |
emscripten, then linux |
<arch>-openkal |
openkal, then linux (a platform may state its own: [platform] descriptor_keys) |
| iOS | ios, then macosx |
bare metal (<arch>-none-<abi>) |
none |
The first block present is the one read, both for the versions under xpm
and for the per-platform table of the mcpp segment. A library that builds
differently for the Web — without the -pthread its Linux block adds, say —
gives it an emscripten block; one that builds for bare metal gives it a
none block, and without one it has no version there. Before 2026.10.30.1 such
a target read the build machine's block, so the same project took different
flags on a Linux and on a Windows machine.
The index is an artifact, not a git clone. Merging to main is not
enough: publish-artifact.yml has to run and push a content-hash artifact,
and clients hold a refresh TTL on top of that. Editing a cached pkgs/** by
hand does nothing.
gh run list --repo mcpplibs/mcpp-index --workflow publish-artifact.yml --limit 1
rm -rf ~/.mcpp/registry/data/<namespace> # force a client refresh
The point of this step is that a local checkout of the library will mask every mistake above. Resolve it the way a stranger would:
rm -rf ~/.mcpp/registry/data/xpkgs/<ns>-x-<name>/0.0.48
mcpp build # must download and compile 0.0.48
Only then bump [dependencies] in the consumers.
Do not try to force a refresh with
find ~/.mcpp/registry -mindepth 1 -maxdepth 1 ! -name data -exec rm -rf {} +alone.data/xpkgssits at depth 2 and is not nameddata, so a careless second pass deletes the whole payload store (~800 MB of toolchains). Recovery ismcpp self doctor, which re-provisions, thenmcpp update.
While the chain above is still in flight, seed the registry by hand so consumers can compile against the library before it is published:
REG=~/.mcpp/xpkgs/<ns>-x-<name>/0.0.48 # the store of mcpp's indices (25 §1)
mkdir -p "$REG"
git -C /path/to/library archive --format=tar --prefix=<repo>-0.0.48/ HEAD \
| tar -x -C "$REG"
cp ../0.0.47/.xpkg.lua "$REG/.xpkg.lua" # add a 0.0.48 entry to it
mcpp's build sandbox is network-isolated, so file:// and
http://127.0.0.1 index URLs cannot be fetched — seeding the cache is the way.
Remove the seeded copy before believing the real thing works. A seeded 0.0.48 and a published 0.0.48 are indistinguishable to the build, and the seeded one is the copy that will still be there when the publish silently failed.
A member's manifest may leave version, [build] flags and x.workspace = true
entries to its workspace (07 §4.1). Both publishing routes
keep that working.
- The descriptor points into the repository's tag tarball
(
mcpp = "*/libs/http/mcpp.toml"). The consumer reads the member's manifest from the tarball and applies the workspace root the tarball contains, as agitconsumer does. The manifest is published as written. mcpp publishormcpp emit xpkginside the member. The archive contains only the member's directory, so itsmcpp.tomlis normalised: the values the member inherits are written out,x.workspace = trueentries receive their resolved source, and a dependency on a sibling member is published as a version dependency. The manifest as written is kept beside it asmcpp.toml.orig, and the normalised file is also written totarget/dist/<identity>-<version>.mcpp.tomlfor review. The archive is built from git objects with the commit's dates, so two runs produce the same bytes. A package that is not a workspace member is archived exactly as before.
A sibling dependency is published under the sibling's version. A path edge that
states none takes the version of the sibling's own manifest (2026.11.17.2+;
before, the edge was refused and the refusal named the line to write); one that
states a version is published with it:
[dependencies]
acme.util = { path = "../util" } # published as acme.util = "<the version of ../util>"
acme.net = { path = "../net", version = "0.3.0" } # published as written
A sibling whose manifest states no version is refused. mcpp publish also
refuses a path dependency outside the package that is not a workspace member,
and an inherited include directory outside the member's directory, because the
archive contains neither.
A descriptor's mcpp field has two forms (SPEC-001 §3.5). The pointer form,
mcpp = "<glob>", names the manifest inside the payload; the inline form,
mcpp = { sources = ..., ... }, is the manifest of a payload that carries none.
mcpp publish and mcpp emit xpkg write the pointer form:
mcpp = "*/mcpp.toml",
The archive is the package's source tree under one top directory, and its
manifest is in it, so the descriptor states where the manifest is and repeats
nothing the manifest states: modules, dependencies and run-time requirements
are read from mcpp.toml. mcpp xpkg parse, a consumer's build and
mcpp new --template read the field through one function, so a descriptor that
was written is a descriptor that is read. Before this release the two commands
wrote a table with manifest = "mcpp.toml", which is neither form; such a
descriptor is refused with the line to write in its place.
| Item | Rule |
|---|---|
| Archive and its top directory | the package's identity: <namespace>.<name>-<version>.tar.gz; a package with no namespace keeps <name>-<version>.tar.gz. Two members that share a short name across namespaces (omui.core, hanim.core) are two archives under one tag |
| Descriptor | namespace and a one-segment name (SPEC-001 §3.2), in the file the index uses: <name>.lua in mcpplibs, <namespace>.<name>.lua in another namespace |
| Tag | --tag <template> of {version}, {name} and {namespace}; v{version} without it. The descriptor's URL is <repo>/releases/download/<tag>/<archive> |
| Several members | mcpp publish --workspace (with --exclude), or -p <member> repeated: one archive and one descriptor per member in the workspace's target/dist, and SHA256SUMS beside them in the form sha256sum -c reads |
mcpp publish --workspace --tag 'v{version}' # every member, one tag where the versions are equal
mcpp publish -p mlibs.math -p mlibs.unicode # two members
The tag's template is evaluated for each member. Members whose tags are equal
are one release; where the tags differ, each has its own checksum file,
SHA256SUMS-<tag>. mcpp publish writes archives, checksums and descriptors;
it creates no tag and no release.
Most [build] keys degrade cleanly on an older mcpp: it warns that the key is
unsupported, ignores it, and the build either still works or fails with a clear
message. build_program_timeout is one of those — an older mcpp falls back to
the 600 s default and, if that is too short, says so.
module_extensions is not. An older mcpp warns and ignores it, and then
compiles those files as ordinary translation units — a wrong build rather
than a clean failure: the module interface produces no BMI, and the failure
surfaces later, somewhere that names neither the key nor the file.
A published package that uses module_extensions must declare an mcpp version
floor in its index descriptor. The floor mechanism must degrade: a package
that is unavailable because the client is too old has to be reported as
unavailable, never as absent — a client told "no such package" will keep
re-refreshing the index looking for it.
-
mcpp.tomlversion == git tag - tag pushed; tarball downloads and its sha256 recorded
- gitcode asset verified with GET, byte-identical to GitHub's
- index entry in all three platform blocks
-
publish-artifact.ymlsucceeded - cold resolve (seeded copy deleted) downloads and compiles it
- consumers bumped
- a workspace member: the normalised
target/dist/<name>-<version>.mcpp.tomlreviewed