|
1 | 1 | # Contributing |
2 | 2 |
|
| 3 | +## Understanding the structure of the Darling project |
| 4 | + |
| 5 | +### Submodules |
| 6 | + |
| 7 | +The Darling project relies heavily on the usage of submodules. The best way to understand a submodule is to think of it as repo inside of another repo. |
| 8 | + |
| 9 | +The [`.gitmodules` file](https://github.com/darlinghq/darling/blob/master/.gitmodules) provides a list of submodules that the `darling` repo uses. |
| 10 | + |
| 11 | +For example, let's take a look at the `darling-xnu` repo that the `darling` repo includes. |
| 12 | + |
| 13 | +``` |
| 14 | +[submodule "src/external/xnu"] |
| 15 | +path = src/external/xnu |
| 16 | +url = ../darling-xnu.git |
| 17 | +``` |
| 18 | + |
| 19 | +The path indicates the location of the submodule, while the url is the link to the git repo. |
| 20 | + |
| 21 | +> [!NOTE] |
| 22 | +> A git submodule's URL path would usually be absolute instead of relative. |
| 23 | +> ``` |
| 24 | +> [submodule "src/external/xnu"] |
| 25 | +> path = src/external/xnu |
| 26 | +> url = https://github.com/darlinghq/darling-xnu.git |
| 27 | +> ``` |
| 28 | +> However, the Darling team has made the deliberate decision to use a relative path instead, mainly for the following reasons: |
| 29 | +> * To allow cloning/updating the project either through `https` or `ssh` |
| 30 | +> * To make it easier to hard fork this project. |
| 31 | +
|
| 32 | +When you `cd` into the `src/external/xnu` directory, you are working off of the `darling-xnu` repo, instead of the usual `darling` repo. |
| 33 | +
|
| 34 | +```bash |
| 35 | +cd ~/Downloads/darling |
| 36 | +git remote -v |
| 37 | +# origin https://github.com/darlinghq/darling.git (fetch) |
| 38 | +# origin https://github.com/darlinghq/darling.git (push) |
| 39 | +``` |
| 40 | +```bash |
| 41 | +cd ~/Downloads/darling/src/external/xnu |
| 42 | +git remote -v |
| 43 | +# origin https://github.com/darlinghq/darling-xnu.git (fetch) |
| 44 | +# origin https://github.com/darlinghq/darling-xnu.git (push) |
| 45 | +``` |
| 46 | + |
| 47 | +[For additional details on git submodules, we recommend reading the submodule section in the git-scm website](https://git-scm.com/book/en/v2/Git-Tools-Submodules) |
3 | 48 | ## Setting up your development environment |
4 | 49 |
|
5 | | -[See instruction page for guidance on how to set up and build Darling.](../build-instructions.md) |
| 50 | +If you have not already, [please see instruction page for guidance on how to set up and build Darling.](../build-instructions.md) |
6 | 51 |
|
7 | 52 | We recommend adding the following additional flags when configuring the project with cmake: |
8 | 53 |
|
|
0 commit comments