Skip to content

Commit

Permalink
Feature: configurable Nim upstream repo (#76)
Browse files Browse the repository at this point in the history
* add tunable repo URL when using NIM_COMMIT

* fix docs

* remove embedded single quotes from repo default

* drop old upstream (if any) before adding a new one

* rename NIM_REPO -> NIM_COMMIT_REPO

* add new remote named "extra" if upstream already exists

* remove previous "extra" remote before trying to reset it

* make extra point to custom repo, upstream to nim-lang's
  • Loading branch information
gmega authored Oct 30, 2024
1 parent 1c6c29b commit 0dfdddb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,20 @@ You also need to specify it when using this non-default Nim compiler version:

`make -j8 NIM_COMMIT="v1.2.6" nimbus_beacon_node`

### NIM_COMMIT_REPO

`NIM_COMMIT` will try to fetch commits from the
[status-im fork](https://github.com/status-im/Nim), followed by the
[official Nim language repo](https://github.com/nim-lang/Nim). If you want to
use a fork from somewhere else, you can set this to the repo's URL.

`make -j8 NIM_COMMIT="4561f01" NIM_COMMIT_REPO="https://github.com/myorg/my-nim-fork"`

As before, you will need to specify this again when using this non-default Nim
compiler version:

`make -j8 NIM_COMMIT="4561f01" NIM_COMMIT_REPO="https://github.com/myorg/my-nim-fork" nimbus_beacon_node`

### EXCLUDED_NIM_PACKAGES

List of relative paths (incomplete ones also work) to Git submodules that
Expand Down
9 changes: 8 additions & 1 deletion scripts/build_nim.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,14 @@ nim_needs_rebuilding() {
if ! git checkout -q ${NIM_COMMIT} 2>/dev/null; then
# Pay the price for a non-default NIM_COMMIT here, by fetching everything.
# (This includes upstream branches and tags that might be missing from our fork.)
git remote add upstream https://github.com/nim-lang/Nim
if ! git remote | grep -q "^upstream$"; then
git remote add upstream https://github.com/nim-lang/Nim
fi
# If the user has specified a custom repo, add it here as a remote as well.
if [[ -n "${NIM_COMMIT_REPO}" ]]; then
git remote remove extra 2>/dev/null || true
git remote add extra "${NIM_COMMIT_REPO}"
fi
git fetch --all --tags --quiet
git checkout -q ${NIM_COMMIT}
fi
Expand Down

0 comments on commit 0dfdddb

Please sign in to comment.