Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: build Bitcoin with Cmake #113

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 45 additions & 47 deletions salt/sys-bitcoin/configure-builder-source.sls
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{#
SPDX-FileCopyrightText: 2024 Benjamin Grande M. S. <[email protected]>
SPDX-FileCopyrightText: 2024 - 2025 Benjamin Grande M. S. <[email protected]>

SPDX-License-Identifier: AGPL-3.0-or-later
#}
Expand Down Expand Up @@ -49,81 +49,79 @@ include:
- cwd: /home/user/src/bitcoin
- runas: user

"{{ slsdotpath }}-source-build-autogen":
cmd.run:
- require:
- cmd: "{{ slsdotpath }}-source-git-checkout-tag-{{ bitcoin_tag }}"
- name: ./autogen.sh
- cwd: /home/user/src/bitcoin
- runas: user

"{{ slsdotpath }}-source-build-configure":
cmd.run:
- require:
- cmd: "{{ slsdotpath }}-source-build-autogen"
- env:
- CXX: "clang++"
- CC: "clang"
- cmd: "{{ slsdotpath }}-source-git-checkout-tag-{{ bitcoin_tag }}"
- name: |
./configure \
--prefix=/home/user/bitcoin-build \
--disable-maintainer-mode \
--disable-tests \
--disable-bench \
--disable-fuzz-binary \
--disable-shared \
--disable-dependency-tracking \
--without-miniupnpc \
--without-natpmp \
--without-bdb \
--without-libs
cmake \
-B /home/user/bitcoin-build \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O2 -g0" \
-DCMAKE_C_COMPILER=clang \
-DBUILD_BENCH=OFF \
-DBUILD_CLI=ON \
-DBUILD_DAEMON=ON \
-DBUILD_FOR_FUZZING=OFF \
-DBUILD_GUI=ON \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_TESTS=OFF \
-DBUILD_TX=ON \
-DBUILD_UTIL=ON \
-DBUILD_UTIL_CHAINSTATE=ON \
-DBUILD_WALLET_TOOL=ON \
-DENABLE_EXTERNAL_SIGNER=ON \
-DENABLE_HARDENING=ON \
-DENABLE_WALLET=ON \
-DWITH_BDB=OFF \
-DWITH_CCACHE=ON \
-DWITH_MINIUPNPC=OFF \
-DWITH_SQLITE=ON \
-DWITH_USDT=OFF \
-DWITH_ZMQ=ON
- cwd: /home/user/src/bitcoin
- runas: user

"{{ slsdotpath }}-source-build-make-clean":
"{{ slsdotpath }}-source-build-execute":
cmd.run:
- require:
- cmd: "{{ slsdotpath }}-source-build-configure"
- name: make clean
- cwd: /home/user/src/bitcoin
- runas: user

"{{ slsdotpath }}-source-build-make":
cmd.run:
- require:
- cmd: "{{ slsdotpath }}-source-build-make-clean"
- name: make -j "$(($(nproc)+1))"
- name: |
cmake \
--build /home/user/bitcoin-build \
--parallel "$(($(nproc)+1))" \
--clean-first
- cwd: /home/user/src/bitcoin
- runas: user

"{{ slsdotpath }}-source-build-gen-manpages":
cmd.run:
- require:
- cmd: "{{ slsdotpath }}-source-build-make"
- cmd: "{{ slsdotpath }}-source-build-execute"
- name: ./contrib/devtools/gen-manpages.py
- cwd: /home/user/src/bitcoin
- runas: user

"{{ slsdotpath }}-source-build-gen-bitcoin-conf":
cmd.run:
- require:
- cmd: "{{ slsdotpath }}-source-build-make"
- cmd: "{{ slsdotpath }}-source-build-execute"
- name: ./contrib/devtools/gen-bitcoin-conf.sh
- cwd: /home/user/src/bitcoin
- runas: user

"{{ slsdotpath }}-source-build-make-install":
"{{ slsdotpath }}-source-build-install":
cmd.run:
- require:
- cmd: "{{ slsdotpath }}-source-build-make"
- name: make install
- cmd: "{{ slsdotpath }}-source-build-execute"
- name: cmake --install /home/user/bitcoin-build
- cwd: /home/user/src/bitcoin
- runas: user

"{{ slsdotpath }}-source-readme":
cmd.run:
- require:
- cmd: "{{ slsdotpath }}-source-build-make-install"
- cmd: "{{ slsdotpath }}-source-build-install"
- name: |
\mkdir -p -- share/bitcoin
\cp -v -- ~/src/bitcoin/README.md share/bitcoin/
Expand All @@ -133,7 +131,7 @@ include:
"{{ slsdotpath }}-source-share-examples":
cmd.run:
- require:
- cmd: "{{ slsdotpath }}-source-build-make-install"
- cmd: "{{ slsdotpath }}-source-build-install"
- name: |
\cp -v -- ~/src/bitcoin/share/examples/bitcoin.conf bitcoin.conf
- cwd: /home/user/bitcoin-build
Expand All @@ -142,7 +140,7 @@ include:
"{{ slsdotpath }}-source-shell-completion":
cmd.run:
- require:
- cmd: "{{ slsdotpath }}-source-build-make-install"
- cmd: "{{ slsdotpath }}-source-build-install"
- name: |
\mkdir -p -- share/bash-completion/completions/
\cp -v -- ~/src/bitcoin/contrib/completions/bash/* share/bash-completion/completions/
Expand All @@ -152,17 +150,17 @@ include:
"{{ slsdotpath }}-source-rpcauth":
cmd.run:
- require:
- cmd: "{{ slsdotpath }}-source-build-make-install"
- cmd: "{{ slsdotpath }}-source-build-install"
- name: |
\mkdir -p -- share/rpcauth
\cp -v -- ~/src/bitcoin/share/rpcauth/rpcauth.py share/rpcauth/
- cwd: /home/user/bitcoin-build
- runas: user

"{{ slsdotpath }}-source-rpcauth":
"{{ slsdotpath }}-source-gui-icons":
cmd.run:
- require:
- cmd: "{{ slsdotpath }}-source-build-make-install"
- cmd: "{{ slsdotpath }}-source-build-install"
- name: |
\mkdir -p -- share/icons/hicolor/scalable/apps/
\cp -v -- ~/src/bitcoin/src/qt/res/src/bitcoin.svg share/icons/hicolor/scalable/apps/
Expand All @@ -172,7 +170,7 @@ include:
"{{ slsdotpath }}-source-copy-files-to-template":
cmd.run:
- require:
- cmd: "{{ slsdotpath }}-source-build-make"
- cmd: "{{ slsdotpath }}-source-build-install"
- name: qrexec-client-vm -T -- @default qusal.InstallBitcoin /usr/lib/qubes/qfile-agent /home/user/bitcoin-build/*
- runas: user

Expand Down
12 changes: 6 additions & 6 deletions salt/sys-bitcoin/install-source.sls
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{#
SPDX-FileCopyrightText: 2024 Benjamin Grande M. S. <[email protected]>
SPDX-FileCopyrightText: 2024 - 2025 Benjamin Grande M. S. <[email protected]>

SPDX-License-Identifier: AGPL-3.0-or-later
#}
Expand All @@ -21,19 +21,19 @@ include:
- skip_suggestions: True
- setopt: "install_weak_deps=False"
- pkgs:
- clang
- cmake
- clang-16
- ccache
- help2man

{% set pkg = {
'Debian': {
'pkg': ['build-essential', 'libtool', 'autotools-dev', 'automake',
'pkg-config', 'bsdmainutils', 'python3', 'libevent-dev',
'pkg': ['build-essential', 'pkg-config', 'python3', 'libevent-dev',
'libboost-dev', 'libsqlite3-dev', 'libzmq3-dev'],
},
'RedHat': {
'pkg': ['gcc-c++', 'libtool', 'make', 'autoconf', 'automake', 'python3',
'libevent-devel', 'boost-devel', 'sqlite-devel', 'zeromq-devel'],
'pkg': ['gcc-c++', 'make', 'python3', 'libevent-devel', 'boost-devel',
'sqlite-devel', 'zeromq-devel'],
},
}.get(grains.os_family) -%}

Expand Down
Loading