Skip to content

Commit 4b56aa7

Browse files
committed
Add A Overview Section For the Structure of the Darling Project
1 parent 50f1d29 commit 4b56aa7

1 file changed

Lines changed: 46 additions & 1 deletion

File tree

src/contributing/README.md

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,53 @@
11
# Contributing
22

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)
348
## Setting up your development environment
449

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)
651

752
We recommend adding the following additional flags when configuring the project with cmake:
853

0 commit comments

Comments
 (0)