diff --git a/contrib/docker/bitcoin-abc-dev/Dockerfile b/contrib/docker/bitcoin-abc-dev/Dockerfile new file mode 100644 --- /dev/null +++ b/contrib/docker/bitcoin-abc-dev/Dockerfile @@ -0,0 +1,10 @@ +FROM debian:buster + +# Expected to run from the project root +COPY . bitcoin-abc +VOLUME bitcoin-abc + +WORKDIR bitcoin-abc +RUN contrib/utils/install-dependencies.sh + +CMD ["bash"] diff --git a/contrib/docker/bitcoin-abc-dev/README.md b/contrib/docker/bitcoin-abc-dev/README.md new file mode 100644 --- /dev/null +++ b/contrib/docker/bitcoin-abc-dev/README.md @@ -0,0 +1,36 @@ +# Building Bitcoin ABC inside a Docker container + +## Building your Docker image + +From the project root: + +```shell +docker build -t bitcoin-abc-dev -f contrib/docker/bitcoin-abc-dev/Dockerfile +``` + +This will build an image with all the required dependencies for running any kind +of build. + +## Start building + +Start the container. This will run a `bashè shell with your prompt located at +the project root. + +```shell +docker run -it bitcoin-abc-dev +``` + +Build the project: + +```shell +mkdir build +cd build +cmake -GNinja .. +ninja +``` + +Run the tests: + +```shell +ninja check +``` diff --git a/contrib/teamcity/setup-debian-buster.sh b/contrib/teamcity/setup-debian-buster.sh --- a/contrib/teamcity/setup-debian-buster.sh +++ b/contrib/teamcity/setup-debian-buster.sh @@ -4,136 +4,22 @@ set -euxo pipefail -dpkg --add-architecture i386 - -PACKAGES=( - arcanist - automake - autotools-dev - binutils - bsdmainutils - build-essential - ccache - cppcheck - curl - default-jdk - flake8 - g++-aarch64-linux-gnu - g++-arm-linux-gnueabihf - gettext-base - git - golang - g++-mingw-w64 - gnupg - gperf - help2man - imagemagick - jq - lcov - less - lib32stdc++-8-dev - libboost-all-dev - libbz2-dev - libc6-dev:i386 - libcap-dev - libdb++-dev - libdb-dev - libevent-dev - libjemalloc-dev - libminiupnpc-dev - libprotobuf-dev - libqrencode-dev - libqt5core5a - libqt5dbus5 - libqt5gui5 - librsvg2-bin - libssl-dev - libtiff-tools - libtinfo5 - libtool - libzmq3-dev - make - ninja-build - nsis - php-codesniffer - pkg-config - protobuf-compiler - python3 - python3-autopep8 - python3-pip - python3-setuptools - python3-yaml - python3-zmq - qemu-user-static - qttools5-dev - qttools5-dev-tools - software-properties-common - tar - wget - xvfb - yamllint - wine -) - -function join_by() { - local IFS="$1" - shift - echo "$*" -} - -apt-get update -DEBIAN_FRONTEND=noninteractive apt-get install -y $(join_by ' ' "${PACKAGES[@]}") - -BACKPORTS=( - cmake - shellcheck -) - -echo "deb http://deb.debian.org/debian buster-backports main" | tee -a /etc/apt/sources.list -apt-get update -DEBIAN_FRONTEND=noninteractive apt-get -t buster-backports install -y $(join_by ' ' "${BACKPORTS[@]}") - TEAMCITY_DIR=$(dirname "$0") -# Install llvm-8 and clang-10 -apt-key add "${TEAMCITY_DIR}"/llvm.pub -add-apt-repository "deb https://apt.llvm.org/buster/ llvm-toolchain-buster-8 main" -add-apt-repository "deb https://apt.llvm.org/buster/ llvm-toolchain-buster-10 main" -apt-get update - -LLVM_PACKAGES=( - clang-10 - clang-format-8 - clang-tidy-8 - clang-tools-8 -) -DEBIAN_FRONTEND=noninteractive apt-get install -y $(join_by ' ' "${LLVM_PACKAGES[@]}") -# Make sure clang-10 has highest priority -update-alternatives --install /usr/bin/clang clang "$(command -v clang-10)" 100 -update-alternatives --install /usr/bin/clang++ clang++ "$(command -v clang++-10)" 100 -update-alternatives --install /usr/bin/llvm-symbolizer llvm-symbolizer "$(command -v llvm-symbolizer-10)" 100 - -# Use the mingw posix variant -update-alternatives --set x86_64-w64-mingw32-g++ $(command -v x86_64-w64-mingw32-g++-posix) -update-alternatives --set x86_64-w64-mingw32-gcc $(command -v x86_64-w64-mingw32-gcc-posix) +# Install all the build dependencies +"${TEAMCITY_DIR}"/../utils/install-dependencies.sh # Python library for interacting with teamcity pip3 install teamcity-messages -# Python library for merging nested structures -pip3 install deepmerge -# For running Python test suites -pip3 install pytest - # Install Python dependencies for the build bot # Note: Path should be relative to TEAMCITY_DIR since the base image build # context may be different than the project root. pip3 install -r "${TEAMCITY_DIR}"/../buildbot/requirements.txt -# Install pandoc. The version from buster is outdated, so get a more recent one -# from github. -wget https://github.com/jgm/pandoc/releases/download/2.10.1/pandoc-2.10.1-1-amd64.deb -echo "4515d6fe2bf8b82765d8dfa1e1b63ccb0ff3332d60389f948672eaa37932e936 pandoc-2.10.1-1-amd64.deb" | sha256sum -c -DEBIAN_FRONTEND=noninteractive dpkg -i pandoc-2.10.1-1-amd64.deb +# Make sure clang-10 has highest priority +update-alternatives --install /usr/bin/clang clang "$(command -v clang-10)" 100 +update-alternatives --install /usr/bin/clang++ clang++ "$(command -v clang++-10)" 100 +update-alternatives --install /usr/bin/llvm-symbolizer llvm-symbolizer "$(command -v llvm-symbolizer-10)" 100 # Set default git config so that any git operations requiring authoring, # rebasing, or cherry-picking of commits just work out of the box. diff --git a/contrib/teamcity/setup-debian-buster.sh b/contrib/utils/install-dependencies.sh copy from contrib/teamcity/setup-debian-buster.sh copy to contrib/utils/install-dependencies.sh --- a/contrib/teamcity/setup-debian-buster.sh +++ b/contrib/utils/install-dependencies.sh @@ -93,10 +93,9 @@ apt-get update DEBIAN_FRONTEND=noninteractive apt-get -t buster-backports install -y $(join_by ' ' "${BACKPORTS[@]}") -TEAMCITY_DIR=$(dirname "$0") # Install llvm-8 and clang-10 -apt-key add "${TEAMCITY_DIR}"/llvm.pub +apt-key add "$(dirname "$0")"/llvm.pub add-apt-repository "deb https://apt.llvm.org/buster/ llvm-toolchain-buster-8 main" add-apt-repository "deb https://apt.llvm.org/buster/ llvm-toolchain-buster-10 main" apt-get update @@ -108,34 +107,18 @@ clang-tools-8 ) DEBIAN_FRONTEND=noninteractive apt-get install -y $(join_by ' ' "${LLVM_PACKAGES[@]}") -# Make sure clang-10 has highest priority -update-alternatives --install /usr/bin/clang clang "$(command -v clang-10)" 100 -update-alternatives --install /usr/bin/clang++ clang++ "$(command -v clang++-10)" 100 -update-alternatives --install /usr/bin/llvm-symbolizer llvm-symbolizer "$(command -v llvm-symbolizer-10)" 100 # Use the mingw posix variant update-alternatives --set x86_64-w64-mingw32-g++ $(command -v x86_64-w64-mingw32-g++-posix) update-alternatives --set x86_64-w64-mingw32-gcc $(command -v x86_64-w64-mingw32-gcc-posix) -# Python library for interacting with teamcity -pip3 install teamcity-messages # Python library for merging nested structures pip3 install deepmerge # For running Python test suites pip3 install pytest -# Install Python dependencies for the build bot -# Note: Path should be relative to TEAMCITY_DIR since the base image build -# context may be different than the project root. -pip3 install -r "${TEAMCITY_DIR}"/../buildbot/requirements.txt - # Install pandoc. The version from buster is outdated, so get a more recent one # from github. wget https://github.com/jgm/pandoc/releases/download/2.10.1/pandoc-2.10.1-1-amd64.deb echo "4515d6fe2bf8b82765d8dfa1e1b63ccb0ff3332d60389f948672eaa37932e936 pandoc-2.10.1-1-amd64.deb" | sha256sum -c DEBIAN_FRONTEND=noninteractive dpkg -i pandoc-2.10.1-1-amd64.deb - -# Set default git config so that any git operations requiring authoring, -# rebasing, or cherry-picking of commits just work out of the box. -git config --global user.name "abc-bot" -git config --global user.email "no-email-abc-bot@bitcoinabc.org" diff --git a/contrib/teamcity/llvm.pub b/contrib/utils/llvm.pub rename from contrib/teamcity/llvm.pub rename to contrib/utils/llvm.pub