Skip to content

Commit

Permalink
Merge #292: cmake: Fix toolchain.cmake for *BSD systems
Browse files Browse the repository at this point in the history
20ef783 fixup! build: Generate `toolchain.cmake` in depends (Hennadii Stepanov)

Pull request description:

  For *BSD systems, the `qt` and `qrencode` packages are not built, even without the `NO_QT` or `NO_QR` variables defined, because these package are not available for the host systems: https://github.com/hebasto/bitcoin/blob/19d4d920d97aa7fc4675eb4ac4ecf744e9ec8613/depends/packages/packages.mk#L7-L13

  We already handle the exact logic for the `systemtap` (USDT) package. Therefore, it is reasonable to use this working logic uniformly for all cases.

  Additionally, this PR correctly handles cases when a `*_packages_`  variable contains only spaces rather than being empty.

  ---

  How to test this PR on a *BSD system:
  1. Build depends following the build guides (`depends/README.md`, `doc/build-*bsd.md`)
  2. Configure the main build system using the generated toolchain file:
  ```
  cmake -B build --toolchain depends/<your-platform>/toolchain.cmake
  ```
  It fails.

  With this PR it configures successfully.

ACKs for top commit:
  vasild:
    ACK 20ef783

Tree-SHA512: 901770884fea57c1b4439f8eaaf0399d753840730caeaaf79eb77e23a1292ef28703e445e7f43a94eda59160b765a37e2ac56ca30a3e961038ba4bbe0fe473ce
  • Loading branch information
hebasto committed Aug 2, 2024
2 parents ef5b385 + 20ef783 commit f63b200
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 18 deletions.
16 changes: 8 additions & 8 deletions depends/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -283,14 +283,14 @@ $(host_prefix)/toolchain.cmake : toolchain.cmake.in $(host_prefix)/.stamp_$(fina
-e 's|@LDFLAGS@|$(strip $(host_LDFLAGS))|' \
-e 's|@LDFLAGS_RELEASE@|$(strip $(host_release_LDFLAGS))|' \
-e 's|@LDFLAGS_DEBUG@|$(strip $(host_debug_LDFLAGS))|' \
-e 's|@no_qt@|$(NO_QT)|' \
-e 's|@no_qr@|$(NO_QR)|' \
-e 's|@no_zmq@|$(NO_ZMQ)|' \
-e 's|@no_wallet@|$(NO_WALLET)|' \
-e 's|@no_bdb@|$(NO_BDB)|' \
-e 's|@no_sqlite@|$(NO_SQLITE)|' \
-e 's|@no_upnp@|$(NO_UPNP)|' \
-e 's|@no_natpmp@|$(NO_NATPMP)|' \
-e 's|@qt_packages@|$(qt_packages_)|' \
-e 's|@qrencode_packages@|$(qrencode_packages_)|' \
-e 's|@zmq_packages@|$(zmq_packages_)|' \
-e 's|@wallet_packages@|$(wallet_packages_)|' \
-e 's|@bdb_packages@|$(bdb_packages_)|' \
-e 's|@sqlite_packages@|$(sqlite_packages_)|' \
-e 's|@upnp_packages@|$(upnp_packages_)|' \
-e 's|@natpmp_packages@|$(natpmp_packages_)|' \
-e 's|@usdt_packages@|$(usdt_packages_)|' \
-e 's|@no_harden@|$(NO_HARDEN)|' \
-e 's|@multiprocess@|$(MULTIPROCESS)|' \
Expand Down
31 changes: 21 additions & 10 deletions depends/toolchain.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -97,53 +97,64 @@ set(PKG_CONFIG_ARGN --static)


# Set configuration options for the main build system.
if("@no_qt@")
set(qt_packages @qt_packages@)
if("${qt_packages}" STREQUAL "")
set(BUILD_GUI OFF CACHE BOOL "")
else()
set(BUILD_GUI ON CACHE BOOL "")
endif()

if(NOT WITH_QRENCODE AND "@no_qr@" STREQUAL "1")
set(WITH_QRENCODE OFF CACHE STRING "Enable QR code support.")
set(qrencode_packages @qrencode_packages@)
if("${qrencode_packages}" STREQUAL "")
set(WITH_QRENCODE OFF CACHE BOOL "")
else()
set(WITH_QRENCODE ON CACHE BOOL "")
endif()

if("@no_zmq@")
set(zmq_packages @zmq_packages@)
if("${zmq_packages}" STREQUAL "")
set(WITH_ZMQ OFF CACHE BOOL "")
else()
set(WITH_ZMQ ON CACHE BOOL "")
endif()

if("@no_wallet@")
set(wallet_packages @wallet_packages@)
if("${wallet_packages}" STREQUAL "")
set(ENABLE_WALLET OFF CACHE BOOL "")
else()
set(ENABLE_WALLET ON CACHE BOOL "")
endif()

if("@no_wallet@" OR "@no_bdb@")
set(bdb_packages @bdb_packages@)
if("${wallet_packages}" STREQUAL "" OR "${bdb_packages}" STREQUAL "")
set(WITH_BDB OFF CACHE BOOL "")
else()
set(WITH_BDB ON CACHE BOOL "")
endif()

if("@no_wallet@" OR "@no_sqlite@")
set(sqlite_packages @sqlite_packages@)
if("${wallet_packages}" STREQUAL "" OR "${sqlite_packages}" STREQUAL "")
set(WITH_SQLITE OFF CACHE BOOL "")
else()
set(WITH_SQLITE ON CACHE BOOL "")
endif()

if("@no_upnp@")
set(upnp_packages @upnp_packages@)
if("${upnp_packages}" STREQUAL "")
set(WITH_MINIUPNPC OFF CACHE BOOL "")
else()
set(WITH_MINIUPNPC ON CACHE BOOL "")
endif()

if("@no_natpmp@")
set(natpmp_packages @natpmp_packages@)
if("${natpmp_packages}" STREQUAL "")
set(WITH_NATPMP OFF CACHE BOOL "")
else()
set(WITH_NATPMP ON CACHE BOOL "")
endif()

if("@usdt_packages@" STREQUAL "")
set(usdt_packages @usdt_packages@)
if("${usdt_packages}" STREQUAL "")
set(WITH_USDT OFF CACHE BOOL "")
else()
set(WITH_USDT ON CACHE BOOL "")
Expand Down

0 comments on commit f63b200

Please sign in to comment.