|
1 | | --- Form B (inline mcpp = { ... }) carries the build info for ALL listed versions. |
2 | | --- 0.0.2+ ships an upstream `mcpp.toml`, but `mcpp` is a package-level field |
3 | | --- (not per-version) in xpkg.lua, so to keep 0.0.1 installable we keep the |
4 | | --- workaround table here. The src/**/*.cppm layout is the same across 0.0.1, |
5 | | --- 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.0.6 and 0.0.7 (0.0.3 adds src/completions*.cppm, which the glob takes in; |
6 | | --- 0.0.6 replaces src/completions/ with src/complete.cppm; 0.0.7 changes src/cmdline.cppm only), |
7 | | --- so a single Form B block describes every version correctly. |
8 | | --- When 0.0.1 is dropped, this can be replaced with `mcpp = "*/mcpp.toml"`. |
| 1 | +-- Form A: the upstream `mcpp.toml` carries every version from 0.0.2 on. The |
| 2 | +-- 0.1.0 manifest also carries the agent-skills feature and the |
| 3 | +-- `[build-dependencies]` path re-export of the mcpp/cmdline build package, |
| 4 | +-- which a Form B table cannot state. 0.0.1 (the only version without a |
| 5 | +-- manifest) is dropped. |
9 | 6 | -- |
10 | | --- M6.x: Form B paths are globs relative to the verdir (the untouched |
11 | | --- xlings extract dir). The leading `*/` absorbs the GitHub tarball's |
| 7 | +-- The leading `*/` in the manifest glob absorbs the GitHub tarball's |
12 | 8 | -- `cmdline-<tag>/` wrap layer. |
13 | 9 | package = { |
14 | 10 | spec = "1", |
@@ -70,6 +66,11 @@ package = { |
70 | 66 | }, |
71 | 67 | sha256 = "2e998d70953c0da856dc2131902414ab25bc9faafd0bae255290d833ad0e9b49", |
72 | 68 | }, |
| 69 | + ["0.1.0"] = { |
| 70 | + -- No CN mirror yet: a plain-string url (see docs/cn-mirror.md). |
| 71 | + url = "https://github.com/mcpplibs/cmdline/archive/refs/tags/v0.1.0.tar.gz", |
| 72 | + sha256 = "2167b41288d7bdfcd8a22c33fb3bbfa2a9df2d5900bb00b282a4260ad615971d", |
| 73 | + }, |
73 | 74 | }, |
74 | 75 | macosx = { |
75 | 76 | ["0.0.1"] = { |
@@ -121,6 +122,11 @@ package = { |
121 | 122 | }, |
122 | 123 | sha256 = "2e998d70953c0da856dc2131902414ab25bc9faafd0bae255290d833ad0e9b49", |
123 | 124 | }, |
| 125 | + ["0.1.0"] = { |
| 126 | + -- No CN mirror yet: a plain-string url (see docs/cn-mirror.md). |
| 127 | + url = "https://github.com/mcpplibs/cmdline/archive/refs/tags/v0.1.0.tar.gz", |
| 128 | + sha256 = "2167b41288d7bdfcd8a22c33fb3bbfa2a9df2d5900bb00b282a4260ad615971d", |
| 129 | + }, |
124 | 130 | }, |
125 | 131 | windows = { |
126 | 132 | ["0.0.1"] = { |
@@ -172,16 +178,41 @@ package = { |
172 | 178 | }, |
173 | 179 | sha256 = "2e998d70953c0da856dc2131902414ab25bc9faafd0bae255290d833ad0e9b49", |
174 | 180 | }, |
| 181 | + ["0.1.0"] = { |
| 182 | + -- No CN mirror yet: a plain-string url (see docs/cn-mirror.md). |
| 183 | + url = "https://github.com/mcpplibs/cmdline/archive/refs/tags/v0.1.0.tar.gz", |
| 184 | + sha256 = "2167b41288d7bdfcd8a22c33fb3bbfa2a9df2d5900bb00b282a4260ad615971d", |
| 185 | + }, |
175 | 186 | }, |
176 | 187 | }, |
177 | 188 |
|
178 | | - mcpp = { |
179 | | - schema = "0.1", |
180 | | - language = "c++23", |
181 | | - import_std = true, |
182 | | - modules = { "mcpplibs.cmdline" }, |
183 | | - sources = { "*/src/**/*.cppm" }, |
184 | | - targets = { ["cmdline"] = { kind = "lib" } }, |
185 | | - deps = { }, |
186 | | - }, |
| 189 | + mcpp = "*/mcpp.toml", |
187 | 190 | } |
| 191 | + |
| 192 | +-- 0.0.1 is the only archive without an upstream manifest. install() writes a |
| 193 | +-- minimal one beside its sources so the `*/mcpp.toml` pointer resolves for it |
| 194 | +-- too; every newer version ships its own and is left untouched. |
| 195 | +local LEGACY_TOML = [==[ |
| 196 | +[package] |
| 197 | +namespace = "mcpplibs" |
| 198 | +name = "cmdline" |
| 199 | +version = "0.0.1" |
| 200 | +standard = "c++23" |
| 201 | +
|
| 202 | +[build] |
| 203 | +sources = ["src/*.cppm"] |
| 204 | +
|
| 205 | +[modules] |
| 206 | +exports = ["mcpplibs.cmdline"] |
| 207 | +]==] |
| 208 | + |
| 209 | +function install() |
| 210 | + if pkginfo.version() ~= "0.0.1" then return true end |
| 211 | + local layer = path.join(pkginfo.install_dir(), "cmdline-0.0.1") |
| 212 | + if not os.isfile(path.join(layer, "src", "cmdline.cppm")) then |
| 213 | + log.error("cmdline 0.0.1: no src/cmdline.cppm under %s after unpacking", layer) |
| 214 | + return false |
| 215 | + end |
| 216 | + io.writefile(path.join(layer, "mcpp.toml"), LEGACY_TOML) |
| 217 | + return true |
| 218 | +end |
0 commit comments