build: try to consolidate instructions and decr codedupe in release.sh
This commit is contained in:
@@ -5,8 +5,7 @@ Windows binaries
|
||||
binaries that match the official releases._
|
||||
|
||||
This assumes an Ubuntu (x86_64) host, but it should not be too hard to adapt to another
|
||||
similar system. The docker commands should be executed in the project's root
|
||||
folder.
|
||||
similar system.
|
||||
|
||||
1. Install Docker
|
||||
|
||||
@@ -21,39 +20,17 @@ folder.
|
||||
(see [#6971](https://github.com/spesmilo/electrum/issues/6971)).
|
||||
If having problems, try to upgrade to at least `docker 20.10`.
|
||||
|
||||
2. Build image
|
||||
2. Build Windows binaries
|
||||
|
||||
```
|
||||
$ sudo docker build -t electrum-wine-builder-img contrib/build-wine
|
||||
$ ./build.sh
|
||||
```
|
||||
If you want reproducibility, try instead e.g.:
|
||||
```
|
||||
$ ELECBUILD_COMMIT=HEAD ELECBUILD_NOCACHE=1 ./build.sh
|
||||
```
|
||||
|
||||
Note: see [this](https://stackoverflow.com/a/40516974/7499128) if having dns problems
|
||||
|
||||
3. Build Windows binaries
|
||||
|
||||
It's recommended to build from a fresh clone
|
||||
(but you can skip this if reproducibility is not necessary).
|
||||
|
||||
```
|
||||
$ FRESH_CLONE="contrib/build-wine/fresh_clone/electrum" && \
|
||||
sudo rm -rf "$FRESH_CLONE" && \
|
||||
umask 0022 && \
|
||||
git clone . "$FRESH_CLONE" && \
|
||||
cd "$FRESH_CLONE"
|
||||
```
|
||||
|
||||
And then build from this directory:
|
||||
```
|
||||
$ git checkout $REV
|
||||
$ sudo docker run -it \
|
||||
--name electrum-wine-builder-cont \
|
||||
-v $PWD:/opt/wine64/drive_c/electrum \
|
||||
--rm \
|
||||
--workdir /opt/wine64/drive_c/electrum/contrib/build-wine \
|
||||
electrum-wine-builder-img \
|
||||
./make_win.sh
|
||||
```
|
||||
4. The generated binaries are in `./contrib/build-wine/dist`.
|
||||
3. The generated binaries are in `./contrib/build-wine/dist`.
|
||||
|
||||
|
||||
|
||||
|
||||
56
contrib/build-wine/build.sh
Executable file
56
contrib/build-wine/build.sh
Executable file
@@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# env vars:
|
||||
# - ELECBUILD_NOCACHE: if set, forces rebuild of docker image
|
||||
# - ELECBUILD_COMMIT: if set, do a fresh clone and git checkout
|
||||
|
||||
set -e
|
||||
|
||||
PROJECT_ROOT="$(dirname "$(readlink -e "$0")")/../.."
|
||||
PROJECT_ROOT_OR_FRESHCLONE_ROOT="$PROJECT_ROOT"
|
||||
CONTRIB="$PROJECT_ROOT/contrib"
|
||||
CONTRIB_WINE="$CONTRIB/build-wine"
|
||||
|
||||
. "$CONTRIB"/build_tools_util.sh
|
||||
|
||||
|
||||
DOCKER_BUILD_FLAGS=""
|
||||
if [ ! -z "$ELECBUILD_NOCACHE" ] ; then
|
||||
info "ELECBUILD_NOCACHE is set. forcing rebuild of docker image."
|
||||
DOCKER_BUILD_FLAGS="--pull --no-cache"
|
||||
fi
|
||||
|
||||
info "building docker image."
|
||||
sudo docker build \
|
||||
$DOCKER_BUILD_FLAGS \
|
||||
-t electrum-wine-builder-img \
|
||||
"$CONTRIB_WINE"
|
||||
|
||||
# maybe do fresh clone
|
||||
if [ ! -z "$ELECBUILD_COMMIT" ] ; then
|
||||
info "ELECBUILD_COMMIT=$ELECBUILD_COMMIT. doing fresh clone and git checkout."
|
||||
FRESH_CLONE="$CONTRIB_WINE/fresh_clone/electrum" && \
|
||||
sudo rm -rf "$FRESH_CLONE" && \
|
||||
umask 0022 && \
|
||||
git clone "$PROJECT_ROOT" "$FRESH_CLONE" && \
|
||||
cd "$FRESH_CLONE"
|
||||
git checkout "$ELECBUILD_COMMIT"
|
||||
PROJECT_ROOT_OR_FRESHCLONE_ROOT="$FRESH_CLONE"
|
||||
else
|
||||
info "not doing fresh clone."
|
||||
fi
|
||||
|
||||
info "building binary..."
|
||||
sudo docker run -it \
|
||||
--name electrum-wine-builder-cont \
|
||||
-v "$PROJECT_ROOT_OR_FRESHCLONE_ROOT":/opt/wine64/drive_c/electrum \
|
||||
--rm \
|
||||
--workdir /opt/wine64/drive_c/electrum/contrib/build-wine \
|
||||
electrum-wine-builder-img \
|
||||
./make_win.sh
|
||||
|
||||
# make sure resulting binary location is independent of fresh_clone
|
||||
if [ ! -z "$ELECBUILD_COMMIT" ] ; then
|
||||
mkdir --parents "$PROJECT_ROOT/contrib/build-wine/dist/"
|
||||
sudo cp -f "$FRESH_CLONE/contrib/build-wine/dist"/* "$PROJECT_ROOT/contrib/build-wine/dist/"
|
||||
fi
|
||||
Reference in New Issue
Block a user