|
7 | 7 | ! Contributors : Nul None <[email protected]> |
8 | 8 | ! | |
9 | 9 | ! Created On : <2024-08-19> |
10 | | - ! Last Modified : <2025-07-14> |
| 10 | + ! Last Modified : <2025-07-15> |
11 | 11 | ! ---------------------------------------------------------- --> |
12 | 12 |
|
13 | 13 | # Write A Recipe Even If You Don't Know C |
|
20 | 20 |
|
21 | 21 | 我鼓励你为新的软件添加换源支持,因为通过 `chsrc` 这将非常简单,你的贡献也将非常有价值。理论上每一个 `recipe` 都需要有专人长时间维护 ([招募](https://github.com/RubyMetric/chsrc/issues/130))。 |
22 | 22 |
|
23 | | -1. 本项目采用 `GPLv3+` 协议,是真正的**自由软件**,而非仅仅是开源软件 |
24 | | -2. 代码规范灵活遵循 `GNU` 标准(若标准干扰了可维护性,则并不采纳) |
25 | | -3. 高度模块化,目录结构清晰易懂 |
26 | | -4. 极小依赖,极易构建,只需要 `GCC` 或 `Clang` 即可编译 (`make` 和 `just`可简化,但不是必需的) |
27 | | -5. 易于将 `shell` 脚本转换为等价的 `recipe` |
28 | | -6. 已有大量 `recipe` 可提供参考,并提供了 [recipe template] 供直接使用 |
29 | | -7. 提供持续关注镜像站可用性的协作平台: |
30 | | - |
31 | | - 1. <https://github.com/RubyMetric/chsrc/wiki> |
32 | | - 2. <https://github.com/RubyMetric/chsrc/discussions> |
| 23 | +- 本项目采用 `GPLv3+` 协议,是真正的**自由软件**,而非仅仅是开源软件 |
| 24 | +- 代码规范灵活遵循 `GNU` 标准(若标准干扰了可维护性,则并不采纳) |
| 25 | +- 高度模块化,目录结构清晰易懂 |
| 26 | +- 极小依赖,极易构建,只需要 `GCC` 或 `Clang` 即可编译 (`make` 和 `just`可简化,但不是必需的) |
| 27 | +- 易于将 `shell` 脚本转换为等价的 `recipe` |
| 28 | +- 已有大量 `recipe` 可提供参考,并提供了 [recipe template] 供直接使用 |
| 29 | +- [rawstr4c] 帮助你在C语言中维护复杂的字符串 |
| 30 | +- [chsrc-bootstrap] 帮助你在没有预编译 `chsrc` 的平台上 bootstrap 自己 |
33 | 31 |
|
34 | 32 | <br> |
35 | 33 |
|
36 | 34 | 成功案例: |
37 | 35 |
|
38 | | -1. [Armbian](../src/recipe/os/APT/Armbian.c) |
39 | | -2. [uv](../src/recipe/lang/Python/uv.c) |
| 36 | +- [Armbian](../src/recipe/os/APT/Armbian.c) |
| 37 | +- [uv](../src/recipe/lang/Python/uv.c) |
40 | 38 |
|
41 | 39 | <br> |
42 | 40 |
|
43 | 41 | ## 基本概念 |
44 | 42 |
|
45 | | -1. `target`: 所要换源的目标 |
| 43 | +- `target`: 所要换源的目标 |
| 44 | +- `target group`: 一个 `target` 包含了多个子 `target`,比如 `Python group` 包含了该语言的多个包管理器 |
46 | 45 |
|
47 | | -2. `category`: 是 `target category` 的简写,即 `target` 所属的类别,可以是 **编程语言**,**操作系统**,**软件** 三类之一 |
| 46 | +- `category`: 是 `target category` 的简写,即 `target` 所属的类别,可以是 **编程语言**,**操作系统**,**软件** 三类之一 |
48 | 47 |
|
49 | 48 | 1. 在目录中,三者分别为 `lang`, `os`, `ware` |
50 | 49 | 2. 在代码中,三者前缀分别为 `pl`, `os`, `wr` |
51 | 50 |
|
52 | | -3. `mirror`: 是 `mirror site` 的简写,指镜像站,如清华大学开源软件镜像站 |
53 | | -4. `source`: 该 `target` 所能换的具体的源,由 `mirror` 提供服务,往往一个 `mirror` 会提供许多 `source` |
54 | | -5. `recipe`: 是为一个 `target` 定义的具体换源方法,请参考 `src` 目录中的 `recipe` 目录 |
| 51 | +- `mirror`: 是 `mirror site` 的简写,指镜像站,如清华大学开源软件镜像站 |
| 52 | +- `source`: 该 `target` 所能换的具体的源,由 `mirror` 提供服务,往往一个 `mirror` 会提供许多 `source` |
| 53 | +- `recipe`: 是为一个 `target` 定义的具体换源方法,请参考 `src` 目录中的 `recipe` 目录 |
55 | 54 |
|
56 | | -6. `feature`: 一个 `target` 可以支持的功能,比如能否重置回上游默认源等 |
| 55 | +- `feature`: 一个 `target` 可以支持的功能,比如能否重置回上游默认源等 |
57 | 56 |
|
58 | | -7. **镜像源**: 为了方便,**偶尔**我们将直接称`mirror`和/或`source`为**镜像源**,这只是一种方便性的称呼,可以统称二者,也可以根据上下文指代二者之一 |
| 57 | +- **镜像源**: 为了方便,**偶尔**我们将直接称`mirror`和/或`source`为**镜像源**,这只是一种方便性的称呼,可以统称二者,也可以根据上下文指代二者之一 |
59 | 58 |
|
60 | 59 | <br> |
61 | 60 |
|
|
72 | 71 | 4. 参考现有 `recipe` 的写法 |
73 | 72 |
|
74 | 73 | 1. 看一眼就能上手的参照物是 [PHP recipe](../src/recipe/lang/PHP.c) |
75 | | - 2. 最好的参照物是 [Ruby recipe](../src/recipe/lang/Ruby.c) |
76 | | - 3. 组换源参照物是 [Python Group recipe](../src/recipe/lang/Python/Python.c) |
| 74 | + 2. 最好的参照物是 [Ruby recipe](../src/recipe/lang/Ruby/Ruby.c) |
| 75 | + 3. 组换源参照物是 [Python group recipe](../src/recipe/lang/Python/Python.c) |
77 | 76 |
|
78 | 77 | 5. 在 [Wiki] 中记录的镜像站中寻找可用源;可以额外补充镜像站 |
79 | 78 |
|
80 | | - 并创建或更新对应 `target` 的镜像站可用状态 [Wiki] 页 |
81 | | - |
82 | 79 | 6. 可以使用这些函数: |
83 | 80 |
|
84 | 81 | 1. `framework/core.c` 中以 `chsrc_` 开头的所有函数或宏 |
|
105 | 102 |
|
106 | 103 | <br> |
107 | 104 |
|
| 105 | +[rawstr4c]: ../tool/rawstr4c/ |
| 106 | +[chsrc-bootstrap]: ../bootstrap/ |
108 | 107 | [recipe template]: ../src/recipe/recipe-template.c |
109 | 108 | [Wiki]: https://github.com/RubyMetric/chsrc/wiki |
0 commit comments