Skip to content

Commit 4a53056

Browse files
authored
docs: rewrite README with library catalog, community info, and descriptor guide (#10)
1 parent 4f0cb6b commit 4a53056

1 file changed

Lines changed: 119 additions & 15 deletions

File tree

README.md

Lines changed: 119 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,129 @@
11
# mcpp-index
22

3-
> Default package registry for [`mcpp`](https://github.com/mcpp-community/mcpp).
4-
> Browse: **https://mcpp-community.github.io/mcpp-index/**
3+
> [`mcpp`](https://github.com/mcpp-community/mcpp) 构建工具的默认包索引仓库
4+
>
5+
> 在线浏览: **https://mcpplibs.github.io/mcpp-index/**
6+
7+
## 快速使用
58

69
```bash
7-
mcpp add mcpplibs.cmdline@0.0.2 # → updates mcpp.toml
8-
mcpp build # → fetches sources, builds
10+
mcpp add ftxui@6.1.9 # 添加依赖到 mcpp.toml
11+
mcpp build # 自动拉取源码 + 构建
12+
```
13+
14+
## 已收录的包
15+
16+
### mcpplibs 模块化库
17+
18+
| 包名 | 版本 | 简介 | 仓库 |
19+
|------|------|------|------|
20+
| `mcpplibs.cmdline` | 0.0.2 | 命令行解析框架 — `import mcpplibs.cmdline;` | [mcpplibs/cmdline](https://github.com/mcpplibs/cmdline) |
21+
| `mcpplibs.tinyhttps` | 0.2.2 | 轻量 HTTP/HTTPS 客户端(SSE 流式) — `import mcpplibs.tinyhttps;` | [mcpplibs/tinyhttps](https://github.com/mcpplibs/tinyhttps) |
22+
| `mcpplibs.llmapi` | 0.2.5 | 大语言模型 API 客户端(OpenAI/Anthropic 兼容) — `import mcpplibs.llmapi;` | [mcpplibs/llmapi](https://github.com/mcpplibs/llmapi) |
23+
| `mcpplibs.capi.lua` | 0.0.3 | Lua 5.4 C API 的 C++23 模块封装 — `import mcpplibs.capi.lua;` | [mcpplibs/lua](https://github.com/mcpplibs/lua) |
24+
| `mcpplibs.xpkg` | 0.0.39 | xpkg V1 规范的 C++23 参考实现 — `import mcpplibs.xpkg;` | [openxlings/libxpkg](https://github.com/openxlings/libxpkg) |
25+
| `mcpplibs.templates` | 0.0.1 | 最小化模块库模板 — `import mcpplibs.templates;` | [mcpplibs/templates](https://github.com/mcpplibs/templates) |
26+
27+
### 第三方 C/C++ 库
28+
29+
| 包名 | 版本 | 简介 |
30+
|------|------|------|
31+
| `ftxui` | 6.1.9 | C++ 函数式终端 UI 库(screen + dom + component) |
32+
| `gtest` | 1.15.2 | Google Test 测试框架 |
33+
| `mbedtls` | 3.6.1 | TLS/加密库(纯 C) |
34+
| `lua` | 5.4.7 | Lua 脚本语言(纯 C 嵌入式库) |
35+
36+
### 依赖关系链
37+
38+
```
39+
mcpplibs.llmapi
40+
└── mcpplibs.tinyhttps
41+
└── mbedtls ← mcpp 自动传递,无需手动声明
42+
43+
mcpplibs.xpkg
44+
└── mcpplibs.capi.lua
45+
└── lua ← 同上
46+
```
47+
48+
mcpp 0.0.3+ 的 transitive walker 自动沿链路传播头文件和依赖,消费者只需声明直接依赖。
49+
50+
## 包描述文件
51+
52+
每个包对应一个 `pkgs/<首字母>/<包名>.lua` 文件,遵循 [xpkg V1 规范](https://github.com/d2learn/xim-pkgindex/blob/main/docs/V1/xpackage-spec.md)
53+
54+
### 两种形式
55+
56+
**Form A** — 上游自带 `mcpp.toml`,描述文件只声明元数据和下载地址:
57+
58+
```lua
59+
package = {
60+
spec = "1",
61+
name = "mcpplibs.tinyhttps",
62+
xpm = {
63+
linux = { ["0.2.2"] = { url = "...", sha256 = "..." } },
64+
macosx = { ["0.2.2"] = { url = "...", sha256 = "..." } },
65+
windows = { ["0.2.2"] = { url = "...", sha256 = "..." } },
66+
},
67+
}
968
```
1069

11-
## Adding a package
70+
**Form B** — 上游没有 `mcpp.toml`,在描述文件里内联构建信息:
71+
72+
```lua
73+
package = {
74+
spec = "1",
75+
name = "ftxui",
76+
xpm = { ... },
77+
mcpp = {
78+
include_dirs = { "*/include", "*/src" },
79+
sources = {
80+
"*/src/ftxui/**/*.cpp",
81+
"!*/src/ftxui/**/*_test.cpp", -- glob 排除(mcpp 0.0.4+)
82+
"!*/src/ftxui/**/*_fuzzer.cpp",
83+
},
84+
targets = { ["ftxui"] = { kind = "lib" } },
85+
},
86+
}
87+
```
88+
89+
### 获取方式
90+
91+
mcpp 初次运行时自动 clone 本仓库到 `~/.mcpp/registry/data/mcpp-index/`。后续更新:
92+
93+
```bash
94+
mcpp search <keyword> # 触发索引刷新 + 搜索
95+
```
96+
97+
也可手动拉取:
98+
99+
```bash
100+
cd ~/.mcpp/registry/data/mcpp-index && git pull
101+
```
102+
103+
## 添加新包
104+
105+
1. Fork 本仓库
106+
2.`pkgs/<首字母>/` 下创建 `<包名>.lua`,参考现有文件([mbedtls.lua](pkgs/m/mbedtls.lua)[ftxui.lua](pkgs/f/ftxui.lua))
107+
3. 提交 PR — `validate` workflow 自动 lint,`deploy-site` 合入后自动发布到浏览站
108+
109+
详细格式说明见 [mcpp 扩展字段文档](https://github.com/mcpp-community/mcpp/blob/main/docs/04-schema-xpkg-extension.md)
110+
111+
## 相关链接
112+
113+
| 项目 | 说明 |
114+
|------|------|
115+
| [mcpp](https://github.com/mcpp-community/mcpp) | 现代 C++23 构建 & 包管理工具 |
116+
| [xlings](https://github.com/d2learn/xlings) | mcpp 底层的包安装引擎 + 沙箱环境 |
117+
| [xpkg V1 spec](https://github.com/d2learn/xim-pkgindex/blob/main/docs/V1/xpackage-spec.md) | 包描述文件规范 |
118+
| [mcpplibs](https://github.com/mcpplibs) | mcpp 生态的模块化 C++23 库集合 |
119+
| [xim-pkgindex](https://github.com/d2learn/xim-pkgindex) | xlings 的通用包索引仓库 |
120+
121+
## 社区
12122

13-
Drop one [xpkg V1](https://github.com/d2learn/xim-pkgindex/blob/main/docs/V1/xpackage-spec.md)
14-
descriptor at `pkgs/<first-letter>/<name>.lua`. Existing files (e.g.
15-
[`pkgs/m/mbedtls.lua`](pkgs/m/mbedtls.lua),
16-
[`pkgs/l/lua.lua`](pkgs/l/lua.lua)) are the canonical templates;
17-
the [mcpp extension](https://github.com/mcpp-community/mcpp/blob/main/docs/04-schema-xpkg-extension.md)
18-
covers the optional `mcpp = { ... }` segment for upstreams that
19-
don't ship their own `mcpp.toml`. Open a PR — the `validate`
20-
workflow lint-checks descriptors, the `deploy-site` workflow
21-
republishes the browse site after merge.
123+
- **Issues / 反馈**: [mcpp issues](https://github.com/mcpp-community/mcpp/issues) · [mcpp-index issues](https://github.com/mcpp-community/mcpp-index/issues)
124+
- **讨论 / 论坛**: [d2learn 论坛](https://forum.d2learn.org)
125+
- **mcpplibs 库贡献**: 各库仓库接受 PR,CI 使用 mcpp 构建验证
22126

23127
## License
24128

25-
Descriptors: CC0. Each indexed upstream keeps its own license.
129+
包描述文件: CC0。各上游库保留其自身许可证。

0 commit comments

Comments
 (0)