From d758a049efc70f273ff163edaf7198c4b164a16e Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Wed, 18 Mar 2020 18:04:26 +0000 Subject: [PATCH] Add gitian-build.sh script for Gitian builds --- contrib/gitian-build.sh | 81 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100755 contrib/gitian-build.sh diff --git a/contrib/gitian-build.sh b/contrib/gitian-build.sh new file mode 100755 index 0000000000..700b91cafb --- /dev/null +++ b/contrib/gitian-build.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +# This script is to be used to generate Gitian builds for Elements releases. +# Requirements: +# - One needs the OSX SDK file in the following location: +# bec9d089ebf2e2dd59b1a811a38ec78ebd5da18cbbcd6ab39d1e59f64ac5033f $HOME/blockstream/gitian/MacOSX10.11.sdk.tar.gz +# The file can be downloaded here: +# https://bitcoincore.org/depends-sources/sdks/MacOSX10.11.sdk.tar.gz +# +# - On an Arch machine, I had to install and start apt-cacher-ng. +# Any non-Debian environment probably should do the same. +# $ sudo systemctl start apt-cacher-ng +# +# - You'll need a bunch of basic packages from your distro. Non-exhaustive: +# git, docker +# +# - User must have access to /tmp. /tmp/gitian and /tmp/elements are used in the process. +# +# +# +# Using the script: +# Just invoke the script and pass the tag you want to build as an argument: +# ./gitian-build.sh elements-0.18.1.6 + + + +: ${1?Need commit hash or tag} + +rm -fr /tmp/gitian /tmp/elements +export USE_DOCKER=1 +export NUM_JOB=$(cat /proc/cpuinfo | grep ^processor | wc -l) + +export CI_PROJECT_DIR=/tmp/elements +export CI_COMMIT_TAG=$1 +git clone https://github.com/devrandom/gitian-builder.git /tmp/gitian + +RESULT_DIR=$HOME/blockstream/gitian/out/$CI_COMMIT_TAG +mkdir -p "$RESULT_DIR" + +git clone https://github.com/ElementsProject/elements.git ${CI_PROJECT_DIR} +cd ${CI_PROJECT_DIR} +mkdir /tmp/gitian/inputs +cp $HOME/blockstream/gitian/MacOSX10.11.sdk.tar.gz /tmp/gitian/inputs/MacOSX10.11.sdk.tar.gz + +cd /tmp/gitian + +bin/make-base-vm --docker --suite bionic --arch amd64 + +bin/gbuild --num-make ${NUM_JOB} --memory 10000 --url elements=${CI_PROJECT_DIR} --commit elements=${CI_COMMIT_TAG} ${CI_PROJECT_DIR}/contrib/gitian-descriptors/gitian-linux.yml + +cp result/* $RESULT_DIR +cp -r build/out/* $RESULT_DIR + +bin/gbuild --num-make ${NUM_JOB} --memory 10000 --url elements=${CI_PROJECT_DIR} --commit elements=${CI_COMMIT_TAG} ${CI_PROJECT_DIR}/contrib/gitian-descriptors/gitian-win.yml + +cp result/* $RESULT_DIR +cp -r build/out/* $RESULT_DIR + +bin/gbuild --num-make ${NUM_JOB} --memory 10000 --url elements=${CI_PROJECT_DIR} --commit elements=${CI_COMMIT_TAG} ${CI_PROJECT_DIR}/contrib/gitian-descriptors/gitian-osx.yml + +cp result/* $RESULT_DIR +cp -r build/out/* $RESULT_DIR + +# Afterwards, move all but the following files into another folder (I call it `unused`): +# - elements--aarch64-linux-gnu.tar.gz +# - elements--arm-linux-gnueabihf.tar.gz +# - elements--i686-pc-linux-gnu.tar.gz +# - elements--osx64.tar.gz +# - elements--osx-unsigned.dmg +# - elements--osx-unsigned.tar.gz +# - elements--riscv64-linux-gnu.tar.gz +# - elements--win32-setup-unsigned.exe +# - elements--win32.zip +# - elements--win64-setup-unsigned.exe +# - elements--win64.zip +# - elements--win-unsigned.tar.gz +# - elements--x86_64-linux-gnu.tar.gz + +# Then create SHA256SUMS.asc as follows: +#sha256sum | gpg2 --armor --clearsign > SHA256SUMS.asc +