Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Use a submodule to avoid duplicating source code #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "dmd"]
path = dm/src/dmd
url = https://github.com/dlang/dmd.git
34 changes: 31 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,41 @@ https://digitalmars.com/ctg/sc.html
`shared stdout = &_iob[1];`
with
`enum stdout = &_iob[1];`.
4. Change directory to `dm\src\dmc`
5. Make sure the `dm\bin\make.exe` program is on your `PATH`.
6. Execute the commands:
4. Run `git submodule update --init` to make sure you have up-to-date submodules.
5. Change directory to `dm\src\dmc`
6. Make sure the `dm\bin\make.exe` program is on your `PATH`.
7. Execute the commands:
`make CC=dmc clean`
`make CC=dmc scppn`
You might need to edit the `makefile` to set the path to your DMD installation.

Note that DMC runs on Win32, and hasn't been ported to other platforms.
It can generate code for Win32, 16 bit DOS, 16 and 32 bit Windows, 286 DOS extenders,
and 386 DOS extenders.

# Updating the backend

In order to update the backend to a more recent version, do the following:
1. Go to the DMD submodule: `cd dm/src/dmd`;
2. Fetch the latest commits: `git fetch`
3. Checkout the desired commit, e.g.:
- `git checkout origin/master`: Checkout the latest version of the DMD backend;
- `git checkout v2.095.0`: Checkout the state of the backend as of DMD v2.095.0;
- `git checkout 385312b93`: Checkout the state of the backend as of commit `385312b93`;
4. Leave the `dmd` repository, e.g. `cd ../../` to come back to the root of this repository;
5. Commit the change to the submodule: `git add dm/src/dmd && git commit -m "Update DMD backend to master"`

Alternatively, when pulling from this repository, remember to always run `git submodule update --init`
if the submodule have been updated. This is visible from `git status`:
```shell
$ git diff
diff --git a/dm/src/dmd b/dm/src/dmd
index 123456789..abcdef123 160000
--- a/dm/src/dmd
+++ b/dm/src/dmd
@@ -1 +1 @@
-Subproject commit 67ca0a14c4d4d3161541eda27a4126f889d53546
+Subproject commit 385312b93239311c038ffd8c221ac62738006382
```

To learn more about `git submodule`, see [this section of the Pro Git book](https://git-scm.com/book/en/v2/Git-Tools-Submodules).
Loading