Skip to content

Commit

Permalink
Merge branch 'nick-apple-aarch64'
Browse files Browse the repository at this point in the history
This enables builds for both Apple's amd64 and M1 aarch64.

#23
  • Loading branch information
x1ddos committed May 20, 2021
2 parents 2fc7b43 + fa271ad commit 0092697
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 17 deletions.
8 changes: 6 additions & 2 deletions .cargo/config
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
[target.x86_64-apple-darwin]
linker = "x86_64-apple-darwin14-clang"
ar = "x86_64-apple-darwin14-ar"
linker = "x86_64-apple-darwin20.2-clang"
ar = "x86_64-apple-darwin20.2-ar"

[target.aarch64-apple-darwin]
linker = "aarch64-apple-darwin20.2-clang"
ar = "aarch64-apple-darwin20.2-ar"

[target.x86_64-pc-windows-gnu]
linker = "x86_64-w64-mingw32-gcc"
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Changelog

### 1.3.0
## 1.3.0
- Whitelist bity.com
- Enable builds for Apple's M1 aarch64 platform
- Produce amd64+aarch64 Apple's universal binary

## 1.2.0
- Whitelist pocketbitcoin.com
19 changes: 10 additions & 9 deletions bitbox-bridge/release/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ RUN gem install --no-document fpm


##############################
# llvm 8 (needed because some rust crates compile C code)
# llvm 11 (needed because some rust crates compile C code)
RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
RUN add-apt-repository 'deb http://apt.llvm.org/xenial llvm-toolchain-xenial-8 main'
RUN add-apt-repository 'deb http://apt.llvm.org/xenial llvm-toolchain-xenial-11 main'
RUN apt-get update -y && apt-get install -y --no-install-recommends \
llvm-8 \
clang-8
RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-8 100
RUN update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-8 100
llvm-11 \
clang-11
RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-11 100
RUN update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-11 100


##############################
Expand All @@ -63,9 +63,9 @@ RUN apt-get update -y && apt-get install -y --no-install-recommends \
libssl-dev
# SDK
RUN git clone https://github.com/tpoechtrager/osxcross /opt/osxcross
RUN cd /opt/osxcross && wget -nc https://s3.dockerproject.org/darwin/v2/MacOSX10.10.sdk.tar.xz
RUN cd /opt/osxcross && mv MacOSX10.10.sdk.tar.xz tarballs/
RUN cd /opt/osxcross && UNATTENDED=yes OSX_VERSION_MIN=10.7 ./build.sh
RUN cd /opt/osxcross && wget -nc https://github.com/joseluisq/macosx-sdks/releases/download/11.1/MacOSX11.1.sdk.tar.xz
RUN cd /opt/osxcross && mv MacOSX11.1.sdk.tar.xz tarballs/
RUN cd /opt/osxcross && UNATTENDED=yes OSX_VERSION_MIN=10.9 ./build.sh


##############################
Expand All @@ -75,6 +75,7 @@ ENV RUSTUP_HOME=/opt/rustup
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | CARGO_HOME=/opt/cargo sh -s -- --profile minimal --default-toolchain 1.51.0 -y
RUN rustup target add x86_64-pc-windows-gnu
RUN rustup target add x86_64-apple-darwin
RUN rustup target add aarch64-apple-darwin


##############################
Expand Down
2 changes: 1 addition & 1 deletion bitbox-bridge/release/darwin/distribution.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<background alignment="bottomleft" file="BBBridge_icon_blue_160x125.png" scaling="none" />
<background-darkAqua alignment="bottomleft" file="BBBridge_icon_blue_160x125.png" scaling="none" />
<domains enable_localSystem="true"/>
<options customize="never" require-scripts="true" rootVolumeOnly="true" />
<options customize="never" require-scripts="true" rootVolumeOnly="true" hostArchitectures="x86_64,arm64"/>
<!-- Define documents displayed at various steps -->
<welcome file="welcome.html" mime-type="text/html" />
<conclusion file="conclusion.html" mime-type="text/html" />
Expand Down
8 changes: 6 additions & 2 deletions bitbox-bridge/release/darwin/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ VERSION=$(toml-echo bitbox-bridge/Cargo.toml package.version)

(
cd bitbox-bridge/release/darwin
pkgbuild --root tmp --scripts scripts --identifier ch.shiftcrypto.bitboxbridge --version "${VERSION}" --ownership recommended bridge.pkg
productbuild --distribution distribution.xml --resources resources --package-path . --version "${VERSION}" "${NAME}-${VERSION}-macOS-installer.pkg"
pkgbuild --root tmp --scripts scripts \
--identifier ch.shiftcrypto.bitboxbridge \
--version "${VERSION}" --ownership recommended bridge.pkg
productbuild --distribution distribution.xml --resources resources \
--package-path . --version "${VERSION}" \
"${NAME}-${VERSION}-macOS-installer.pkg"
)
12 changes: 10 additions & 2 deletions bitbox-bridge/release/darwin/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,24 @@ set -e

PATH="/opt/osxcross/target/bin:$PATH" \
CARGO_HOME=/tmp/cargo \
TARGET_CC=x86_64-apple-darwin14-clang \
TARGET_CC=x86_64-apple-darwin20.2-clang \
cargo build --target x86_64-apple-darwin --release

PATH="/opt/osxcross/target/bin:$PATH" \
CARGO_HOME=/tmp/cargo \
TARGET_CC=aarch64-apple-darwin20.2-clang \
cargo build --target aarch64-apple-darwin --release

NAME=BitBoxBridge
VERSION=$(toml-echo bitbox-bridge/Cargo.toml package.version)

(
cd bitbox-bridge/release/darwin
mkdir -p tmp/opt/shiftcrypto/bitbox-bridge/bin
cp ../../../target/x86_64-apple-darwin/release/bitbox-bridge tmp/opt/shiftcrypto/bitbox-bridge/bin
PATH="/opt/osxcross/target/bin:$PATH" lipo -create \
-output tmp/opt/shiftcrypto/bitbox-bridge/bin/bitbox-bridge \
../../../target/x86_64-apple-darwin/release/bitbox-bridge \
../../../target/aarch64-apple-darwin/release/bitbox-bridge
mkdir -p tmp/Library/LaunchDaemons
cp ch.shiftcrypto.bitboxbridge.plist tmp/Library/LaunchDaemons
)
Expand Down

0 comments on commit 0092697

Please sign in to comment.