From e9cb70c258f038fd0e3e16a1bb28bcadcf4e8579 Mon Sep 17 00:00:00 2001 From: Torkel Rogstad Date: Thu, 1 Feb 2024 11:05:37 +0100 Subject: [PATCH 1/4] contrib: add macOS builder Dockerfile --- contrib/Dockerfile.macosbuilder | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 contrib/Dockerfile.macosbuilder diff --git a/contrib/Dockerfile.macosbuilder b/contrib/Dockerfile.macosbuilder new file mode 100644 index 0000000000000..d7393f0c0c68f --- /dev/null +++ b/contrib/Dockerfile.macosbuilder @@ -0,0 +1,27 @@ +FROM ubuntu:trusty + +RUN mkdir -p /work/SDKs + +WORKDIR /work + +RUN apt-get update + +# Needed for TLS to work +RUN apt-get install ca-certificates + +# General Linux deps +RUN apt-get -y install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils python3 + +# macOS cross-compilation deps +RUN apt-get -y install curl librsvg2-bin libtiff-tools bsdmainutils cmake imagemagick libcap-dev libz-dev libbz2-dev python-setuptools + +ARG SDK_VERSION=10.11 +ARG SDK_FILE=MacOSX${SDK_VERSION}.sdk + +RUN curl --fail https://bitcoincore.org/depends-sources/sdks/${SDK_FILE}.tar.gz \ + --output ${SDK_FILE}.tar.gz \ + --insecure + +RUN tar -C /work/SDKs -xf ${SDK_FILE}.tar.gz + +ENV HOST=x86_64-apple-darwin11 SDK_PATH=/work/SDKs \ No newline at end of file From a38fcc1f1843f5aaa181cfc8088430415815c510 Mon Sep 17 00:00:00 2001 From: Torkel Rogstad Date: Thu, 1 Feb 2024 10:15:03 +0100 Subject: [PATCH 2/4] ci: add macos build --- .github/workflows/build.yml | 44 ++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f9ce84d510ef5..fde54859610e4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,7 @@ jobs: uses: actions/cache@v3 with: path: ./depends - key: ${{ runner.os }}-${{ hashFiles('depends/packages/**') }} + key: linux-${{ hashFiles('depends/packages/**') }} - name: download dependencies run: make -C ./depends download-linux @@ -70,7 +70,7 @@ jobs: uses: actions/cache@v3 with: path: ./depends - key: ${{ runner.os }}-${{ hashFiles('depends/packages/**') }} + key: windows-${{ hashFiles('depends/packages/**') }} - name: download dependencies run: make -C ./depends download-win @@ -92,4 +92,42 @@ jobs: if-no-files-found: error path: | src/testchaind.exe - src/testchain-cli.exe \ No newline at end of file + src/testchain-cli.exe + + build-macos: + name: Build macOS binaries + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: ./depends + key: macos-${{ hashFiles('depends/packages/**') }} + + - name: download dependencies + run: make -C ./depends download-osx + + - name: Run build in Docker + uses: addnab/docker-run-action@v3 + with: + image: barebitcoin/testchain-macos-builder + options: -v ${{ github.workspace }}:/testchain --workdir=/testchain + shell: bash + run: | + set -e + + make -C depends NO_QT=1 -j4 + export CONFIG_SITE=$PWD/depends/x86_64-apple-darwin11/share/config.site + ./autogen.sh + ./configure + make -j + + - uses: actions/upload-artifact@v4 + with: + name: binaries-macOS + if-no-files-found: error + path: | + src/testchaind + src/testchain-cli \ No newline at end of file From fec5fb40a41e673b1454b7655edf53853dc57b4f Mon Sep 17 00:00:00 2001 From: Torkel Rogstad Date: Thu, 1 Feb 2024 12:04:34 +0100 Subject: [PATCH 3/4] docs: add build notes to README --- README.md | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 89 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a78549bc9c69b..7303d0c901ddc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ Testchain is a template sidechain that can be used as the starting point for creating Drivechain sidechains. -Drivechain (BIPs 300+301) +## Drivechain (BIPs 300+301) Drivechain allows Bitcoin to create, delete, send BTC to, and receive BTC from “Layer-2”s called “sidechains”. Sidechains are Altcoins that lack a native “coin” – instead, BTC must first be sent over. BIP 300: https://github.com/bitcoin/bips/blob/master/bip-0300.mediawiki @@ -11,5 +11,92 @@ Learn more about Drivechain here: http://drivechain.info For an example sidechain implementation, see: https://github.com/drivechain-project/sidechains -License +## Building Testchain + +Testchain is built and released for Linux, macOS and Windows. The only supported +way of building Testchain is through cross-compiling from Linux. If you only want +to build node binaries, you can disable building the UI through passing `NO_QT=1` +to the `make -C ./depends` call. If the build crashes unexpectedly, try reducing +the amount of concurrency by removing the `-j` parameter. + +### Linux + +These instructions have been tested with Ubuntu 20.04 (Focal). + +```bash +# install build dependencies +$ sudo apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils python3 + +# compile dependencies +$ make -C ./depends -j + +# Compile binaries +$ ./autogen.sh +$ export CONFIG_SITE=$PWD/depends/x86_64-pc-linux-gnu/share/config.site +$ ./configure +$ ./make -j + +# binaries are located in src/testchaind and src/testchain-cli +``` + +### macOS + +Building Testchain requires a very old version of Ubuntu. A version that is +known to work is 14.04 (Jerry). An old version of the macOS SDK is also required. +For convenience, a [Docker image](https://hub.docker.com/r/barebitcoin/testchain-macos-builder) +is provided that has all the required build dependencies pre-installed. +If you want to set up your local environment to match this, it is recommended +to take a look at the [Dockerfile](./contrib/Dockerfile.macosbuilder) that +produced this image. + +```bash +# start the Docker container that will build the binaries +$ docker run --rm -it \ + --workdir /testchain -v $PWD:/testchain \ + barebitcoin/testchain-macos-builder bash + +# from within the Docker container shell + +# compile dependencies +$ make -C ./depends -j + +# compile the binaries +$ export CONFIG_SITE=$PWD/depends/x86_64-apple-darwin11/share/config.site +$ ./autogen.sh +$ ./configure.sh +$ make -j + +# binaries are located (on the host machine) +# at src/testchaind and src/testchain-cli +``` + +### Windows + +These instructions have been tested with Ubuntu 20.04 (Focal). + +```bash +# install dependencies +$ sudo apt install g++-mingw-w64-x86-64 \ + build-essential libtool autotools-dev automake \ + libssl-dev libevent-dev \ + pkg-config bsdmainutils curl git \ + python3-setuptools python-is-python3 \ + +# configure the Windows toolchain +$ sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix + +# compile dependencies +$ make -C ./depends HOST=x86_64-w64-mingw32 -j + +# compile the binaries +$ export CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site +$ ./autogen.sh +$ ./configure.sh +$ make -j + +# binaries are located at src/testchaind.exe and src/testchain-cli.exe +``` + + +## License Bitcoin Core (and Drivechain) are released under the terms of the MIT license. See COPYING for more information or see https://opensource.org/licenses/MIT. From c15441c6928b29c53d8a96546e2579ac20ad9b3f Mon Sep 17 00:00:00 2001 From: Torkel Rogstad Date: Thu, 1 Feb 2024 12:56:21 +0100 Subject: [PATCH 4/4] build: include Qt --- .github/workflows/build.yml | 13 ++++++++----- README.md | 7 ++++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fde54859610e4..69a04d4ee3f77 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,7 +26,7 @@ jobs: run: make -C ./depends download-linux - name: build dependencies - run: make -C ./depends NO_QT=1 -j4 + run: make -C ./depends -j4 - run: ./autogen.sh @@ -43,6 +43,7 @@ jobs: path: | src/testchaind src/testchain-cli + src/qt/testchain-qt build-windows: @@ -76,7 +77,7 @@ jobs: run: make -C ./depends download-win - name: build dependencies - run: make -C ./depends HOST=x86_64-w64-mingw32 NO_QT=1 -j4 + run: make -C ./depends HOST=x86_64-w64-mingw32 -j4 - run: ./autogen.sh @@ -93,6 +94,7 @@ jobs: path: | src/testchaind.exe src/testchain-cli.exe + src/qt/testchain-qt.exe build-macos: name: Build macOS binaries @@ -118,11 +120,11 @@ jobs: run: | set -e - make -C depends NO_QT=1 -j4 + make -C depends -j4 export CONFIG_SITE=$PWD/depends/x86_64-apple-darwin11/share/config.site ./autogen.sh ./configure - make -j + make -j4 # Limit the concurrency to prevent OOM - uses: actions/upload-artifact@v4 with: @@ -130,4 +132,5 @@ jobs: if-no-files-found: error path: | src/testchaind - src/testchain-cli \ No newline at end of file + src/testchain-cli + src/qt/testchain-qt \ No newline at end of file diff --git a/README.md b/README.md index 7303d0c901ddc..2580479530133 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ $ export CONFIG_SITE=$PWD/depends/x86_64-pc-linux-gnu/share/config.site $ ./configure $ ./make -j -# binaries are located in src/testchaind and src/testchain-cli +# binaries are located in src/testchaind, src/testchain-cli and src/qt/testchain-qt ``` ### macOS @@ -67,7 +67,7 @@ $ ./configure.sh $ make -j # binaries are located (on the host machine) -# at src/testchaind and src/testchain-cli +# at src/testchaind, src/testchain-cli and src/qt/testchain-qt ``` ### Windows @@ -94,7 +94,8 @@ $ ./autogen.sh $ ./configure.sh $ make -j -# binaries are located at src/testchaind.exe and src/testchain-cli.exe +# binaries are located at src/testchaind.exe, src/testchain-cli.exe and +# src/qt/testchain-qt.exe ```