93 lines
2.3 KiB
Markdown
93 lines
2.3 KiB
Markdown
# build-monero
|
|
|
|
building verifiable builds of monerod and monero-wallet, and package
|
|
them up as deb-packages. using docker to build with a `Dockerfile`
|
|
thats adapted from the [upstream
|
|
`Dockerfile`](https://github.com/monero-project/monero), but should
|
|
essentially be doing the same. we want to use our own copy so that
|
|
we dont have to rely on upstream.
|
|
|
|
## git config
|
|
|
|
```shell
|
|
git config -f .gitmodules diff.submodule log
|
|
git config -f .gitmodules status.submodulesummary 1
|
|
|
|
# follow the 'release-v0.17' branch of the upstream monero repo
|
|
git config -f .gitmodules submodule.monero.branch release-v0.17
|
|
|
|
# default to: git pull --recurse-submodules
|
|
# git config -f .gitmodules submodule.recurse true
|
|
# explicitly require using 'git submodule update' to update submodules
|
|
git config -f .gitmodules submodule.recurse false
|
|
```
|
|
|
|
## building
|
|
|
|
pull in upstream changes from the `monero` submodule (and the
|
|
submodules it contains):
|
|
|
|
```shell
|
|
# if upstream has changed references to any of its own submodules
|
|
git submodule sync
|
|
|
|
# checkout the branch in the upstream monero repo submodule
|
|
git submodule update --init --remote monero
|
|
|
|
# the monero repo has submodules of its own, checked out at specific commits in
|
|
# the upstream repo. the build depends on them being checked out at those
|
|
# commits so we want to read the hash to checkout from the branch we checked
|
|
# out in the upstream repo.
|
|
git submodule update --init --recursive
|
|
|
|
|
|
```
|
|
|
|
build the container:
|
|
|
|
```shell
|
|
docker build --build-arg NPROC=$(nproc) -t monero .
|
|
```
|
|
|
|
## other
|
|
|
|
the upstream `Dockerfile` does:
|
|
|
|
```shell
|
|
git submodule init && git submodule update
|
|
|
|
# equivalent to
|
|
git submodule update --init
|
|
|
|
# bit since the monero repo is a submodule for us (and we run
|
|
# from the "parent" repo) we need to add --recursive
|
|
|
|
git submodule update --init --recursive
|
|
|
|
```
|
|
|
|
updating submodules:
|
|
|
|
```shell
|
|
|
|
# these commands are equivalent to each other
|
|
git pull --recurse-submodules
|
|
git submodule update --init --recursive
|
|
|
|
```
|
|
|
|
get tags and `foreach`:
|
|
|
|
```shell
|
|
# fetch tags in submodules
|
|
git submodule foreach git fetch --tags
|
|
```
|
|
|
|
useful `git` aliases:
|
|
|
|
```shell
|
|
git config -f .gitmodules alias.sdiff '!'"git diff && git submodule foreach 'git diff'"
|
|
git config -f .gitmodules alias.spush 'push --recurse-submodules=on-demand'
|
|
git config -f .gitmodules alias.supdate 'submodule update --remote --init --recursive'
|
|
```
|