Skip to content

Commit

Permalink
Build ARMv7 releases (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
shesek committed Sep 26, 2020
1 parent 163833f commit 38d0e84
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 19 deletions.
3 changes: 3 additions & 0 deletions .cargo/config
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ ar = "x86_64-apple-darwin15-ar"
# use --no-insert-timestamp to drop PE timestamps in Windows builds for reproducibility
# https://wiki.debian.org/ReproducibleBuilds/TimestampsInPEBinaries#building_with_mingw-w64
rustflags = [ "-C", "link-arg=-Wl,--no-insert-timestamp" ]

[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

- Reproducible builds using Docker (#51)

- Pre-built binary releases for macOS (#24)
- Pre-built binary releases for macOS (#24) and ARMv7 (#19)

- Scriptable transaction broadcast command via `--tx-broadcast-cmd <cmd>` (#7)

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Get yourself a synced Bitcoin Core node (v0.19 is recommended, v0.17 is sufficie

#### Signed pre-built binaries

Available for download on [the releases page](https://github.com/shesek/bwt/releases) (Linux and Windows).
Available for download on [the releases page](https://github.com/shesek/bwt/releases) (Linux, Mac, Windows and ARMv7).

The releases are signed by Nadav Ivgi (@shesek).
The public key can be verified on [keybase](https://keybase.io/nadav),
Expand Down Expand Up @@ -264,7 +264,7 @@ Download the `electrum_plugin` package from the [releases page](https://github.c
After restarting Electrum, you should see bwt in the list of installed plugins under `Tools -> Plugins`.

The supported Electrum version is 3.3.8.
The plugin is currently available for Linux and Windows.
The plugin is available for Linux, Mac, Windows and ARMv7.

Note that it is not possible to install external plugins with the Electrum AppImage or standalone Windows executable.
You will need to [run from tar.gz](https://github.com/spesmilo/electrum/#running-from-targz) on Linux, use the Windows installer, or [run from source](https://github.com/spesmilo/electrum/#development-version-git-clone).
Expand Down Expand Up @@ -1214,7 +1214,7 @@ The builds can be reproduced in a Docker container environment as follows:
```
$ git clone https://github.com/shesek/bwt && cd bwt
# Linux & Windows
# Linux, Windows & ARMv7
$ docker build -t bwt-builder -f scripts/builder.Dockerfile .
$ docker run -it --rm -v `pwd`:/usr/src/bwt bwt-builder
Expand Down
23 changes: 13 additions & 10 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash
set -xeo pipefail

# `osx` is also available, but requires osxcross installed (see builder-os.Dockerfile)
TARGETS=${TARGETS:-linux,win}
# `x86_64-osx` is also available, but requires osxcross installed (see builder-os.Dockerfile)
TARGETS=${TARGETS:-x86_64-linux,x86_64-win,armv7}

build() {
name=$1; target=$2; features=$3
Expand All @@ -16,7 +16,9 @@ build() {

mv target/$target/release/bwt$ext $dest

[[ $target == *"-apple-"* ]] || strip $dest/bwt$ext
if [[ $target != *"-apple-"* && $target != "armv7-"* ]]; then
strip $dest/bwt$ext
fi

cp README.md LICENSE $dest/

Expand All @@ -38,25 +40,26 @@ pack() {

version=`cat Cargo.toml | egrep '^version =' | cut -d'"' -f2`

for cfg in linux,x86_64-unknown-linux-gnu \
win,x86_64-pc-windows-gnu \
osx,x86_64-apple-darwin; do
for cfg in x86_64-linux,x86_64-unknown-linux-gnu \
x86_64-osx,x86_64-apple-darwin \
x86_64-win,x86_64-pc-windows-gnu \
armv7,armv7-unknown-linux-gnueabihf; do
IFS=',' read platform target <<< $cfg
if [[ $TARGETS != *"$platform"* ]]; then continue; fi

build bwt-$version-x86_64-$platform $target http,electrum,webhooks,track-spends
build bwt-$version-electrum_only-x86_64-$platform $target electrum
build bwt-$version-$platform $target http,electrum,webhooks,track-spends
build bwt-$version-electrum_only-$platform $target electrum
done

echo Building electrum plugin
for platform in linux win osx; do
if [[ $TARGETS != *"$platform"* ]]; then continue; fi

name=bwt-$version-electrum_plugin-x86_64-$platform
name=bwt-$version-electrum_plugin-$platform
dest=dist/$name
mkdir $dest
cp contrib/electrum-plugin/*.py $dest
cp dist/bwt-$version-electrum_only-x86_64-$platform/* $dest
cp dist/bwt-$version-electrum_only-$platform/* $dest
# needs to be inside a directory with a name that matches the plugin module name for electrum to load it,
# create a temporary link to get tar/zip to pack it properly. (can also be done for tar.gz with --transform)
ln -s $name dist/bwt
Expand Down
2 changes: 1 addition & 1 deletion scripts/builder-osx.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ RUN git clone https://github.com/tpoechtrager/osxcross /usr/src/osxcross && \
echo "$OSX_SDK_SHASUM tarballs/MacOSX$OSX_SDK_VERSION.sdk.tar.xz" | sha256sum -c - && \
UNATTENDED=yes OSX_VERSION_MIN=10.7 ./build.sh

ENV TARGETS=osx
ENV TARGETS=x86_64-osx
ENV CC=x86_64-apple-darwin15-cc
ENV AR=x86_64-apple-darwin15-ar
ENV PATH=$PATH:/usr/src/osxcross/target/bin
8 changes: 5 additions & 3 deletions scripts/builder.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
FROM rust:1.46-slim as builder
RUN apt-get update && apt-get install -y pkg-config libssl-dev gcc-mingw-w64-x86-64 zip && \
rustup target add x86_64-pc-windows-gnu
RUN apt-get update && apt-get install -y pkg-config libssl-dev gcc-mingw-w64-x86-64 gcc-arm-linux-gnueabihf zip && \
rustup target add x86_64-pc-windows-gnu && \
rustup target add armv7-unknown-linux-gnueabihf
# macOS is built using a separate image, see builder-osx.Dockerfile

WORKDIR /usr/src/bwt
VOLUME /usr/src/bwt
ENV TARGETS=linux,win
ENV TARGETS=x86_64-linux,x86_64-win,armv7
ENTRYPOINT [ "/usr/src/bwt/scripts/build.sh" ]
2 changes: 1 addition & 1 deletion scripts/release-footer.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ See [more details here](https://github.com/shesek/bwt#reproducible-builds).

#### Electrum plugin

The [Electrum plugin](https://github.com/shesek/bwt#electrum-plugin) is available for download for Linux and Windows, as the `electrum_plugin` package.
The [Electrum plugin](https://github.com/shesek/bwt#electrum-plugin) is available for download for Linux, Mac, Windows and ARMv7 as the `electrum_plugin` package.

> ⚠️ **NOTE:** The plugin supports watch-only wallets only and **cannot be used with hot wallets**. This is done as a security measure, which is expected to eventually be lifted. You can use the plugin with hardware wallets or with an offline Electrum setup. For hot wallets, you will need to setup a standalone server instead of using the plugin, ideally far away from your keys.

0 comments on commit 38d0e84

Please sign in to comment.