|
2 | 2 | ! SPDX-License-Identifier: GFDL-1.3-or-later |
3 | 3 | ! ------------------------------------------------------------- |
4 | 4 | ! Doc Type : Markdown |
5 | | - ! Doc Name : 02-Write-A-Recipe-Even-If-You-Dont-Know-C.md |
| 5 | + ! Doc Name : 10-Write-A-Recipe-Even-If-You-Dont-Know-C.md |
6 | 6 | ! Doc Authors : Aoran Zeng <[email protected]> |
7 | 7 | ! Contributors : Nul None <[email protected]> |
8 | 8 | ! | |
9 | 9 | ! Created On : <2024-08-19> |
10 | | - ! Last Modified : <2025-07-21> |
| 10 | + ! Last Modified : <2025-08-11> |
11 | 11 | ! ---------------------------------------------------------- --> |
12 | 12 |
|
13 | 13 | # Write A Recipe Even If You Don't Know C |
|
52 | 52 | - `source`: 该 `target` 所能换的具体的源,由 `mirror` 提供服务,往往一个 `mirror` 会提供许多 `source` |
53 | 53 | - `recipe`: 是为一个 `target` 定义的具体换源方法,请参考 `src` 目录中的 `recipe` 目录 |
54 | 54 |
|
55 | | -- `feature`: 一个 `target` 可以支持的功能,比如能否重置回上游默认源等 |
56 | | - |
57 | 55 | - **镜像源**: 为了方便,**偶尔**我们将直接称`mirror`和/或`source`为**镜像源**,这只是一种方便性的称呼,可以统称二者,也可以根据上下文指代二者之一 |
58 | 56 |
|
59 | 57 | <br> |
|
76 | 74 |
|
77 | 75 | 5. 在 [Wiki] 中记录的镜像站中寻找可用源;可以额外补充镜像站 |
78 | 76 |
|
79 | | -6. 可以使用这些函数: |
| 77 | +6. 使用 chef DSL 定义 `_prelude()` 函数 |
| 78 | + |
| 79 | + 该函数将填充 target 所有的必要信息,包括维护信息、换源信息 |
| 80 | + |
| 81 | +7. 按需实现 `_setsrc()` `_getsrc()` `_resetsrc()`, 可以使用这些函数: |
80 | 82 |
|
81 | 83 | 1. `framework/core.c` 中以 `chsrc_` 开头的所有函数或宏 |
82 | 84 | 2. `xy.h` 中以 `xy_` 开头的所有函数或宏 |
83 | | - 3. `chec.h` 中以 `chef_` 开头的所有函数或宏 |
| 85 | + 3. `chec.c` `chef-helper.c` 中以 `chef_` 开头的所有函数或宏 |
84 | 86 |
|
85 | 87 | 一个简单的方法是,在 VS Code 中按快捷键 `Ctrl-T` 搜索上述三种前缀 |
86 | 88 |
|
87 | | -7. 在 `recipe/menu.c` 中添加用户可以使用的 `target` 别名 |
| 89 | +8. 在 `recipe/menu.c` 中登记此 target |
88 | 90 |
|
89 | | -8. [编译、运行、测试 (how?)](./01-Develop.md),若无问题可提交 Pull Request |
| 91 | +9. [编译、运行、测试 (how?)](./01-Develop.md),若无问题可提交 Pull Request |
90 | 92 |
|
91 | 93 | <br> |
92 | 94 |
|
|
0 commit comments