From a4176c82d0fac12677af8a847c3b2510980865d1 Mon Sep 17 00:00:00 2001 From: merge-script Date: Wed, 28 Aug 2024 10:51:24 +0100 Subject: [PATCH 1/9] partial Merge bitcoin/bitcoin#30454: build: Introduce CMake-based build system Import Bitcoin Core's CMake build system (merge commit 338bc2cd261ba3daf7fb494f8cb4a534762e292c), with its source lists and target names changed to the Dash tree: the top-level CMakeLists.txt, the cmake/ modules, the per-directory CMakeLists.txt under src/, and the depends changes that produce depends//toolchain.cmake. Left out: - vcpkg.json, CMakePresets.json and doc/build-windows-msvc.md. Dash Core does not build with MSVC yet, and CMake stops with an error there, so the manifest, the presets (both MSVC-only) and the guide would describe a build that cannot run. - Test and fuzz registrations whose sources Dash does not have, either because the upstream change is not backported yet or because it belongs to a feature Dash does not adopt (SegWit, RBF, Signet). - Upstream's CI, Guix and build-guide changes. Dash's own scripts and guides are switched to CMake in the later commits of this series, and the last one removes Autotools, as bitcoin/bitcoin#30664 did. The work the import needs before it builds Dash Core is in the next commit, so that this one stays comparable to its upstream source. Co-Authored-By: Claude Opus 5.5 Co-Authored-By: Claude Fable 5.2 --- .gitignore | 5 + CMakeLists.txt | 769 +++++++++++++++--- README.md | 2 +- ci/test/00_setup_env_s390x.sh | 2 +- cmake/bitcoin-config.h.in | 153 ++++ cmake/ccache.cmake | 36 + cmake/cov_tool_wrapper.sh.in | 5 + cmake/crc32c.cmake | 123 +++ cmake/introspection.cmake | 227 ++++++ cmake/leveldb.cmake | 105 +++ cmake/minisketch.cmake | 91 +++ cmake/module/AddBoostIfNeeded.cmake | 78 ++ cmake/module/AddWindowsResources.cmake | 14 + .../module/CheckSourceCompilesAndLinks.cmake | 39 + cmake/module/FindBerkeleyDB.cmake | 133 +++ cmake/module/FindLibevent.cmake | 80 ++ cmake/module/FindMiniUPnPc.cmake | 84 ++ cmake/module/FindNATPMP.cmake | 32 + cmake/module/FindQt5.cmake | 66 ++ cmake/module/FindUSDT.cmake | 64 ++ cmake/module/FlagsSummary.cmake | 73 ++ cmake/module/GenerateHeaders.cmake | 21 + cmake/module/GenerateSetupNsi.cmake | 18 + cmake/module/GetTargetInterface.cmake | 53 ++ cmake/module/Maintenance.cmake | 151 ++++ cmake/module/ProcessConfigurations.cmake | 175 ++++ .../module/TestAppendRequiredLibraries.cmake | 92 +++ cmake/module/TryAppendCXXFlags.cmake | 138 ++++ cmake/module/TryAppendLinkerFlag.cmake | 85 ++ cmake/module/WarnAboutGlobalProperties.cmake | 36 + cmake/script/Coverage.cmake | 77 ++ cmake/script/CoverageFuzz.cmake | 42 + cmake/script/CoverageInclude.cmake.in | 56 ++ cmake/script/GenerateBuildInfo.cmake | 115 +++ cmake/script/GenerateHeaderFromJson.cmake | 23 + cmake/script/GenerateHeaderFromRaw.cmake | 22 + cmake/script/macos_zip.sh | 12 + cmake/tests.cmake | 15 + contrib/guix/README.md | 1 + depends/Makefile | 50 +- depends/funcs.mk | 2 +- depends/hosts/default.mk | 4 +- depends/packages/qt.mk | 7 +- depends/patches/qt/qt.pro | 4 - depends/toolchain.cmake.in | 174 ++++ doc/CMakeLists.txt | 25 + doc/Doxyfile.in | 2 +- src/CMakeLists.txt | 522 ++++++++++++ src/Makefile.qt.include | 2 +- src/bench/CMakeLists.txt | 81 ++ src/crypto/CMakeLists.txt | 88 ++ src/ipc/CMakeLists.txt | 19 + src/kernel/CMakeLists.txt | 106 +++ src/qt/CMakeLists.txt | 369 +++++++++ src/qt/test/CMakeLists.txt | 56 ++ src/test/CMakeLists.txt | 251 ++++++ src/test/fuzz/CMakeLists.txt | 129 +++ src/test/fuzz/util/CMakeLists.txt | 24 + src/test/util/CMakeLists.txt | 31 + src/univalue/CMakeLists.txt | 41 + src/util/CMakeLists.txt | 60 ++ src/wallet/CMakeLists.txt | 65 ++ src/wallet/test/CMakeLists.txt | 32 + src/wallet/test/fuzz/CMakeLists.txt | 12 + src/zmq/CMakeLists.txt | 24 + test/CMakeLists.txt | 48 ++ test/functional/test_runner.py | 2 +- 67 files changed, 5420 insertions(+), 123 deletions(-) create mode 100644 cmake/bitcoin-config.h.in create mode 100644 cmake/ccache.cmake create mode 100644 cmake/cov_tool_wrapper.sh.in create mode 100644 cmake/crc32c.cmake create mode 100644 cmake/introspection.cmake create mode 100644 cmake/leveldb.cmake create mode 100644 cmake/minisketch.cmake create mode 100644 cmake/module/AddBoostIfNeeded.cmake create mode 100644 cmake/module/AddWindowsResources.cmake create mode 100644 cmake/module/CheckSourceCompilesAndLinks.cmake create mode 100644 cmake/module/FindBerkeleyDB.cmake create mode 100644 cmake/module/FindLibevent.cmake create mode 100644 cmake/module/FindMiniUPnPc.cmake create mode 100644 cmake/module/FindNATPMP.cmake create mode 100644 cmake/module/FindQt5.cmake create mode 100644 cmake/module/FindUSDT.cmake create mode 100644 cmake/module/FlagsSummary.cmake create mode 100644 cmake/module/GenerateHeaders.cmake create mode 100644 cmake/module/GenerateSetupNsi.cmake create mode 100644 cmake/module/GetTargetInterface.cmake create mode 100644 cmake/module/Maintenance.cmake create mode 100644 cmake/module/ProcessConfigurations.cmake create mode 100644 cmake/module/TestAppendRequiredLibraries.cmake create mode 100644 cmake/module/TryAppendCXXFlags.cmake create mode 100644 cmake/module/TryAppendLinkerFlag.cmake create mode 100644 cmake/module/WarnAboutGlobalProperties.cmake create mode 100644 cmake/script/Coverage.cmake create mode 100644 cmake/script/CoverageFuzz.cmake create mode 100644 cmake/script/CoverageInclude.cmake.in create mode 100644 cmake/script/GenerateBuildInfo.cmake create mode 100644 cmake/script/GenerateHeaderFromJson.cmake create mode 100644 cmake/script/GenerateHeaderFromRaw.cmake create mode 100755 cmake/script/macos_zip.sh create mode 100644 cmake/tests.cmake create mode 100644 depends/toolchain.cmake.in create mode 100644 doc/CMakeLists.txt create mode 100644 src/CMakeLists.txt create mode 100644 src/bench/CMakeLists.txt create mode 100644 src/crypto/CMakeLists.txt create mode 100644 src/ipc/CMakeLists.txt create mode 100644 src/kernel/CMakeLists.txt create mode 100644 src/qt/CMakeLists.txt create mode 100644 src/qt/test/CMakeLists.txt create mode 100644 src/test/CMakeLists.txt create mode 100644 src/test/fuzz/CMakeLists.txt create mode 100644 src/test/fuzz/util/CMakeLists.txt create mode 100644 src/test/util/CMakeLists.txt create mode 100644 src/univalue/CMakeLists.txt create mode 100644 src/util/CMakeLists.txt create mode 100644 src/wallet/CMakeLists.txt create mode 100644 src/wallet/test/CMakeLists.txt create mode 100644 src/wallet/test/fuzz/CMakeLists.txt create mode 100644 src/zmq/CMakeLists.txt create mode 100644 test/CMakeLists.txt diff --git a/.gitignore b/.gitignore index 735428cc7ec7..280135f58152 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,11 @@ todo.txt reset-files.bash +# Build subdirectories. +/*build* +!/build-aux +!/build_msvc + *.tar.gz *.exe diff --git a/CMakeLists.txt b/CMakeLists.txt index 1af0d14fa95d..66a2ee335b42 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,122 +1,677 @@ -# This CMakeLists.txt is not meant to actually work! -# It only serves as a dummy project to make CLion work properly when it comes to symbol resolution and all the nice -# features dependent on that. Building must still be done on the command line using the automake build chain -# If you load this project in CLion and would like to run/debug executables, make sure to remove the "Build" entry from -# the run/debug configuration as otherwise CLion will try to build this project with cmake, failing horribly. -# You'll also have to manually change the executable in the configuration to the correct path of the already built executable +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. -cmake_minimum_required(VERSION 3.7) -project(dash) +# Ubuntu 22.04 LTS Jammy Jellyfish, https://wiki.ubuntu.com/Releases, EOSS in June 2027: +# - CMake 3.22.1, https://packages.ubuntu.com/jammy/cmake +# +# Centos Stream 9, EOL in May 2027: +# - CMake 3.26.5, https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages/ +cmake_minimum_required(VERSION 3.22) +if(POLICY CMP0141) + # MSVC debug information format flags are selected by an abstraction. + # We want to use the CMAKE_MSVC_DEBUG_INFORMATION_FORMAT variable + # to select the MSVC debug information format. + cmake_policy(SET CMP0141 NEW) +endif() + +if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + message(FATAL_ERROR "In-source builds are not allowed.") +endif() + +# Relic's headers include "relic_conf.h" with quotes, so a copy left in the +# source tree by an in-source Autotools configure would shadow the one CMake +# generates in the build tree. +if(EXISTS ${CMAKE_SOURCE_DIR}/src/dashbls/depends/relic/include/relic_conf.h) + message(FATAL_ERROR "Found src/dashbls/depends/relic/include/relic_conf.h from an in-source Autotools configure. Run \"make distclean\" in the source tree before configuring with CMake.") +endif() + +#============================= +# Project / Package metadata +#============================= +set(PACKAGE_NAME "Dash Core") +set(CLIENT_VERSION_MAJOR 23) +set(CLIENT_VERSION_MINOR 1) +set(CLIENT_VERSION_BUILD 5) +set(CLIENT_VERSION_RC 0) +set(CLIENT_VERSION_IS_RELEASE "false") +set(COPYRIGHT_YEAR "2026") + +# During the enabling of the CXX and CXXOBJ languages, we modify +# CMake's compiler/linker invocation strings by appending the content +# of the user-defined `APPEND_*` variables, which allows overriding +# any flag. We also ensure that the APPEND_* flags are considered +# during CMake's tests, which use the `try_compile()` command. +# +# CMake's docs state that the `CMAKE_TRY_COMPILE_PLATFORM_VARIABLES` +# variable "is meant to be set by CMake's platform information modules +# for the current toolchain, or by a toolchain file." We do our best +# to set it before the `project()` command. +set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES + CMAKE_CXX_COMPILE_OBJECT + CMAKE_OBJCXX_COMPILE_OBJECT + CMAKE_CXX_LINK_EXECUTABLE +) + +project(BitcoinCore + VERSION ${CLIENT_VERSION_MAJOR}.${CLIENT_VERSION_MINOR}.${CLIENT_VERSION_BUILD} + DESCRIPTION "Dash client software" + HOMEPAGE_URL "https://dash.org/" + LANGUAGES NONE +) +set(PACKAGE_VERSION ${PROJECT_VERSION}) +if(CLIENT_VERSION_RC GREATER 0) + string(APPEND PACKAGE_VERSION "rc${CLIENT_VERSION_RC}") +endif() + +set(COPYRIGHT_HOLDERS "The %s developers") +set(COPYRIGHT_HOLDERS_FINAL "The ${PACKAGE_NAME} developers") +set(PACKAGE_BUGREPORT "https://github.com/dashpay/dash/issues") + +#============================= +# Language setup +#============================= +if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT CMAKE_HOST_APPLE) + # We do not use the install_name_tool when cross-compiling for macOS. + # So disable this tool check in further enable_language() commands. + set(CMAKE_PLATFORM_HAS_INSTALLNAME FALSE) +endif() +enable_language(CXX) +enable_language(C) + +if(MSVC) + # Dash's stack-trace support (src/stacktraces.{h,cpp}) still relies on + # GCC/Clang-only extensions, so the build cannot succeed yet. + message(FATAL_ERROR "Building Dash Core with MSVC is not supported yet. See doc/build-windows.md.") +endif() set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/module) + +#============================= +# Configurable options +#============================= +include(CMakeDependentOption) +# When adding a new option, end the with a full stop for consistency. +option(BUILD_DAEMON "Build bitcoind executable." ON) +option(BUILD_GUI "Build bitcoin-qt executable." OFF) +option(BUILD_CLI "Build bitcoin-cli executable." ON) + +option(BUILD_TESTS "Build test_bitcoin executable." ON) +option(BUILD_TX "Build bitcoin-tx executable." ${BUILD_TESTS}) +option(BUILD_UTIL "Build bitcoin-util executable." ${BUILD_TESTS}) + +option(BUILD_UTIL_CHAINSTATE "Build experimental bitcoin-chainstate executable." OFF) +option(BUILD_KERNEL_LIB "Build experimental bitcoinkernel library." ${BUILD_UTIL_CHAINSTATE}) + +option(ENABLE_WALLET "Enable wallet." ON) +option(WITH_SQLITE "Enable SQLite wallet support." ${ENABLE_WALLET}) +if(WITH_SQLITE) + if(VCPKG_TARGET_TRIPLET) + # Use of the `unofficial::` namespace is a vcpkg package manager convention. + find_package(unofficial-sqlite3 CONFIG REQUIRED) + else() + find_package(SQLite3 3.7.17 REQUIRED) + endif() + set(USE_SQLITE ON) + set(ENABLE_WALLET ON) +endif() +option(WITH_BDB "Enable Berkeley DB (BDB) wallet support." OFF) +cmake_dependent_option(WARN_INCOMPATIBLE_BDB "Warn when using a Berkeley DB (BDB) version other than 4.8." ON "WITH_BDB" OFF) +if(WITH_BDB) + find_package(BerkeleyDB 4.8 MODULE REQUIRED) + set(USE_BDB ON) + set(ENABLE_WALLET ON) + if(NOT BerkeleyDB_VERSION VERSION_EQUAL 4.8) + message(WARNING "Found Berkeley DB (BDB) other than 4.8.\n" + "BDB (legacy) wallets opened by this build will not be portable!" + ) + if(WARN_INCOMPATIBLE_BDB) + message(WARNING "If this is intended, pass \"-DWARN_INCOMPATIBLE_BDB=OFF\".\n" + "Passing \"-DWITH_BDB=OFF\" will suppress this warning." + ) + endif() + endif() +endif() +cmake_dependent_option(BUILD_WALLET_TOOL "Build bitcoin-wallet tool." ${BUILD_TESTS} "ENABLE_WALLET" OFF) + +option(ENABLE_HARDENING "Attempt to harden the resulting executables." ON) +option(REDUCE_EXPORTS "Attempt to reduce exported symbols in the resulting executables." OFF) +option(WERROR "Treat compiler warnings as errors." OFF) +option(WITH_CCACHE "Attempt to use ccache for compiling." ON) + +option(WITH_NATPMP "Enable NAT-PMP." OFF) +if(WITH_NATPMP) + find_package(NATPMP MODULE REQUIRED) +endif() -include_directories( - src - src/qt/forms - src/leveldb/include - src/univalue/include +option(WITH_MINIUPNPC "Enable UPnP." OFF) +if(WITH_MINIUPNPC) + find_package(MiniUPnPc MODULE REQUIRED) +endif() + +option(WITH_ZMQ "Enable ZMQ notifications." OFF) +if(WITH_ZMQ) + if(VCPKG_TARGET_TRIPLET) + find_package(ZeroMQ CONFIG REQUIRED) + else() + # The ZeroMQ project has provided config files since v4.2.2. + # TODO: Switch to find_package(ZeroMQ) at some point in the future. + find_package(PkgConfig REQUIRED) + pkg_check_modules(libzmq REQUIRED IMPORTED_TARGET libzmq>=4) + # TODO: This command will be redundant once + # https://github.com/bitcoin/bitcoin/pull/30508 is merged. + target_link_libraries(PkgConfig::libzmq INTERFACE + $<$:iphlpapi;ws2_32> + ) + endif() +endif() + +option(WITH_USDT "Enable tracepoints for Userspace, Statically Defined Tracing." OFF) +if(WITH_USDT) + find_package(USDT MODULE REQUIRED) +endif() + +cmake_dependent_option(ENABLE_EXTERNAL_SIGNER "Enable external signer support." ON "NOT WIN32" OFF) + +cmake_dependent_option(WITH_QRENCODE "Enable QR code support." ON "BUILD_GUI" OFF) +if(WITH_QRENCODE) + find_package(PkgConfig REQUIRED) + pkg_check_modules(libqrencode REQUIRED IMPORTED_TARGET libqrencode) + set(USE_QRCODE TRUE) +endif() + +cmake_dependent_option(WITH_DBUS "Enable DBus support." ON "CMAKE_SYSTEM_NAME STREQUAL \"Linux\" AND BUILD_GUI" OFF) + +option(WITH_MULTIPROCESS "Build multiprocess bitcoin-node and bitcoin-gui executables in addition to monolithic bitcoind and bitcoin-qt executables. Requires libmultiprocess library. Experimental." OFF) +if(WITH_MULTIPROCESS) + find_package(Libmultiprocess COMPONENTS Lib) + find_package(LibmultiprocessNative COMPONENTS Bin + NAMES Libmultiprocess + ) +endif() + +cmake_dependent_option(BUILD_GUI_TESTS "Build test_bitcoin-qt executable." ON "BUILD_GUI;BUILD_TESTS" OFF) +if(BUILD_GUI) + set(qt_components Core Gui Widgets LinguistTools) + if(ENABLE_WALLET) + list(APPEND qt_components Network) + endif() + if(WITH_DBUS) + list(APPEND qt_components DBus) + set(USE_DBUS TRUE) + endif() + if(BUILD_GUI_TESTS) + list(APPEND qt_components Test) + endif() + find_package(Qt5 5.11.3 MODULE REQUIRED + COMPONENTS ${qt_components} + ) + unset(qt_components) +endif() + +option(BUILD_BENCH "Build bench_bitcoin executable." OFF) +option(BUILD_FUZZ_BINARY "Build fuzz binary." OFF) +cmake_dependent_option(BUILD_FOR_FUZZING "Build for fuzzing. Enabling this will disable all other targets and override BUILD_FUZZ_BINARY." OFF "NOT MSVC" OFF) + +option(INSTALL_MAN "Install man pages." ON) + +set(APPEND_CPPFLAGS "" CACHE STRING "Preprocessor flags that are appended to the command line after all other flags added by the build system. This variable is intended for debugging and special builds.") +set(APPEND_CFLAGS "" CACHE STRING "C compiler flags that are appended to the command line after all other flags added by the build system. This variable is intended for debugging and special builds.") +set(APPEND_CXXFLAGS "" CACHE STRING "(Objective) C++ compiler flags that are appended to the command line after all other flags added by the build system. This variable is intended for debugging and special builds.") +set(APPEND_LDFLAGS "" CACHE STRING "Linker flags that are appended to the command line after all other flags added by the build system. This variable is intended for debugging and special builds.") +# Appending to this low-level rule variables is the only way to +# guarantee that the flags appear at the end of the command line. +string(APPEND CMAKE_CXX_COMPILE_OBJECT " ${APPEND_CPPFLAGS} ${APPEND_CXXFLAGS}") +string(APPEND CMAKE_CXX_CREATE_SHARED_LIBRARY " ${APPEND_LDFLAGS}") +string(APPEND CMAKE_CXX_LINK_EXECUTABLE " ${APPEND_LDFLAGS}") + +set(configure_warnings) + +include(CheckPIESupported) +check_pie_supported(OUTPUT_VARIABLE check_pie_output LANGUAGES CXX) +if(CMAKE_CXX_LINK_PIE_SUPPORTED) + set(CMAKE_POSITION_INDEPENDENT_CODE ON) +elseif(NOT WIN32) + # The warning is superfluous for Windows. + message(WARNING "PIE is not supported at link time: ${check_pie_output}") + list(APPEND configure_warnings "Position independent code disabled.") +endif() +unset(check_pie_output) + +# The core_interface library aims to encapsulate common build flags. +# It is a usage requirement for all targets except for secp256k1, which +# gets its flags by other means. +add_library(core_interface INTERFACE) +add_library(core_interface_relwithdebinfo INTERFACE) +add_library(core_interface_debug INTERFACE) +target_link_libraries(core_interface INTERFACE + $<$:core_interface_relwithdebinfo> + $<$:core_interface_debug> ) +target_compile_definitions(core_interface INTERFACE HAVE_CONFIG_H) + +if(BUILD_FOR_FUZZING) + message(WARNING "BUILD_FOR_FUZZING=ON will disable all other targets and force BUILD_FUZZ_BINARY=ON.") + set(BUILD_DAEMON OFF) + set(BUILD_CLI OFF) + set(BUILD_TX OFF) + set(BUILD_UTIL OFF) + set(BUILD_UTIL_CHAINSTATE OFF) + set(BUILD_KERNEL_LIB OFF) + set(BUILD_WALLET_TOOL OFF) + set(BUILD_GUI OFF) + set(ENABLE_EXTERNAL_SIGNER OFF) + set(WITH_NATPMP OFF) + set(WITH_MINIUPNPC OFF) + set(WITH_ZMQ OFF) + set(BUILD_TESTS OFF) + set(BUILD_GUI_TESTS OFF) + set(BUILD_BENCH OFF) + set(BUILD_FUZZ_BINARY ON) + + target_compile_definitions(core_interface INTERFACE + ABORT_ON_FAILED_ASSUME + ) +endif() + +include(ProcessConfigurations) + +include(TryAppendCXXFlags) +include(TryAppendLinkerFlag) + +if(WIN32) + #[=[ + This build system supports two ways to build binaries for Windows. -if(UNIX AND NOT APPLE) - set(DEPENDS_PREFIX depends/x86_64-pc-linux-gnu) -elseif(APPLE) - EXECUTE_PROCESS( COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE ) - EXECUTE_PROCESS( COMMAND system_profiler -detailLevel mini -json SPSoftwareDataType - COMMAND jq .SPSoftwareDataType - COMMAND jq .[] - COMMAND jq .kernel_version - COMMAND tr -d "Dawrin\" " - OUTPUT_VARIABLE DARWIN_KERNEL_VERSION) - if( ${ARCHITECTURE} STREQUAL "arm64" ) - set(DEPENDS_PREFIX depends/aarch64-apple-darwin${DARWIN_KERNEL_VERSION}) + 1. Building on Windows using MSVC. + Implementation notes: + - /DWIN32 and /D_WINDOWS definitions are included into the CMAKE_CXX_FLAGS_INIT + and CMAKE_CXX_FLAGS_INIT variables by default. + - A run-time library is selected using the CMAKE_MSVC_RUNTIME_LIBRARY variable. + - MSVC-specific options, for example, /Zc:__cplusplus, are additionally required. + + 2. Cross-compiling using MinGW. + Implementation notes: + - WIN32 and _WINDOWS definitions must be provided explicitly. + - A run-time library must be specified explicitly using _MT definition. + ]=] + + target_compile_definitions(core_interface INTERFACE + _WIN32_WINNT=0x0601 + _WIN32_IE=0x0501 + WIN32_LEAN_AND_MEAN + NOMINMAX + ) + + if(MSVC) + if(VCPKG_TARGET_TRIPLET MATCHES "-static") + set(msvc_library_linkage "") else() - set(DEPENDS_PREFIX depends/x86_64-apple-darwin${DARWIN_KERNEL_VERSION}) + set(msvc_library_linkage "DLL") endif() -elseif(WIN32) - set(DEPENDS_PREFIX depends/x86_64-w64-mingw32) + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>${msvc_library_linkage}") + unset(msvc_library_linkage) + + target_compile_definitions(core_interface INTERFACE + _UNICODE;UNICODE + ) + target_compile_options(core_interface INTERFACE + /utf-8 + /Zc:preprocessor + /Zc:__cplusplus + /sdl + ) + # Improve parallelism in MSBuild. + # See: https://devblogs.microsoft.com/cppblog/improved-parallelism-in-msbuild/. + list(APPEND CMAKE_VS_GLOBALS "UseMultiToolTask=true") + endif() + + if(MINGW) + target_compile_definitions(core_interface INTERFACE + WIN32 + _WINDOWS + _MT + ) + # Avoid the use of aligned vector instructions when building for Windows. + # See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54412. + try_append_cxx_flags("-Wa,-muse-unaligned-vector-move" TARGET core_interface SKIP_LINK) + try_append_linker_flag("-static" TARGET core_interface) + # We require Windows 7 (NT 6.1) or later. + try_append_linker_flag("-Wl,--major-subsystem-version,6" TARGET core_interface) + try_append_linker_flag("-Wl,--minor-subsystem-version,1" TARGET core_interface) + endif() endif() -message(STATUS "DEPENDS_PREFIX: ${DEPENDS_PREFIX}") +# Use 64-bit off_t on 32-bit Linux. +if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SIZEOF_VOID_P EQUAL 4) + # Ensure 64-bit offsets are used for filesystem accesses for 32-bit compilation. + target_compile_definitions(core_interface INTERFACE + _FILE_OFFSET_BITS=64 + ) +endif() -if(DEFINED DEPENDS_PREFIX) - include_directories(${DEPENDS_PREFIX}/include) - include_directories(${DEPENDS_PREFIX}/include/QtWidgets) +if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + target_compile_definitions(core_interface INTERFACE + MAC_OSX + OBJC_OLD_DISPATCH_PROTOTYPES=0 + ) + # These flags are specific to ld64, and may cause issues with other linkers. + # For example: GNU ld will interpret -dead_strip as -de and then try and use + # "ad_strip" as the symbol for the entry point. + try_append_linker_flag("-Wl,-dead_strip" TARGET core_interface) + try_append_linker_flag("-Wl,-dead_strip_dylibs" TARGET core_interface) + if(CMAKE_HOST_APPLE) + try_append_linker_flag("-Wl,-headerpad_max_install_names" TARGET core_interface) + endif() endif() -add_definitions( - -DENABLE_CRASH_HOOKS=1 - -DENABLE_STACKTRACES=1 - -DENABLE_WALLET=1 +set(THREADS_PREFER_PTHREAD_FLAG ON) +find_package(Threads REQUIRED) +target_link_libraries(core_interface INTERFACE + Threads::Threads ) -# find src/ -name '*.h' -or -name '*.cpp' | sed -r 's/[^/]*.(h|cpp)$/*.\1/' | sort | uniq | grep -Ev "/(bench/data|obj)/" > list.txt - -file(GLOB SOURCE_FILES - src/*.cpp - src/*.h - src/bench/*.cpp - src/bench/*.h - src/bls/*.cpp - src/bls/*.h - src/coinjoin/*.cpp - src/coinjoin/*.h - src/compat/*.cpp - src/compat/*.h - src/consensus/*.cpp - src/consensus/*.h - src/crypto/*.c - src/crypto/*.cpp - src/crypto/*.h - src/evo/*.cpp - src/evo/*.h - src/governance/*.cpp - src/governance/*.h - src/index/*.cpp - src/index/*.h - src/interfaces/*.cpp - src/interfaces/*.h - src/leveldb/db/*.cc - src/leveldb/db/*.h - src/leveldb/include/*.h - src/llmq/*.cpp - src/llmq/*.h - src/logging/*.h - src/masternode/*.cpp - src/masternode/*.h - src/node/*.cpp - src/node/*.h - src/policy/*.cpp - src/policy/*.h - src/primitives/*.cpp - src/primitives/*.h - src/qt/*.cpp - src/qt/*.h - src/qt/test/*.cpp - src/qt/test/*.h - src/rpc/*.cpp - src/rpc/*.h - src/script/*.cpp - src/script/*.h - src/secp256k1/include/*.h - src/support/allocators/*.h - src/support/*.cpp - src/support/*.h - src/test/*.cpp - src/test/*.h - src/test/fuzz/*.cpp - src/test/fuzz/*.h - src/test/util/*.cpp - src/test/util/*.h - src/univalue/include/*.h - src/univalue/lib/*.cpp - src/univalue/lib/*.h - src/util/*.h - src/util/*.cpp - src/wallet/*.cpp - src/wallet/*.h - src/wallet/test/*.cpp - src/zmq/*.cpp - src/zmq/*.h - ) - -add_executable(dash ${SOURCE_FILES}) +add_library(sanitize_interface INTERFACE) +target_link_libraries(core_interface INTERFACE sanitize_interface) +if(SANITIZERS) + # First check if the compiler accepts flags. If an incompatible pair like + # -fsanitize=address,thread is used here, this check will fail. This will also + # fail if a bad argument is passed, e.g. -fsanitize=undfeined + try_append_cxx_flags("-fsanitize=${SANITIZERS}" TARGET sanitize_interface + RESULT_VAR cxx_supports_sanitizers + SKIP_LINK + ) + if(NOT cxx_supports_sanitizers) + message(FATAL_ERROR "Compiler did not accept requested flags.") + endif() + + # Some compilers (e.g. GCC) require additional libraries like libasan, + # libtsan, libubsan, etc. Make sure linking still works with the sanitize + # flag. This is a separate check so we can give a better error message when + # the sanitize flags are supported by the compiler but the actual sanitizer + # libs are missing. + try_append_linker_flag("-fsanitize=${SANITIZERS}" VAR SANITIZER_LDFLAGS + SOURCE " + #include + #include + extern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { return 0; } + __attribute__((weak)) // allow for libFuzzer linking + int main() { return 0; } + " + RESULT_VAR linker_supports_sanitizers + ) + if(NOT linker_supports_sanitizers) + message(FATAL_ERROR "Linker did not accept requested flags, you are missing required libraries.") + endif() +endif() +target_link_options(sanitize_interface INTERFACE ${SANITIZER_LDFLAGS}) + +if(BUILD_FUZZ_BINARY) + include(CheckSourceCompilesAndLinks) + check_cxx_source_links_with_flags("${SANITIZER_LDFLAGS}" " + #include + #include + extern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { return 0; } + // No main() function. + " FUZZ_BINARY_LINKS_WITHOUT_MAIN_FUNCTION + ) +endif() + +include(AddBoostIfNeeded) +add_boost_if_needed() + +if(BUILD_DAEMON OR BUILD_GUI OR BUILD_CLI OR BUILD_TESTS OR BUILD_BENCH OR BUILD_FUZZ_BINARY OR WITH_MULTIPROCESS) + find_package(Libevent 2.1.8 MODULE REQUIRED) +endif() + +include(cmake/introspection.cmake) + +include(cmake/ccache.cmake) + +add_library(warn_interface INTERFACE) +target_link_libraries(core_interface INTERFACE warn_interface) +if(MSVC) + try_append_cxx_flags("/W3" TARGET warn_interface SKIP_LINK) + try_append_cxx_flags("/wd4018" TARGET warn_interface SKIP_LINK) + try_append_cxx_flags("/wd4244" TARGET warn_interface SKIP_LINK) + try_append_cxx_flags("/wd4267" TARGET warn_interface SKIP_LINK) + try_append_cxx_flags("/wd4715" TARGET warn_interface SKIP_LINK) + try_append_cxx_flags("/wd4805" TARGET warn_interface SKIP_LINK) + target_compile_definitions(warn_interface INTERFACE + _CRT_SECURE_NO_WARNINGS + _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING + ) +else() + try_append_cxx_flags("-Wall" TARGET warn_interface SKIP_LINK) + try_append_cxx_flags("-Wextra" TARGET warn_interface SKIP_LINK) + try_append_cxx_flags("-Wgnu" TARGET warn_interface SKIP_LINK) + # Some compilers will ignore -Wformat-security without -Wformat, so just combine the two here. + try_append_cxx_flags("-Wformat -Wformat-security" TARGET warn_interface SKIP_LINK) + try_append_cxx_flags("-Wvla" TARGET warn_interface SKIP_LINK) + try_append_cxx_flags("-Wshadow-field" TARGET warn_interface SKIP_LINK) + try_append_cxx_flags("-Wthread-safety" TARGET warn_interface SKIP_LINK) + try_append_cxx_flags("-Wloop-analysis" TARGET warn_interface SKIP_LINK) + try_append_cxx_flags("-Wredundant-decls" TARGET warn_interface SKIP_LINK) + try_append_cxx_flags("-Wunused-member-function" TARGET warn_interface SKIP_LINK) + try_append_cxx_flags("-Wdate-time" TARGET warn_interface SKIP_LINK) + try_append_cxx_flags("-Wconditional-uninitialized" TARGET warn_interface SKIP_LINK) + try_append_cxx_flags("-Wduplicated-branches" TARGET warn_interface SKIP_LINK) + try_append_cxx_flags("-Wduplicated-cond" TARGET warn_interface SKIP_LINK) + try_append_cxx_flags("-Wlogical-op" TARGET warn_interface SKIP_LINK) + try_append_cxx_flags("-Woverloaded-virtual" TARGET warn_interface SKIP_LINK) + try_append_cxx_flags("-Wsuggest-override" TARGET warn_interface SKIP_LINK) + try_append_cxx_flags("-Wimplicit-fallthrough" TARGET warn_interface SKIP_LINK) + try_append_cxx_flags("-Wunreachable-code" TARGET warn_interface SKIP_LINK) + try_append_cxx_flags("-Wdocumentation" TARGET warn_interface SKIP_LINK) + try_append_cxx_flags("-Wself-assign" TARGET warn_interface SKIP_LINK) + try_append_cxx_flags("-Wundef" TARGET warn_interface SKIP_LINK) + + # Some compilers (gcc) ignore unknown -Wno-* options, but warn about all + # unknown options if any other warning is produced. Test the -Wfoo case, and + # set the -Wno-foo case if it works. + try_append_cxx_flags("-Wunused-parameter" TARGET warn_interface SKIP_LINK + IF_CHECK_PASSED "-Wno-unused-parameter" + ) +endif() + +configure_file(cmake/script/Coverage.cmake Coverage.cmake COPYONLY) +configure_file(cmake/script/CoverageFuzz.cmake CoverageFuzz.cmake COPYONLY) +configure_file(cmake/script/CoverageInclude.cmake.in CoverageInclude.cmake @ONLY) +configure_file(contrib/filter-lcov.py filter-lcov.py COPYONLY) + +# Don't allow extended (non-ASCII) symbols in identifiers. This is easier for code review. +try_append_cxx_flags("-fno-extended-identifiers" TARGET core_interface SKIP_LINK) + +# Currently all versions of gcc are subject to a class of bugs, see the +# gccbug_90348 test case (only reproduces on GCC 11 and earlier) and +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111843. To work around that, set +# -fstack-reuse=none for all gcc builds. (Only gcc understands this flag). +try_append_cxx_flags("-fstack-reuse=none" TARGET core_interface) + +if(ENABLE_HARDENING) + add_library(hardening_interface INTERFACE) + target_link_libraries(core_interface INTERFACE hardening_interface) + if(MSVC) + try_append_linker_flag("/DYNAMICBASE" TARGET hardening_interface) + try_append_linker_flag("/HIGHENTROPYVA" TARGET hardening_interface) + try_append_linker_flag("/NXCOMPAT" TARGET hardening_interface) + else() + try_append_cxx_flags("-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3" + RESULT_VAR cxx_supports_fortify_source + ) + if(cxx_supports_fortify_source) + # When the build configuration is Debug, all optimizations are disabled. + # However, _FORTIFY_SOURCE requires that there is some level of optimization, + # otherwise it does nothing and just creates a compiler warning. + # Since _FORTIFY_SOURCE is a no-op without optimizations, do not enable it + # when the build configuration is Debug. + target_compile_options(hardening_interface INTERFACE + $<$>:-U_FORTIFY_SOURCE> + $<$>:-D_FORTIFY_SOURCE=3> + ) + endif() + unset(cxx_supports_fortify_source) + + try_append_cxx_flags("-Wstack-protector" TARGET hardening_interface SKIP_LINK) + try_append_cxx_flags("-fstack-protector-all" TARGET hardening_interface) + try_append_cxx_flags("-fcf-protection=full" TARGET hardening_interface) + + if(MINGW) + # stack-clash-protection doesn't compile with GCC 10 and earlier. + # In any case, it is a no-op for Windows. + # See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90458 for more details. + else() + try_append_cxx_flags("-fstack-clash-protection" TARGET hardening_interface) + endif() + + if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64") + try_append_cxx_flags("-mbranch-protection=bti" TARGET hardening_interface SKIP_LINK) + endif() + + try_append_linker_flag("-Wl,--enable-reloc-section" TARGET hardening_interface) + try_append_linker_flag("-Wl,--dynamicbase" TARGET hardening_interface) + try_append_linker_flag("-Wl,--nxcompat" TARGET hardening_interface) + try_append_linker_flag("-Wl,--high-entropy-va" TARGET hardening_interface) + try_append_linker_flag("-Wl,-z,relro" TARGET hardening_interface) + try_append_linker_flag("-Wl,-z,now" TARGET hardening_interface) + try_append_linker_flag("-Wl,-z,separate-code" TARGET hardening_interface) + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + try_append_linker_flag("-Wl,-fixup_chains" TARGET hardening_interface) + endif() + endif() +endif() + +if(REDUCE_EXPORTS) + set(CMAKE_CXX_VISIBILITY_PRESET hidden) + try_append_linker_flag("-Wl,--exclude-libs,ALL" TARGET core_interface) + try_append_linker_flag("-Wl,-no_exported_symbols" VAR CMAKE_EXE_LINKER_FLAGS) +endif() + +if(WERROR) + if(MSVC) + set(werror_flag "/WX") + else() + set(werror_flag "-Werror") + endif() + try_append_cxx_flags(${werror_flag} TARGET core_interface SKIP_LINK RESULT_VAR compiler_supports_werror) + if(NOT compiler_supports_werror) + message(FATAL_ERROR "WERROR set but ${werror_flag} is not usable.") + endif() + unset(werror_flag) +endif() + +find_package(Python3 3.9 COMPONENTS Interpreter) +if(Python3_EXECUTABLE) + set(PYTHON_COMMAND ${Python3_EXECUTABLE}) +else() + list(APPEND configure_warnings + "Minimum required Python not found. Utils and rpcauth tests are disabled." + ) +endif() + +target_compile_definitions(core_interface INTERFACE ${DEPENDS_COMPILE_DEFINITIONS}) +target_compile_definitions(core_interface_relwithdebinfo INTERFACE ${DEPENDS_COMPILE_DEFINITIONS_RELWITHDEBINFO}) +target_compile_definitions(core_interface_debug INTERFACE ${DEPENDS_COMPILE_DEFINITIONS_DEBUG}) + +# If the {CXX,LD}FLAGS environment variables are defined during building depends +# and configuring this build system, their content might be duplicated. +if(DEFINED ENV{CXXFLAGS}) + deduplicate_flags(CMAKE_CXX_FLAGS) +endif() +if(DEFINED ENV{LDFLAGS}) + deduplicate_flags(CMAKE_EXE_LINKER_FLAGS) +endif() + +if(BUILD_TESTS) + enable_testing() +endif() +# TODO: The `CMAKE_SKIP_BUILD_RPATH` variable setting can be deleted +# in the future after reordering Guix script commands to +# perform binary checks after the installation step. +# Relevant discussions: +# - https://github.com/hebasto/bitcoin/pull/236#issuecomment-2183120953 +# - https://github.com/bitcoin/bitcoin/pull/30312#issuecomment-2191235833 +set(CMAKE_SKIP_BUILD_RPATH TRUE) +set(CMAKE_SKIP_INSTALL_RPATH TRUE) +add_subdirectory(test) +add_subdirectory(doc) + +include(cmake/crc32c.cmake) +include(cmake/leveldb.cmake) +include(cmake/minisketch.cmake) +add_subdirectory(src) + +include(cmake/tests.cmake) + +include(Maintenance) +setup_split_debug_script() +add_maintenance_targets() +add_windows_deploy_target() +add_macos_deploy_target() + +message("\n") +message("Configure summary") +message("=================") +message("Executables:") +message(" bitcoind ............................ ${BUILD_DAEMON}") +message(" bitcoin-node (multiprocess) ......... ${WITH_MULTIPROCESS}") +message(" bitcoin-qt (GUI) .................... ${BUILD_GUI}") +if(BUILD_GUI AND WITH_MULTIPROCESS) + set(bitcoin_gui_status ON) +else() + set(bitcoin_gui_status OFF) +endif() +message(" bitcoin-gui (GUI, multiprocess) ..... ${bitcoin_gui_status}") +message(" bitcoin-cli ......................... ${BUILD_CLI}") +message(" bitcoin-tx .......................... ${BUILD_TX}") +message(" bitcoin-util ........................ ${BUILD_UTIL}") +message(" bitcoin-wallet ...................... ${BUILD_WALLET_TOOL}") +message(" bitcoin-chainstate (experimental) ... ${BUILD_UTIL_CHAINSTATE}") +message(" libbitcoinkernel (experimental) ..... ${BUILD_KERNEL_LIB}") +message("Optional features:") +message(" wallet support ...................... ${ENABLE_WALLET}") +if(ENABLE_WALLET) + message(" - descriptor wallets (SQLite) ...... ${WITH_SQLITE}") + message(" - legacy wallets (Berkeley DB) ..... ${WITH_BDB}") +endif() +message(" external signer ..................... ${ENABLE_EXTERNAL_SIGNER}") +message(" port mapping:") +message(" - using NAT-PMP .................... ${WITH_NATPMP}") +message(" - using UPnP ....................... ${WITH_MINIUPNPC}") +message(" ZeroMQ .............................. ${WITH_ZMQ}") +message(" USDT tracing ........................ ${WITH_USDT}") +message(" QR code (GUI) ....................... ${WITH_QRENCODE}") +message(" DBus (GUI, Linux only) .............. ${WITH_DBUS}") +message("Tests:") +message(" test_bitcoin ........................ ${BUILD_TESTS}") +message(" test_bitcoin-qt ..................... ${BUILD_GUI_TESTS}") +message(" bench_bitcoin ....................... ${BUILD_BENCH}") +message(" fuzz binary ......................... ${BUILD_FUZZ_BINARY}") +message("") +if(CMAKE_CROSSCOMPILING) + set(cross_status "TRUE, for ${CMAKE_SYSTEM_NAME}, ${CMAKE_SYSTEM_PROCESSOR}") +else() + set(cross_status "FALSE") +endif() +message("Cross compiling ....................... ${cross_status}") +message("C++ compiler .......................... ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}, ${CMAKE_CXX_COMPILER}") +include(FlagsSummary) +flags_summary() +message("Attempt to harden executables ......... ${ENABLE_HARDENING}") +message("Treat compiler warnings as errors ..... ${WERROR}") +message("Use ccache for compiling .............. ${WITH_CCACHE}") +message("\n") +if(configure_warnings) + message(" ******\n") + foreach(warning IN LISTS configure_warnings) + message(WARNING "${warning}") + endforeach() + message(" ******\n") +endif() + +# We want all build properties to be encapsulated properly. +include(WarnAboutGlobalProperties) diff --git a/README.md b/README.md index edb28d9739c8..937b55e4127e 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ lots of money. Developers are strongly encouraged to write [unit tests](src/test/README.md) for new code, and to submit new unit tests for old code. Unit tests can be compiled and run -(assuming they weren't disabled in configure) with: `make check`. Further details on running +(assuming they weren't disabled during the generation of the build system) with: `ctest`. Further details on running and extending unit tests can be found in [/src/test/README.md](/src/test/README.md). There are also [regression and integration tests](/test), written diff --git a/ci/test/00_setup_env_s390x.sh b/ci/test/00_setup_env_s390x.sh index 6f6b0f6c14d1..91dfae39f942 100755 --- a/ci/test/00_setup_env_s390x.sh +++ b/ci/test/00_setup_env_s390x.sh @@ -22,4 +22,4 @@ export RUN_UNIT_TESTS=true export TEST_RUNNER_EXTRA="--exclude feature_init,rpc_bind,feature_bind_extra" # Excluded for now, see https://github.com/bitcoin/bitcoin/issues/17765#issuecomment-602068547 export RUN_FUNCTIONAL_TESTS=true export GOAL="install" -export BITCOIN_CONFIG="--enable-reduce-exports" +export BITCOIN_CONFIG="-DREDUCE_EXPORTS=ON" diff --git a/cmake/bitcoin-config.h.in b/cmake/bitcoin-config.h.in new file mode 100644 index 000000000000..094eb8040a3b --- /dev/null +++ b/cmake/bitcoin-config.h.in @@ -0,0 +1,153 @@ +// Copyright (c) 2023-present The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or https://opensource.org/license/mit/. + +#ifndef BITCOIN_CONFIG_H +#define BITCOIN_CONFIG_H + +/* Version Build */ +#define CLIENT_VERSION_BUILD @CLIENT_VERSION_BUILD@ + +/* Version is release */ +#define CLIENT_VERSION_IS_RELEASE @CLIENT_VERSION_IS_RELEASE@ + +/* Major version */ +#define CLIENT_VERSION_MAJOR @CLIENT_VERSION_MAJOR@ + +/* Minor version */ +#define CLIENT_VERSION_MINOR @CLIENT_VERSION_MINOR@ + +/* Copyright holder(s) before %s replacement */ +#define COPYRIGHT_HOLDERS "@COPYRIGHT_HOLDERS@" + +/* Copyright holder(s) */ +#define COPYRIGHT_HOLDERS_FINAL "@COPYRIGHT_HOLDERS_FINAL@" + +/* Replacement for %s in copyright holders string */ +#define COPYRIGHT_HOLDERS_SUBSTITUTION "@PACKAGE_NAME@" + +/* Copyright year */ +#define COPYRIGHT_YEAR @COPYRIGHT_YEAR@ + +/* Define this symbol to build code that uses ARMv8 SHA-NI intrinsics */ +#cmakedefine ENABLE_ARM_SHANI 1 + +/* Define this symbol to build code that uses AVX2 intrinsics */ +#cmakedefine ENABLE_AVX2 1 + +/* Define if external signer support is enabled */ +#cmakedefine ENABLE_EXTERNAL_SIGNER 1 + +/* Define this symbol to build code that uses SSE4.1 intrinsics */ +#cmakedefine ENABLE_SSE41 1 + +/* Define to 1 to enable tracepoints for Userspace, Statically Defined Tracing + */ +#cmakedefine ENABLE_TRACING 1 + +/* Define to 1 to enable wallet functions. */ +#cmakedefine ENABLE_WALLET 1 + +/* Define this symbol to build code that uses x86 SHA-NI intrinsics */ +#cmakedefine ENABLE_X86_SHANI 1 + +/* Define to 1 if you have the declaration of `fork', and to 0 if you don't. + */ +#cmakedefine01 HAVE_DECL_FORK + +/* Define to 1 if you have the declaration of `freeifaddrs', and to 0 if you + don't. */ +#cmakedefine01 HAVE_DECL_FREEIFADDRS + +/* Define to 1 if you have the declaration of `getifaddrs', and to 0 if you + don't. */ +#cmakedefine01 HAVE_DECL_GETIFADDRS + +/* Define to 1 if you have the declaration of `pipe2', and to 0 if you don't. + */ +#cmakedefine01 HAVE_DECL_PIPE2 + +/* Define to 1 if you have the declaration of `setsid', and to 0 if you don't. + */ +#cmakedefine01 HAVE_DECL_SETSID + +/* Define this symbol if evhttp_connection_get_peer expects const char** */ +#cmakedefine HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR 1 + +/* Define to 1 if fdatasync is available. */ +#cmakedefine HAVE_FDATASYNC 1 + +/* Define this symbol if the BSD getentropy system call is available with + sys/random.h */ +#cmakedefine HAVE_GETENTROPY_RAND 1 + +/* Define this symbol if the Linux getrandom function call is available */ +#cmakedefine HAVE_GETRANDOM 1 + +/* Define this symbol if you have malloc_info */ +#cmakedefine HAVE_MALLOC_INFO 1 + +/* Define this symbol if you have mallopt with M_ARENA_MAX */ +#cmakedefine HAVE_MALLOPT_ARENA_MAX 1 + +/* Define to 1 if O_CLOEXEC flag is available. */ +#cmakedefine01 HAVE_O_CLOEXEC + +/* Define this symbol if you have posix_fallocate */ +#cmakedefine HAVE_POSIX_FALLOCATE 1 + +/* Define this symbol if platform supports unix domain sockets */ +#cmakedefine HAVE_SOCKADDR_UN 1 + +/* Define this symbol to build code that uses getauxval */ +#cmakedefine HAVE_STRONG_GETAUXVAL 1 + +/* Define this symbol if the BSD sysctl() is available */ +#cmakedefine HAVE_SYSCTL 1 + +/* Define this symbol if the BSD sysctl(KERN_ARND) is available */ +#cmakedefine HAVE_SYSCTL_ARND 1 + +/* Define to 1 if std::system or ::wsystem is available. */ +#cmakedefine HAVE_SYSTEM 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_PRCTL_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_RESOURCES_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_VMMETER_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_VM_VM_PARAM_H 1 + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "@PACKAGE_NAME@" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "@PROJECT_HOMEPAGE_URL@" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "@PACKAGE_VERSION@" + +/* Define to 1 if strerror_r returns char *. */ +#cmakedefine STRERROR_R_CHAR_P 1 + +/* Define if BDB support should be compiled in */ +#cmakedefine USE_BDB 1 + +/* Define if dbus support should be compiled in */ +#cmakedefine USE_DBUS 1 + +/* Define if QR support should be compiled in */ +#cmakedefine USE_QRCODE 1 + +/* Define if sqlite support should be compiled in */ +#cmakedefine USE_SQLITE 1 + +#endif //BITCOIN_CONFIG_H diff --git a/cmake/ccache.cmake b/cmake/ccache.cmake new file mode 100644 index 000000000000..099aa66411fb --- /dev/null +++ b/cmake/ccache.cmake @@ -0,0 +1,36 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +if(NOT MSVC) + find_program(CCACHE_EXECUTABLE ccache) + if(CCACHE_EXECUTABLE) + execute_process( + COMMAND readlink -f ${CMAKE_CXX_COMPILER} + OUTPUT_VARIABLE compiler_resolved_link + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(CCACHE_EXECUTABLE STREQUAL compiler_resolved_link AND NOT WITH_CCACHE) + list(APPEND configure_warnings + "Disabling ccache was attempted using -DWITH_CCACHE=${WITH_CCACHE}, but ccache masquerades as the compiler." + ) + set(WITH_CCACHE ON) + elseif(WITH_CCACHE) + list(APPEND CMAKE_C_COMPILER_LAUNCHER ${CCACHE_EXECUTABLE}) + list(APPEND CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_EXECUTABLE}) + endif() + else() + set(WITH_CCACHE OFF) + endif() + if(WITH_CCACHE) + try_append_cxx_flags("-fdebug-prefix-map=A=B" TARGET core_interface SKIP_LINK + IF_CHECK_PASSED "-fdebug-prefix-map=${PROJECT_SOURCE_DIR}=." + ) + try_append_cxx_flags("-fmacro-prefix-map=A=B" TARGET core_interface SKIP_LINK + IF_CHECK_PASSED "-fmacro-prefix-map=${PROJECT_SOURCE_DIR}=." + ) + endif() +endif() + +mark_as_advanced(CCACHE_EXECUTABLE) diff --git a/cmake/cov_tool_wrapper.sh.in b/cmake/cov_tool_wrapper.sh.in new file mode 100644 index 000000000000..f6b7ff3419ff --- /dev/null +++ b/cmake/cov_tool_wrapper.sh.in @@ -0,0 +1,5 @@ +# Copyright (c) 2024-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +exec @COV_TOOL@ "$@" diff --git a/cmake/crc32c.cmake b/cmake/crc32c.cmake new file mode 100644 index 000000000000..16fde7f95dab --- /dev/null +++ b/cmake/crc32c.cmake @@ -0,0 +1,123 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +# This file is part of the transition from Autotools to CMake. Once CMake +# support has been merged we should switch to using the upstream CMake +# buildsystem. + +include(CheckCXXSourceCompiles) + +# Check for __builtin_prefetch support in the compiler. +check_cxx_source_compiles(" + int main() { + char data = 0; + const char* address = &data; + __builtin_prefetch(address, 0, 0); + return 0; + } + " HAVE_BUILTIN_PREFETCH +) + +# Check for _mm_prefetch support in the compiler. +check_cxx_source_compiles(" + #if defined(_MSC_VER) + #include + #else + #include + #endif + + int main() { + char data = 0; + const char* address = &data; + _mm_prefetch(address, _MM_HINT_NTA); + return 0; + } + " HAVE_MM_PREFETCH +) + +# Check for SSE4.2 support in the compiler. +if(MSVC) + set(SSE42_CXXFLAGS /arch:AVX) +else() + set(SSE42_CXXFLAGS -msse4.2) +endif() +check_cxx_source_compiles_with_flags("${SSE42_CXXFLAGS}" " + #include + #if defined(_MSC_VER) + #include + #elif defined(__GNUC__) && defined(__SSE4_2__) + #include + #endif + + int main() { + uint64_t l = 0; + l = _mm_crc32_u8(l, 0); + l = _mm_crc32_u32(l, 0); + l = _mm_crc32_u64(l, 0); + return l; + } + " HAVE_SSE42 +) + +# Check for ARMv8 w/ CRC and CRYPTO extensions support in the compiler. +set(ARM64_CRC_CXXFLAGS -march=armv8-a+crc+crypto) +check_cxx_source_compiles_with_flags("${ARM64_CRC_CXXFLAGS}" " + #include + #include + + int main() { + #ifdef __aarch64__ + __crc32cb(0, 0); __crc32ch(0, 0); __crc32cw(0, 0); __crc32cd(0, 0); + vmull_p64(0, 0); + #else + #error crc32c library does not support hardware acceleration on 32-bit ARM + #endif + return 0; + } + " HAVE_ARM64_CRC32C +) + +add_library(crc32c_common INTERFACE) +target_compile_definitions(crc32c_common INTERFACE + HAVE_BUILTIN_PREFETCH=$ + HAVE_MM_PREFETCH=$ + HAVE_STRONG_GETAUXVAL=$ + BYTE_ORDER_BIG_ENDIAN=$ + HAVE_SSE42=$ + HAVE_ARM64_CRC32C=$ +) +target_link_libraries(crc32c_common INTERFACE + core_interface +) + +add_library(crc32c STATIC EXCLUDE_FROM_ALL + ${PROJECT_SOURCE_DIR}/src/crc32c/src/crc32c.cc + ${PROJECT_SOURCE_DIR}/src/crc32c/src/crc32c_portable.cc +) +target_include_directories(crc32c + PUBLIC + $ +) +target_link_libraries(crc32c PRIVATE crc32c_common) +set_target_properties(crc32c PROPERTIES EXPORT_COMPILE_COMMANDS OFF) + +if(HAVE_SSE42) + add_library(crc32c_sse42 STATIC EXCLUDE_FROM_ALL + ${PROJECT_SOURCE_DIR}/src/crc32c/src/crc32c_sse42.cc + ) + target_compile_options(crc32c_sse42 PRIVATE ${SSE42_CXXFLAGS}) + target_link_libraries(crc32c_sse42 PRIVATE crc32c_common) + set_target_properties(crc32c_sse42 PROPERTIES EXPORT_COMPILE_COMMANDS OFF) + target_link_libraries(crc32c PRIVATE crc32c_sse42) +endif() + +if(HAVE_ARM64_CRC32C) + add_library(crc32c_arm64 STATIC EXCLUDE_FROM_ALL + ${PROJECT_SOURCE_DIR}/src/crc32c/src/crc32c_arm64.cc + ) + target_compile_options(crc32c_arm64 PRIVATE ${ARM64_CRC_CXXFLAGS}) + target_link_libraries(crc32c_arm64 PRIVATE crc32c_common) + set_target_properties(crc32c_arm64 PROPERTIES EXPORT_COMPILE_COMMANDS OFF) + target_link_libraries(crc32c PRIVATE crc32c_arm64) +endif() diff --git a/cmake/introspection.cmake b/cmake/introspection.cmake new file mode 100644 index 000000000000..5435a109d41c --- /dev/null +++ b/cmake/introspection.cmake @@ -0,0 +1,227 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +include(CheckCXXSourceCompiles) +include(CheckCXXSymbolExists) +include(CheckIncludeFileCXX) + +# The following HAVE_{HEADER}_H variables go to the bitcoin-config.h header. +check_include_file_cxx(sys/prctl.h HAVE_SYS_PRCTL_H) +check_include_file_cxx(sys/resources.h HAVE_SYS_RESOURCES_H) +check_include_file_cxx(sys/vmmeter.h HAVE_SYS_VMMETER_H) +check_include_file_cxx(vm/vm_param.h HAVE_VM_VM_PARAM_H) + +check_cxx_symbol_exists(O_CLOEXEC "fcntl.h" HAVE_O_CLOEXEC) +check_cxx_symbol_exists(fdatasync "unistd.h" HAVE_FDATASYNC) +check_cxx_symbol_exists(fork "unistd.h" HAVE_DECL_FORK) +check_cxx_symbol_exists(pipe2 "unistd.h" HAVE_DECL_PIPE2) +check_cxx_symbol_exists(setsid "unistd.h" HAVE_DECL_SETSID) + +check_include_file_cxx(sys/types.h HAVE_SYS_TYPES_H) +check_include_file_cxx(ifaddrs.h HAVE_IFADDRS_H) +if(HAVE_SYS_TYPES_H AND HAVE_IFADDRS_H) + include(TestAppendRequiredLibraries) + test_append_socket_library(core_interface) +endif() + +include(TestAppendRequiredLibraries) +test_append_atomic_library(core_interface) + +check_cxx_symbol_exists(std::system "cstdlib" HAVE_STD_SYSTEM) +check_cxx_symbol_exists(::_wsystem "stdlib.h" HAVE__WSYSTEM) +if(HAVE_STD_SYSTEM OR HAVE__WSYSTEM) + set(HAVE_SYSTEM 1) +endif() + +check_cxx_source_compiles(" + #include + + int main() + { + char buf[100]; + char* p{strerror_r(0, buf, sizeof buf)}; + (void)p; + } + " STRERROR_R_CHAR_P +) + +# Check for malloc_info (for memory statistics information in getmemoryinfo). +check_cxx_symbol_exists(malloc_info "malloc.h" HAVE_MALLOC_INFO) + +# Check for mallopt(M_ARENA_MAX) (to set glibc arenas). +check_cxx_source_compiles(" + #include + + int main() + { + mallopt(M_ARENA_MAX, 1); + } + " HAVE_MALLOPT_ARENA_MAX +) + +# Check for posix_fallocate(). +check_cxx_source_compiles(" + // same as in src/util/fs_helpers.cpp + #ifdef __linux__ + #ifdef _POSIX_C_SOURCE + #undef _POSIX_C_SOURCE + #endif + #define _POSIX_C_SOURCE 200112L + #endif // __linux__ + #include + + int main() + { + return posix_fallocate(0, 0, 0); + } + " HAVE_POSIX_FALLOCATE +) + +# Check for strong getauxval() support in the system headers. +check_cxx_source_compiles(" + #include + + int main() + { + getauxval(AT_HWCAP); + } + " HAVE_STRONG_GETAUXVAL +) + +# Check for UNIX sockets. +check_cxx_source_compiles(" + #include + #include + + int main() + { + struct sockaddr_un addr; + addr.sun_family = AF_UNIX; + } + " HAVE_SOCKADDR_UN +) + +# Check for different ways of gathering OS randomness: +# - Linux getrandom() +check_cxx_source_compiles(" + #include + + int main() + { + getrandom(nullptr, 32, 0); + } + " HAVE_GETRANDOM +) + +# - BSD getentropy() +check_cxx_source_compiles(" + #include + + int main() + { + getentropy(nullptr, 32); + } + " HAVE_GETENTROPY_RAND +) + + +# - BSD sysctl() +check_cxx_source_compiles(" + #include + #include + + #ifdef __linux__ + #error Don't use sysctl on Linux, it's deprecated even when it works + #endif + + int main() + { + sysctl(nullptr, 2, nullptr, nullptr, nullptr, 0); + } + " HAVE_SYSCTL +) + +# - BSD sysctl(KERN_ARND) +check_cxx_source_compiles(" + #include + #include + + #ifdef __linux__ + #error Don't use sysctl on Linux, it's deprecated even when it works + #endif + + int main() + { + static int name[2] = {CTL_KERN, KERN_ARND}; + sysctl(name, 2, nullptr, nullptr, nullptr, 0); + } + " HAVE_SYSCTL_ARND +) + +if(NOT MSVC) + include(CheckSourceCompilesAndLinks) + + # Check for SSE4.1 intrinsics. + set(SSE41_CXXFLAGS -msse4.1) + check_cxx_source_compiles_with_flags("${SSE41_CXXFLAGS}" " + #include + + int main() + { + __m128i a = _mm_set1_epi32(0); + __m128i b = _mm_set1_epi32(1); + __m128i r = _mm_blend_epi16(a, b, 0xFF); + return _mm_extract_epi32(r, 3); + } + " HAVE_SSE41 + ) + set(ENABLE_SSE41 ${HAVE_SSE41}) + + # Check for AVX2 intrinsics. + set(AVX2_CXXFLAGS -mavx -mavx2) + check_cxx_source_compiles_with_flags("${AVX2_CXXFLAGS}" " + #include + + int main() + { + __m256i l = _mm256_set1_epi32(0); + return _mm256_extract_epi32(l, 7); + } + " HAVE_AVX2 + ) + set(ENABLE_AVX2 ${HAVE_AVX2}) + + # Check for x86 SHA-NI intrinsics. + set(X86_SHANI_CXXFLAGS -msse4 -msha) + check_cxx_source_compiles_with_flags("${X86_SHANI_CXXFLAGS}" " + #include + + int main() + { + __m128i i = _mm_set1_epi32(0); + __m128i j = _mm_set1_epi32(1); + __m128i k = _mm_set1_epi32(2); + return _mm_extract_epi32(_mm_sha256rnds2_epu32(i, j, k), 0); + } + " HAVE_X86_SHANI + ) + set(ENABLE_X86_SHANI ${HAVE_X86_SHANI}) + + # Check for ARMv8 SHA-NI intrinsics. + set(ARM_SHANI_CXXFLAGS -march=armv8-a+crypto) + check_cxx_source_compiles_with_flags("${ARM_SHANI_CXXFLAGS}" " + #include + + int main() + { + uint32x4_t a, b, c; + vsha256h2q_u32(a, b, c); + vsha256hq_u32(a, b, c); + vsha256su0q_u32(a, b); + vsha256su1q_u32(a, b, c); + } + " HAVE_ARM_SHANI + ) + set(ENABLE_ARM_SHANI ${HAVE_ARM_SHANI}) +endif() diff --git a/cmake/leveldb.cmake b/cmake/leveldb.cmake new file mode 100644 index 000000000000..823a5d8e3dae --- /dev/null +++ b/cmake/leveldb.cmake @@ -0,0 +1,105 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +# This file is part of the transition from Autotools to CMake. Once CMake +# support has been merged we should switch to using the upstream CMake +# buildsystem. + +include(CheckCXXSymbolExists) +check_cxx_symbol_exists(F_FULLFSYNC "fcntl.h" HAVE_FULLFSYNC) + +add_library(leveldb STATIC EXCLUDE_FROM_ALL + ${PROJECT_SOURCE_DIR}/src/leveldb/db/builder.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/db/c.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/db/db_impl.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/db/db_iter.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/db/dbformat.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/db/dumpfile.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/db/filename.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/db/log_reader.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/db/log_writer.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/db/memtable.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/db/repair.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/db/table_cache.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/db/version_edit.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/db/version_set.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/db/write_batch.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/table/block.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/table/block_builder.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/table/filter_block.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/table/format.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/table/iterator.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/table/merger.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/table/table.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/table/table_builder.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/table/two_level_iterator.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/util/arena.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/util/bloom.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/util/cache.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/util/coding.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/util/comparator.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/util/crc32c.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/util/env.cc + $<$>:${PROJECT_SOURCE_DIR}/src/leveldb/util/env_posix.cc> + $<$:${PROJECT_SOURCE_DIR}/src/leveldb/util/env_windows.cc> + ${PROJECT_SOURCE_DIR}/src/leveldb/util/filter_policy.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/util/hash.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/util/histogram.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/util/logging.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/util/options.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/util/status.cc + ${PROJECT_SOURCE_DIR}/src/leveldb/helpers/memenv/memenv.cc +) + +target_compile_definitions(leveldb + PRIVATE + HAVE_SNAPPY=0 + HAVE_CRC32C=1 + HAVE_FDATASYNC=$ + HAVE_FULLFSYNC=$ + HAVE_O_CLOEXEC=$ + FALLTHROUGH_INTENDED=[[fallthrough]] + LEVELDB_IS_BIG_ENDIAN=$ + $<$>:LEVELDB_PLATFORM_POSIX> + $<$:LEVELDB_PLATFORM_WINDOWS> + $<$:_UNICODE;UNICODE> +) +if(MINGW) + target_compile_definitions(leveldb + PRIVATE + __USE_MINGW_ANSI_STDIO=1 + ) +endif() + +target_include_directories(leveldb + PRIVATE + $ + PUBLIC + $ +) + +add_library(nowarn_leveldb_interface INTERFACE) +if(MSVC) + target_compile_options(nowarn_leveldb_interface INTERFACE + /wd4722 + ) + target_compile_definitions(nowarn_leveldb_interface INTERFACE + _CRT_NONSTDC_NO_WARNINGS + ) +else() + target_compile_options(nowarn_leveldb_interface INTERFACE + -Wno-conditional-uninitialized + -Wno-suggest-override + ) +endif() + +target_link_libraries(leveldb PRIVATE + core_interface + nowarn_leveldb_interface + crc32c +) + +set_target_properties(leveldb PROPERTIES + EXPORT_COMPILE_COMMANDS OFF +) diff --git a/cmake/minisketch.cmake b/cmake/minisketch.cmake new file mode 100644 index 000000000000..bb93c8046725 --- /dev/null +++ b/cmake/minisketch.cmake @@ -0,0 +1,91 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +# Check for clmul instructions support. +if(MSVC) + set(CLMUL_CXXFLAGS) +else() + set(CLMUL_CXXFLAGS -mpclmul) +endif() +check_cxx_source_compiles_with_flags("${CLMUL_CXXFLAGS}" " + #include + #include + + int main() + { + __m128i a = _mm_cvtsi64_si128((uint64_t)7); + __m128i b = _mm_clmulepi64_si128(a, a, 37); + __m128i c = _mm_srli_epi64(b, 41); + __m128i d = _mm_xor_si128(b, c); + uint64_t e = _mm_cvtsi128_si64(d); + return e == 0; + } + " HAVE_CLMUL +) + +add_library(minisketch_common INTERFACE) +target_compile_definitions(minisketch_common INTERFACE + DISABLE_DEFAULT_FIELDS + ENABLE_FIELD_32 +) +if(MSVC) + target_compile_options(minisketch_common INTERFACE + /wd4060 + /wd4065 + /wd4146 + /wd4244 + /wd4267 + ) +endif() + +if(HAVE_CLMUL) + add_library(minisketch_clmul OBJECT EXCLUDE_FROM_ALL + ${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/clmul_1byte.cpp + ${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/clmul_2bytes.cpp + ${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/clmul_3bytes.cpp + ${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/clmul_4bytes.cpp + ${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/clmul_5bytes.cpp + ${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/clmul_6bytes.cpp + ${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/clmul_7bytes.cpp + ${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/clmul_8bytes.cpp + ) + target_compile_definitions(minisketch_clmul PUBLIC HAVE_CLMUL) + target_compile_options(minisketch_clmul PRIVATE ${CLMUL_CXXFLAGS}) + target_link_libraries(minisketch_clmul + PRIVATE + core_interface + minisketch_common + ) + set_target_properties(minisketch_clmul PROPERTIES + EXPORT_COMPILE_COMMANDS OFF + ) +endif() + +add_library(minisketch STATIC EXCLUDE_FROM_ALL + ${PROJECT_SOURCE_DIR}/src/minisketch/src/minisketch.cpp + ${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/generic_1byte.cpp + ${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/generic_2bytes.cpp + ${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/generic_3bytes.cpp + ${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/generic_4bytes.cpp + ${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/generic_5bytes.cpp + ${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/generic_6bytes.cpp + ${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/generic_7bytes.cpp + ${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/generic_8bytes.cpp +) + +target_include_directories(minisketch + PUBLIC + $ +) + +target_link_libraries(minisketch + PRIVATE + core_interface + minisketch_common + $ +) + +set_target_properties(minisketch PROPERTIES + EXPORT_COMPILE_COMMANDS OFF +) diff --git a/cmake/module/AddBoostIfNeeded.cmake b/cmake/module/AddBoostIfNeeded.cmake new file mode 100644 index 000000000000..89603ecd6155 --- /dev/null +++ b/cmake/module/AddBoostIfNeeded.cmake @@ -0,0 +1,78 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +function(add_boost_if_needed) + #[=[ + TODO: Not all targets, which will be added in the future, require + Boost. Therefore, a proper check will be appropriate here. + + Implementation notes: + Although only Boost headers are used to build Bitcoin Core, + we still leverage a standard CMake's approach to handle + dependencies, i.e., the Boost::headers "library". + A command target_link_libraries(target PRIVATE Boost::headers) + will propagate Boost::headers usage requirements to the target. + For Boost::headers such usage requirements is an include + directory and other added INTERFACE properties. + ]=] + + # We cannot rely on find_package(Boost ...) to work properly without + # Boost_NO_BOOST_CMAKE set until we require a more recent Boost because + # upstream did not ship proper CMake files until 1.82.0. + # Until then, we rely on CMake's FindBoost module. + # See: https://cmake.org/cmake/help/latest/policy/CMP0167.html + if(POLICY CMP0167) + cmake_policy(SET CMP0167 OLD) + endif() + set(Boost_NO_BOOST_CMAKE ON) + find_package(Boost 1.73.0 REQUIRED) + mark_as_advanced(Boost_INCLUDE_DIR) + set_target_properties(Boost::headers PROPERTIES IMPORTED_GLOBAL TRUE) + target_compile_definitions(Boost::headers INTERFACE + # We don't use multi_index serialization. + BOOST_MULTI_INDEX_DISABLE_SERIALIZATION + ) + if(DEFINED VCPKG_TARGET_TRIPLET) + # Workaround for https://github.com/microsoft/vcpkg/issues/36955. + target_compile_definitions(Boost::headers INTERFACE + BOOST_NO_USER_CONFIG + ) + endif() + + # Prevent use of std::unary_function, which was removed in C++17, + # and will generate warnings with newer compilers for Boost + # older than 1.80. + # See: https://github.com/boostorg/config/pull/430. + set(CMAKE_REQUIRED_DEFINITIONS -DBOOST_NO_CXX98_FUNCTION_BASE) + set(CMAKE_REQUIRED_INCLUDES ${Boost_INCLUDE_DIR}) + include(CMakePushCheckState) + cmake_push_check_state() + include(TryAppendCXXFlags) + set(CMAKE_REQUIRED_FLAGS ${working_compiler_werror_flag}) + set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) + check_cxx_source_compiles(" + #include + " NO_DIAGNOSTICS_BOOST_NO_CXX98_FUNCTION_BASE + ) + cmake_pop_check_state() + if(NO_DIAGNOSTICS_BOOST_NO_CXX98_FUNCTION_BASE) + target_compile_definitions(Boost::headers INTERFACE + BOOST_NO_CXX98_FUNCTION_BASE + ) + else() + set(CMAKE_REQUIRED_DEFINITIONS) + endif() + + if(BUILD_TESTS) + # Some package managers, such as vcpkg, vendor Boost.Test separately + # from the rest of the headers, so we have to check for it individually. + list(APPEND CMAKE_REQUIRED_DEFINITIONS -DBOOST_TEST_NO_MAIN) + include(CheckIncludeFileCXX) + check_include_file_cxx(boost/test/included/unit_test.hpp HAVE_BOOST_INCLUDED_UNIT_TEST_H) + if(NOT HAVE_BOOST_INCLUDED_UNIT_TEST_H) + message(FATAL_ERROR "Building test_bitcoin executable requested but boost/test/included/unit_test.hpp header not available.") + endif() + endif() + +endfunction() diff --git a/cmake/module/AddWindowsResources.cmake b/cmake/module/AddWindowsResources.cmake new file mode 100644 index 000000000000..a9b4f51f73d9 --- /dev/null +++ b/cmake/module/AddWindowsResources.cmake @@ -0,0 +1,14 @@ +# Copyright (c) 2024-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +include_guard(GLOBAL) + +macro(add_windows_resources target rc_file) + if(WIN32) + target_sources(${target} PRIVATE ${rc_file}) + set_property(SOURCE ${rc_file} + APPEND PROPERTY COMPILE_DEFINITIONS WINDRES_PREPROC + ) + endif() +endmacro() diff --git a/cmake/module/CheckSourceCompilesAndLinks.cmake b/cmake/module/CheckSourceCompilesAndLinks.cmake new file mode 100644 index 000000000000..88c897d52433 --- /dev/null +++ b/cmake/module/CheckSourceCompilesAndLinks.cmake @@ -0,0 +1,39 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +include_guard(GLOBAL) +include(CheckCXXSourceCompiles) +include(CMakePushCheckState) + +# This avoids running the linker. +set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) + +macro(check_cxx_source_links source) + set(CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE) + check_cxx_source_compiles("${source}" ${ARGN}) + set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) +endmacro() + +macro(check_cxx_source_compiles_with_flags flags source) + cmake_push_check_state(RESET) + set(CMAKE_REQUIRED_FLAGS ${flags}) + list(JOIN CMAKE_REQUIRED_FLAGS " " CMAKE_REQUIRED_FLAGS) + check_cxx_source_compiles("${source}" ${ARGN}) + cmake_pop_check_state() +endmacro() + +macro(check_cxx_source_links_with_flags flags source) + cmake_push_check_state(RESET) + set(CMAKE_REQUIRED_FLAGS ${flags}) + list(JOIN CMAKE_REQUIRED_FLAGS " " CMAKE_REQUIRED_FLAGS) + check_cxx_source_links("${source}" ${ARGN}) + cmake_pop_check_state() +endmacro() + +macro(check_cxx_source_links_with_libs libs source) + cmake_push_check_state(RESET) + set(CMAKE_REQUIRED_LIBRARIES "${libs}") + check_cxx_source_links("${source}" ${ARGN}) + cmake_pop_check_state() +endmacro() diff --git a/cmake/module/FindBerkeleyDB.cmake b/cmake/module/FindBerkeleyDB.cmake new file mode 100644 index 000000000000..03a3cce10c53 --- /dev/null +++ b/cmake/module/FindBerkeleyDB.cmake @@ -0,0 +1,133 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +#[=======================================================================[ +FindBerkeleyDB +-------------- + +Finds the Berkeley DB headers and library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module provides imported target ``BerkeleyDB::BerkeleyDB``, if +Berkeley DB has been found. + +Result Variables +^^^^^^^^^^^^^^^^ + +This module defines the following variables: + +``BerkeleyDB_FOUND`` + "True" if Berkeley DB found. + +``BerkeleyDB_VERSION`` + The MAJOR.MINOR version of Berkeley DB found. + +#]=======================================================================] + +set(_BerkeleyDB_homebrew_prefix) +if(CMAKE_HOST_APPLE) + find_program(HOMEBREW_EXECUTABLE brew) + if(HOMEBREW_EXECUTABLE) + # The Homebrew package manager installs the berkeley-db* packages as + # "keg-only", which means they are not symlinked into the default prefix. + # To find such a package, the find_path() and find_library() commands + # need additional path hints that are computed by Homebrew itself. + execute_process( + COMMAND ${HOMEBREW_EXECUTABLE} --prefix berkeley-db@4 + OUTPUT_VARIABLE _BerkeleyDB_homebrew_prefix + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + endif() +endif() + +find_path(BerkeleyDB_INCLUDE_DIR + NAMES db_cxx.h + HINTS ${_BerkeleyDB_homebrew_prefix}/include + PATH_SUFFIXES 4.8 48 db4.8 4 db4 5.3 db5.3 5 db5 +) +mark_as_advanced(BerkeleyDB_INCLUDE_DIR) +unset(_BerkeleyDB_homebrew_prefix) + +if(NOT BerkeleyDB_LIBRARY) + if(VCPKG_TARGET_TRIPLET) + # The vcpkg package manager installs the berkeleydb package with the same name + # of release and debug libraries. Therefore, the default search paths set by + # vcpkg's toolchain file cannot be used to search libraries as the debug one + # will always be found. + set(CMAKE_FIND_USE_CMAKE_PATH FALSE) + endif() + + get_filename_component(_BerkeleyDB_lib_hint "${BerkeleyDB_INCLUDE_DIR}" DIRECTORY) + + find_library(BerkeleyDB_LIBRARY_RELEASE + NAMES db_cxx-4.8 db4_cxx db48 db_cxx-5.3 db_cxx-5 db_cxx libdb48 + NAMES_PER_DIR + HINTS ${_BerkeleyDB_lib_hint} + PATH_SUFFIXES lib + ) + mark_as_advanced(BerkeleyDB_LIBRARY_RELEASE) + + find_library(BerkeleyDB_LIBRARY_DEBUG + NAMES db_cxx-4.8 db4_cxx db48 db_cxx-5.3 db_cxx-5 db_cxx libdb48 + NAMES_PER_DIR + HINTS ${_BerkeleyDB_lib_hint} + PATH_SUFFIXES debug/lib + ) + mark_as_advanced(BerkeleyDB_LIBRARY_DEBUG) + + unset(_BerkeleyDB_lib_hint) + unset(CMAKE_FIND_USE_CMAKE_PATH) + + include(SelectLibraryConfigurations) + select_library_configurations(BerkeleyDB) + # The select_library_configurations() command sets BerkeleyDB_FOUND, but we + # want the one from the find_package_handle_standard_args() command below. + unset(BerkeleyDB_FOUND) +endif() + +if(BerkeleyDB_INCLUDE_DIR) + file(STRINGS "${BerkeleyDB_INCLUDE_DIR}/db.h" _BerkeleyDB_version_strings REGEX "^#define[\t ]+DB_VERSION_(MAJOR|MINOR|PATCH)[ \t]+[0-9]+.*") + string(REGEX REPLACE ".*#define[\t ]+DB_VERSION_MAJOR[ \t]+([0-9]+).*" "\\1" _BerkeleyDB_version_major "${_BerkeleyDB_version_strings}") + string(REGEX REPLACE ".*#define[\t ]+DB_VERSION_MINOR[ \t]+([0-9]+).*" "\\1" _BerkeleyDB_version_minor "${_BerkeleyDB_version_strings}") + string(REGEX REPLACE ".*#define[\t ]+DB_VERSION_PATCH[ \t]+([0-9]+).*" "\\1" _BerkeleyDB_version_patch "${_BerkeleyDB_version_strings}") + unset(_BerkeleyDB_version_strings) + # The MAJOR.MINOR.PATCH version will be logged in the following find_package_handle_standard_args() command. + set(_BerkeleyDB_full_version ${_BerkeleyDB_version_major}.${_BerkeleyDB_version_minor}.${_BerkeleyDB_version_patch}) + set(BerkeleyDB_VERSION ${_BerkeleyDB_version_major}.${_BerkeleyDB_version_minor}) + unset(_BerkeleyDB_version_major) + unset(_BerkeleyDB_version_minor) + unset(_BerkeleyDB_version_patch) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(BerkeleyDB + REQUIRED_VARS BerkeleyDB_LIBRARY BerkeleyDB_INCLUDE_DIR + VERSION_VAR _BerkeleyDB_full_version +) +unset(_BerkeleyDB_full_version) + +if(BerkeleyDB_FOUND AND NOT TARGET BerkeleyDB::BerkeleyDB) + add_library(BerkeleyDB::BerkeleyDB UNKNOWN IMPORTED) + set_target_properties(BerkeleyDB::BerkeleyDB PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${BerkeleyDB_INCLUDE_DIR}" + ) + if(BerkeleyDB_LIBRARY_RELEASE) + set_property(TARGET BerkeleyDB::BerkeleyDB APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE + ) + set_target_properties(BerkeleyDB::BerkeleyDB PROPERTIES + IMPORTED_LOCATION_RELEASE "${BerkeleyDB_LIBRARY_RELEASE}" + ) + endif() + if(BerkeleyDB_LIBRARY_DEBUG) + set_property(TARGET BerkeleyDB::BerkeleyDB APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(BerkeleyDB::BerkeleyDB PROPERTIES + IMPORTED_LOCATION_DEBUG "${BerkeleyDB_LIBRARY_DEBUG}" + ) + endif() +endif() diff --git a/cmake/module/FindLibevent.cmake b/cmake/module/FindLibevent.cmake new file mode 100644 index 000000000000..901a4f3bd41e --- /dev/null +++ b/cmake/module/FindLibevent.cmake @@ -0,0 +1,80 @@ +# Copyright (c) 2024-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +#[=======================================================================[ +FindLibevent +------------ + +Finds the Libevent headers and libraries. + +This is a wrapper around find_package()/pkg_check_modules() commands that: + - facilitates searching in various build environments + - prints a standard log message + +#]=======================================================================] + +# Check whether evhttp_connection_get_peer expects const char**. +# See https://github.com/libevent/libevent/commit/a18301a2bb160ff7c3ffaf5b7653c39ffe27b385 +function(check_evhttp_connection_get_peer target) + include(CMakePushCheckState) + cmake_push_check_state(RESET) + set(CMAKE_REQUIRED_LIBRARIES ${target}) + include(CheckCXXSourceCompiles) + check_cxx_source_compiles(" + #include + #include + + int main() + { + evhttp_connection* conn = (evhttp_connection*)1; + const char* host; + uint16_t port; + evhttp_connection_get_peer(conn, &host, &port); + } + " HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR + ) + cmake_pop_check_state() + set(HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR ${HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR} PARENT_SCOPE) +endfunction() + + +include(FindPackageHandleStandardArgs) +if(VCPKG_TARGET_TRIPLET) + find_package(Libevent ${Libevent_FIND_VERSION} NO_MODULE QUIET + COMPONENTS extra + ) + find_package_handle_standard_args(Libevent + REQUIRED_VARS Libevent_DIR + VERSION_VAR Libevent_VERSION + ) + check_evhttp_connection_get_peer(libevent::extra) + add_library(libevent::libevent ALIAS libevent::extra) + mark_as_advanced(Libevent_DIR) + mark_as_advanced(_event_h) + mark_as_advanced(_event_lib) +else() + find_package(PkgConfig REQUIRED) + pkg_check_modules(libevent QUIET + IMPORTED_TARGET + libevent>=${Libevent_FIND_VERSION} + ) + set(_libevent_required_vars libevent_LIBRARY_DIRS libevent_FOUND) + if(NOT WIN32) + pkg_check_modules(libevent_pthreads QUIET + IMPORTED_TARGET + libevent_pthreads>=${Libevent_FIND_VERSION} + ) + list(APPEND _libevent_required_vars libevent_pthreads_FOUND) + endif() + find_package_handle_standard_args(Libevent + REQUIRED_VARS ${_libevent_required_vars} + VERSION_VAR libevent_VERSION + ) + unset(_libevent_required_vars) + check_evhttp_connection_get_peer(PkgConfig::libevent) + add_library(libevent::libevent ALIAS PkgConfig::libevent) + if(NOT WIN32) + add_library(libevent::pthreads ALIAS PkgConfig::libevent_pthreads) + endif() +endif() diff --git a/cmake/module/FindMiniUPnPc.cmake b/cmake/module/FindMiniUPnPc.cmake new file mode 100644 index 000000000000..34b94f05f16e --- /dev/null +++ b/cmake/module/FindMiniUPnPc.cmake @@ -0,0 +1,84 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +if(NOT MSVC) + find_package(PkgConfig REQUIRED) + pkg_check_modules(PC_MiniUPnPc QUIET miniupnpc) +endif() + +find_path(MiniUPnPc_INCLUDE_DIR + NAMES miniupnpc/miniupnpc.h + PATHS ${PC_MiniUPnPc_INCLUDE_DIRS} +) + +if(MiniUPnPc_INCLUDE_DIR) + file( + STRINGS "${MiniUPnPc_INCLUDE_DIR}/miniupnpc/miniupnpc.h" version_strings + REGEX "^#define[\t ]+MINIUPNPC_API_VERSION[\t ]+[0-9]+" + ) + string(REGEX REPLACE "^#define[\t ]+MINIUPNPC_API_VERSION[\t ]+([0-9]+)" "\\1" MiniUPnPc_API_VERSION "${version_strings}") + + # The minimum supported miniUPnPc API version is set to 17. This excludes + # versions with known vulnerabilities. + if(MiniUPnPc_API_VERSION GREATER_EQUAL 17) + set(MiniUPnPc_API_VERSION_OK TRUE) + endif() +endif() + +if(MSVC) + cmake_path(GET MiniUPnPc_INCLUDE_DIR PARENT_PATH MiniUPnPc_IMPORTED_PATH) + find_library(MiniUPnPc_LIBRARY_DEBUG + NAMES miniupnpc PATHS ${MiniUPnPc_IMPORTED_PATH}/debug/lib + NO_DEFAULT_PATH + ) + find_library(MiniUPnPc_LIBRARY_RELEASE + NAMES miniupnpc PATHS ${MiniUPnPc_IMPORTED_PATH}/lib + NO_DEFAULT_PATH + ) + set(MiniUPnPc_required MiniUPnPc_IMPORTED_PATH) +else() + find_library(MiniUPnPc_LIBRARY + NAMES miniupnpc + PATHS ${PC_MiniUPnPc_LIBRARY_DIRS} + ) + set(MiniUPnPc_required MiniUPnPc_LIBRARY) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(MiniUPnPc + REQUIRED_VARS ${MiniUPnPc_required} MiniUPnPc_INCLUDE_DIR MiniUPnPc_API_VERSION_OK +) + +if(MiniUPnPc_FOUND AND NOT TARGET MiniUPnPc::MiniUPnPc) + add_library(MiniUPnPc::MiniUPnPc UNKNOWN IMPORTED) + set_target_properties(MiniUPnPc::MiniUPnPc PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${MiniUPnPc_INCLUDE_DIR}" + ) + if(MSVC) + if(MiniUPnPc_LIBRARY_DEBUG) + set_property(TARGET MiniUPnPc::MiniUPnPc APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(MiniUPnPc::MiniUPnPc PROPERTIES + IMPORTED_LOCATION_DEBUG "${MiniUPnPc_LIBRARY_DEBUG}" + ) + endif() + if(MiniUPnPc_LIBRARY_RELEASE) + set_property(TARGET MiniUPnPc::MiniUPnPc APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(MiniUPnPc::MiniUPnPc PROPERTIES + IMPORTED_LOCATION_RELEASE "${MiniUPnPc_LIBRARY_RELEASE}" + ) + endif() + else() + set_target_properties(MiniUPnPc::MiniUPnPc PROPERTIES + IMPORTED_LOCATION "${MiniUPnPc_LIBRARY}" + ) + endif() + set_property(TARGET MiniUPnPc::MiniUPnPc PROPERTY + INTERFACE_COMPILE_DEFINITIONS USE_UPNP=1 $<$:MINIUPNP_STATICLIB> + ) +endif() + +mark_as_advanced( + MiniUPnPc_INCLUDE_DIR + MiniUPnPc_LIBRARY +) diff --git a/cmake/module/FindNATPMP.cmake b/cmake/module/FindNATPMP.cmake new file mode 100644 index 000000000000..930555232bd8 --- /dev/null +++ b/cmake/module/FindNATPMP.cmake @@ -0,0 +1,32 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +find_path(NATPMP_INCLUDE_DIR + NAMES natpmp.h +) + +find_library(NATPMP_LIBRARY + NAMES natpmp +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(NATPMP + REQUIRED_VARS NATPMP_LIBRARY NATPMP_INCLUDE_DIR +) + +if(NATPMP_FOUND AND NOT TARGET NATPMP::NATPMP) + add_library(NATPMP::NATPMP UNKNOWN IMPORTED) + set_target_properties(NATPMP::NATPMP PROPERTIES + IMPORTED_LOCATION "${NATPMP_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${NATPMP_INCLUDE_DIR}" + ) + set_property(TARGET NATPMP::NATPMP PROPERTY + INTERFACE_COMPILE_DEFINITIONS USE_NATPMP=1 $<$:NATPMP_STATICLIB> + ) +endif() + +mark_as_advanced( + NATPMP_INCLUDE_DIR + NATPMP_LIBRARY +) diff --git a/cmake/module/FindQt5.cmake b/cmake/module/FindQt5.cmake new file mode 100644 index 000000000000..f39ee53d5b5c --- /dev/null +++ b/cmake/module/FindQt5.cmake @@ -0,0 +1,66 @@ +# Copyright (c) 2024-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +#[=======================================================================[ +FindQt5 +------- + +Finds the Qt 5 headers and libraries. + +This is a wrapper around find_package() command that: + - facilitates searching in various build environments + - prints a standard log message + +#]=======================================================================] + +set(_qt_homebrew_prefix) +if(CMAKE_HOST_APPLE) + find_program(HOMEBREW_EXECUTABLE brew) + if(HOMEBREW_EXECUTABLE) + execute_process( + COMMAND ${HOMEBREW_EXECUTABLE} --prefix qt@5 + OUTPUT_VARIABLE _qt_homebrew_prefix + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + endif() +endif() + +# Save CMAKE_FIND_ROOT_PATH_MODE_LIBRARY state. +unset(_qt_find_root_path_mode_library_saved) +if(DEFINED CMAKE_FIND_ROOT_PATH_MODE_LIBRARY) + set(_qt_find_root_path_mode_library_saved ${CMAKE_FIND_ROOT_PATH_MODE_LIBRARY}) +endif() + +# The Qt config files internally use find_library() calls for all +# dependencies to ensure their availability. In turn, the find_library() +# inspects the well-known locations on the file system; therefore, it must +# be able to find platform-specific system libraries, for example: +# /usr/x86_64-w64-mingw32/lib/libm.a or /usr/arm-linux-gnueabihf/lib/libm.a. +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH) + +find_package(Qt5 ${Qt5_FIND_VERSION} + COMPONENTS ${Qt5_FIND_COMPONENTS} + HINTS ${_qt_homebrew_prefix} + PATH_SUFFIXES Qt5 # Required on OpenBSD systems. +) +unset(_qt_homebrew_prefix) + +# Restore CMAKE_FIND_ROOT_PATH_MODE_LIBRARY state. +if(DEFINED _qt_find_root_path_mode_library_saved) + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ${_qt_find_root_path_mode_library_saved}) + unset(_qt_find_root_path_mode_library_saved) +else() + unset(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Qt5 + REQUIRED_VARS Qt5_DIR + VERSION_VAR Qt5_VERSION +) + +foreach(component IN LISTS Qt5_FIND_COMPONENTS ITEMS "") + mark_as_advanced(Qt5${component}_DIR) +endforeach() diff --git a/cmake/module/FindUSDT.cmake b/cmake/module/FindUSDT.cmake new file mode 100644 index 000000000000..0ba9a58fc10a --- /dev/null +++ b/cmake/module/FindUSDT.cmake @@ -0,0 +1,64 @@ +# Copyright (c) 2024-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +#[=======================================================================[ +FindUSDT +-------- + +Finds the Userspace, Statically Defined Tracing header(s). + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module provides imported target ``USDT::headers``, if +USDT has been found. + +Result Variables +^^^^^^^^^^^^^^^^ + +This module defines the following variables: + +``USDT_FOUND`` + "True" if USDT found. + +#]=======================================================================] + +find_path(USDT_INCLUDE_DIR + NAMES sys/sdt.h +) +mark_as_advanced(USDT_INCLUDE_DIR) + +if(USDT_INCLUDE_DIR) + include(CMakePushCheckState) + cmake_push_check_state(RESET) + + include(CheckCXXSourceCompiles) + set(CMAKE_REQUIRED_INCLUDES ${USDT_INCLUDE_DIR}) + check_cxx_source_compiles(" + #include + + int main() + { + DTRACE_PROBE(context, event); + int a, b, c, d, e, f, g; + DTRACE_PROBE7(context, event, a, b, c, d, e, f, g); + } + " HAVE_USDT_H + ) + + cmake_pop_check_state() +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(USDT + REQUIRED_VARS USDT_INCLUDE_DIR HAVE_USDT_H +) + +if(USDT_FOUND AND NOT TARGET USDT::headers) + add_library(USDT::headers INTERFACE IMPORTED) + set_target_properties(USDT::headers PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${USDT_INCLUDE_DIR}" + ) + set(ENABLE_TRACING TRUE) +endif() diff --git a/cmake/module/FlagsSummary.cmake b/cmake/module/FlagsSummary.cmake new file mode 100644 index 000000000000..9a408f715d91 --- /dev/null +++ b/cmake/module/FlagsSummary.cmake @@ -0,0 +1,73 @@ +# Copyright (c) 2024-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +include_guard(GLOBAL) + +function(indent_message header content indent_num) + if(indent_num GREATER 0) + string(REPEAT " " ${indent_num} indentation) + string(REPEAT "." ${indent_num} tail) + string(REGEX REPLACE "${tail}$" "" header "${header}") + endif() + message("${indentation}${header} ${content}") +endfunction() + +# Print tools' flags on best-effort. Include the abstracted +# CMake flags that we touch ourselves. +function(print_flags_per_config config indent_num) + string(TOUPPER "${config}" config_uppercase) + + include(GetTargetInterface) + get_target_interface(definitions "${config}" core_interface COMPILE_DEFINITIONS) + indent_message("Preprocessor defined macros ..........." "${definitions}" ${indent_num}) + + string(STRIP "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${config_uppercase}}" combined_cxx_flags) + string(STRIP "${combined_cxx_flags} ${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION}" combined_cxx_flags) + if(CMAKE_POSITION_INDEPENDENT_CODE) + string(JOIN " " combined_cxx_flags ${combined_cxx_flags} ${CMAKE_CXX_COMPILE_OPTIONS_PIC}) + endif() + get_target_interface(core_cxx_flags "${config}" core_interface COMPILE_OPTIONS) + string(STRIP "${combined_cxx_flags} ${core_cxx_flags}" combined_cxx_flags) + string(STRIP "${combined_cxx_flags} ${APPEND_CPPFLAGS}" combined_cxx_flags) + string(STRIP "${combined_cxx_flags} ${APPEND_CXXFLAGS}" combined_cxx_flags) + indent_message("C++ compiler flags ...................." "${combined_cxx_flags}" ${indent_num}) + + string(STRIP "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${config_uppercase}}" combined_linker_flags) + string(STRIP "${combined_linker_flags} ${CMAKE_EXE_LINKER_FLAGS}" combined_linker_flags) + get_target_interface(common_link_options "${config}" core_interface LINK_OPTIONS) + string(STRIP "${combined_linker_flags} ${common_link_options}" combined_linker_flags) + if(CMAKE_CXX_LINK_PIE_SUPPORTED) + string(JOIN " " combined_linker_flags ${combined_linker_flags} ${CMAKE_CXX_LINK_OPTIONS_PIE}) + endif() + string(STRIP "${combined_linker_flags} ${APPEND_LDFLAGS}" combined_linker_flags) + indent_message("Linker flags .........................." "${combined_linker_flags}" ${indent_num}) +endfunction() + +function(flags_summary) + get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if(is_multi_config) + list(JOIN CMAKE_CONFIGURATION_TYPES ", " configs) + message("Available build configurations ........ ${configs}") + if(CMAKE_GENERATOR MATCHES "Visual Studio") + set(default_config "Debug") + else() + list(GET CMAKE_CONFIGURATION_TYPES 0 default_config) + endif() + message("Default build configuration ........... ${default_config}") + foreach(config IN LISTS CMAKE_CONFIGURATION_TYPES) + message("") + message("'${config}' build configuration:") + print_flags_per_config("${config}" 2) + endforeach() + else() + message("CMAKE_BUILD_TYPE ...................... ${CMAKE_BUILD_TYPE}") + print_flags_per_config("${CMAKE_BUILD_TYPE}" 0) + endif() + message("") + message([=[ +NOTE: The summary above may not exactly match the final applied build flags + if any additional CMAKE_* or environment variables have been modified. + To see the exact flags applied, build with the --verbose option. +]=]) +endfunction() diff --git a/cmake/module/GenerateHeaders.cmake b/cmake/module/GenerateHeaders.cmake new file mode 100644 index 000000000000..35dc54eebb5d --- /dev/null +++ b/cmake/module/GenerateHeaders.cmake @@ -0,0 +1,21 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +function(generate_header_from_json json_source_relpath) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${json_source_relpath}.h + COMMAND ${CMAKE_COMMAND} -DJSON_SOURCE_PATH=${CMAKE_CURRENT_SOURCE_DIR}/${json_source_relpath} -DHEADER_PATH=${CMAKE_CURRENT_BINARY_DIR}/${json_source_relpath}.h -P ${PROJECT_SOURCE_DIR}/cmake/script/GenerateHeaderFromJson.cmake + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${json_source_relpath} ${PROJECT_SOURCE_DIR}/cmake/script/GenerateHeaderFromJson.cmake + VERBATIM + ) +endfunction() + +function(generate_header_from_raw raw_source_relpath) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${raw_source_relpath}.h + COMMAND ${CMAKE_COMMAND} -DRAW_SOURCE_PATH=${CMAKE_CURRENT_SOURCE_DIR}/${raw_source_relpath} -DHEADER_PATH=${CMAKE_CURRENT_BINARY_DIR}/${raw_source_relpath}.h -P ${PROJECT_SOURCE_DIR}/cmake/script/GenerateHeaderFromRaw.cmake + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${raw_source_relpath} ${PROJECT_SOURCE_DIR}/cmake/script/GenerateHeaderFromRaw.cmake + VERBATIM + ) +endfunction() diff --git a/cmake/module/GenerateSetupNsi.cmake b/cmake/module/GenerateSetupNsi.cmake new file mode 100644 index 000000000000..b7ea423611f7 --- /dev/null +++ b/cmake/module/GenerateSetupNsi.cmake @@ -0,0 +1,18 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +function(generate_setup_nsi) + set(abs_top_srcdir ${PROJECT_SOURCE_DIR}) + set(abs_top_builddir ${PROJECT_BINARY_DIR}) + set(PACKAGE_URL ${PROJECT_HOMEPAGE_URL}) + set(PACKAGE_TARNAME "bitcoin") + set(BITCOIN_GUI_NAME "bitcoin-qt") + set(BITCOIN_DAEMON_NAME "bitcoind") + set(BITCOIN_CLI_NAME "bitcoin-cli") + set(BITCOIN_TX_NAME "bitcoin-tx") + set(BITCOIN_WALLET_TOOL_NAME "bitcoin-wallet") + set(BITCOIN_TEST_NAME "test_bitcoin") + set(EXEEXT ${CMAKE_EXECUTABLE_SUFFIX}) + configure_file(${PROJECT_SOURCE_DIR}/share/setup.nsi.in ${PROJECT_BINARY_DIR}/bitcoin-win64-setup.nsi @ONLY) +endfunction() diff --git a/cmake/module/GetTargetInterface.cmake b/cmake/module/GetTargetInterface.cmake new file mode 100644 index 000000000000..1e455d456b41 --- /dev/null +++ b/cmake/module/GetTargetInterface.cmake @@ -0,0 +1,53 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +include_guard(GLOBAL) + +# Evaluates config-specific generator expressions in a list. +# Recognizable patterns are: +# - $<$:[value]> +# - $<$>:[value]> +function(evaluate_generator_expressions list config) + set(input ${${list}}) + set(result) + foreach(token IN LISTS input) + if(token MATCHES "\\$<\\$]+)>:([^>]+)>") + if(CMAKE_MATCH_1 STREQUAL config) + list(APPEND result ${CMAKE_MATCH_2}) + endif() + elseif(token MATCHES "\\$<\\$]+)>>:([^>]+)>") + if(NOT CMAKE_MATCH_1 STREQUAL config) + list(APPEND result ${CMAKE_MATCH_2}) + endif() + else() + list(APPEND result ${token}) + endif() + endforeach() + set(${list} ${result} PARENT_SCOPE) +endfunction() + + +# Gets target's interface properties recursively. +function(get_target_interface var config target property) + get_target_property(result ${target} INTERFACE_${property}) + if(result) + evaluate_generator_expressions(result "${config}") + list(JOIN result " " result) + else() + set(result) + endif() + + get_target_property(dependencies ${target} INTERFACE_LINK_LIBRARIES) + if(dependencies) + evaluate_generator_expressions(dependencies "${config}") + foreach(dependency IN LISTS dependencies) + if(TARGET ${dependency}) + get_target_interface(dep_result "${config}" ${dependency} ${property}) + string(STRIP "${result} ${dep_result}" result) + endif() + endforeach() + endif() + + set(${var} "${result}" PARENT_SCOPE) +endfunction() diff --git a/cmake/module/Maintenance.cmake b/cmake/module/Maintenance.cmake new file mode 100644 index 000000000000..1d3f5f927980 --- /dev/null +++ b/cmake/module/Maintenance.cmake @@ -0,0 +1,151 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +include_guard(GLOBAL) + +function(setup_split_debug_script) + if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") + set(OBJCOPY ${CMAKE_OBJCOPY}) + set(STRIP ${CMAKE_STRIP}) + configure_file( + contrib/devtools/split-debug.sh.in split-debug.sh + FILE_PERMISSIONS OWNER_READ OWNER_EXECUTE + GROUP_READ GROUP_EXECUTE + WORLD_READ + @ONLY + ) + endif() +endfunction() + +function(add_maintenance_targets) + if(NOT PYTHON_COMMAND) + return() + endif() + + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set(exe_format MACHO) + elseif(WIN32) + set(exe_format PE) + else() + set(exe_format ELF) + endif() + + # In CMake, the components of the compiler invocation are separated into distinct variables: + # - CMAKE_CXX_COMPILER: the full path to the compiler binary itself (e.g., /usr/bin/clang++). + # - CMAKE_CXX_COMPILER_ARG1: a string containing initial compiler options (e.g., --target=x86_64-apple-darwin -nostdlibinc). + # By concatenating these variables, we form the complete command line to be passed to a Python script via the CXX environment variable. + string(STRIP "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1}" cxx_compiler_command) + add_custom_target(test-security-check + COMMAND ${CMAKE_COMMAND} -E env CXX=${cxx_compiler_command} CXXFLAGS=${CMAKE_CXX_FLAGS} LDFLAGS=${CMAKE_EXE_LINKER_FLAGS} ${PYTHON_COMMAND} ${PROJECT_SOURCE_DIR}/contrib/devtools/test-security-check.py TestSecurityChecks.test_${exe_format} + COMMAND ${CMAKE_COMMAND} -E env CXX=${cxx_compiler_command} CXXFLAGS=${CMAKE_CXX_FLAGS} LDFLAGS=${CMAKE_EXE_LINKER_FLAGS} ${PYTHON_COMMAND} ${PROJECT_SOURCE_DIR}/contrib/devtools/test-symbol-check.py TestSymbolChecks.test_${exe_format} + VERBATIM + ) + + foreach(target IN ITEMS bitcoind bitcoin-qt bitcoin-cli bitcoin-tx bitcoin-util bitcoin-wallet test_bitcoin bench_bitcoin) + if(TARGET ${target}) + list(APPEND executables $) + endif() + endforeach() + + add_custom_target(check-symbols + COMMAND ${CMAKE_COMMAND} -E echo "Running symbol and dynamic library checks..." + COMMAND ${PYTHON_COMMAND} ${PROJECT_SOURCE_DIR}/contrib/devtools/symbol-check.py ${executables} + VERBATIM + ) + + if(ENABLE_HARDENING) + add_custom_target(check-security + COMMAND ${CMAKE_COMMAND} -E echo "Checking binary security..." + COMMAND ${PYTHON_COMMAND} ${PROJECT_SOURCE_DIR}/contrib/devtools/security-check.py ${executables} + VERBATIM + ) + else() + add_custom_target(check-security) + endif() +endfunction() + +function(add_windows_deploy_target) + if(MINGW AND TARGET bitcoin-qt AND TARGET bitcoind AND TARGET bitcoin-cli AND TARGET bitcoin-tx AND TARGET bitcoin-wallet AND TARGET bitcoin-util AND TARGET test_bitcoin) + # TODO: Consider replacing this code with the CPack NSIS Generator. + # See https://cmake.org/cmake/help/latest/cpack_gen/nsis.html + include(GenerateSetupNsi) + generate_setup_nsi() + add_custom_command( + OUTPUT ${PROJECT_BINARY_DIR}/bitcoin-win64-setup.exe + COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/release + COMMAND ${CMAKE_STRIP} $ -o ${PROJECT_BINARY_DIR}/release/$ + COMMAND ${CMAKE_STRIP} $ -o ${PROJECT_BINARY_DIR}/release/$ + COMMAND ${CMAKE_STRIP} $ -o ${PROJECT_BINARY_DIR}/release/$ + COMMAND ${CMAKE_STRIP} $ -o ${PROJECT_BINARY_DIR}/release/$ + COMMAND ${CMAKE_STRIP} $ -o ${PROJECT_BINARY_DIR}/release/$ + COMMAND ${CMAKE_STRIP} $ -o ${PROJECT_BINARY_DIR}/release/$ + COMMAND ${CMAKE_STRIP} $ -o ${PROJECT_BINARY_DIR}/release/$ + COMMAND makensis -V2 ${PROJECT_BINARY_DIR}/bitcoin-win64-setup.nsi + VERBATIM + ) + add_custom_target(deploy DEPENDS ${PROJECT_BINARY_DIR}/bitcoin-win64-setup.exe) + endif() +endfunction() + +function(add_macos_deploy_target) + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND TARGET bitcoin-qt) + set(macos_app "Dash-Qt.app") + # Populate Contents subdirectory. + configure_file(${PROJECT_SOURCE_DIR}/share/qt/Info.plist.in ${macos_app}/Contents/Info.plist) + file(CONFIGURE OUTPUT ${macos_app}/Contents/PkgInfo CONTENT "APPL????") + # Populate Contents/Resources subdirectory. + file(CONFIGURE OUTPUT ${macos_app}/Contents/Resources/empty.lproj CONTENT "") + configure_file(${PROJECT_SOURCE_DIR}/src/qt/res/icons/dash.icns ${macos_app}/Contents/Resources/dash.icns COPYONLY) + file(CONFIGURE OUTPUT ${macos_app}/Contents/Resources/Base.lproj/InfoPlist.strings + CONTENT "{ CFBundleDisplayName = \"@PACKAGE_NAME@\"; CFBundleName = \"@PACKAGE_NAME@\"; }" + ) + + add_custom_command( + OUTPUT ${PROJECT_BINARY_DIR}/${macos_app}/Contents/MacOS/Dash-Qt + COMMAND ${CMAKE_COMMAND} --install ${PROJECT_BINARY_DIR} --config $ --component GUI --prefix ${macos_app}/Contents/MacOS --strip + COMMAND ${CMAKE_COMMAND} -E rename ${macos_app}/Contents/MacOS/bin/$ ${macos_app}/Contents/MacOS/Dash-Qt + COMMAND ${CMAKE_COMMAND} -E rm -rf ${macos_app}/Contents/MacOS/bin + VERBATIM + ) + + string(REPLACE " " "-" osx_volname ${PACKAGE_NAME}) + if(CMAKE_HOST_APPLE) + add_custom_command( + OUTPUT ${PROJECT_BINARY_DIR}/${osx_volname}.zip + COMMAND ${PYTHON_COMMAND} ${PROJECT_SOURCE_DIR}/contrib/macdeploy/macdeployqtplus ${macos_app} ${osx_volname} -translations-dir=${QT_TRANSLATIONS_DIR} -zip + DEPENDS ${PROJECT_BINARY_DIR}/${macos_app}/Contents/MacOS/Dash-Qt + VERBATIM + ) + add_custom_target(deploydir + DEPENDS ${PROJECT_BINARY_DIR}/${osx_volname}.zip + ) + add_custom_target(deploy + DEPENDS ${PROJECT_BINARY_DIR}/${osx_volname}.zip + ) + else() + add_custom_command( + OUTPUT ${PROJECT_BINARY_DIR}/dist/${macos_app}/Contents/MacOS/Dash-Qt + COMMAND OBJDUMP=${CMAKE_OBJDUMP} ${PYTHON_COMMAND} ${PROJECT_SOURCE_DIR}/contrib/macdeploy/macdeployqtplus ${macos_app} ${osx_volname} -translations-dir=${QT_TRANSLATIONS_DIR} + DEPENDS ${PROJECT_BINARY_DIR}/${macos_app}/Contents/MacOS/Dash-Qt + VERBATIM + ) + add_custom_target(deploydir + DEPENDS ${PROJECT_BINARY_DIR}/dist/${macos_app}/Contents/MacOS/Dash-Qt + ) + + find_program(ZIP_COMMAND zip REQUIRED) + add_custom_command( + OUTPUT ${PROJECT_BINARY_DIR}/dist/${osx_volname}.zip + WORKING_DIRECTORY dist + COMMAND ${PROJECT_SOURCE_DIR}/cmake/script/macos_zip.sh ${ZIP_COMMAND} ${osx_volname}.zip + VERBATIM + ) + add_custom_target(deploy + DEPENDS ${PROJECT_BINARY_DIR}/dist/${osx_volname}.zip + ) + endif() + add_dependencies(deploydir bitcoin-qt) + add_dependencies(deploy deploydir) + endif() +endfunction() diff --git a/cmake/module/ProcessConfigurations.cmake b/cmake/module/ProcessConfigurations.cmake new file mode 100644 index 000000000000..5286d10267be --- /dev/null +++ b/cmake/module/ProcessConfigurations.cmake @@ -0,0 +1,175 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +include_guard(GLOBAL) + +include(TryAppendCXXFlags) + +macro(normalize_string string) + string(REGEX REPLACE " +" " " ${string} "${${string}}") + string(STRIP "${${string}}" ${string}) +endmacro() + +function(are_flags_overridden flags_var result_var) + normalize_string(${flags_var}) + normalize_string(${flags_var}_INIT) + if(${flags_var} STREQUAL ${flags_var}_INIT) + set(${result_var} FALSE PARENT_SCOPE) + else() + set(${result_var} TRUE PARENT_SCOPE) + endif() +endfunction() + + +# Removes duplicated flags. The relative order of flags is preserved. +# If duplicates are encountered, only the last instance is preserved. +function(deduplicate_flags flags) + separate_arguments(${flags}) + list(REVERSE ${flags}) + list(REMOVE_DUPLICATES ${flags}) + list(REVERSE ${flags}) + list(JOIN ${flags} " " result) + set(${flags} "${result}" PARENT_SCOPE) +endfunction() + + +function(get_all_configs output) + get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if(is_multi_config) + set(all_configs ${CMAKE_CONFIGURATION_TYPES}) + else() + get_property(all_configs CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS) + if(NOT all_configs) + # See https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#default-and-custom-configurations + set(all_configs Debug Release RelWithDebInfo MinSizeRel) + endif() + endif() + set(${output} "${all_configs}" PARENT_SCOPE) +endfunction() + + +#[=[ +Set the default build configuration. + +See: https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#build-configurations. + +On single-configuration generators, this function sets the CMAKE_BUILD_TYPE variable to +the default build configuration, which can be overridden by the user at configure time if needed. + +On multi-configuration generators, this function rearranges the CMAKE_CONFIGURATION_TYPES list, +ensuring that the default build configuration appears first while maintaining the order of the +remaining configurations. The user can choose a build configuration at build time. +]=] +function(set_default_config config) + get_all_configs(all_configs) + if(NOT ${config} IN_LIST all_configs) + message(FATAL_ERROR "The default config is \"${config}\", but must be one of ${all_configs}.") + endif() + + list(REMOVE_ITEM all_configs ${config}) + list(PREPEND all_configs ${config}) + + get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if(is_multi_config) + get_property(help_string CACHE CMAKE_CONFIGURATION_TYPES PROPERTY HELPSTRING) + set(CMAKE_CONFIGURATION_TYPES "${all_configs}" CACHE STRING "${help_string}" FORCE) + # Also see https://gitlab.kitware.com/cmake/cmake/-/issues/19512. + set(CMAKE_TRY_COMPILE_CONFIGURATION "${config}" PARENT_SCOPE) + else() + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY + STRINGS "${all_configs}" + ) + if(NOT CMAKE_BUILD_TYPE) + message(STATUS "Setting build type to \"${config}\" as none was specified") + get_property(help_string CACHE CMAKE_BUILD_TYPE PROPERTY HELPSTRING) + set(CMAKE_BUILD_TYPE "${config}" CACHE STRING "${help_string}" FORCE) + endif() + set(CMAKE_TRY_COMPILE_CONFIGURATION "${CMAKE_BUILD_TYPE}" PARENT_SCOPE) + endif() +endfunction() + +function(remove_cxx_flag_from_all_configs flag) + get_all_configs(all_configs) + foreach(config IN LISTS all_configs) + string(TOUPPER "${config}" config_uppercase) + set(flags "${CMAKE_CXX_FLAGS_${config_uppercase}}") + separate_arguments(flags) + list(FILTER flags EXCLUDE REGEX "${flag}") + list(JOIN flags " " new_flags) + set(CMAKE_CXX_FLAGS_${config_uppercase} "${new_flags}" PARENT_SCOPE) + set(CMAKE_CXX_FLAGS_${config_uppercase} "${new_flags}" + CACHE STRING + "Flags used by the CXX compiler during ${config_uppercase} builds." + FORCE + ) + endforeach() +endfunction() + +function(replace_cxx_flag_in_config config old_flag new_flag) + string(TOUPPER "${config}" config_uppercase) + string(REGEX REPLACE "(^| )${old_flag}( |$)" "\\1${new_flag}\\2" new_flags "${CMAKE_CXX_FLAGS_${config_uppercase}}") + set(CMAKE_CXX_FLAGS_${config_uppercase} "${new_flags}" PARENT_SCOPE) + set(CMAKE_CXX_FLAGS_${config_uppercase} "${new_flags}" + CACHE STRING + "Flags used by the CXX compiler during ${config_uppercase} builds." + FORCE + ) +endfunction() + +set_default_config(RelWithDebInfo) + +# Redefine/adjust per-configuration flags. +target_compile_definitions(core_interface_debug INTERFACE + DEBUG + DEBUG_LOCKORDER + DEBUG_LOCKCONTENTION + RPC_DOC_CHECK + ABORT_ON_FAILED_ASSUME +) +# We leave assertions on. +if(MSVC) + remove_cxx_flag_from_all_configs(/DNDEBUG) +else() + remove_cxx_flag_from_all_configs(-DNDEBUG) + + # Adjust flags used by the CXX compiler during RELEASE builds. + # Prefer -O2 optimization level. (-O3 is CMake's default for Release for many compilers.) + replace_cxx_flag_in_config(Release -O3 -O2) + + are_flags_overridden(CMAKE_CXX_FLAGS_DEBUG cxx_flags_debug_overridden) + if(NOT cxx_flags_debug_overridden) + # Redefine flags used by the CXX compiler during DEBUG builds. + try_append_cxx_flags("-g3" RESULT_VAR compiler_supports_g3) + if(compiler_supports_g3) + replace_cxx_flag_in_config(Debug -g -g3) + endif() + unset(compiler_supports_g3) + + try_append_cxx_flags("-ftrapv" RESULT_VAR compiler_supports_ftrapv) + if(compiler_supports_ftrapv) + string(PREPEND CMAKE_CXX_FLAGS_DEBUG "-ftrapv ") + endif() + unset(compiler_supports_ftrapv) + + string(PREPEND CMAKE_CXX_FLAGS_DEBUG "-O0 ") + + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}" + CACHE STRING + "Flags used by the CXX compiler during DEBUG builds." + FORCE + ) + endif() + unset(cxx_flags_debug_overridden) +endif() + +set(CMAKE_CXX_FLAGS_COVERAGE "-Og --coverage") +set(CMAKE_OBJCXX_FLAGS_COVERAGE "-Og --coverage") +set(CMAKE_EXE_LINKER_FLAGS_COVERAGE "--coverage") +set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE "--coverage") +get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(is_multi_config) + if(NOT "Coverage" IN_LIST CMAKE_CONFIGURATION_TYPES) + list(APPEND CMAKE_CONFIGURATION_TYPES Coverage) + endif() +endif() diff --git a/cmake/module/TestAppendRequiredLibraries.cmake b/cmake/module/TestAppendRequiredLibraries.cmake new file mode 100644 index 000000000000..5352102c7a48 --- /dev/null +++ b/cmake/module/TestAppendRequiredLibraries.cmake @@ -0,0 +1,92 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +include_guard(GLOBAL) + +# Illumos/SmartOS requires linking with -lsocket if +# using getifaddrs & freeifaddrs. +# See: +# - https://github.com/bitcoin/bitcoin/pull/21486 +# - https://smartos.org/man/3socket/getifaddrs +function(test_append_socket_library target) + if (NOT TARGET ${target}) + message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION}() called with non-existent target \"${target}\".") + endif() + + set(check_socket_source " + #include + #include + + int main() { + struct ifaddrs* ifaddr; + getifaddrs(&ifaddr); + freeifaddrs(ifaddr); + } + ") + + include(CheckSourceCompilesAndLinks) + check_cxx_source_links("${check_socket_source}" IFADDR_LINKS_WITHOUT_LIBSOCKET) + if(NOT IFADDR_LINKS_WITHOUT_LIBSOCKET) + check_cxx_source_links_with_libs(socket "${check_socket_source}" IFADDR_NEEDS_LINK_TO_LIBSOCKET) + if(IFADDR_NEEDS_LINK_TO_LIBSOCKET) + target_link_libraries(${target} INTERFACE socket) + else() + message(FATAL_ERROR "Cannot figure out how to use getifaddrs/freeifaddrs.") + endif() + endif() + set(HAVE_DECL_GETIFADDRS TRUE PARENT_SCOPE) + set(HAVE_DECL_FREEIFADDRS TRUE PARENT_SCOPE) +endfunction() + +# Clang, when building for 32-bit, +# and linking against libstdc++, requires linking with +# -latomic if using the C++ atomic library. +# Can be tested with: clang++ -std=c++20 test.cpp -m32 +# +# Sourced from http://bugs.debian.org/797228 +function(test_append_atomic_library target) + if (NOT TARGET ${target}) + message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION}() called with non-existent target \"${target}\".") + endif() + + set(check_atomic_source " + #include + #include + #include + + using namespace std::chrono_literals; + + int main() { + std::atomic lock{true}; + lock.exchange(false); + + std::atomic t{0s}; + t.store(2s); + auto t1 = t.load(); + t.compare_exchange_strong(t1, 3s); + + std::atomic d{}; + d.store(3.14); + auto d1 = d.load(); + + std::atomic a{}; + int64_t v = 5; + int64_t r = a.fetch_add(v); + return static_cast(r); + } + ") + + include(CheckSourceCompilesAndLinks) + check_cxx_source_links("${check_atomic_source}" STD_ATOMIC_LINKS_WITHOUT_LIBATOMIC) + if(STD_ATOMIC_LINKS_WITHOUT_LIBATOMIC) + return() + endif() + + check_cxx_source_links_with_libs(atomic "${check_atomic_source}" STD_ATOMIC_NEEDS_LINK_TO_LIBATOMIC) + if(STD_ATOMIC_NEEDS_LINK_TO_LIBATOMIC) + target_link_libraries(${target} INTERFACE atomic) + else() + message(FATAL_ERROR "Cannot figure out how to use std::atomic.") + endif() +endfunction() diff --git a/cmake/module/TryAppendCXXFlags.cmake b/cmake/module/TryAppendCXXFlags.cmake new file mode 100644 index 000000000000..0f6e014d437a --- /dev/null +++ b/cmake/module/TryAppendCXXFlags.cmake @@ -0,0 +1,138 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +include_guard(GLOBAL) +include(CheckCXXSourceCompiles) + +#[=[ +Add language-wide flags, which will be passed to all invocations of the compiler. +This includes invocations that drive compiling and those that drive linking. + +Usage examples: + + try_append_cxx_flags("-Wformat -Wformat-security" VAR warn_cxx_flags) + + + try_append_cxx_flags("-Wsuggest-override" VAR warn_cxx_flags + SOURCE "struct A { virtual void f(); }; struct B : A { void f() final; };" + ) + + + try_append_cxx_flags("-fsanitize=${SANITIZERS}" TARGET core_interface + RESULT_VAR cxx_supports_sanitizers + ) + if(NOT cxx_supports_sanitizers) + message(FATAL_ERROR "Compiler did not accept requested flags.") + endif() + + + try_append_cxx_flags("-Wunused-parameter" TARGET core_interface + IF_CHECK_PASSED "-Wno-unused-parameter" + ) + + + try_append_cxx_flags("-Werror=return-type" TARGET core_interface + IF_CHECK_FAILED "-Wno-error=return-type" + SOURCE "#include \nint f(){ assert(false); }" + ) + + +In configuration output, this function prints a string by the following pattern: + + -- Performing Test CXX_SUPPORTS_[flags] + -- Performing Test CXX_SUPPORTS_[flags] - Success + +]=] +function(try_append_cxx_flags flags) + cmake_parse_arguments(PARSE_ARGV 1 + TACXXF # prefix + "SKIP_LINK" # options + "TARGET;VAR;SOURCE;RESULT_VAR" # one_value_keywords + "IF_CHECK_PASSED;IF_CHECK_FAILED" # multi_value_keywords + ) + + set(flags_as_string "${flags}") + separate_arguments(flags) + + string(MAKE_C_IDENTIFIER "${flags_as_string}" id_string) + string(TOUPPER "${id_string}" id_string) + + set(source "int main() { return 0; }") + if(DEFINED TACXXF_SOURCE AND NOT TACXXF_SOURCE STREQUAL source) + set(source "${TACXXF_SOURCE}") + string(SHA256 source_hash "${source}") + string(SUBSTRING ${source_hash} 0 4 source_hash_head) + string(APPEND id_string _${source_hash_head}) + endif() + + # This avoids running a linker. + set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) + set(CMAKE_REQUIRED_FLAGS "${flags_as_string} ${working_compiler_werror_flag}") + set(compiler_result CXX_SUPPORTS_${id_string}) + check_cxx_source_compiles("${source}" ${compiler_result}) + + if(${compiler_result}) + if(DEFINED TACXXF_IF_CHECK_PASSED) + if(DEFINED TACXXF_TARGET) + target_compile_options(${TACXXF_TARGET} INTERFACE ${TACXXF_IF_CHECK_PASSED}) + endif() + if(DEFINED TACXXF_VAR) + string(STRIP "${${TACXXF_VAR}} ${TACXXF_IF_CHECK_PASSED}" ${TACXXF_VAR}) + endif() + else() + if(DEFINED TACXXF_TARGET) + target_compile_options(${TACXXF_TARGET} INTERFACE ${flags}) + endif() + if(DEFINED TACXXF_VAR) + string(STRIP "${${TACXXF_VAR}} ${flags_as_string}" ${TACXXF_VAR}) + endif() + endif() + elseif(DEFINED TACXXF_IF_CHECK_FAILED) + if(DEFINED TACXXF_TARGET) + target_compile_options(${TACXXF_TARGET} INTERFACE ${TACXXF_IF_CHECK_FAILED}) + endif() + if(DEFINED TACXXF_VAR) + string(STRIP "${${TACXXF_VAR}} ${TACXXF_IF_CHECK_FAILED}" ${TACXXF_VAR}) + endif() + endif() + + if(DEFINED TACXXF_VAR) + set(${TACXXF_VAR} "${${TACXXF_VAR}}" PARENT_SCOPE) + endif() + + if(DEFINED TACXXF_RESULT_VAR) + set(${TACXXF_RESULT_VAR} "${${compiler_result}}" PARENT_SCOPE) + endif() + + if(NOT ${compiler_result} OR TACXXF_SKIP_LINK) + return() + endif() + + # This forces running a linker. + set(CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE) + set(CMAKE_REQUIRED_FLAGS "${flags_as_string}") + set(CMAKE_REQUIRED_LINK_OPTIONS ${working_linker_werror_flag}) + set(linker_result LINKER_SUPPORTS_${id_string}) + check_cxx_source_compiles("${source}" ${linker_result}) + + if(${linker_result}) + if(DEFINED TACXXF_IF_CHECK_PASSED) + if(DEFINED TACXXF_TARGET) + target_link_options(${TACXXF_TARGET} INTERFACE ${TACXXF_IF_CHECK_PASSED}) + endif() + else() + if(DEFINED TACXXF_TARGET) + target_link_options(${TACXXF_TARGET} INTERFACE ${flags}) + endif() + endif() + else() + message(WARNING "'${flags_as_string}' fail(s) to link.") + endif() +endfunction() + +if(MSVC) + try_append_cxx_flags("/WX /options:strict" VAR working_compiler_werror_flag SKIP_LINK) +else() + try_append_cxx_flags("-Werror" VAR working_compiler_werror_flag SKIP_LINK) +endif() diff --git a/cmake/module/TryAppendLinkerFlag.cmake b/cmake/module/TryAppendLinkerFlag.cmake new file mode 100644 index 000000000000..749120d4458d --- /dev/null +++ b/cmake/module/TryAppendLinkerFlag.cmake @@ -0,0 +1,85 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +include_guard(GLOBAL) +include(CheckCXXSourceCompiles) + +#[=[ +Usage example: + + try_append_linker_flag("-Wl,--major-subsystem-version,6" TARGET core_interface) + + +In configuration output, this function prints a string by the following pattern: + + -- Performing Test LINKER_SUPPORTS_[flag] + -- Performing Test LINKER_SUPPORTS_[flag] - Success + +]=] +function(try_append_linker_flag flag) + cmake_parse_arguments(PARSE_ARGV 1 + TALF # prefix + "" # options + "TARGET;VAR;SOURCE;RESULT_VAR" # one_value_keywords + "IF_CHECK_PASSED;IF_CHECK_FAILED" # multi_value_keywords + ) + + string(MAKE_C_IDENTIFIER "${flag}" result) + string(TOUPPER "${result}" result) + string(PREPEND result LINKER_SUPPORTS_) + + set(source "int main() { return 0; }") + if(DEFINED TALF_SOURCE AND NOT TALF_SOURCE STREQUAL source) + set(source "${TALF_SOURCE}") + string(SHA256 source_hash "${source}") + string(SUBSTRING ${source_hash} 0 4 source_hash_head) + string(APPEND result _${source_hash_head}) + endif() + + # This forces running a linker. + set(CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE) + set(CMAKE_REQUIRED_LINK_OPTIONS ${flag} ${working_linker_werror_flag}) + check_cxx_source_compiles("${source}" ${result}) + + if(${result}) + if(DEFINED TALF_IF_CHECK_PASSED) + if(DEFINED TALF_TARGET) + target_link_options(${TALF_TARGET} INTERFACE ${TALF_IF_CHECK_PASSED}) + endif() + if(DEFINED TALF_VAR) + string(STRIP "${${TALF_VAR}} ${TALF_IF_CHECK_PASSED}" ${TALF_VAR}) + endif() + else() + if(DEFINED TALF_TARGET) + target_link_options(${TALF_TARGET} INTERFACE ${flag}) + endif() + if(DEFINED TALF_VAR) + string(STRIP "${${TALF_VAR}} ${flag}" ${TALF_VAR}) + endif() + endif() + elseif(DEFINED TALF_IF_CHECK_FAILED) + if(DEFINED TALF_TARGET) + target_link_options(${TALF_TARGET} INTERFACE ${TACXXF_IF_CHECK_FAILED}) + endif() + if(DEFINED TALF_VAR) + string(STRIP "${${TALF_VAR}} ${TACXXF_IF_CHECK_FAILED}" ${TALF_VAR}) + endif() + endif() + + if(DEFINED TALF_VAR) + set(${TALF_VAR} "${${TALF_VAR}}" PARENT_SCOPE) + endif() + + if(DEFINED TALF_RESULT_VAR) + set(${TALF_RESULT_VAR} "${${result}}" PARENT_SCOPE) + endif() +endfunction() + +if(MSVC) + try_append_linker_flag("/WX" VAR working_linker_werror_flag) +elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + try_append_linker_flag("-Wl,-fatal_warnings" VAR working_linker_werror_flag) +else() + try_append_linker_flag("-Wl,--fatal-warnings" VAR working_linker_werror_flag) +endif() diff --git a/cmake/module/WarnAboutGlobalProperties.cmake b/cmake/module/WarnAboutGlobalProperties.cmake new file mode 100644 index 000000000000..faa56a2a7f19 --- /dev/null +++ b/cmake/module/WarnAboutGlobalProperties.cmake @@ -0,0 +1,36 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +include_guard(GLOBAL) + +# Avoid the directory-wide add_definitions() and add_compile_definitions() commands. +# Instead, prefer the target-specific target_compile_definitions() one. +get_directory_property(global_compile_definitions COMPILE_DEFINITIONS) +if(global_compile_definitions) + message(AUTHOR_WARNING "The directory's COMPILE_DEFINITIONS property is not empty: ${global_compile_definitions}") +endif() + +# Avoid the directory-wide add_compile_options() command. +# Instead, prefer the target-specific target_compile_options() one. +get_directory_property(global_compile_options COMPILE_OPTIONS) +if(global_compile_options) + message(AUTHOR_WARNING "The directory's COMPILE_OPTIONS property is not empty: ${global_compile_options}") +endif() + +# Avoid the directory-wide add_link_options() command. +# Instead, prefer the target-specific target_link_options() one. +get_directory_property(global_link_options LINK_OPTIONS) +if(global_link_options) + message(AUTHOR_WARNING "The directory's LINK_OPTIONS property is not empty: ${global_link_options}") +endif() + +# Avoid the directory-wide link_libraries() command. +# Instead, prefer the target-specific target_link_libraries() one. +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/dummy_cxx_source.cpp "#error") +add_library(check_loose_linked_libraries OBJECT EXCLUDE_FROM_ALL ${CMAKE_CURRENT_BINARY_DIR}/dummy_cxx_source.cpp) +set_target_properties(check_loose_linked_libraries PROPERTIES EXPORT_COMPILE_COMMANDS OFF) +get_target_property(global_linked_libraries check_loose_linked_libraries LINK_LIBRARIES) +if(global_linked_libraries) + message(AUTHOR_WARNING "There are libraries linked with `link_libraries` commands: ${global_linked_libraries}") +endif() diff --git a/cmake/script/Coverage.cmake b/cmake/script/Coverage.cmake new file mode 100644 index 000000000000..0df2e0b734d8 --- /dev/null +++ b/cmake/script/Coverage.cmake @@ -0,0 +1,77 @@ +# Copyright (c) 2024-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +include(${CMAKE_CURRENT_LIST_DIR}/CoverageInclude.cmake) + +set(functional_test_runner test/functional/test_runner.py) +if(EXTENDED_FUNCTIONAL_TESTS) + list(APPEND functional_test_runner --extended) +endif() +if(DEFINED JOBS) + list(APPEND CMAKE_CTEST_COMMAND -j ${JOBS}) + list(APPEND functional_test_runner -j ${JOBS}) +endif() + +execute_process( + COMMAND ${CMAKE_CTEST_COMMAND} --build-config Coverage + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + COMMAND_ERROR_IS_FATAL ANY +) +execute_process( + COMMAND ${LCOV_COMMAND} --capture --directory src --test-name test_bitcoin --output-file test_bitcoin.info + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} +) +execute_process( + COMMAND ${LCOV_COMMAND} --zerocounters --directory src + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} +) +execute_process( + COMMAND ${LCOV_FILTER_COMMAND} test_bitcoin.info test_bitcoin_filtered.info + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} +) +execute_process( + COMMAND ${LCOV_COMMAND} --add-tracefile test_bitcoin_filtered.info --output-file test_bitcoin_filtered.info + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} +) +execute_process( + COMMAND ${LCOV_COMMAND} --add-tracefile baseline_filtered.info --add-tracefile test_bitcoin_filtered.info --output-file test_bitcoin_coverage.info + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} +) +execute_process( + COMMAND ${GENHTML_COMMAND} test_bitcoin_coverage.info --output-directory test_bitcoin.coverage + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} +) + +execute_process( + COMMAND ${functional_test_runner} + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + COMMAND_ERROR_IS_FATAL ANY +) +execute_process( + COMMAND ${LCOV_COMMAND} --capture --directory src --test-name functional-tests --output-file functional_test.info + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} +) +execute_process( + COMMAND ${LCOV_COMMAND} --zerocounters --directory src + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} +) +execute_process( + COMMAND ${LCOV_FILTER_COMMAND} functional_test.info functional_test_filtered.info + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} +) +execute_process( + COMMAND ${LCOV_COMMAND} --add-tracefile functional_test_filtered.info --output-file functional_test_filtered.info + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} +) +execute_process( + COMMAND ${LCOV_COMMAND} --add-tracefile baseline_filtered.info --add-tracefile test_bitcoin_filtered.info --add-tracefile functional_test_filtered.info --output-file total_coverage.info + COMMAND ${GREP_EXECUTABLE} "%" + COMMAND ${AWK_EXECUTABLE} "{ print substr($3,2,50) \"/\" $5 }" + OUTPUT_FILE coverage_percent.txt + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} +) +execute_process( + COMMAND ${GENHTML_COMMAND} total_coverage.info --output-directory total.coverage + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} +) diff --git a/cmake/script/CoverageFuzz.cmake b/cmake/script/CoverageFuzz.cmake new file mode 100644 index 000000000000..2626ea0cb5de --- /dev/null +++ b/cmake/script/CoverageFuzz.cmake @@ -0,0 +1,42 @@ +# Copyright (c) 2024-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +include(${CMAKE_CURRENT_LIST_DIR}/CoverageInclude.cmake) + +if(NOT DEFINED FUZZ_SEED_CORPUS_DIR) + set(FUZZ_SEED_CORPUS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/qa-assets/fuzz_seed_corpus) +endif() + +execute_process( + COMMAND test/fuzz/test_runner.py ${FUZZ_SEED_CORPUS_DIR} --loglevel DEBUG + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + COMMAND_ERROR_IS_FATAL ANY +) +execute_process( + COMMAND ${LCOV_COMMAND} --capture --directory src --test-name fuzz-tests --output-file fuzz.info + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} +) +execute_process( + COMMAND ${LCOV_COMMAND} --zerocounters --directory src + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} +) +execute_process( + COMMAND ${LCOV_FILTER_COMMAND} fuzz.info fuzz_filtered.info + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} +) +execute_process( + COMMAND ${LCOV_COMMAND} --add-tracefile fuzz_filtered.info --output-file fuzz_filtered.info + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} +) +execute_process( + COMMAND ${LCOV_COMMAND} --add-tracefile baseline_filtered.info --add-tracefile fuzz_filtered.info --output-file fuzz_coverage.info + COMMAND ${GREP_EXECUTABLE} "%" + COMMAND ${AWK_EXECUTABLE} "{ print substr($3,2,50) \"/\" $5 }" + OUTPUT_FILE coverage_percent.txt + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} +) +execute_process( + COMMAND ${GENHTML_COMMAND} fuzz_coverage.info --output-directory fuzz.coverage + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} +) diff --git a/cmake/script/CoverageInclude.cmake.in b/cmake/script/CoverageInclude.cmake.in new file mode 100644 index 000000000000..7a8bf2f0af2d --- /dev/null +++ b/cmake/script/CoverageInclude.cmake.in @@ -0,0 +1,56 @@ +# Copyright (c) 2024-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +if("@CMAKE_CXX_COMPILER_ID@" STREQUAL "Clang") + find_program(LLVM_COV_EXECUTABLE llvm-cov REQUIRED) + set(COV_TOOL "${LLVM_COV_EXECUTABLE} gcov") +else() + find_program(GCOV_EXECUTABLE gcov REQUIRED) + set(COV_TOOL "${GCOV_EXECUTABLE}") +endif() + +# COV_TOOL is used to replace a placeholder. +configure_file( + cmake/cov_tool_wrapper.sh.in ${CMAKE_CURRENT_LIST_DIR}/cov_tool_wrapper.sh + FILE_PERMISSIONS OWNER_READ OWNER_EXECUTE + GROUP_READ GROUP_EXECUTE + WORLD_READ + @ONLY +) + +find_program(LCOV_EXECUTABLE lcov REQUIRED) +separate_arguments(LCOV_OPTS) +set(LCOV_COMMAND ${LCOV_EXECUTABLE} --gcov-tool ${CMAKE_CURRENT_LIST_DIR}/cov_tool_wrapper.sh ${LCOV_OPTS}) + +find_program(GENHTML_EXECUTABLE genhtml REQUIRED) +set(GENHTML_COMMAND ${GENHTML_EXECUTABLE} --show-details ${LCOV_OPTS}) + +find_program(GREP_EXECUTABLE grep REQUIRED) +find_program(AWK_EXECUTABLE awk REQUIRED) + +set(LCOV_FILTER_COMMAND ./filter-lcov.py) +list(APPEND LCOV_FILTER_COMMAND -p "/usr/local/") +list(APPEND LCOV_FILTER_COMMAND -p "/usr/include/") +list(APPEND LCOV_FILTER_COMMAND -p "/usr/lib/") +list(APPEND LCOV_FILTER_COMMAND -p "/usr/lib64/") +list(APPEND LCOV_FILTER_COMMAND -p "src/leveldb/") +list(APPEND LCOV_FILTER_COMMAND -p "src/crc32c/") +list(APPEND LCOV_FILTER_COMMAND -p "src/bench/") +list(APPEND LCOV_FILTER_COMMAND -p "src/crypto/ctaes") +list(APPEND LCOV_FILTER_COMMAND -p "src/minisketch") +list(APPEND LCOV_FILTER_COMMAND -p "src/secp256k1") +list(APPEND LCOV_FILTER_COMMAND -p "depends") + +execute_process( + COMMAND ${LCOV_COMMAND} --capture --initial --directory src --output-file baseline.info + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} +) +execute_process( + COMMAND ${LCOV_FILTER_COMMAND} baseline.info baseline_filtered.info + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} +) +execute_process( + COMMAND ${LCOV_COMMAND} --add-tracefile baseline_filtered.info --output-file baseline_filtered.info + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} +) diff --git a/cmake/script/GenerateBuildInfo.cmake b/cmake/script/GenerateBuildInfo.cmake new file mode 100644 index 000000000000..4a640b9636f2 --- /dev/null +++ b/cmake/script/GenerateBuildInfo.cmake @@ -0,0 +1,115 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +# This script is a multiplatform port of the share/genbuild.sh shell script. + +macro(fatal_error) + message(FATAL_ERROR "\n" + "Usage:\n" + " cmake -D BUILD_INFO_HEADER_PATH= [-D SOURCE_DIR=] -P ${CMAKE_CURRENT_LIST_FILE}\n" + "All specified paths must be absolute ones.\n" + ) +endmacro() + +if(DEFINED BUILD_INFO_HEADER_PATH AND IS_ABSOLUTE "${BUILD_INFO_HEADER_PATH}") + if(EXISTS "${BUILD_INFO_HEADER_PATH}") + file(STRINGS ${BUILD_INFO_HEADER_PATH} INFO LIMIT_COUNT 1) + endif() +else() + fatal_error() +endif() + +if(DEFINED SOURCE_DIR) + if(IS_ABSOLUTE "${SOURCE_DIR}" AND IS_DIRECTORY "${SOURCE_DIR}") + set(WORKING_DIR ${SOURCE_DIR}) + else() + fatal_error() + endif() +else() + set(WORKING_DIR ${CMAKE_CURRENT_SOURCE_DIR}) +endif() + +set(GIT_TAG) +set(GIT_COMMIT) +if(NOT "$ENV{BITCOIN_GENBUILD_NO_GIT}" STREQUAL "1") + find_package(Git QUIET) + if(Git_FOUND) + execute_process( + COMMAND ${GIT_EXECUTABLE} rev-parse --is-inside-work-tree + WORKING_DIRECTORY ${WORKING_DIR} + OUTPUT_VARIABLE IS_INSIDE_WORK_TREE + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET + ) + if(IS_INSIDE_WORK_TREE) + # Clean 'dirty' status of touched files that haven't been modified. + execute_process( + COMMAND ${GIT_EXECUTABLE} diff + WORKING_DIRECTORY ${WORKING_DIR} + OUTPUT_QUIET + ERROR_QUIET + ) + + execute_process( + COMMAND ${GIT_EXECUTABLE} describe --abbrev=0 + WORKING_DIRECTORY ${WORKING_DIR} + OUTPUT_VARIABLE MOST_RECENT_TAG + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET + ) + + execute_process( + COMMAND ${GIT_EXECUTABLE} rev-list -1 ${MOST_RECENT_TAG} + WORKING_DIRECTORY ${WORKING_DIR} + OUTPUT_VARIABLE MOST_RECENT_TAG_COMMIT + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET + ) + + execute_process( + COMMAND ${GIT_EXECUTABLE} rev-parse HEAD + WORKING_DIRECTORY ${WORKING_DIR} + OUTPUT_VARIABLE HEAD_COMMIT + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET + ) + + execute_process( + COMMAND ${GIT_EXECUTABLE} diff-index --quiet HEAD -- + WORKING_DIRECTORY ${WORKING_DIR} + RESULT_VARIABLE IS_DIRTY + ) + + if(HEAD_COMMIT STREQUAL MOST_RECENT_TAG_COMMIT AND NOT IS_DIRTY) + # If latest commit is tagged and not dirty, then use the tag name. + set(GIT_TAG ${MOST_RECENT_TAG}) + else() + # Otherwise, generate suffix from git, i.e. string like "0e0a5173fae3-dirty". + execute_process( + COMMAND ${GIT_EXECUTABLE} rev-parse --short=12 HEAD + WORKING_DIRECTORY ${WORKING_DIR} + OUTPUT_VARIABLE GIT_COMMIT + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET + ) + if(IS_DIRTY) + string(APPEND GIT_COMMIT "-dirty") + endif() + endif() + endif() + endif() +endif() + +if(GIT_TAG) + set(NEWINFO "#define BUILD_GIT_TAG \"${GIT_TAG}\"") +elseif(GIT_COMMIT) + set(NEWINFO "#define BUILD_GIT_COMMIT \"${GIT_COMMIT}\"") +else() + set(NEWINFO "// No build information available") +endif() + +# Only update the header if necessary. +if(NOT "${INFO}" STREQUAL "${NEWINFO}") + file(WRITE ${BUILD_INFO_HEADER_PATH} "${NEWINFO}\n") +endif() diff --git a/cmake/script/GenerateHeaderFromJson.cmake b/cmake/script/GenerateHeaderFromJson.cmake new file mode 100644 index 000000000000..0c2f2f39cb4b --- /dev/null +++ b/cmake/script/GenerateHeaderFromJson.cmake @@ -0,0 +1,23 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +file(READ ${JSON_SOURCE_PATH} hex_content HEX) +string(REGEX MATCHALL "([A-Za-z0-9][A-Za-z0-9])" bytes "${hex_content}") + +file(WRITE ${HEADER_PATH} "namespace json_tests{\n") +get_filename_component(json_source_basename ${JSON_SOURCE_PATH} NAME_WE) +file(APPEND ${HEADER_PATH} "static const unsigned char ${json_source_basename}[] = {\n") + +set(i 0) +foreach(byte ${bytes}) + math(EXPR i "${i} + 1") + math(EXPR remainder "${i} % 8") + if(remainder EQUAL 0) + file(APPEND ${HEADER_PATH} "0x${byte},\n") + else() + file(APPEND ${HEADER_PATH} "0x${byte}, ") + endif() +endforeach() + +file(APPEND ${HEADER_PATH} "\n};};") diff --git a/cmake/script/GenerateHeaderFromRaw.cmake b/cmake/script/GenerateHeaderFromRaw.cmake new file mode 100644 index 000000000000..18c5b4bef25d --- /dev/null +++ b/cmake/script/GenerateHeaderFromRaw.cmake @@ -0,0 +1,22 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +file(READ ${RAW_SOURCE_PATH} hex_content HEX) +string(REGEX MATCHALL "([A-Za-z0-9][A-Za-z0-9])" bytes "${hex_content}") + +get_filename_component(raw_source_basename ${RAW_SOURCE_PATH} NAME_WE) +file(WRITE ${HEADER_PATH} "static unsigned const char ${raw_source_basename}_raw[] = {\n") + +set(i 0) +foreach(byte ${bytes}) + math(EXPR i "${i} + 1") + math(EXPR remainder "${i} % 8") + if(remainder EQUAL 0) + file(APPEND ${HEADER_PATH} "0x${byte},\n") + else() + file(APPEND ${HEADER_PATH} "0x${byte}, ") + endif() +endforeach() + +file(APPEND ${HEADER_PATH} "\n};") diff --git a/cmake/script/macos_zip.sh b/cmake/script/macos_zip.sh new file mode 100755 index 000000000000..cc51699dc938 --- /dev/null +++ b/cmake/script/macos_zip.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# Copyright (c) 2024-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +export LC_ALL=C + +if [ -n "$SOURCE_DATE_EPOCH" ]; then + find . -exec touch -d "@$SOURCE_DATE_EPOCH" {} + +fi + +find . | sort | "$1" -X@ "$2" diff --git a/cmake/tests.cmake b/cmake/tests.cmake new file mode 100644 index 000000000000..279132980017 --- /dev/null +++ b/cmake/tests.cmake @@ -0,0 +1,15 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +if(TARGET bitcoin-util AND TARGET bitcoin-tx AND PYTHON_COMMAND) + add_test(NAME util_test_runner + COMMAND ${CMAKE_COMMAND} -E env BITCOINUTIL=$ BITCOINTX=$ ${PYTHON_COMMAND} ${PROJECT_BINARY_DIR}/test/util/test_runner.py + ) +endif() + +if(PYTHON_COMMAND) + add_test(NAME util_rpcauth_test + COMMAND ${PYTHON_COMMAND} ${PROJECT_BINARY_DIR}/test/util/rpcauth-test.py + ) +endif() diff --git a/contrib/guix/README.md b/contrib/guix/README.md index 750d674034b8..16e79b1f6684 100644 --- a/contrib/guix/README.md +++ b/contrib/guix/README.md @@ -265,6 +265,7 @@ details. - `guix` build commands as in `guix shell --cores="$JOBS"` - `make` as in `make --jobs="$JOBS"` + - `cmake` as in `cmake --build build -j "$JOBS"` - `xargs` as in `xargs -P"$JOBS"` See [here](#controlling-the-number-of-threads-used-by-guix-build-commands) for diff --git a/depends/Makefile b/depends/Makefile index b6420ffc8b21..fe70c172dd15 100644 --- a/depends/Makefile +++ b/depends/Makefile @@ -204,6 +204,7 @@ meta_depends = Makefile config.guess config.sub funcs.mk builders/default.mk hos include funcs.mk final_build_id_long+=$(shell $(build_SHA256SUM) config.site.in) +final_build_id_long+=$(shell $(build_SHA256SUM) toolchain.cmake.in) final_build_id+=$(shell echo -n "$(final_build_id_long)" | $(build_SHA256SUM) | cut -c-$(HASH_LENGTH)) $(host_prefix)/.stamp_$(final_build_id): $(native_packages) $(packages) rm -rf $(@D) @@ -272,6 +273,52 @@ $(host_prefix)/share/config.site : config.site.in $(host_prefix)/.stamp_$(final_ $< > $@ touch $@ +ifeq ($(host),$(build)) + crosscompiling=FALSE +else + crosscompiling=TRUE +endif + +$(host_prefix)/toolchain.cmake : toolchain.cmake.in $(host_prefix)/.stamp_$(final_build_id) + @mkdir -p $(@D) + sed -e 's|@depends_crosscompiling@|$(crosscompiling)|' \ + -e 's|@host_system_name@|$($(host_os)_cmake_system_name)|' \ + -e 's|@host_system_version@|$($(host_os)_cmake_system_version)|' \ + -e 's|@host_arch@|$(host_arch)|' \ + -e 's|@CC@|$(host_CC)|' \ + -e 's|@CXX@|$(host_CXX)|' \ + -e 's|@OSX_SDK@|$(OSX_SDK)|' \ + -e 's|@AR@|$(host_AR)|' \ + -e 's|@RANLIB@|$(host_RANLIB)|' \ + -e 's|@STRIP@|$(host_STRIP)|' \ + -e 's|@OBJCOPY@|$(host_OBJCOPY)|' \ + -e 's|@OBJDUMP@|$(host_OBJDUMP)|' \ + -e 's|@depends_prefix@|$(host_prefix)|' \ + -e 's|@CFLAGS@|$(strip $(host_CFLAGS))|' \ + -e 's|@CFLAGS_RELEASE@|$(strip $(host_release_CFLAGS))|' \ + -e 's|@CFLAGS_DEBUG@|$(strip $(host_debug_CFLAGS))|' \ + -e 's|@CXXFLAGS@|$(strip $(host_CXXFLAGS))|' \ + -e 's|@CXXFLAGS_RELEASE@|$(strip $(host_release_CXXFLAGS))|' \ + -e 's|@CXXFLAGS_DEBUG@|$(strip $(host_debug_CXXFLAGS))|' \ + -e 's|@CPPFLAGS@|$(strip $(host_CPPFLAGS))|' \ + -e 's|@CPPFLAGS_RELEASE@|$(strip $(host_release_CPPFLAGS))|' \ + -e 's|@CPPFLAGS_DEBUG@|$(strip $(host_debug_CPPFLAGS))|' \ + -e 's|@LDFLAGS@|$(strip $(host_LDFLAGS))|' \ + -e 's|@LDFLAGS_RELEASE@|$(strip $(host_release_LDFLAGS))|' \ + -e 's|@LDFLAGS_DEBUG@|$(strip $(host_debug_LDFLAGS))|' \ + -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)|' \ + $< > $@ + touch $@ define check_or_remove_cached mkdir -p $(BASE_CACHE)/$(host)/$(package) && cd $(BASE_CACHE)/$(host)/$(package); \ @@ -293,6 +340,7 @@ check-sources: @$(foreach package,$(all_packages),$(call check_or_remove_sources,$(package));) $(host_prefix)/share/config.site: check-packages +$(host_prefix)/toolchain.cmake: check-packages check-packages: check-sources @@ -302,7 +350,7 @@ clean-all: clean clean: @rm -rf $(WORK_PATH) $(BASE_CACHE) $(BUILD) *.log -install: check-packages $(host_prefix)/share/config.site +install: check-packages $(host_prefix)/share/config.site $(host_prefix)/toolchain.cmake download-one: check-sources $(all_sources) diff --git a/depends/funcs.mk b/depends/funcs.mk index e8aa530f2c3c..db09a2819110 100644 --- a/depends/funcs.mk +++ b/depends/funcs.mk @@ -172,7 +172,7 @@ $(1)_autoconf += LDFLAGS="$$($(1)_ldflags)" endif # We hardcode the library install path to "lib" to match the PKG_CONFIG_PATH -# setting in depends/config.site.in, which also hardcodes "lib". +# setting in depends/toolchain.cmake.in, which also hardcodes "lib". # Without this setting, CMake by default would use the OS library # directory, which might be "lib64" or something else, not "lib", on multiarch systems. $(1)_cmake=env CC="$$($(1)_cc)" \ diff --git a/depends/hosts/default.mk b/depends/hosts/default.mk index 54c12c818024..b0f907f13db0 100644 --- a/depends/hosts/default.mk +++ b/depends/hosts/default.mk @@ -28,8 +28,8 @@ endef define add_host_flags_func ifeq ($(filter $(origin $1),undefined default),) -$(host_arch)_$(host_os)_$1 = -$(host_arch)_$(host_os)_$(release_type)_$1 = $($1) +$(host_arch)_$(host_os)_$1 = $($1) +$(host_arch)_$(host_os)_$(release_type)_$1 = else $(host_arch)_$(host_os)_$1 += $($(host_os)_$1) $(host_arch)_$(host_os)_$(release_type)_$1 += $($(host_os)_$(release_type)_$1) diff --git a/depends/packages/qt.mk b/depends/packages/qt.mk index b157fef6f562..a6742b9ef9c9 100644 --- a/depends/packages/qt.mk +++ b/depends/packages/qt.mk @@ -266,13 +266,14 @@ define $(package)_build_cmds $(MAKE) endef +# TODO: Investigate whether specific targets can be used here to minimize the amount of files/components installed. define $(package)_stage_cmds - $(MAKE) -C qtbase/src INSTALL_ROOT=$($(package)_staging_dir) $(addsuffix -install_subtargets,$(addprefix sub-,$($(package)_qt_libs))) && \ - $(MAKE) -C qttools/src/linguist INSTALL_ROOT=$($(package)_staging_dir) $(addsuffix -install_subtargets,$(addprefix sub-,$($(package)_linguist_tools))) && \ + $(MAKE) -C qtbase INSTALL_ROOT=$($(package)_staging_dir) install && \ + $(MAKE) -C qttools INSTALL_ROOT=$($(package)_staging_dir) install && \ $(MAKE) -C qttranslations INSTALL_ROOT=$($(package)_staging_dir) install_subtargets endef define $(package)_postprocess_cmds - rm -rf native/mkspecs/ native/lib/ lib/cmake/ && \ + rm -rf doc/ native/lib/ && \ rm -f lib/lib*.la endef diff --git a/depends/patches/qt/qt.pro b/depends/patches/qt/qt.pro index 8f2e900a840f..6d8b7fdb6a2c 100644 --- a/depends/patches/qt/qt.pro +++ b/depends/patches/qt/qt.pro @@ -3,10 +3,6 @@ cache(, super) !QTDIR_build: cache(CONFIG, add, $$list(QTDIR_build)) -prl = no_install_prl -CONFIG += $$prl -cache(CONFIG, add stash, prl) - TEMPLATE = subdirs SUBDIRS = qtbase qttools qttranslations diff --git a/depends/toolchain.cmake.in b/depends/toolchain.cmake.in new file mode 100644 index 000000000000..c733c81edf77 --- /dev/null +++ b/depends/toolchain.cmake.in @@ -0,0 +1,174 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +# This file is expected to be highly volatile and may still change substantially. + +# If CMAKE_SYSTEM_NAME is set within a toolchain file, CMake will also +# set CMAKE_CROSSCOMPILING to TRUE, even if CMAKE_SYSTEM_NAME matches +# CMAKE_HOST_SYSTEM_NAME. To avoid potential misconfiguration of CMake, +# it is best not to touch CMAKE_SYSTEM_NAME unless cross-compiling is +# intended. +if(@depends_crosscompiling@) + set(CMAKE_SYSTEM_NAME @host_system_name@) + set(CMAKE_SYSTEM_VERSION @host_system_version@) + set(CMAKE_SYSTEM_PROCESSOR @host_arch@) +endif() + +if(NOT DEFINED CMAKE_C_FLAGS_INIT) + set(CMAKE_C_FLAGS_INIT "@CFLAGS@") +endif() +if(NOT DEFINED CMAKE_C_FLAGS_RELWITHDEBINFO_INIT) + set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "@CFLAGS_RELEASE@") +endif() +if(NOT DEFINED CMAKE_C_FLAGS_DEBUG_INIT) + set(CMAKE_C_FLAGS_DEBUG_INIT "@CFLAGS_DEBUG@") +endif() + +if(NOT DEFINED CMAKE_C_COMPILER) + set(CMAKE_C_COMPILER @CC@) +endif() + +if(NOT DEFINED CMAKE_CXX_FLAGS_INIT) + set(CMAKE_CXX_FLAGS_INIT "@CXXFLAGS@") + set(CMAKE_OBJCXX_FLAGS_INIT "@CXXFLAGS@") +endif() +if(NOT DEFINED CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT) + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "@CXXFLAGS_RELEASE@") + set(CMAKE_OBJCXX_FLAGS_RELWITHDEBINFO_INIT "@CXXFLAGS_RELEASE@") +endif() +if(NOT DEFINED CMAKE_CXX_FLAGS_DEBUG_INIT) + set(CMAKE_CXX_FLAGS_DEBUG_INIT "@CXXFLAGS_DEBUG@") + set(CMAKE_OBJCXX_FLAGS_DEBUG_INIT "@CXXFLAGS_DEBUG@") +endif() + +if(NOT DEFINED CMAKE_CXX_COMPILER) + set(CMAKE_CXX_COMPILER @CXX@) + set(CMAKE_OBJCXX_COMPILER ${CMAKE_CXX_COMPILER}) +endif() + +# The DEPENDS_COMPILE_DEFINITIONS* variables are to be treated as lists. +set(DEPENDS_COMPILE_DEFINITIONS @CPPFLAGS@) +set(DEPENDS_COMPILE_DEFINITIONS_RELWITHDEBINFO @CPPFLAGS_RELEASE@) +set(DEPENDS_COMPILE_DEFINITIONS_DEBUG @CPPFLAGS_DEBUG@) + +if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_INIT) + set(CMAKE_EXE_LINKER_FLAGS_INIT "@LDFLAGS@") +endif() +if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT) + set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "@LDFLAGS_RELEASE@") +endif() +if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT) + set(CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "@LDFLAGS_DEBUG@") +endif() + +set(CMAKE_AR "@AR@") +set(CMAKE_RANLIB "@RANLIB@") +set(CMAKE_STRIP "@STRIP@") +set(CMAKE_OBJCOPY "@OBJCOPY@") +set(CMAKE_OBJDUMP "@OBJDUMP@") + +# Using our own built dependencies should not be +# affected by a potentially random environment. +set(CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH OFF) + +set(CMAKE_FIND_ROOT_PATH "@depends_prefix@") +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) +set(QT_TRANSLATIONS_DIR "@depends_prefix@/translations") + +if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT CMAKE_HOST_APPLE) + # The find_package(Qt ...) function internally uses find_library() + # calls for all dependencies to ensure their availability. + # In turn, the find_library() inspects the well-known locations + # on the file system; therefore, a hint is required. + set(CMAKE_FRAMEWORK_PATH "@OSX_SDK@/System/Library/Frameworks") +endif() + + +# Customize pkg-config behaviour. +cmake_path(APPEND CMAKE_FIND_ROOT_PATH "lib" "pkgconfig" OUTPUT_VARIABLE pkg_config_path) +set(ENV{PKG_CONFIG_PATH} ${pkg_config_path}) +set(ENV{PKG_CONFIG_LIBDIR} ${pkg_config_path}) +unset(pkg_config_path) +set(PKG_CONFIG_ARGN --static) + + +# Set configuration options for the main build system. +set(qt_packages @qt_packages@) +if("${qt_packages}" STREQUAL "") + set(BUILD_GUI OFF CACHE BOOL "") +else() + set(BUILD_GUI ON CACHE BOOL "") +endif() + +set(qrencode_packages @qrencode_packages@) +if("${qrencode_packages}" STREQUAL "") + set(WITH_QRENCODE OFF CACHE BOOL "") +else() + set(WITH_QRENCODE ON CACHE BOOL "") +endif() + +set(zmq_packages @zmq_packages@) +if("${zmq_packages}" STREQUAL "") + set(WITH_ZMQ OFF CACHE BOOL "") +else() + set(WITH_ZMQ ON CACHE BOOL "") +endif() + +set(wallet_packages @wallet_packages@) +if("${wallet_packages}" STREQUAL "") + set(ENABLE_WALLET OFF CACHE BOOL "") +else() + set(ENABLE_WALLET ON CACHE BOOL "") +endif() + +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() + +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() + +set(upnp_packages @upnp_packages@) +if("${upnp_packages}" STREQUAL "") + set(WITH_MINIUPNPC OFF CACHE BOOL "") +else() + set(WITH_MINIUPNPC ON CACHE BOOL "") +endif() + +set(natpmp_packages @natpmp_packages@) +if("${natpmp_packages}" STREQUAL "") + set(WITH_NATPMP OFF CACHE BOOL "") +else() + set(WITH_NATPMP ON CACHE BOOL "") +endif() + +set(usdt_packages @usdt_packages@) +if("${usdt_packages}" STREQUAL "") + set(WITH_USDT OFF CACHE BOOL "") +else() + set(WITH_USDT ON CACHE BOOL "") +endif() + +if("@no_harden@") + set(ENABLE_HARDENING OFF CACHE BOOL "") +else() + set(ENABLE_HARDENING ON CACHE BOOL "") +endif() + +if("@multiprocess@" STREQUAL "1") + set(WITH_MULTIPROCESS ON CACHE BOOL "") + set(LibmultiprocessNative_DIR "${CMAKE_FIND_ROOT_PATH}/native/lib/cmake/Libmultiprocess" CACHE PATH "") +else() + set(WITH_MULTIPROCESS OFF CACHE BOOL "") +endif() diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt new file mode 100644 index 000000000000..61a7653e4aa5 --- /dev/null +++ b/doc/CMakeLists.txt @@ -0,0 +1,25 @@ +# Copyright (c) 2024-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +find_package(Doxygen COMPONENTS dot) + +if(DOXYGEN_FOUND) + set(doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) + configure_file(Doxyfile.in ${doxyfile}) + + # In CMake 3.27, The FindDoxygen module's doxygen_add_docs() + # command gained a CONFIG_FILE option to specify a custom doxygen + # configuration file. + # TODO: Consider using it. + add_custom_target(docs + COMMAND Doxygen::doxygen ${doxyfile} + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + COMMENT "Generating developer documentation" + VERBATIM USES_TERMINAL + ) +else() + add_custom_target(docs + COMMAND ${CMAKE_COMMAND} -E echo "Error: Doxygen not found" + ) +endif() diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index 6eab2544793c..68f50d3e71aa 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -61,7 +61,7 @@ PROJECT_LOGO = doc/bitcoin_logo_doxygen.png # entered, it will be relative to the location where doxygen was started. If # left blank the current directory will be used. -OUTPUT_DIRECTORY = doc/doxygen +OUTPUT_DIRECTORY = @PROJECT_BINARY_DIR@/doc/doxygen # If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- # directories (in 2 levels) under the output directory of each output format and diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 000000000000..fcf9a4093192 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,522 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +include(GNUInstallDirs) +include(AddWindowsResources) + +configure_file(${PROJECT_SOURCE_DIR}/cmake/bitcoin-config.h.in config/bitcoin-config.h @ONLY) +include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/immer) + +# TODO: After the transition from Autotools to CMake, the obj/ subdirectory +# could be dropped as its only purpose was to separate a generated header +# from source files. +add_custom_target(generate_build_info + BYPRODUCTS ${PROJECT_BINARY_DIR}/src/obj/build.h + COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/src/obj + COMMAND ${CMAKE_COMMAND} -DBUILD_INFO_HEADER_PATH=${PROJECT_BINARY_DIR}/src/obj/build.h -DSOURCE_DIR=${PROJECT_SOURCE_DIR} -P ${PROJECT_SOURCE_DIR}/cmake/script/GenerateBuildInfo.cmake + COMMENT "Generating obj/build.h" + VERBATIM +) +add_library(bitcoin_clientversion OBJECT EXCLUDE_FROM_ALL + clientversion.cpp +) +target_compile_definitions(bitcoin_clientversion + PRIVATE + HAVE_BUILD_INFO +) +target_link_libraries(bitcoin_clientversion + PRIVATE + core_interface +) +add_dependencies(bitcoin_clientversion generate_build_info) + +add_subdirectory(crypto) +add_subdirectory(univalue) +add_subdirectory(util) +if(WITH_MULTIPROCESS) + add_subdirectory(ipc) +endif() + +#============================= +# secp256k1 subtree +#============================= +message("") +message("Configuring secp256k1 subtree...") +set(SECP256K1_DISABLE_SHARED ON CACHE BOOL "" FORCE) +set(SECP256K1_ENABLE_MODULE_ECDH OFF CACHE BOOL "" FORCE) +set(SECP256K1_ENABLE_MODULE_RECOVERY ON CACHE BOOL "" FORCE) +set(SECP256K1_BUILD_BENCHMARK OFF CACHE BOOL "" FORCE) +set(SECP256K1_BUILD_TESTS ${BUILD_TESTS} CACHE BOOL "" FORCE) +set(SECP256K1_BUILD_EXHAUSTIVE_TESTS ${BUILD_TESTS} CACHE BOOL "" FORCE) +set(SECP256K1_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) +include(GetTargetInterface) +# -fsanitize and related flags apply to both C++ and C, +# so we can pass them down to libsecp256k1 as CFLAGS. +get_target_interface(core_sanitizer_cxx_flags "" sanitize_interface COMPILE_OPTIONS) +set(SECP256K1_LATE_CFLAGS ${core_sanitizer_cxx_flags} CACHE STRING "" FORCE) +unset(core_sanitizer_cxx_flags) +# We want to build libsecp256k1 with the most tested RelWithDebInfo configuration. +enable_language(C) +foreach(config IN LISTS CMAKE_BUILD_TYPE CMAKE_CONFIGURATION_TYPES) + if(config STREQUAL "") + continue() + endif() + string(TOUPPER "${config}" config) + set(CMAKE_C_FLAGS_${config} "${CMAKE_C_FLAGS_RELWITHDEBINFO}") +endforeach() +# If the CFLAGS environment variable is defined during building depends +# and configuring this build system, its content might be duplicated. +if(DEFINED ENV{CFLAGS}) + deduplicate_flags(CMAKE_C_FLAGS) +endif() +set(CMAKE_EXPORT_COMPILE_COMMANDS OFF) +add_subdirectory(secp256k1) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +string(APPEND CMAKE_C_COMPILE_OBJECT " ${APPEND_CPPFLAGS} ${APPEND_CFLAGS}") + +set(BUILD_BLS_JS_BINDINGS OFF CACHE STRING "" FORCE) +set(BUILD_BLS_PYTHON_BINDINGS OFF CACHE STRING "" FORCE) +set(BUILD_BLS_TESTS OFF CACHE STRING "" FORCE) +set(BUILD_BLS_BENCHMARKS OFF CACHE STRING "" FORCE) +add_subdirectory(dashbls EXCLUDE_FROM_ALL) + +# Stable, backwards-compatible consensus functionality. +add_library(bitcoin_consensus STATIC EXCLUDE_FROM_ALL + arith_uint256.cpp + bls/bls.cpp + consensus/merkle.cpp + consensus/tx_check.cpp + hash.cpp + primitives/block.cpp + primitives/transaction.cpp + pubkey.cpp + script/bitcoinconsensus.cpp + script/interpreter.cpp + script/script.cpp + script/script_error.cpp + uint256.cpp + util/strencodings.cpp + util/string.cpp +) +set_target_properties(bitcoin_consensus PROPERTIES OUTPUT_NAME dashconsensus) +target_link_libraries(bitcoin_consensus + PRIVATE + core_interface + bitcoin_crypto + Boost::headers + dashbls + secp256k1 +) + +if(WITH_ZMQ) + add_subdirectory(zmq) +endif() + +# Home for common functionality shared by different executables and libraries. +# Similar to `bitcoin_util` library, but higher-level. +add_library(bitcoin_common STATIC EXCLUDE_FROM_ALL + base58.cpp + bech32.cpp + chainparams.cpp + chainparamsbase.cpp + coins.cpp + common/bloom.cpp + common/run_command.cpp + common/url.cpp + compressor.cpp + core_read.cpp + core_write.cpp + deploymentinfo.cpp + evo/core_write.cpp + evo/netinfo.cpp + evo/providertx_util.cpp + external_signer.cpp + governance/common.cpp + governance/core_write.cpp + init/common.cpp + key.cpp + key_io.cpp + llmq/core_write.cpp + merkleblock.cpp + net_permissions.cpp + net_types.cpp + netaddress.cpp + netbase.cpp + outputtype.cpp + policy/feerate.cpp + policy/policy.cpp + protocol.cpp + psbt.cpp + rpc/external_signer.cpp + rpc/rawtransaction_util.cpp + rpc/request.cpp + rpc/util.cpp + saltedhasher.cpp + scheduler.cpp + script/descriptor.cpp + script/miniscript.cpp + script/sign.cpp + script/signingprovider.cpp + script/standard.cpp + warnings.cpp +) +target_link_libraries(bitcoin_common + PRIVATE + core_interface + bitcoin_consensus + bitcoin_util + leveldb + univalue + dashbls + secp256k1 + Boost::headers + $ + $<$:ws2_32> +) + + +set(installable_targets) +if(ENABLE_WALLET) + add_subdirectory(wallet) + + if(BUILD_WALLET_TOOL) + add_executable(bitcoin-wallet + bitcoin-wallet.cpp + init/bitcoin-wallet.cpp + wallet/wallettool.cpp + ) + add_windows_resources(bitcoin-wallet bitcoin-wallet-res.rc) + target_link_libraries(bitcoin-wallet + core_interface + bitcoin_wallet + bitcoin_common + bitcoin_util + univalue + Boost::headers + ) + set_target_properties(bitcoin-wallet PROPERTIES OUTPUT_NAME dash-wallet) + list(APPEND installable_targets bitcoin-wallet) + endif() +endif() + + +# P2P and RPC server functionality used by `bitcoind` and `bitcoin-qt` executables. +add_library(bitcoin_node STATIC EXCLUDE_FROM_ALL + active/context.cpp + active/dkgsession.cpp + active/dkgsessionhandler.cpp + active/masternode.cpp + addrdb.cpp + addrman.cpp + banman.cpp + batchedlogger.cpp + bip324.cpp + blockencodings.cpp + blockfilter.cpp + chainlock/chainlock.cpp + chainlock/clsig.cpp + chainlock/handler.cpp + chainlock/signing.cpp + coinjoin/coinjoin.cpp + coinjoin/server.cpp + coinjoin/walletman.cpp + chain.cpp + consensus/tx_verify.cpp + dbwrapper.cpp + deploymentstatus.cpp + dsnotificationinterface.cpp + evo/assetlocktx.cpp + evo/cbtx.cpp + evo/creditpool.cpp + evo/chainhelper.cpp + evo/deterministicmns.cpp + evo/dmnstate.cpp + evo/evodb.cpp + evo/mnauth.cpp + evo/mnhftx.cpp + evo/providertx.cpp + evo/simplifiedmns.cpp + evo/smldiff.cpp + evo/specialtx.cpp + evo/specialtx_filter.cpp + evo/specialtxman.cpp + flatfile.cpp + governance/governance.cpp + governance/net_governance.cpp + governance/object.cpp + governance/signing.cpp + governance/superblock.cpp + governance/vote.cpp + governance/votedb.cpp + gsl/assert.cpp + httprpc.cpp + httpserver.cpp + i2p.cpp + index/addressindex.cpp + index/addressindex_util.cpp + index/base.cpp + index/blockfilterindex.cpp + index/coinstatsindex.cpp + index/spentindex.cpp + index/timestampindex.cpp + index/txindex.cpp + init.cpp + kernel/coinstats.cpp + instantsend/db.cpp + instantsend/instantsend.cpp + instantsend/lock.cpp + instantsend/net_instantsend.cpp + instantsend/signing.cpp + llmq/blockprocessor.cpp + llmq/commitment.cpp + llmq/context.cpp + llmq/debug.cpp + llmq/dkgsession.cpp + llmq/dkgsessionhandler.cpp + llmq/dkgsessionmgr.cpp + llmq/ehf_signals.cpp + llmq/net_dkg.cpp + llmq/net_quorum.cpp + llmq/net_signing.cpp + llmq/observer.cpp + llmq/options.cpp + llmq/quorums.cpp + llmq/quorumsman.cpp + llmq/signhash.cpp + llmq/signing.cpp + llmq/signing_shares.cpp + llmq/snapshot.cpp + llmq/utils.cpp + mapport.cpp + masternode/meta.cpp + masternode/payments.cpp + masternode/sync.cpp + masternode/utils.cpp + net.cpp + netfulfilledman.cpp + net_processing.cpp + netgroup.cpp + node/blockstorage.cpp + node/caches.cpp + node/chainstate.cpp + node/coin.cpp + node/connection_types.cpp + node/context.cpp + node/eviction.cpp + node/interface_ui.cpp + node/interfaces.cpp + node/miner.cpp + node/minisketchwrapper.cpp + node/psbt.cpp + node/sync_manager.cpp + node/transaction.cpp + node/txreconciliation.cpp + noui.cpp + policy/fees.cpp + policy/packages.cpp + policy/settings.cpp + pow.cpp + rest.cpp + rpc/blockchain.cpp + rpc/coinjoin.cpp + rpc/evo.cpp + rpc/evo_util.cpp + rpc/fees.cpp + rpc/governance.cpp + rpc/masternode.cpp + rpc/mempool.cpp + rpc/mining.cpp + rpc/net.cpp + rpc/node.cpp + rpc/output_script.cpp + rpc/quorums.cpp + rpc/rawtransaction.cpp + rpc/server.cpp + rpc/server_util.cpp + rpc/signmessage.cpp + rpc/txoutproof.cpp + script/sigcache.cpp + shutdown.cpp + spork.cpp + stats/client.cpp + stats/rawsender.cpp + timedata.cpp + torcontrol.cpp + txdb.cpp + txmempool.cpp + txorphanage.cpp + validation.cpp + validationinterface.cpp + versionbits.cpp + $<$:wallet/init.cpp> + $<$>:dummywallet.cpp> +) +target_link_libraries(bitcoin_node + PRIVATE + core_interface + bitcoin_common + bitcoin_util + dashbls + leveldb + minisketch + univalue + Boost::headers + $ + $ + $ + $ + $ + $ +) + + +# Bitcoin Core bitcoind. +if(BUILD_DAEMON) + add_executable(bitcoind + bitcoind.cpp + init/bitcoind.cpp + ) + add_windows_resources(bitcoind bitcoind-res.rc) + target_link_libraries(bitcoind + core_interface + bitcoin_node + $ + ) + set_target_properties(bitcoind PROPERTIES OUTPUT_NAME dashd) + list(APPEND installable_targets bitcoind) +endif() +if(WITH_MULTIPROCESS) + add_executable(bitcoin-node + bitcoind.cpp + init/bitcoin-node.cpp + ) + target_link_libraries(bitcoin-node + core_interface + bitcoin_node + bitcoin_ipc + $ + ) + list(APPEND installable_targets bitcoin-node) +endif() + + +add_library(bitcoin_cli STATIC EXCLUDE_FROM_ALL + compat/stdin.cpp + rpc/client.cpp +) +target_link_libraries(bitcoin_cli + PUBLIC + core_interface + univalue +) + + +# Bitcoin Core RPC client +if(BUILD_CLI) + add_executable(bitcoin-cli bitcoin-cli.cpp) + add_windows_resources(bitcoin-cli bitcoin-cli-res.rc) + target_link_libraries(bitcoin-cli + core_interface + bitcoin_cli + bitcoin_common + bitcoin_util + $ + ) + set_target_properties(bitcoin-cli PROPERTIES OUTPUT_NAME dash-cli) + list(APPEND installable_targets bitcoin-cli) +endif() + + +if(BUILD_TX) + add_executable(bitcoin-tx bitcoin-tx.cpp) + add_windows_resources(bitcoin-tx bitcoin-tx-res.rc) + target_link_libraries(bitcoin-tx + core_interface + bitcoin_common + bitcoin_util + univalue + ) + set_target_properties(bitcoin-tx PROPERTIES OUTPUT_NAME dash-tx) + list(APPEND installable_targets bitcoin-tx) +endif() + + +if(BUILD_UTIL) + add_executable(bitcoin-util bitcoin-util.cpp) + add_windows_resources(bitcoin-util bitcoin-util-res.rc) + target_link_libraries(bitcoin-util + core_interface + bitcoin_common + bitcoin_util + ) + set_target_properties(bitcoin-util PROPERTIES OUTPUT_NAME dash-util) + list(APPEND installable_targets bitcoin-util) +endif() + + +if(BUILD_GUI) + add_subdirectory(qt) +endif() + + +if(BUILD_KERNEL_LIB AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/kernel/bitcoinkernel.cpp) + add_subdirectory(kernel) +endif() + +if(BUILD_UTIL_CHAINSTATE) + add_executable(bitcoin-chainstate + bitcoin-chainstate.cpp + ) + # TODO: The `SKIP_BUILD_RPATH` property setting can be deleted + # in the future after reordering Guix script commands to + # perform binary checks after the installation step. + # Relevant discussions: + # - https://github.com/hebasto/bitcoin/pull/236#issuecomment-2183120953 + # - https://github.com/bitcoin/bitcoin/pull/30312#issuecomment-2191235833 + set_target_properties(bitcoin-chainstate PROPERTIES + SKIP_BUILD_RPATH OFF + ) + target_link_libraries(bitcoin-chainstate + PRIVATE + core_interface + bitcoin_common + bitcoin_node + bitcoin_util + Boost::headers + dashbls + leveldb + univalue + $ + ) + set_target_properties(bitcoin-chainstate PROPERTIES OUTPUT_NAME dash-chainstate) +endif() + + +add_subdirectory(test/util) +if(BUILD_BENCH) + add_subdirectory(bench) +endif() + +if(BUILD_TESTS) + add_subdirectory(test) +endif() + +if(BUILD_FUZZ_BINARY) + add_subdirectory(test/fuzz) +endif() + + +install(TARGETS ${installable_targets} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) +unset(installable_targets) + +if(INSTALL_MAN) + # TODO: these stubs are no longer needed. man pages should be generated at install time. + install(DIRECTORY ../doc/man/ + DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 + FILES_MATCHING PATTERN *.1 + ) +endif() diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index c73b53f062b1..3f4e8d77ad3c 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -450,7 +450,7 @@ BITCOIN_QT_RC = qt/res/dash-qt-res.rc BITCOIN_QT_INCLUDES = -DQT_NO_KEYWORDS -DQT_USE_QSTRINGBUILDER qt_libbitcoinqt_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \ - $(QT_INCLUDES) $(QT_DBUS_INCLUDES) $(QR_CFLAGS) $(BOOST_CPPFLAGS) + $(QT_INCLUDES) $(QT_DBUS_INCLUDES) $(QR_CFLAGS) $(BOOST_CPPFLAGS) $(BDB_CPPFLAGS) qt_libbitcoinqt_a_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS) qt_libbitcoinqt_a_OBJCXXFLAGS = $(AM_OBJCXXFLAGS) $(QT_PIE_FLAGS) diff --git a/src/bench/CMakeLists.txt b/src/bench/CMakeLists.txt new file mode 100644 index 000000000000..fb8154e11671 --- /dev/null +++ b/src/bench/CMakeLists.txt @@ -0,0 +1,81 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +include(GenerateHeaders) +generate_header_from_raw(data/block813851.raw) + +add_executable(bench_bitcoin + bench_bitcoin.cpp + bench.cpp + data.cpp + nanobench.cpp + ${CMAKE_CURRENT_BINARY_DIR}/data/block813851.raw.h +# Benchmarks: + addrman.cpp + base58.cpp + bech32.cpp + bip324_ecdh.cpp + bls.cpp + bls_dkg.cpp + bls_pubkey_agg.cpp + block_assemble.cpp + ccoins_caching.cpp + chacha20.cpp + checkblock.cpp + checkqueue.cpp + crypto_hash.cpp + duplicate_inputs.cpp + ecdsa.cpp + ellswift.cpp + examples.cpp + gcs_filter.cpp + hashpadding.cpp + load_external.cpp + lockedpool.cpp + logging.cpp + mempool_eviction.cpp + mempool_stress.cpp + merkle_root.cpp + peer_eviction.cpp + poly1305.cpp + pool.cpp + pow_hash.cpp + prevector.cpp + rollingbloom.cpp + rpc_blockchain.cpp + rpc_mempool.cpp + strencodings.cpp + string_cast.cpp + util_time.cpp + verify_script.cpp +) +set_target_properties(bench_bitcoin PROPERTIES OUTPUT_NAME bench_dash) + +target_link_libraries(bench_bitcoin + core_interface + test_util + bitcoin_node + Boost::headers + dashbls + leveldb +) + +if(ENABLE_WALLET) + target_sources(bench_bitcoin + PRIVATE + coin_selection.cpp + wallet_balance.cpp + wallet_create.cpp + wallet_loading.cpp + ) + target_link_libraries(bench_bitcoin bitcoin_wallet) +endif() + +add_test(NAME bench_sanity_check_high_priority + COMMAND bench_bitcoin -sanity-check -priority-level=high +) + +install(TARGETS bench_bitcoin + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) diff --git a/src/crypto/CMakeLists.txt b/src/crypto/CMakeLists.txt new file mode 100644 index 000000000000..b0c2762bc53f --- /dev/null +++ b/src/crypto/CMakeLists.txt @@ -0,0 +1,88 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +add_library(bitcoin_crypto STATIC EXCLUDE_FROM_ALL + aes.cpp + chacha20.cpp + chacha20poly1305.cpp + hkdf_sha256_32.cpp + hmac_sha256.cpp + hmac_sha512.cpp + muhash.cpp + pkcs5_pbkdf2_hmac_sha512.cpp + poly1305.cpp + ripemd160.cpp + sha1.cpp + sha256.cpp + sha256_sse4.cpp + sha3.cpp + sha512.cpp + siphash.cpp + x11/aes.cpp + x11/blake.c + x11/bmw.c + x11/cubehash.c + x11/dispatch.cpp + x11/echo.cpp + x11/groestl.c + x11/jh.c + x11/keccak.c + x11/luffa.c + x11/shavite.cpp + x11/simd.c + x11/skein.c + ../support/cleanse.cpp +) + +target_link_libraries(bitcoin_crypto + PRIVATE + core_interface +) + +if(HAVE_SSE41) + add_library(bitcoin_crypto_sse41 STATIC EXCLUDE_FROM_ALL + sha256_sse41.cpp + ) + target_compile_definitions(bitcoin_crypto_sse41 PUBLIC ENABLE_SSE41) + target_compile_options(bitcoin_crypto_sse41 PRIVATE ${SSE41_CXXFLAGS}) + target_link_libraries(bitcoin_crypto_sse41 PRIVATE core_interface) + target_link_libraries(bitcoin_crypto PRIVATE bitcoin_crypto_sse41) +endif() + +if(HAVE_AVX2) + add_library(bitcoin_crypto_avx2 STATIC EXCLUDE_FROM_ALL + sha256_avx2.cpp + ) + target_compile_definitions(bitcoin_crypto_avx2 PUBLIC ENABLE_AVX2) + target_compile_options(bitcoin_crypto_avx2 PRIVATE ${AVX2_CXXFLAGS}) + target_link_libraries(bitcoin_crypto_avx2 PRIVATE core_interface) + target_link_libraries(bitcoin_crypto PRIVATE bitcoin_crypto_avx2) +endif() + +if(HAVE_SSE41 AND HAVE_X86_SHANI) + add_library(bitcoin_crypto_x86_shani STATIC EXCLUDE_FROM_ALL + sha256_x86_shani.cpp + ) + target_compile_definitions(bitcoin_crypto_x86_shani PUBLIC ENABLE_SSE41 ENABLE_X86_SHANI) + target_compile_options(bitcoin_crypto_x86_shani PRIVATE ${X86_SHANI_CXXFLAGS}) + target_link_libraries(bitcoin_crypto_x86_shani PRIVATE core_interface) + target_link_libraries(bitcoin_crypto PRIVATE bitcoin_crypto_x86_shani) +endif() + +if(HAVE_ARM_SHANI) + add_library(bitcoin_crypto_arm_shani STATIC EXCLUDE_FROM_ALL + sha256_arm_shani.cpp + ) + target_compile_definitions(bitcoin_crypto_arm_shani PUBLIC ENABLE_ARM_SHANI) + target_compile_options(bitcoin_crypto_arm_shani PRIVATE ${ARM_SHANI_CXXFLAGS}) + target_link_libraries(bitcoin_crypto_arm_shani PRIVATE core_interface) + target_link_libraries(bitcoin_crypto PRIVATE bitcoin_crypto_arm_shani) +endif() + +add_library(bitcoin_crypto_sph INTERFACE) +target_compile_definitions(bitcoin_crypto_sph INTERFACE + SPH_SMALL_FOOTPRINT_CUBEHASH=1 + SPH_SMALL_FOOTPRINT_JH=1 +) +target_link_libraries(bitcoin_crypto PRIVATE bitcoin_crypto_sph) diff --git a/src/ipc/CMakeLists.txt b/src/ipc/CMakeLists.txt new file mode 100644 index 000000000000..848916a7e81f --- /dev/null +++ b/src/ipc/CMakeLists.txt @@ -0,0 +1,19 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +add_library(bitcoin_ipc STATIC EXCLUDE_FROM_ALL + capnp/protocol.cpp + interfaces.cpp + process.cpp +) + +target_capnp_sources(bitcoin_ipc ${PROJECT_SOURCE_DIR} + capnp/echo.capnp capnp/init.capnp +) + +target_link_libraries(bitcoin_ipc + PRIVATE + core_interface + dashbls +) diff --git a/src/kernel/CMakeLists.txt b/src/kernel/CMakeLists.txt new file mode 100644 index 000000000000..ffb1a857ac17 --- /dev/null +++ b/src/kernel/CMakeLists.txt @@ -0,0 +1,106 @@ +# Copyright (c) 2024-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +# TODO: libbitcoinkernel is a work in progress consensus engine +# library, as more and more modules are decoupled from the +# consensus engine, this list will shrink to only those +# which are absolutely necessary. +add_library(bitcoinkernel + bitcoinkernel.cpp + chain.cpp + checks.cpp + chainparams.cpp + coinstats.cpp + context.cpp + cs_main.cpp + disconnected_transactions.cpp + mempool_removal_reason.cpp + ../arith_uint256.cpp + ../chain.cpp + ../coins.cpp + ../compressor.cpp + ../consensus/merkle.cpp + ../consensus/tx_check.cpp + ../consensus/tx_verify.cpp + ../core_read.cpp + ../dbwrapper.cpp + ../deploymentinfo.cpp + ../deploymentstatus.cpp + ../flatfile.cpp + ../hash.cpp + ../logging.cpp + ../node/blockstorage.cpp + ../node/chainstate.cpp + ../node/utxo_snapshot.cpp + ../policy/feerate.cpp + ../policy/packages.cpp + ../policy/policy.cpp + ../policy/rbf.cpp + ../policy/settings.cpp + ../policy/truc_policy.cpp + ../pow.cpp + ../primitives/block.cpp + ../primitives/transaction.cpp + ../pubkey.cpp + ../random.cpp + ../randomenv.cpp + ../script/interpreter.cpp + ../script/script.cpp + ../script/script_error.cpp + ../script/sigcache.cpp + ../script/solver.cpp + ../signet.cpp + ../streams.cpp + ../support/lockedpool.cpp + ../sync.cpp + ../txdb.cpp + ../txmempool.cpp + ../uint256.cpp + ../util/chaintype.cpp + ../util/check.cpp + ../util/feefrac.cpp + ../util/fs.cpp + ../util/fs_helpers.cpp + ../util/hasher.cpp + ../util/moneystr.cpp + ../util/rbf.cpp + ../util/serfloat.cpp + ../util/signalinterrupt.cpp + ../util/strencodings.cpp + ../util/string.cpp + ../util/syserror.cpp + ../util/threadnames.cpp + ../util/time.cpp + ../util/tokenpipe.cpp + ../validation.cpp + ../validationinterface.cpp + ../versionbits.cpp +) +target_link_libraries(bitcoinkernel + PRIVATE + core_interface + bitcoin_clientversion + bitcoin_crypto + leveldb + secp256k1 + PUBLIC + Boost::headers +) + +# libbitcoinkernel requires default symbol visibility, explicitly +# specify that here so that things still work even when user +# configures with -DREDUCE_EXPORTS=ON +# +# Note this is a quick hack that will be removed as we +# incrementally define what to export from the library. +set_target_properties(bitcoinkernel PROPERTIES + CXX_VISIBILITY_PRESET default +) + +include(GNUInstallDirs) +install(TARGETS bitcoinkernel + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/src/qt/CMakeLists.txt b/src/qt/CMakeLists.txt new file mode 100644 index 000000000000..cf4cd71cdd58 --- /dev/null +++ b/src/qt/CMakeLists.txt @@ -0,0 +1,369 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + enable_language(OBJCXX) + set(CMAKE_OBJCXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") + set(CMAKE_OBJCXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") + set(CMAKE_OBJCXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") + set(CMAKE_OBJCXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}") + string(APPEND CMAKE_OBJCXX_COMPILE_OBJECT " ${APPEND_CPPFLAGS} ${APPEND_CXXFLAGS}") +endif() + +get_target_property(qt_lib_type Qt5::Core TYPE) + +# TODO: After the transition from Autotools to CMake, +# all `Q_IMPORT_PLUGIN` macros can be deleted from the +# qt/bitcoin.cpp and qt/test/test_main.cpp source files. +function(import_plugins target) + if(qt_lib_type STREQUAL "STATIC_LIBRARY") + set(plugins Qt5::QMinimalIntegrationPlugin) + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + list(APPEND plugins Qt5::QXcbIntegrationPlugin) + elseif(WIN32) + list(APPEND plugins Qt5::QWindowsIntegrationPlugin Qt5::QWindowsVistaStylePlugin) + elseif(APPLE) + list(APPEND plugins Qt5::QCocoaIntegrationPlugin Qt5::QMacStylePlugin) + endif() + qt5_import_plugins(${target} + INCLUDE ${plugins} + EXCLUDE_BY_TYPE imageformats iconengines + ) + endif() +endfunction() + +# For Qt-specific commands and variables, please consult: +# - https://cmake.org/cmake/help/latest/manual/cmake-qt.7.html +# - https://doc.qt.io/qt-5/cmake-manual.html + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTOUIC_SEARCH_PATHS forms) + +# TODO: The file(GLOB ...) command should be replaced with an explicit +# file list. Such a change must be synced with the corresponding change +# to https://github.com/bitcoin-core/bitcoin-maintainer-tools/blob/main/update-translations.py +file(GLOB ts_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} locale/*.ts) +set_source_files_properties(${ts_files} PROPERTIES OUTPUT_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/locale) +qt5_add_translation(qm_files ${ts_files}) + +configure_file(dash_locale.qrc dash_locale.qrc COPYONLY) + +# The bitcoinqt sources have to include headers in +# order to parse them to collect translatable strings. +add_library(bitcoinqt STATIC EXCLUDE_FROM_ALL + appearancewidget.cpp + appearancewidget.h + bantablemodel.cpp + bantablemodel.h + bitcoin.cpp + bitcoin.h + bitcoinaddressvalidator.cpp + bitcoinaddressvalidator.h + bitcoinamountfield.cpp + bitcoinamountfield.h + bitcoingui.cpp + bitcoingui.h + bitcoinunits.cpp + bitcoinunits.h + clientfeeds.cpp + clientfeeds.h + clientmodel.cpp + clientmodel.h + csvmodelwriter.cpp + csvmodelwriter.h + donutchart.cpp + donutchart.h + guiutil.cpp + guiutil.h + guiutil_font.cpp + informationwidget.cpp + informationwidget.h + initexecutor.cpp + initexecutor.h + intro.cpp + intro.h + $<$:macdockiconhandler.h> + $<$:macdockiconhandler.mm> + $<$:macnotificationhandler.h> + $<$:macnotificationhandler.mm> + $<$:macos_appnap.h> + $<$:macos_appnap.mm> + modaloverlay.cpp + modaloverlay.h + networkstyle.cpp + networkstyle.h + networkwidget.cpp + networkwidget.h + notificator.cpp + notificator.h + optionsdialog.cpp + optionsdialog.h + optionsmodel.cpp + optionsmodel.h + peertablemodel.cpp + peertablemodel.h + peertablesortproxy.cpp + peertablesortproxy.h + proposalinfo.cpp + proposalinfo.h + proposalmodel.cpp + proposalmodel.h + qvalidatedlineedit.cpp + qvalidatedlineedit.h + qvaluecombobox.cpp + qvaluecombobox.h + rpcconsole.cpp + rpcconsole.h + splashscreen.cpp + splashscreen.h + trafficgraphdata.cpp + trafficgraphdata.h + trafficgraphwidget.cpp + trafficgraphwidget.h + utilitydialog.cpp + utilitydialog.h + $<$:winshutdownmonitor.cpp> + $<$:winshutdownmonitor.h> + dash.qrc + ${CMAKE_CURRENT_BINARY_DIR}/dash_locale.qrc +) +target_compile_definitions(bitcoinqt + PUBLIC + QT_NO_KEYWORDS + QT_USE_QSTRINGBUILDER +) +target_include_directories(bitcoinqt + PUBLIC + $ +) +set_property(SOURCE macnotificationhandler.mm + # Ignore warnings "'NSUserNotificationCenter' is deprecated: first deprecated in macOS 11.0". + APPEND PROPERTY COMPILE_OPTIONS -Wno-deprecated-declarations +) +target_link_libraries(bitcoinqt + PUBLIC + Qt5::Widgets + PRIVATE + core_interface + bitcoin_cli + bitcoin_common + bitcoin_util + dashbls + leveldb + univalue + Boost::headers + $ + $ + $ + $<$:-framework\ AppKit> + $<$:shlwapi> +) + +if(ENABLE_WALLET) + target_sources(bitcoinqt + PRIVATE + addressbookpage.cpp + addressbookpage.h + addresstablemodel.cpp + addresstablemodel.h + askpassphrasedialog.cpp + askpassphrasedialog.h + coincontroldialog.cpp + coincontroldialog.h + coincontroltreewidget.cpp + coincontroltreewidget.h + createwalletdialog.cpp + createwalletdialog.h + descriptiondialog.cpp + descriptiondialog.h + editaddressdialog.cpp + editaddressdialog.h + masternodelist.cpp + masternodelist.h + masternodemodel.cpp + masternodemodel.h + mnemonicverificationdialog.cpp + mnemonicverificationdialog.h + openuridialog.cpp + openuridialog.h + overviewpage.cpp + overviewpage.h + paymentserver.cpp + paymentserver.h + proposalcreate.cpp + proposalcreate.h + proposallist.cpp + proposallist.h + proposalresume.cpp + proposalresume.h + psbtoperationsdialog.cpp + psbtoperationsdialog.h + qrdialog.cpp + qrdialog.h + qrimagewidget.cpp + qrimagewidget.h + receivecoinsdialog.cpp + receivecoinsdialog.h + receiverequestdialog.cpp + receiverequestdialog.h + recentrequeststablemodel.cpp + recentrequeststablemodel.h + sendcoinsdialog.cpp + sendcoinsdialog.h + sendcoinsentry.cpp + sendcoinsentry.h + signverifymessagedialog.cpp + signverifymessagedialog.h + transactiondesc.cpp + transactiondesc.h + transactionfilterproxy.cpp + transactionfilterproxy.h + transactionoverviewwidget.cpp + transactionoverviewwidget.h + transactionrecord.cpp + transactionrecord.h + transactiontablemodel.cpp + transactiontablemodel.h + transactionview.cpp + transactionview.h + walletcontroller.cpp + walletcontroller.h + walletframe.cpp + walletframe.h + walletmodel.cpp + walletmodel.h + walletmodeltransaction.cpp + walletmodeltransaction.h + walletview.cpp + walletview.h + ) + target_link_libraries(bitcoinqt + PRIVATE + bitcoin_wallet + Qt5::Network + ) +endif() + +if(WITH_DBUS) + target_link_libraries(bitcoinqt PRIVATE Qt5::DBus) +endif() + +if(qt_lib_type STREQUAL "STATIC_LIBRARY") + # We want to define static plugins to link ourselves, thus preventing + # automatic linking against a "sane" set of default static plugins. + qt5_import_plugins(bitcoinqt + EXCLUDE_BY_TYPE bearer iconengines imageformats platforms styles + ) +endif() + +add_executable(bitcoin-qt + main.cpp + ../init/bitcoin-qt.cpp +) +set_target_properties(bitcoin-qt PROPERTIES OUTPUT_NAME dash-qt) + +add_windows_resources(bitcoin-qt res/dash-qt-res.rc) + +target_link_libraries(bitcoin-qt + core_interface + bitcoinqt + bitcoin_node +) + +import_plugins(bitcoin-qt) +set(installable_targets bitcoin-qt) +if(WIN32) + set_target_properties(bitcoin-qt PROPERTIES WIN32_EXECUTABLE TRUE) +endif() + +if(WITH_MULTIPROCESS) + add_executable(bitcoin-gui + main.cpp + ../init/bitcoin-gui.cpp + ) + target_link_libraries(bitcoin-gui + core_interface + bitcoinqt + bitcoin_node + bitcoin_ipc + dashbls + ) + import_plugins(bitcoin-gui) + list(APPEND installable_targets bitcoin-gui) + if(WIN32) + set_target_properties(bitcoin-gui PROPERTIES WIN32_EXECUTABLE TRUE) + endif() +endif() + +install(TARGETS ${installable_targets} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + COMPONENT GUI +) + +if(BUILD_GUI_TESTS) + add_subdirectory(test) +endif() + + +# Gets sources to be parsed to gather translatable strings. +function(get_translatable_sources var) + set(result) + set(targets) + foreach(dir IN ITEMS ${ARGN}) + get_directory_property(dir_targets DIRECTORY ${PROJECT_SOURCE_DIR}/${dir} BUILDSYSTEM_TARGETS) + list(APPEND targets ${dir_targets}) + endforeach() + foreach(target IN LISTS targets) + get_target_property(target_sources ${target} SOURCES) + if(target_sources) + foreach(source IN LISTS target_sources) + # Get an expression from the generator expression, if any. + if(source MATCHES ":([^>]+)>$") + set(source ${CMAKE_MATCH_1}) + endif() + cmake_path(GET source EXTENSION LAST_ONLY ext) + if(ext STREQUAL ".qrc") + continue() + endif() + if(NOT IS_ABSOLUTE source) + get_target_property(target_source_dir ${target} SOURCE_DIR) + cmake_path(APPEND target_source_dir ${source} OUTPUT_VARIABLE source) + endif() + list(APPEND result ${source}) + endforeach() + endif() + endforeach() + set(${var} ${result} PARENT_SCOPE) +endfunction() + +find_program(XGETTEXT_EXECUTABLE xgettext) +find_program(SED_EXECUTABLE sed) +if(NOT XGETTEXT_EXECUTABLE) + add_custom_target(translate + COMMAND ${CMAKE_COMMAND} -E echo "Error: GNU gettext-tools not found" + ) +elseif(NOT SED_EXECUTABLE) + add_custom_target(translate + COMMAND ${CMAKE_COMMAND} -E echo "Error: GNU sed not found" + ) +else() + set(translatable_sources_directories src src/qt src/util) + if(ENABLE_WALLET) + list(APPEND translatable_sources_directories src/wallet) + endif() + get_translatable_sources(translatable_sources ${translatable_sources_directories}) + get_translatable_sources(qt_translatable_sources src/qt) + file(GLOB ui_files ${CMAKE_CURRENT_SOURCE_DIR}/forms/*.ui) + add_custom_target(translate + COMMAND ${CMAKE_COMMAND} -E env XGETTEXT=${XGETTEXT_EXECUTABLE} COPYRIGHT_HOLDERS=${COPYRIGHT_HOLDERS} ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/share/qt/extract_strings_qt.py ${translatable_sources} + COMMAND Qt5::lupdate -no-obsolete -I ${PROJECT_SOURCE_DIR}/src -locations relative ${CMAKE_CURRENT_SOURCE_DIR}/dashstrings.cpp ${ui_files} ${qt_translatable_sources} -ts ${CMAKE_CURRENT_SOURCE_DIR}/locale/dash_en.ts + COMMAND Qt5::lconvert -drop-translations -o ${CMAKE_CURRENT_SOURCE_DIR}/locale/dash_en.xlf -i ${CMAKE_CURRENT_SOURCE_DIR}/locale/dash_en.ts + COMMAND ${SED_EXECUTABLE} -i.old -e "s|source-language=\"en\" target-language=\"en\"|source-language=\"en\"|" -e "/<\\/target>/d" ${CMAKE_CURRENT_SOURCE_DIR}/locale/dash_en.xlf + COMMAND ${CMAKE_COMMAND} -E rm ${CMAKE_CURRENT_SOURCE_DIR}/locale/dash_en.xlf.old + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src + VERBATIM + ) +endif() diff --git a/src/qt/test/CMakeLists.txt b/src/qt/test/CMakeLists.txt new file mode 100644 index 000000000000..582ed7146639 --- /dev/null +++ b/src/qt/test/CMakeLists.txt @@ -0,0 +1,56 @@ +# Copyright (c) 2024-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +add_executable(test_bitcoin-qt + apptests.cpp + optiontests.cpp + rpcnestedtests.cpp + test_main.cpp + uritests.cpp + util.cpp + ../../init/bitcoin-qt.cpp +) + +target_link_libraries(test_bitcoin-qt + core_interface + bitcoinqt + test_util + bitcoin_node + Boost::headers + Qt5::Test +) + +import_plugins(test_bitcoin-qt) + +if(ENABLE_WALLET) + target_sources(test_bitcoin-qt + PRIVATE + addressbooktests.cpp + wallettests.cpp + ../../wallet/test/wallet_test_fixture.cpp + ) +endif() + +if(NOT QT_IS_STATIC) + add_custom_command( + TARGET test_bitcoin-qt POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different $>> $/plugins/platforms + VERBATIM + ) +endif() + +add_test(NAME test_bitcoin-qt + COMMAND test_bitcoin-qt +) +if(WIN32 AND VCPKG_TARGET_TRIPLET) + # On Windows, vcpkg configures Qt with `-opengl dynamic`, which makes + # the "minimal" platform plugin unusable due to internal Qt bugs. + set_tests_properties(test_bitcoin-qt PROPERTIES + ENVIRONMENT "QT_QPA_PLATFORM=windows" + ) +endif() + +install(TARGETS test_bitcoin-qt + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt new file mode 100644 index 000000000000..a5d51f903213 --- /dev/null +++ b/src/test/CMakeLists.txt @@ -0,0 +1,251 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +include(GenerateHeaders) +generate_header_from_json(data/base58_encode_decode.json) +generate_header_from_json(data/bip39_vectors.json) +generate_header_from_json(data/blockfilters.json) +generate_header_from_json(data/key_io_invalid.json) +generate_header_from_json(data/key_io_valid.json) +generate_header_from_json(data/proposals_invalid.json) +generate_header_from_json(data/proposals_valid.json) +generate_header_from_json(data/script_tests.json) +generate_header_from_json(data/sighash.json) +generate_header_from_json(data/trivially_invalid.json) +generate_header_from_json(data/trivially_valid.json) +generate_header_from_json(data/tx_invalid.json) +generate_header_from_json(data/tx_valid.json) +generate_header_from_raw(data/asmap.raw) + +# Do not use generator expressions in test sources because the +# SOURCES property is processed to gather test suite macros. +add_executable(test_bitcoin + main.cpp + $ + ${CMAKE_CURRENT_BINARY_DIR}/data/asmap.raw.h + ${CMAKE_CURRENT_BINARY_DIR}/data/base58_encode_decode.json.h + ${CMAKE_CURRENT_BINARY_DIR}/data/bip39_vectors.json.h + ${CMAKE_CURRENT_BINARY_DIR}/data/blockfilters.json.h + ${CMAKE_CURRENT_BINARY_DIR}/data/key_io_invalid.json.h + ${CMAKE_CURRENT_BINARY_DIR}/data/key_io_valid.json.h + ${CMAKE_CURRENT_BINARY_DIR}/data/proposals_invalid.json.h + ${CMAKE_CURRENT_BINARY_DIR}/data/proposals_valid.json.h + ${CMAKE_CURRENT_BINARY_DIR}/data/script_tests.json.h + ${CMAKE_CURRENT_BINARY_DIR}/data/sighash.json.h + ${CMAKE_CURRENT_BINARY_DIR}/data/trivially_invalid.json.h + ${CMAKE_CURRENT_BINARY_DIR}/data/trivially_valid.json.h + ${CMAKE_CURRENT_BINARY_DIR}/data/tx_invalid.json.h + ${CMAKE_CURRENT_BINARY_DIR}/data/tx_valid.json.h + addrman_tests.cpp + allocator_tests.cpp + amount_tests.cpp + argsman_tests.cpp + arith_uint256_tests.cpp + banman_tests.cpp + base32_tests.cpp + base58_tests.cpp + base64_tests.cpp + bech32_tests.cpp + bip32_tests.cpp + bip324_tests.cpp + block_reward_reallocation_tests.cpp + blockchain_tests.cpp + blockencodings_tests.cpp + blockfilter_index_tests.cpp + blockfilter_tests.cpp + blockmanager_tests.cpp + bloom_tests.cpp + bls_tests.cpp + bswap_tests.cpp + cachemap_tests.cpp + cachemultimap_tests.cpp + checkdatasig_tests.cpp + checkqueue_tests.cpp + coins_tests.cpp + coinstatsindex_tests.cpp + compilerbug_tests.cpp + compress_tests.cpp + crypto_tests.cpp + cuckoocache_tests.cpp + dbwrapper_tests.cpp + denialofservice_tests.cpp + descriptor_tests.cpp + dip0020opcodes_tests.cpp + dynamic_activation_thresholds_tests.cpp + evo_assetlocks_tests.cpp + evo_cbtx_tests.cpp + evo_deterministicmns_tests.cpp + evo_islock_tests.cpp + evo_mnhf_tests.cpp + evo_netinfo_tests.cpp + evo_simplifiedmns_tests.cpp + evo_trivialvalidation.cpp + evo_utils_tests.cpp + flatfile_tests.cpp + fs_tests.cpp + getarg_tests.cpp + governance_superblock_tests.cpp + governance_validators_tests.cpp + hash_tests.cpp + httpserver_tests.cpp + i2p_tests.cpp + interfaces_tests.cpp + key_io_tests.cpp + key_tests.cpp + limitedmap_tests.cpp + llmq_chainlock_tests.cpp + llmq_commitment_tests.cpp + llmq_dkg_tests.cpp + llmq_hash_tests.cpp + llmq_params_tests.cpp + llmq_snapshot_tests.cpp + llmq_utils_tests.cpp + logging_tests.cpp + mempool_tests.cpp + merkle_tests.cpp + merkleblock_tests.cpp + miner_tests.cpp + miniscript_tests.cpp + minisketch_tests.cpp + multisig_tests.cpp + net_peer_connection_tests.cpp + net_peer_eviction_tests.cpp + net_tests.cpp + netbase_tests.cpp + orphanage_tests.cpp + pmt_tests.cpp + policyestimator_tests.cpp + pool_tests.cpp + pow_tests.cpp + prevector_tests.cpp + raii_event_tests.cpp + random_tests.cpp + ratecheck_tests.cpp + rest_tests.cpp + result_tests.cpp + reverselock_tests.cpp + rpc_tests.cpp + sanity_tests.cpp + scheduler_tests.cpp + script_p2sh_tests.cpp + script_p2pk_tests.cpp + script_p2pkh_tests.cpp + script_parse_tests.cpp + script_standard_tests.cpp + script_tests.cpp + scriptnum_tests.cpp + serfloat_tests.cpp + serialize_tests.cpp + settings_tests.cpp + sighash_tests.cpp + sigopcount_tests.cpp + skiplist_tests.cpp + sock_tests.cpp + span_tests.cpp + streams_tests.cpp + subsidy_tests.cpp + sync_tests.cpp + system_tests.cpp + timedata_tests.cpp + torcontrol_tests.cpp + transaction_tests.cpp + txindex_tests.cpp + txpackage_tests.cpp + txreconciliation_tests.cpp + txvalidation_tests.cpp + txvalidationcache_tests.cpp + uint256_tests.cpp + util_tests.cpp + util_threadnames_tests.cpp + validation_block_tests.cpp + validation_chainstate_tests.cpp + validation_chainstatemanager_tests.cpp + validation_flush_tests.cpp + validation_tests.cpp + validationinterface_tests.cpp + versionbits_tests.cpp + xoroshiro128plusplus_tests.cpp +) +set_target_properties(test_bitcoin PROPERTIES OUTPUT_NAME test_dash) + +target_link_libraries(test_bitcoin + core_interface + test_util + bitcoin_cli + bitcoin_node + dashbls + leveldb + minisketch + secp256k1 + Boost::headers + $ +) + +if(ENABLE_WALLET) + add_subdirectory(${PROJECT_SOURCE_DIR}/src/wallet/test wallet) +endif() + +if(WITH_MULTIPROCESS) + add_library(bitcoin_ipc_test STATIC EXCLUDE_FROM_ALL + ipc_test.cpp + ) + + target_capnp_sources(bitcoin_ipc_test ${PROJECT_SOURCE_DIR} + ipc_test.capnp + ) + + target_link_libraries(bitcoin_ipc_test + PRIVATE + core_interface + univalue + ) + + target_sources(test_bitcoin + PRIVATE + ipc_tests.cpp + ) + target_link_libraries(test_bitcoin bitcoin_ipc_test) +endif() + +function(add_boost_test source_file) + if(NOT EXISTS ${source_file}) + return() + endif() + + file(READ "${source_file}" source_file_content) + string(REGEX + MATCH "(BOOST_FIXTURE_TEST_SUITE|BOOST_AUTO_TEST_SUITE)\\(([A-Za-z0-9_]+)" + test_suite_macro "${source_file_content}" + ) + string(REGEX + REPLACE "(BOOST_FIXTURE_TEST_SUITE|BOOST_AUTO_TEST_SUITE)\\(" "" + test_suite_name "${test_suite_macro}" + ) + if(test_suite_name) + add_test(NAME ${test_suite_name} + COMMAND test_bitcoin --run_test=${test_suite_name} --catch_system_error=no + ) + set_property(TEST ${test_suite_name} PROPERTY + SKIP_REGULAR_EXPRESSION "no test cases matching filter" "Skipping" + ) + endif() +endfunction() + +function(add_all_test_targets) + get_target_property(test_source_dir test_bitcoin SOURCE_DIR) + get_target_property(test_sources test_bitcoin SOURCES) + foreach(test_source ${test_sources}) + cmake_path(IS_RELATIVE test_source result) + if(result) + cmake_path(APPEND test_source_dir ${test_source} OUTPUT_VARIABLE test_source) + endif() + add_boost_test(${test_source}) + endforeach() +endfunction() + +add_all_test_targets() + +install(TARGETS test_bitcoin + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) diff --git a/src/test/fuzz/CMakeLists.txt b/src/test/fuzz/CMakeLists.txt new file mode 100644 index 000000000000..62259888af39 --- /dev/null +++ b/src/test/fuzz/CMakeLists.txt @@ -0,0 +1,129 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +add_subdirectory(util) + +add_executable(fuzz + addition_overflow.cpp + addrman.cpp + asmap.cpp + asmap_direct.cpp + autofile.cpp + banman.cpp + base_encode_decode.cpp + bech32.cpp + bip324.cpp + block.cpp + block_header.cpp + blockfilter.cpp + bloom_filter.cpp + buffered_file.cpp + chain.cpp + checkqueue.cpp + coins_view.cpp + coinscache_sim.cpp + connman.cpp + crypto.cpp + crypto_aes256.cpp + crypto_aes256cbc.cpp + crypto_chacha20.cpp + crypto_common.cpp + crypto_diff_fuzz_chacha20.cpp + crypto_hkdf_hmac_sha256_l32.cpp + crypto_poly1305.cpp + cuckoocache.cpp + decode_tx.cpp + descriptor_parse.cpp + deserialize.cpp + eval_script.cpp + fee_rate.cpp + fees.cpp + flatfile.cpp + float.cpp + golomb_rice.cpp + hex.cpp + http_request.cpp + integer.cpp + key.cpp + key_io.cpp + kitchen_sink.cpp + load_external_block_file.cpp + locale.cpp + merkleblock.cpp + message.cpp + miniscript.cpp + minisketch.cpp + muhash.cpp + multiplication_overflow.cpp + net.cpp + net_permissions.cpp + netaddress.cpp + netbase_dns_lookup.cpp + node_eviction.cpp + p2p_transport_serialization.cpp + package_eval.cpp + parse_hd_keypath.cpp + parse_numbers.cpp + parse_script.cpp + parse_univalue.cpp + policy_estimator.cpp + policy_estimator_io.cpp + poolresource.cpp + pow.cpp + prevector.cpp + primitives_transaction.cpp + process_message.cpp + process_messages.cpp + protocol.cpp + psbt.cpp + random.cpp + rolling_bloom_filter.cpp + rpc.cpp + script.cpp + script_bitcoin_consensus.cpp + script_descriptor_cache.cpp + script_flags.cpp + script_format.cpp + script_interpreter.cpp + script_ops.cpp + script_sigcache.cpp + script_sign.cpp + scriptnum_ops.cpp + secp256k1_ec_seckey_import_export_der.cpp + secp256k1_ecdsa_signature_parse_der_lax.cpp + signature_checker.cpp + socks5.cpp + span.cpp + spanparsing.cpp + string.cpp + strprintf.cpp + system.cpp + timedata.cpp + torcontrol.cpp + transaction.cpp + tx_in.cpp + tx_out.cpp + tx_pool.cpp + txorphan.cpp + utxo_snapshot.cpp + utxo_total_supply.cpp + validation_load_mempool.cpp + versionbits.cpp +) +target_link_libraries(fuzz + core_interface + test_fuzz + bitcoin_cli + bitcoin_common + minisketch + leveldb + univalue + secp256k1 + Boost::headers + $ +) + +if(ENABLE_WALLET) + add_subdirectory(${PROJECT_SOURCE_DIR}/src/wallet/test/fuzz wallet) +endif() diff --git a/src/test/fuzz/util/CMakeLists.txt b/src/test/fuzz/util/CMakeLists.txt new file mode 100644 index 000000000000..c45acba82e9a --- /dev/null +++ b/src/test/fuzz/util/CMakeLists.txt @@ -0,0 +1,24 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +add_library(test_fuzz STATIC EXCLUDE_FROM_ALL + net.cpp + ../fuzz.cpp + ../util.cpp + ../../util/mining.cpp +) + +target_link_libraries(test_fuzz + PRIVATE + core_interface + test_util + bitcoin_node + Boost::headers + dashbls + leveldb +) + +if(NOT FUZZ_BINARY_LINKS_WITHOUT_MAIN_FUNCTION) + target_compile_definitions(test_fuzz PRIVATE PROVIDE_FUZZ_MAIN_FUNCTION) +endif() diff --git a/src/test/util/CMakeLists.txt b/src/test/util/CMakeLists.txt new file mode 100644 index 000000000000..86b76f8a50e2 --- /dev/null +++ b/src/test/util/CMakeLists.txt @@ -0,0 +1,31 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +add_library(test_util STATIC EXCLUDE_FROM_ALL + blockfilter.cpp + coins.cpp + index.cpp + json.cpp + logging.cpp + mining.cpp + net.cpp + script.cpp + setup_common.cpp + str.cpp + transaction_utils.cpp + txmempool.cpp + validation.cpp + $<$:wallet.cpp> + $<$:${PROJECT_SOURCE_DIR}/src/wallet/test/util.cpp> +) + +target_link_libraries(test_util + PRIVATE + core_interface + Boost::headers + dashbls + leveldb + PUBLIC + univalue +) diff --git a/src/univalue/CMakeLists.txt b/src/univalue/CMakeLists.txt new file mode 100644 index 000000000000..96733fe07725 --- /dev/null +++ b/src/univalue/CMakeLists.txt @@ -0,0 +1,41 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +add_library(univalue STATIC EXCLUDE_FROM_ALL + lib/univalue.cpp + lib/univalue_get.cpp + lib/univalue_read.cpp + lib/univalue_write.cpp +) +target_include_directories(univalue + PUBLIC + $ +) +target_link_libraries(univalue PRIVATE core_interface) + +if(BUILD_TESTS) + add_executable(unitester test/unitester.cpp) + target_compile_definitions(unitester + PRIVATE + JSON_TEST_SRC=\"${CMAKE_CURRENT_SOURCE_DIR}/test\" + ) + target_link_libraries(unitester + PRIVATE + core_interface + univalue + ) + add_test(NAME univalue_test + COMMAND unitester + ) + + add_executable(object test/object.cpp) + target_link_libraries(object + PRIVATE + core_interface + univalue + ) + add_test(NAME univalue_object_test + COMMAND object + ) +endif() diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt new file mode 100644 index 000000000000..783e6a7a6c74 --- /dev/null +++ b/src/util/CMakeLists.txt @@ -0,0 +1,60 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +add_library(bitcoin_util STATIC EXCLUDE_FROM_ALL + asmap.cpp + bip32.cpp + bytevectorhash.cpp + check.cpp + edge.cpp + error.cpp + fees.cpp + getuniquepath.cpp + hasher.cpp + message.cpp + moneystr.cpp + readwritefile.cpp + ranges_set.cpp + serfloat.cpp + settings.cpp + sock.cpp + spanparsing.cpp + strencodings.cpp + string.cpp + system.cpp + syserror.cpp + thread.cpp + threadinterrupt.cpp + threadnames.cpp + time.cpp + tokenpipe.cpp + wpipe.cpp + ../bls/bls_ies.cpp + ../bls/bls_worker.cpp + ../coinjoin/common.cpp + ../coinjoin/options.cpp + ../fs.cpp + ../interfaces/echo.cpp + ../interfaces/handler.cpp + ../interfaces/init.cpp + ../logging.cpp + ../messagesigner.cpp + ../random.cpp + ../randomenv.cpp + ../stacktraces.cpp + ../support/cleanse.cpp + ../support/lockedpool.cpp + ../sync.cpp +) + +target_link_libraries(bitcoin_util + PRIVATE + core_interface + bitcoin_clientversion + bitcoin_crypto + Boost::headers + dashbls + univalue + $<$:ws2_32> +) diff --git a/src/wallet/CMakeLists.txt b/src/wallet/CMakeLists.txt new file mode 100644 index 000000000000..a6f2a2596989 --- /dev/null +++ b/src/wallet/CMakeLists.txt @@ -0,0 +1,65 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +# Wallet functionality used by bitcoind and bitcoin-wallet executables. +add_library(bitcoin_wallet STATIC EXCLUDE_FROM_ALL + ../coinjoin/client.cpp + ../coinjoin/interfaces.cpp + ../coinjoin/util.cpp + bip39.cpp + coinjoin.cpp + coincontrol.cpp + coinselection.cpp + context.cpp + crypter.cpp + db.cpp + dump.cpp + external_signer_scriptpubkeyman.cpp + fees.cpp + hdchain.cpp + interfaces.cpp + load.cpp + receive.cpp + rpc/addresses.cpp + rpc/backup.cpp + rpc/coins.cpp + rpc/encrypt.cpp + rpc/signmessage.cpp + rpc/spend.cpp + rpc/transactions.cpp + rpc/util.cpp + rpc/wallet.cpp + scriptpubkeyman.cpp + spend.cpp + transaction.cpp + wallet.cpp + walletdb.cpp + walletutil.cpp +) +target_link_libraries(bitcoin_wallet + PRIVATE + core_interface + bitcoin_common + leveldb + dashbls + univalue + Boost::headers + $ +) + +if(NOT USE_SQLITE AND NOT USE_BDB) + message(FATAL_ERROR "Wallet functionality requested but no BDB or SQLite support available.") +endif() +if(USE_SQLITE) + target_sources(bitcoin_wallet PRIVATE sqlite.cpp) + target_link_libraries(bitcoin_wallet + PRIVATE + $ + $ + ) +endif() +if(USE_BDB) + target_sources(bitcoin_wallet PRIVATE bdb.cpp salvage.cpp) + target_link_libraries(bitcoin_wallet PUBLIC BerkeleyDB::BerkeleyDB) +endif() diff --git a/src/wallet/test/CMakeLists.txt b/src/wallet/test/CMakeLists.txt new file mode 100644 index 000000000000..3b4bcbc1316e --- /dev/null +++ b/src/wallet/test/CMakeLists.txt @@ -0,0 +1,32 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +# Do not use generator expressions in test sources because the +# SOURCES property is processed to gather test suite macros. +target_sources(test_bitcoin + PRIVATE + init_test_fixture.cpp + wallet_test_fixture.cpp + availablecoins_tests.cpp + bip39_tests.cpp + coinjoin_tests.cpp + coinselector_tests.cpp + init_tests.cpp + ismine_tests.cpp + psbt_wallet_tests.cpp + rpc_util_tests.cpp + scriptpubkeyman_tests.cpp + spend_tests.cpp + wallet_crypto_tests.cpp + wallet_tests.cpp + wallet_transaction_tests.cpp + walletdb_tests.cpp +) +if(USE_BDB) + target_sources(test_bitcoin + PRIVATE + db_tests.cpp + ) +endif() +target_link_libraries(test_bitcoin bitcoin_wallet) diff --git a/src/wallet/test/fuzz/CMakeLists.txt b/src/wallet/test/fuzz/CMakeLists.txt new file mode 100644 index 000000000000..48edf6302301 --- /dev/null +++ b/src/wallet/test/fuzz/CMakeLists.txt @@ -0,0 +1,12 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +target_sources(fuzz + PRIVATE + coincontrol.cpp + coinselection.cpp + $<$:${CMAKE_CURRENT_LIST_DIR}/notifications.cpp> + parse_iso8601.cpp +) +target_link_libraries(fuzz bitcoin_wallet) diff --git a/src/zmq/CMakeLists.txt b/src/zmq/CMakeLists.txt new file mode 100644 index 000000000000..8ecb236b4600 --- /dev/null +++ b/src/zmq/CMakeLists.txt @@ -0,0 +1,24 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +add_library(bitcoin_zmq STATIC EXCLUDE_FROM_ALL + zmqabstractnotifier.cpp + zmqnotificationinterface.cpp + zmqpublishnotifier.cpp + zmqrpc.cpp + zmqutil.cpp +) +target_compile_definitions(bitcoin_zmq + INTERFACE + ENABLE_ZMQ=1 + PRIVATE + $<$,$>:ZMQ_STATIC> +) +target_link_libraries(bitcoin_zmq + PRIVATE + core_interface + univalue + $ + $ +) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 000000000000..9fd4e6e84ea1 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,48 @@ +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +function(create_test_config) + set(abs_top_srcdir ${PROJECT_SOURCE_DIR}) + set(abs_top_builddir ${PROJECT_BINARY_DIR}) + set(EXEEXT ${CMAKE_EXECUTABLE_SUFFIX}) + + macro(set_configure_variable var conf_var) + if(${var}) + set(${conf_var}_TRUE "") + else() + set(${conf_var}_TRUE "#") + endif() + endmacro() + + set_configure_variable(ENABLE_WALLET ENABLE_WALLET) + set_configure_variable(WITH_SQLITE USE_SQLITE) + set_configure_variable(WITH_BDB USE_BDB) + set_configure_variable(BUILD_CLI BUILD_BITCOIN_CLI) + set_configure_variable(BUILD_UTIL BUILD_BITCOIN_UTIL) + set_configure_variable(BUILD_WALLET_TOOL BUILD_BITCOIN_WALLET) + set_configure_variable(BUILD_DAEMON BUILD_BITCOIND) + set_configure_variable(BUILD_FUZZ_BINARY ENABLE_FUZZ_BINARY) + set_configure_variable(WITH_ZMQ ENABLE_ZMQ) + set_configure_variable(ENABLE_EXTERNAL_SIGNER ENABLE_EXTERNAL_SIGNER) + set_configure_variable(WITH_USDT ENABLE_USDT_TRACEPOINTS) + + configure_file(config.ini.in config.ini @ONLY) +endfunction() + +create_test_config() + +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/functional) +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/fuzz) +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/util) + +file(GLOB_RECURSE functional_tests RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} functional/*) +foreach(script ${functional_tests} fuzz/test_runner.py util/rpcauth-test.py util/test_runner.py) + if(CMAKE_HOST_WIN32) + set(symlink) + else() + set(symlink SYMBOLIC) + endif() + file(CREATE_LINK ${CMAKE_CURRENT_SOURCE_DIR}/${script} ${CMAKE_CURRENT_BINARY_DIR}/${script} COPY_ON_ERROR ${symlink}) +endforeach() +unset(functional_tests) diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py index d260cdb6cdeb..c77f8e39dff8 100755 --- a/test/functional/test_runner.py +++ b/test/functional/test_runner.py @@ -709,7 +709,7 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, attempts=1, enab print(f"{BOLD[1]}WARNING!{BOLD[0]} There may be insufficient free space in {tmpdir} to run the Dash functional test suite. " f"Running the test suite with fewer than {min_space // (1024 * 1024)} MB of free space might cause tests to fail.") - tests_dir = src_dir + '/test/functional/' + tests_dir = build_dir + '/test/functional/' # This allows `test_runner.py` to work from an out-of-source build directory using a symlink, # a hard link or a copy on any platform. See https://github.com/bitcoin/bitcoin/pull/27561. sys.path.append(tests_dir) From 313e982a5fbf88df0cf4c966ea4810deae403c46 Mon Sep 17 00:00:00 2001 From: pasta Date: Sat, 25 Jul 2026 12:05:36 -0500 Subject: [PATCH 2/9] build: adapt the CMake build to Dash Bring the imported CMake build to parity with the Autotools build it replaces. The source lists and the config header were checked against src/Makefile*.am and configure.ac. Configuration: - Define the macros Dash sources test: ENABLE_MINER, the X11 SSSE3, AES-NI and ARM backends (with their sources), ENABLE_STACKTRACES and ENABLE_CRASH_HOOKS with libbacktrace from depends, HAVE_GETRANDOM, WITH_ZSTD and ENABLE_PLATFORM_GUI. Without them the build succeeds but behaves differently, for example every mining RPC is stubbed out. - Debug builds define DEBUG_CORE, which Dash uses in place of upstream's DEBUG. - Version 24.1.0, and the `git describe` build description that clientversion.cpp reads. - Windows targets the same API level and PE subsystem as configure.ac. - Linux binaries keep -Wl,--build-id=sha1, which the Guix release script needs to match them to their split debug files. - Appended C flags reach the X11 and secp256k1 subdirectories. - The pipe2 check is skipped on Darwin (bitcoin#36218). Warnings: a WERROR build works. The vendored sphlib C sources are built as their own -O3 library outside the C++ warning set, -Wundef is not an error, and the dashbls and immer headers are system includes. Targets: - Dash executable names, Windows resources and the NSIS installer. - The public libdashconsensus, which Dash keeps (upstream removed it in bitcoin#29648), with its libtool soname, Mach-O versions, install name and MinGW DLL name. It is not built for fuzzing. - dash-chainstate links a kernel library with the sources of libdashkernel_la_SOURCES. - dashbls is compiled from Dash's own source list, like src/Makefile.dashbls.include, with blst from depends through a new FindBLST module. The subtree's own CMake project downloads blst at configure time, so it cannot be used. ENABLE_MIMALLOC mirrors --disable-mimalloc. - Crash-hook --wrap flags are applied where the wrappers are linked. - coinjoin/walletman.cpp is in the wallet library, and the fuzz binary links test_util before the node library. Tests: every unit, fuzz, wallet, Qt and bench source in the tree is compiled. CTest also runs the dashbls and minisketch tests, which `make check` ran, and util_test_runner gets DASHUTIL and DASHTX. The multiprocess IPC test block is dropped: its sources come with bitcoin#28921, which is not backported. Maintenance targets: check-symbols and check-security use Dash's script paths, and check-stdlib-paths and osx_debug are added for Guix and CI. Co-Authored-By: UdjinM6 Co-Authored-By: Claude Opus 5.5 Co-Authored-By: Claude Fable 5.2 --- CMakeLists.txt | 231 ++++++++++++++++++++-- cmake/bitcoin-config.h.in | 41 ++++ cmake/dashbls.cmake | 138 +++++++++++++ cmake/introspection.cmake | 89 ++++++++- cmake/minisketch.cmake | 14 ++ cmake/module/AddBoostIfNeeded.cmake | 9 +- cmake/module/FindBLST.cmake | 29 +++ cmake/module/GenerateSetupNsi.cmake | 26 ++- cmake/module/Maintenance.cmake | 57 +++--- cmake/module/ProcessConfigurations.cmake | 57 +++++- cmake/module/TryAppendLinkerFlag.cmake | 4 +- cmake/script/GenerateBuildInfo.cmake | 56 +----- cmake/script/GenerateHeaderFromJson.cmake | 9 +- cmake/tests.cmake | 2 +- depends/Makefile | 2 + depends/toolchain.cmake.in | 13 ++ src/CMakeLists.txt | 171 ++++++++++++---- src/bench/CMakeLists.txt | 7 + src/crypto/CMakeLists.txt | 103 ++++++++-- src/kernel/CMakeLists.txt | 135 +++++++++---- src/qt/CMakeLists.txt | 28 ++- src/qt/test/CMakeLists.txt | 25 ++- src/test/CMakeLists.txt | 54 +++-- src/test/fuzz/CMakeLists.txt | 13 ++ src/test/fuzz/util/CMakeLists.txt | 2 + src/test/util/CMakeLists.txt | 6 +- src/util/CMakeLists.txt | 19 +- src/wallet/CMakeLists.txt | 3 + src/wallet/test/CMakeLists.txt | 4 +- src/wallet/test/fuzz/CMakeLists.txt | 2 + src/zmq/CMakeLists.txt | 4 + test/CMakeLists.txt | 1 + 32 files changed, 1099 insertions(+), 255 deletions(-) create mode 100644 cmake/dashbls.cmake create mode 100644 cmake/module/FindBLST.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 66a2ee335b42..d5e2cf84ce53 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,25 +19,20 @@ if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) message(FATAL_ERROR "In-source builds are not allowed.") endif() -# Relic's headers include "relic_conf.h" with quotes, so a copy left in the -# source tree by an in-source Autotools configure would shadow the one CMake -# generates in the build tree. -if(EXISTS ${CMAKE_SOURCE_DIR}/src/dashbls/depends/relic/include/relic_conf.h) - message(FATAL_ERROR "Found src/dashbls/depends/relic/include/relic_conf.h from an in-source Autotools configure. Run \"make distclean\" in the source tree before configuring with CMake.") -endif() - #============================= # Project / Package metadata #============================= set(PACKAGE_NAME "Dash Core") -set(CLIENT_VERSION_MAJOR 23) +# AC_INIT's tarname argument; used for the NSIS installer and URI class. +set(PACKAGE_TARNAME "dashcore") +set(CLIENT_VERSION_MAJOR 24) set(CLIENT_VERSION_MINOR 1) -set(CLIENT_VERSION_BUILD 5) +set(CLIENT_VERSION_BUILD 0) set(CLIENT_VERSION_RC 0) set(CLIENT_VERSION_IS_RELEASE "false") set(COPYRIGHT_YEAR "2026") -# During the enabling of the CXX and CXXOBJ languages, we modify +# After enabling the C, CXX and OBJCXX languages, we modify # CMake's compiler/linker invocation strings by appending the content # of the user-defined `APPEND_*` variables, which allows overriding # any flag. We also ensure that the APPEND_* flags are considered @@ -48,6 +43,7 @@ set(COPYRIGHT_YEAR "2026") # for the current toolchain, or by a toolchain file." We do our best # to set it before the `project()` command. set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES + CMAKE_C_COMPILE_OBJECT CMAKE_CXX_COMPILE_OBJECT CMAKE_OBJCXX_COMPILE_OBJECT CMAKE_CXX_LINK_EXECUTABLE @@ -105,7 +101,6 @@ option(BUILD_TX "Build bitcoin-tx executable." ${BUILD_TESTS}) option(BUILD_UTIL "Build bitcoin-util executable." ${BUILD_TESTS}) option(BUILD_UTIL_CHAINSTATE "Build experimental bitcoin-chainstate executable." OFF) -option(BUILD_KERNEL_LIB "Build experimental bitcoinkernel library." ${BUILD_UTIL_CHAINSTATE}) option(ENABLE_WALLET "Enable wallet." ON) option(WITH_SQLITE "Enable SQLite wallet support." ${ENABLE_WALLET}) @@ -143,6 +138,20 @@ option(REDUCE_EXPORTS "Attempt to reduce exported symbols in the resulting execu option(WERROR "Treat compiler warnings as errors." OFF) option(WITH_CCACHE "Attempt to use ccache for compiling." ON) +option(ENABLE_MINER "Enable the in-wallet miner and its RPCs." ON) + +option(ENABLE_MIMALLOC "Use mimalloc for BLS secret memory until BLSInit() installs the locked pool." ON) + +# Dash, unlike upstream, still provides the public libdashconsensus API +# (--with-libs under Autotools, enabled by default). +option(BUILD_CONSENSUS_LIB "Build the public dashconsensus shared library." ON) + +# Matches the Autotools `--enable-stacktraces=auto` default: enabled when +# libbacktrace and its prerequisites are found, otherwise disabled with a +# warning. See the detection block further down. +option(ENABLE_STACKTRACES "Gather and print exception stack traces. Requires libbacktrace." ON) +cmake_dependent_option(ENABLE_CRASH_HOOKS "Hook into exception/signal/assert handling to gather stack traces." OFF "ENABLE_STACKTRACES" OFF) + option(WITH_NATPMP "Enable NAT-PMP." OFF) if(WITH_NATPMP) find_package(NATPMP MODULE REQUIRED) @@ -170,6 +179,13 @@ if(WITH_ZMQ) endif() endif() +option(WITH_ZSTD "Enable zstd compression of block and undo files." OFF) +if(WITH_ZSTD) + find_package(PkgConfig REQUIRED) + pkg_check_modules(libzstd REQUIRED IMPORTED_TARGET libzstd>=1.4.0) + set(ENABLE_ZSTD TRUE) +endif() + option(WITH_USDT "Enable tracepoints for Userspace, Statically Defined Tracing." OFF) if(WITH_USDT) find_package(USDT MODULE REQUIRED) @@ -207,12 +223,17 @@ if(BUILD_GUI) if(BUILD_GUI_TESTS) list(APPEND qt_components Test) endif() - find_package(Qt5 5.11.3 MODULE REQUIRED + find_package(Qt5 5.15 MODULE REQUIRED COMPONENTS ${qt_components} ) unset(qt_components) endif() +# dash-sdk-cxx, the C++ binding of the Dash Platform SDK, is a Rust static +# library linked into dash-qt, test_dash and test_dash-qt only. depends builds +# it with PLATFORM_GUI set, and its toolchain file then turns this option on. +cmake_dependent_option(ENABLE_PLATFORM_GUI "Enable Dash Platform (usernames, DashPay contacts) in the GUI. Requires dash-sdk-cxx." OFF "BUILD_GUI;ENABLE_WALLET" OFF) + option(BUILD_BENCH "Build bench_bitcoin executable." OFF) option(BUILD_FUZZ_BINARY "Build fuzz binary." OFF) cmake_dependent_option(BUILD_FOR_FUZZING "Build for fuzzing. Enabling this will disable all other targets and override BUILD_FUZZ_BINARY." OFF "NOT MSVC" OFF) @@ -225,6 +246,7 @@ set(APPEND_CXXFLAGS "" CACHE STRING "(Objective) C++ compiler flags that are app set(APPEND_LDFLAGS "" CACHE STRING "Linker flags that are appended to the command line after all other flags added by the build system. This variable is intended for debugging and special builds.") # Appending to this low-level rule variables is the only way to # guarantee that the flags appear at the end of the command line. +string(APPEND CMAKE_C_COMPILE_OBJECT " ${APPEND_CPPFLAGS} ${APPEND_CFLAGS}") string(APPEND CMAKE_CXX_COMPILE_OBJECT " ${APPEND_CPPFLAGS} ${APPEND_CXXFLAGS}") string(APPEND CMAKE_CXX_CREATE_SHARED_LIBRARY " ${APPEND_LDFLAGS}") string(APPEND CMAKE_CXX_LINK_EXECUTABLE " ${APPEND_LDFLAGS}") @@ -252,7 +274,12 @@ target_link_libraries(core_interface INTERFACE $<$:core_interface_relwithdebinfo> $<$:core_interface_debug> ) -target_compile_definitions(core_interface INTERFACE HAVE_CONFIG_H) +target_compile_definitions(core_interface INTERFACE + HAVE_CONFIG_H + # gsl/pointers.h pulls in and defines stream operators unless this + # is set. Keep it in sync with CORE_CPPFLAGS in configure.ac. + GSL_NO_IOSTREAMS +) if(BUILD_FOR_FUZZING) message(WARNING "BUILD_FOR_FUZZING=ON will disable all other targets and force BUILD_FUZZ_BINARY=ON.") @@ -261,9 +288,9 @@ if(BUILD_FOR_FUZZING) set(BUILD_TX OFF) set(BUILD_UTIL OFF) set(BUILD_UTIL_CHAINSTATE OFF) - set(BUILD_KERNEL_LIB OFF) set(BUILD_WALLET_TOOL OFF) set(BUILD_GUI OFF) + set(ENABLE_PLATFORM_GUI OFF) set(ENABLE_EXTERNAL_SIGNER OFF) set(WITH_NATPMP OFF) set(WITH_MINIUPNPC OFF) @@ -271,6 +298,7 @@ if(BUILD_FOR_FUZZING) set(BUILD_TESTS OFF) set(BUILD_GUI_TESTS OFF) set(BUILD_BENCH OFF) + set(BUILD_CONSENSUS_LIB OFF) set(BUILD_FUZZ_BINARY ON) target_compile_definitions(core_interface INTERFACE @@ -278,6 +306,9 @@ if(BUILD_FOR_FUZZING) ) endif() +# Derive this after BUILD_FOR_FUZZING has applied its target overrides. +set(HAVE_CONSENSUS_LIB ${BUILD_CONSENSUS_LIB}) + include(ProcessConfigurations) include(TryAppendCXXFlags) @@ -301,8 +332,8 @@ if(WIN32) ]=] target_compile_definitions(core_interface INTERFACE - _WIN32_WINNT=0x0601 - _WIN32_IE=0x0501 + _WIN32_WINNT=0x0A00 + _WIN32_IE=0x0A00 WIN32_LEAN_AND_MEAN NOMINMAX ) @@ -340,9 +371,11 @@ if(WIN32) # See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54412. try_append_cxx_flags("-Wa,-muse-unaligned-vector-move" TARGET core_interface SKIP_LINK) try_append_linker_flag("-static" TARGET core_interface) - # We require Windows 7 (NT 6.1) or later. + # We support Windows 10+, however it's not possible to set these values accordingly, + # due to a bug in mingw-w64. See https://sourceforge.net/p/mingw-w64/bugs/968/. + # As a best effort, target Windows 8. try_append_linker_flag("-Wl,--major-subsystem-version,6" TARGET core_interface) - try_append_linker_flag("-Wl,--minor-subsystem-version,1" TARGET core_interface) + try_append_linker_flag("-Wl,--minor-subsystem-version,2" TARGET core_interface) endif() endif() @@ -354,6 +387,11 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SIZEOF_VOID_P EQUAL 4) ) endif() +if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + # Add build-id for perf and debug symbol matching. + try_append_linker_flag("-Wl,--build-id=sha1" TARGET core_interface) +endif() + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") target_compile_definitions(core_interface INTERFACE MAC_OSX @@ -428,6 +466,26 @@ if(BUILD_DAEMON OR BUILD_GUI OR BUILD_CLI OR BUILD_TESTS OR BUILD_BENCH OR BUILD find_package(Libevent 2.1.8 MODULE REQUIRED) endif() +find_package(BLST MODULE REQUIRED) + +if(ENABLE_PLATFORM_GUI) + find_package(PkgConfig REQUIRED) + pkg_check_modules(dash_sdk_cxx REQUIRED IMPORTED_TARGET dash_sdk_cxx) + include(CheckSourceCompilesAndLinks) + check_cxx_source_links_with_libs(PkgConfig::dash_sdk_cxx " + #include + int main() + { + rust::Box client{dash_sdk::new_platform_client(dash_sdk::Config{}, nullptr)}; + client->shutdown(); + } + " HAVE_WORKING_DASH_SDK_CXX + ) + if(NOT HAVE_WORKING_DASH_SDK_CXX) + message(FATAL_ERROR "A program using dash-sdk-cxx does not link. See CMakeFiles/CMakeConfigureLog.yaml.") + endif() +endif() + include(cmake/introspection.cmake) include(cmake/ccache.cmake) @@ -476,6 +534,42 @@ else() try_append_cxx_flags("-Wunused-parameter" TARGET warn_interface SKIP_LINK IF_CHECK_PASSED "-Wno-unused-parameter" ) + + # Warnings that are suppressed outright. Keep in sync with NOWARN_CXXFLAGS in + # configure.ac; without these a WERROR build fails on GCC or Clang. + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + # -Wdeprecated-literal-operator causes problems with clang 20. + # TODO: remove it once we update hana. + try_append_cxx_flags("-Wdeprecated-literal-operator" TARGET warn_interface SKIP_LINK + IF_CHECK_PASSED "-Wno-error=deprecated-literal-operator" + ) + endif() + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + # -Warray-bounds is noisy and currently unhappy with the immer implementation. + try_append_cxx_flags("-Warray-bounds" TARGET warn_interface SKIP_LINK + IF_CHECK_PASSED "-Wno-array-bounds" + ) + # -Wstringop-overread and -Wstringop-overflow are broken in GCC. + try_append_cxx_flags("-Wstringop-overread" TARGET warn_interface SKIP_LINK + IF_CHECK_PASSED "-Wno-stringop-overread" + ) + try_append_cxx_flags("-Wstringop-overflow" TARGET warn_interface SKIP_LINK + IF_CHECK_PASSED "-Wno-stringop-overflow" + ) + # -Wattributes causes problems with GCC before 14. + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14) + try_append_cxx_flags("-Wattributes" TARGET warn_interface SKIP_LINK + IF_CHECK_PASSED "-Wno-error=attributes" + ) + endif() + # -Wcpp is triggered by _FORTIFY_SOURCE=3 on GCC before 12, where level 3 + # does not exist yet. + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12) + try_append_cxx_flags("-Wcpp" TARGET warn_interface SKIP_LINK + IF_CHECK_PASSED "-Wno-error=cpp" + ) + endif() + endif() endif() configure_file(cmake/script/Coverage.cmake Coverage.cmake COPYONLY) @@ -557,13 +651,105 @@ if(WERROR) else() set(werror_flag "-Werror") endif() - try_append_cxx_flags(${werror_flag} TARGET core_interface SKIP_LINK RESULT_VAR compiler_supports_werror) + try_append_cxx_flags(${werror_flag} TARGET warn_interface SKIP_LINK RESULT_VAR compiler_supports_werror) if(NOT compiler_supports_werror) message(FATAL_ERROR "WERROR set but ${werror_flag} is not usable.") endif() unset(werror_flag) endif() +# Autotools puts the warning and -Werror flags in CXXFLAGS only; AM_CFLAGS +# carries neither. Restrict them to C++ here as well, so that the vendored +# sphlib C sources under crypto/x11 are held to the same standard as they are +# by the Autotools build. +get_target_property(warn_interface_flags warn_interface INTERFACE_COMPILE_OPTIONS) +if(warn_interface_flags) + set_target_properties(warn_interface PROPERTIES + INTERFACE_COMPILE_OPTIONS "$<$:${warn_interface_flags}>" + ) +endif() +unset(warn_interface_flags) + +if(ENABLE_STACKTRACES) + include(CheckIncludeFileCXX) + if(NOT WIN32) + check_include_file_cxx(execinfo.h HAVE_EXECINFO_H) + endif() + # backtrace.h ships with libbacktrace, which for release builds lives only in + # the depends prefix. check_include_file_cxx() compiles with just + # CMAKE_REQUIRED_INCLUDES, which no longer sees that prefix, so probe with + # find_path(): it honours CMAKE_FIND_ROOT_PATH the same way the find_library() + # below already does. + find_path(BACKTRACE_INCLUDE_DIR NAMES backtrace.h) + find_library(BACKTRACE_LIBRARY NAMES backtrace) + if(NOT BACKTRACE_INCLUDE_DIR OR NOT BACKTRACE_LIBRARY OR (NOT WIN32 AND NOT HAVE_EXECINFO_H)) + message(WARNING "libbacktrace was not found, stacktraces will be disabled.") + list(APPEND configure_warnings "Stack traces disabled: libbacktrace not found.") + set(ENABLE_STACKTRACES OFF) + set(ENABLE_CRASH_HOOKS OFF) + endif() +endif() + +if(ENABLE_STACKTRACES) + add_library(stacktraces_interface INTERFACE) + target_link_libraries(core_interface INTERFACE stacktraces_interface) + target_link_libraries(stacktraces_interface INTERFACE ${BACKTRACE_LIBRARY}) + target_include_directories(stacktraces_interface SYSTEM INTERFACE ${BACKTRACE_INCLUDE_DIR}) + if(WIN32) + target_link_libraries(stacktraces_interface INTERFACE dbghelp) + else() + if(CMAKE_SYSTEM_NAME MATCHES "BSD$") + find_library(EXECINFO_LIBRARY NAMES execinfo) + if(EXECINFO_LIBRARY) + target_link_libraries(stacktraces_interface INTERFACE ${EXECINFO_LIBRARY}) + endif() + endif() + # Symbol names are resolved at run time, so they must stay in the dynamic + # symbol table. + try_append_linker_flag("-Wl,-export-dynamic" TARGET stacktraces_interface + RESULT_VAR linker_supports_export_dynamic + ) + if(NOT linker_supports_export_dynamic) + try_append_linker_flag("-rdynamic" TARGET stacktraces_interface) + endif() + unset(linker_supports_export_dynamic) + # No DWARF version pin here: the libbacktrace pinned in depends understands + # DWARF 5, so the compiler's default debug format is used as-is. A -gdwarf-4 + # pin used to live here and, being a -g-family flag, also forced debug + # level 2 onto every target that links core_interface. + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + try_append_cxx_flags("-fno-standalone-debug" TARGET stacktraces_interface SKIP_LINK) + endif() + endif() + + if(ENABLE_CRASH_HOOKS) + # Wrap the internal C++ ABI so that stacktraces can be attached to + # exceptions. Compilers whose linker lacks --wrap (e.g. ld64) fall back to + # the dlsym-based path in stacktraces.cpp. + try_append_linker_flag("-Wl,-wrap,__cxa_allocate_exception" VAR wrap_exceptions_flags + RESULT_VAR CRASH_HOOKS_WRAPPED_CXX_ABI + ) + if(CRASH_HOOKS_WRAPPED_CXX_ABI) + add_library(crash_hooks_interface INTERFACE) + target_link_options(crash_hooks_interface INTERFACE + "-Wl,-wrap,__cxa_allocate_exception" + "-Wl,-wrap,__cxa_free_exception" + ) + if(WIN32) + target_link_options(crash_hooks_interface INTERFACE + "-Wl,-wrap,_assert" + "-Wl,-wrap,_wassert" + ) + else() + target_link_options(crash_hooks_interface INTERFACE + "-Wl,-wrap,__assert_fail" + ) + endif() + endif() + unset(wrap_exceptions_flags) + endif() +endif() + find_package(Python3 3.9 COMPONENTS Interpreter) if(Python3_EXECUTABLE) set(PYTHON_COMMAND ${Python3_EXECUTABLE}) @@ -603,6 +789,7 @@ add_subdirectory(doc) include(cmake/crc32c.cmake) include(cmake/leveldb.cmake) include(cmake/minisketch.cmake) +include(cmake/dashbls.cmake) add_subdirectory(src) include(cmake/tests.cmake) @@ -631,7 +818,7 @@ message(" bitcoin-tx .......................... ${BUILD_TX}") message(" bitcoin-util ........................ ${BUILD_UTIL}") message(" bitcoin-wallet ...................... ${BUILD_WALLET_TOOL}") message(" bitcoin-chainstate (experimental) ... ${BUILD_UTIL_CHAINSTATE}") -message(" libbitcoinkernel (experimental) ..... ${BUILD_KERNEL_LIB}") +message(" libdashconsensus .................... ${BUILD_CONSENSUS_LIB}") message("Optional features:") message(" wallet support ...................... ${ENABLE_WALLET}") if(ENABLE_WALLET) @@ -643,9 +830,13 @@ message(" port mapping:") message(" - using NAT-PMP .................... ${WITH_NATPMP}") message(" - using UPnP ....................... ${WITH_MINIUPNPC}") message(" ZeroMQ .............................. ${WITH_ZMQ}") +message(" zstd block compression .............. ${WITH_ZSTD}") message(" USDT tracing ........................ ${WITH_USDT}") message(" QR code (GUI) ....................... ${WITH_QRENCODE}") message(" DBus (GUI, Linux only) .............. ${WITH_DBUS}") +message(" Dash Platform (GUI) ................. ${ENABLE_PLATFORM_GUI}") +message(" stack traces ........................ ${ENABLE_STACKTRACES}") +message(" crash hooks ......................... ${ENABLE_CRASH_HOOKS}") message("Tests:") message(" test_bitcoin ........................ ${BUILD_TESTS}") message(" test_bitcoin-qt ..................... ${BUILD_GUI_TESTS}") diff --git a/cmake/bitcoin-config.h.in b/cmake/bitcoin-config.h.in index 094eb8040a3b..caaba0a3a295 100644 --- a/cmake/bitcoin-config.h.in +++ b/cmake/bitcoin-config.h.in @@ -29,18 +29,44 @@ /* Copyright year */ #define COPYRIGHT_YEAR @COPYRIGHT_YEAR@ +/* Define this symbol to build code that uses ARMv8 AES intrinsics */ +#cmakedefine ENABLE_ARM_AES 1 + +/* Define this symbol to build code that uses ARM NEON intrinsics */ +#cmakedefine ENABLE_ARM_NEON 1 + /* Define this symbol to build code that uses ARMv8 SHA-NI intrinsics */ #cmakedefine ENABLE_ARM_SHANI 1 /* Define this symbol to build code that uses AVX2 intrinsics */ #cmakedefine ENABLE_AVX2 1 +/* Define this symbol to hook into exception/signal/assert handling to gather + stack traces */ +#cmakedefine ENABLE_CRASH_HOOKS 1 + +/* Define this symbol if the __cxa_throw wrapper used by the crash hooks is + available */ +#cmakedefine CRASH_HOOKS_WRAPPED_CXX_ABI 1 + /* Define if external signer support is enabled */ #cmakedefine ENABLE_EXTERNAL_SIGNER 1 +/* Define this symbol if in-wallet miner should be enabled */ +#cmakedefine ENABLE_MINER 1 + +/* Define this symbol to enable Dash Platform support in the GUI */ +#cmakedefine ENABLE_PLATFORM_GUI 1 + /* Define this symbol to build code that uses SSE4.1 intrinsics */ #cmakedefine ENABLE_SSE41 1 +/* Define this symbol to build code that uses SSSE3 intrinsics */ +#cmakedefine ENABLE_SSSE3 1 + +/* Define this symbol to gather and print exception stack traces */ +#cmakedefine ENABLE_STACKTRACES 1 + /* Define to 1 to enable tracepoints for Userspace, Statically Defined Tracing */ #cmakedefine ENABLE_TRACING 1 @@ -48,9 +74,24 @@ /* Define to 1 to enable wallet functions. */ #cmakedefine ENABLE_WALLET 1 +/* Define this symbol to enable zstd compression */ +#cmakedefine ENABLE_ZSTD 1 + +/* Define this symbol to build code that uses x86 AES-NI intrinsics */ +#cmakedefine ENABLE_X86_AESNI 1 + /* Define this symbol to build code that uses x86 SHA-NI intrinsics */ #cmakedefine ENABLE_X86_SHANI 1 +/* Define this symbol if the consensus lib has been built */ +#cmakedefine HAVE_CONSENSUS_LIB 1 + +/* Define if the visibility attribute is supported. */ +#cmakedefine HAVE_DEFAULT_VISIBILITY_ATTRIBUTE 1 + +/* Define if the dllexport attribute is supported. */ +#cmakedefine HAVE_DLLEXPORT_ATTRIBUTE 1 + /* Define to 1 if you have the declaration of `fork', and to 0 if you don't. */ #cmakedefine01 HAVE_DECL_FORK diff --git a/cmake/dashbls.cmake b/cmake/dashbls.cmake new file mode 100644 index 000000000000..c2ab975aebc5 --- /dev/null +++ b/cmake/dashbls.cmake @@ -0,0 +1,138 @@ +# Copyright (c) 2026 The Dash Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +# Counterpart to src/Makefile.dashbls.include. The dashbls subtree ships no +# build system of its own, so build its sources here and take blst from depends +# or the system. + +if(ENABLE_MIMALLOC) + add_library(mimalloc_secure STATIC EXCLUDE_FROM_ALL + ${PROJECT_SOURCE_DIR}/src/dashbls/depends/mimalloc/src/alloc-aligned.c + ${PROJECT_SOURCE_DIR}/src/dashbls/depends/mimalloc/src/alloc-posix.c + ${PROJECT_SOURCE_DIR}/src/dashbls/depends/mimalloc/src/alloc.c + ${PROJECT_SOURCE_DIR}/src/dashbls/depends/mimalloc/src/arena-meta.c + ${PROJECT_SOURCE_DIR}/src/dashbls/depends/mimalloc/src/arena.c + ${PROJECT_SOURCE_DIR}/src/dashbls/depends/mimalloc/src/bitmap.c + ${PROJECT_SOURCE_DIR}/src/dashbls/depends/mimalloc/src/heap.c + ${PROJECT_SOURCE_DIR}/src/dashbls/depends/mimalloc/src/init.c + ${PROJECT_SOURCE_DIR}/src/dashbls/depends/mimalloc/src/libc.c + ${PROJECT_SOURCE_DIR}/src/dashbls/depends/mimalloc/src/options.c + ${PROJECT_SOURCE_DIR}/src/dashbls/depends/mimalloc/src/os.c + ${PROJECT_SOURCE_DIR}/src/dashbls/depends/mimalloc/src/page-map.c + ${PROJECT_SOURCE_DIR}/src/dashbls/depends/mimalloc/src/page.c + ${PROJECT_SOURCE_DIR}/src/dashbls/depends/mimalloc/src/random.c + ${PROJECT_SOURCE_DIR}/src/dashbls/depends/mimalloc/src/stats.c + ${PROJECT_SOURCE_DIR}/src/dashbls/depends/mimalloc/src/prim/prim.c + ) + target_compile_definitions(mimalloc_secure + PRIVATE + MI_SECURE=4 + NDEBUG + ) + target_include_directories(mimalloc_secure + PRIVATE + ${PROJECT_SOURCE_DIR}/src/dashbls/depends/mimalloc/include + ${PROJECT_SOURCE_DIR}/src/dashbls/depends/mimalloc/src + ) + target_link_libraries(mimalloc_secure + PRIVATE + core_interface + PUBLIC + $<$:psapi;bcrypt;advapi32> + ) + set_target_properties(mimalloc_secure PROPERTIES + EXPORT_COMPILE_COMMANDS OFF + ) +endif() + +add_library(dashbls STATIC EXCLUDE_FROM_ALL + ${PROJECT_SOURCE_DIR}/src/dashbls/src/bls.cpp + ${PROJECT_SOURCE_DIR}/src/dashbls/src/chaincode.cpp + ${PROJECT_SOURCE_DIR}/src/dashbls/src/elements.cpp + ${PROJECT_SOURCE_DIR}/src/dashbls/src/extendedprivatekey.cpp + ${PROJECT_SOURCE_DIR}/src/dashbls/src/extendedpublickey.cpp + ${PROJECT_SOURCE_DIR}/src/dashbls/src/hdkeys.cpp + ${PROJECT_SOURCE_DIR}/src/dashbls/src/hkdf.cpp + ${PROJECT_SOURCE_DIR}/src/dashbls/src/legacy.cpp + ${PROJECT_SOURCE_DIR}/src/dashbls/src/privatekey.cpp + ${PROJECT_SOURCE_DIR}/src/dashbls/src/schemes.cpp + ${PROJECT_SOURCE_DIR}/src/dashbls/src/secure.cpp + ${PROJECT_SOURCE_DIR}/src/dashbls/src/threshold.cpp + ${PROJECT_SOURCE_DIR}/src/dashbls/src/util.cpp +) +target_compile_definitions(dashbls + PRIVATE + $<$:BLSALLOC_MIMALLOC=1> +) +# The vendored headers are included as system headers, as Autotools does, so +# that Dash's warning set (and WERROR) does not apply to them. +target_include_directories(dashbls SYSTEM + PRIVATE + ${PROJECT_SOURCE_DIR}/src/dashbls/include/dashbls + ${PROJECT_SOURCE_DIR}/src/dashbls/depends/mimalloc/include + PUBLIC + $ +) +target_link_libraries(dashbls + PRIVATE + core_interface + PUBLIC + $ + BLST::BLST +) +set_target_properties(dashbls PROPERTIES + EXPORT_COMPILE_COMMANDS OFF +) + +if(BUILD_TESTS) + add_executable(dashbls_runtest + ${PROJECT_SOURCE_DIR}/src/dashbls/src/test.cpp + ${PROJECT_SOURCE_DIR}/src/dashbls/test/test_secure.cpp + ) + target_compile_definitions(dashbls_runtest + PRIVATE + $<$:BLSALLOC_MIMALLOC=1> + DASHBLS_REFERENCE_VECTORS="${PROJECT_SOURCE_DIR}/src/dashbls/test-vectors/reference.txt" + ) + target_include_directories(dashbls_runtest SYSTEM + PRIVATE + ${PROJECT_SOURCE_DIR}/src/dashbls/include/dashbls + ${PROJECT_SOURCE_DIR}/src/dashbls/depends/catch2/include + ) + target_include_directories(dashbls_runtest + PRIVATE + ${PROJECT_SOURCE_DIR}/src/dashbls/src + ) + target_link_libraries(dashbls_runtest + PRIVATE + core_interface + dashbls + ) + set_target_properties(dashbls_runtest PROPERTIES + EXPORT_COMPILE_COMMANDS OFF + ) + add_test(NAME dashbls_runtest COMMAND dashbls_runtest) +endif() + +if(BUILD_BENCH) + add_executable(dashbls_runbench + ${PROJECT_SOURCE_DIR}/src/dashbls/src/test-bench.cpp + ) + target_compile_definitions(dashbls_runbench + PRIVATE + $<$:BLSALLOC_MIMALLOC=1> + ) + target_include_directories(dashbls_runbench SYSTEM + PRIVATE + ${PROJECT_SOURCE_DIR}/src/dashbls/include/dashbls + ) + target_link_libraries(dashbls_runbench + PRIVATE + core_interface + dashbls + ) + set_target_properties(dashbls_runbench PROPERTIES + EXPORT_COMPILE_COMMANDS OFF + ) +endif() diff --git a/cmake/introspection.cmake b/cmake/introspection.cmake index 5435a109d41c..2366720c9330 100644 --- a/cmake/introspection.cmake +++ b/cmake/introspection.cmake @@ -15,7 +15,9 @@ check_include_file_cxx(vm/vm_param.h HAVE_VM_VM_PARAM_H) check_cxx_symbol_exists(O_CLOEXEC "fcntl.h" HAVE_O_CLOEXEC) check_cxx_symbol_exists(fdatasync "unistd.h" HAVE_FDATASYNC) check_cxx_symbol_exists(fork "unistd.h" HAVE_DECL_FORK) -check_cxx_symbol_exists(pipe2 "unistd.h" HAVE_DECL_PIPE2) +if (NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin") + check_cxx_symbol_exists(pipe2 "unistd.h" HAVE_DECL_PIPE2) +endif() check_cxx_symbol_exists(setsid "unistd.h" HAVE_DECL_SETSID) check_include_file_cxx(sys/types.h HAVE_SYS_TYPES_H) @@ -159,9 +161,35 @@ check_cxx_source_compiles(" " HAVE_SYSCTL_ARND ) +# Needed by script/bitcoinconsensus.h to export the public API symbols. +check_cxx_source_compiles(" + int foo(void) __attribute__((visibility(\"default\"))); + int main(){} + " HAVE_DEFAULT_VISIBILITY_ATTRIBUTE +) +check_cxx_source_compiles(" + __declspec(dllexport) int foo(void); + int main(){} + " HAVE_DLLEXPORT_ATTRIBUTE +) + if(NOT MSVC) include(CheckSourceCompilesAndLinks) + # Check for SSSE3 intrinsics, used by the X11 hashing backends. + set(SSSE3_CXXFLAGS -mssse3) + check_cxx_source_compiles_with_flags("${SSSE3_CXXFLAGS}" " + #include + + int main() + { + __m64 x = _mm_abs_pi32(_m_from_int(0)); + return 0; + } + " HAVE_SSSE3 + ) + set(ENABLE_SSSE3 ${HAVE_SSSE3}) + # Check for SSE4.1 intrinsics. set(SSE41_CXXFLAGS -msse4.1) check_cxx_source_compiles_with_flags("${SSE41_CXXFLAGS}" " @@ -208,6 +236,65 @@ if(NOT MSVC) ) set(ENABLE_X86_SHANI ${HAVE_X86_SHANI}) + # Check for x86 AES-NI intrinsics, used by the X11 hashing backends. + set(X86_AESNI_CXXFLAGS -msse4.1 -maes) + check_cxx_source_compiles_with_flags("${X86_AESNI_CXXFLAGS}" " + #include + #include + #include + + int main() + { + __m128i x = _mm_setzero_si128(); + x = _mm_aesenc_si128(x, _mm_setzero_si128()); + return _mm_extract_epi32(x, 0); + } + " HAVE_X86_AESNI + ) + set(ENABLE_X86_AESNI ${HAVE_X86_AESNI}) + + # Check for ARMv8 AES intrinsics, used by the X11 hashing backends. + set(ARM_AES_CXXFLAGS -march=armv8-a+crypto) + check_cxx_source_compiles_with_flags("${ARM_AES_CXXFLAGS}" " + #include + + int main() + { + uint8x16_t a, b; + vaesmcq_u8(vaeseq_u8(a, b)); + return 0; + } + " HAVE_ARM_AES + ) + set(ENABLE_ARM_AES ${HAVE_ARM_AES}) + + # Check for ARM NEON intrinsics, used by the X11 hashing backends. + # Unlike the checks above, the required flag differs between ARMv8 and ARMv7. + # Each attempt needs its own result variable because check_cxx_source_compiles() + # is a no-op once the result variable is cached, including when cached as false. + set(neon_source " + #include + + int main() + { + float32x4_t f = vdupq_n_f32(0.0); + return 0; + } + ") + check_cxx_source_compiles_with_flags("-march=armv8-a" "${neon_source}" HAVE_ARM_NEON_ARMV8) + if(HAVE_ARM_NEON_ARMV8) + set(ARM_NEON_CXXFLAGS -march=armv8-a) + set(HAVE_ARM_NEON TRUE) + else() + check_cxx_source_compiles_with_flags("-march=armv7-a;-mfpu=neon" "${neon_source}" HAVE_ARM_NEON_ARMV7) + if(HAVE_ARM_NEON_ARMV7) + set(ARM_NEON_CXXFLAGS -march=armv7-a -mfpu=neon) + set(HAVE_ARM_NEON TRUE) + endif() + endif() + unset(neon_source) + set(ENABLE_ARM_NEON ${HAVE_ARM_NEON}) + # Check for ARMv8 SHA-NI intrinsics. set(ARM_SHANI_CXXFLAGS -march=armv8-a+crypto) check_cxx_source_compiles_with_flags("${ARM_SHANI_CXXFLAGS}" " diff --git a/cmake/minisketch.cmake b/cmake/minisketch.cmake index bb93c8046725..0fac27f58d71 100644 --- a/cmake/minisketch.cmake +++ b/cmake/minisketch.cmake @@ -89,3 +89,17 @@ target_link_libraries(minisketch set_target_properties(minisketch PROPERTIES EXPORT_COMPILE_COMMANDS OFF ) + +if(BUILD_TESTS) + add_executable(minisketch_test ${PROJECT_SOURCE_DIR}/src/minisketch/src/test.cpp) + target_link_libraries(minisketch_test + PRIVATE + core_interface + minisketch_common + minisketch + ) + set_target_properties(minisketch_test PROPERTIES + EXPORT_COMPILE_COMMANDS OFF + ) + add_test(NAME libminisketch_test COMMAND minisketch_test) +endif() diff --git a/cmake/module/AddBoostIfNeeded.cmake b/cmake/module/AddBoostIfNeeded.cmake index 89603ecd6155..9f4870a9bf6b 100644 --- a/cmake/module/AddBoostIfNeeded.cmake +++ b/cmake/module/AddBoostIfNeeded.cmake @@ -3,10 +3,13 @@ # file COPYING or https://opensource.org/license/mit/. function(add_boost_if_needed) - #[=[ - TODO: Not all targets, which will be added in the future, require - Boost. Therefore, a proper check will be appropriate here. + if(NOT (BUILD_DAEMON OR BUILD_GUI OR BUILD_CLI OR BUILD_TX OR BUILD_UTIL + OR BUILD_UTIL_CHAINSTATE OR ENABLE_WALLET OR BUILD_TESTS OR BUILD_BENCH + OR BUILD_FUZZ_BINARY OR WITH_MULTIPROCESS)) + return() + endif() + #[=[ Implementation notes: Although only Boost headers are used to build Bitcoin Core, we still leverage a standard CMake's approach to handle diff --git a/cmake/module/FindBLST.cmake b/cmake/module/FindBLST.cmake new file mode 100644 index 000000000000..3ded1078df41 --- /dev/null +++ b/cmake/module/FindBLST.cmake @@ -0,0 +1,29 @@ +# Copyright (c) 2026 The Dash Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +find_path(BLST_INCLUDE_DIR + NAMES blst.h +) + +find_library(BLST_LIBRARY + NAMES blst +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(BLST + REQUIRED_VARS BLST_LIBRARY BLST_INCLUDE_DIR +) + +if(BLST_FOUND AND NOT TARGET BLST::BLST) + add_library(BLST::BLST UNKNOWN IMPORTED) + set_target_properties(BLST::BLST PROPERTIES + IMPORTED_LOCATION "${BLST_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${BLST_INCLUDE_DIR}" + ) +endif() + +mark_as_advanced( + BLST_INCLUDE_DIR + BLST_LIBRARY +) diff --git a/cmake/module/GenerateSetupNsi.cmake b/cmake/module/GenerateSetupNsi.cmake index b7ea423611f7..dfdad654476d 100644 --- a/cmake/module/GenerateSetupNsi.cmake +++ b/cmake/module/GenerateSetupNsi.cmake @@ -6,13 +6,23 @@ function(generate_setup_nsi) set(abs_top_srcdir ${PROJECT_SOURCE_DIR}) set(abs_top_builddir ${PROJECT_BINARY_DIR}) set(PACKAGE_URL ${PROJECT_HOMEPAGE_URL}) - set(PACKAGE_TARNAME "bitcoin") - set(BITCOIN_GUI_NAME "bitcoin-qt") - set(BITCOIN_DAEMON_NAME "bitcoind") - set(BITCOIN_CLI_NAME "bitcoin-cli") - set(BITCOIN_TX_NAME "bitcoin-tx") - set(BITCOIN_WALLET_TOOL_NAME "bitcoin-wallet") - set(BITCOIN_TEST_NAME "test_bitcoin") + # These have to match the executables' OUTPUT_NAMEs, since the deploy target + # stages the files under those names. Keep them in sync with configure.ac. + # PACKAGE_TARNAME comes from the top-level CMakeLists.txt, which is also where + # add_windows_deploy_target() reads it from. + set(BITCOIN_GUI_NAME "dash-qt") + set(BITCOIN_DAEMON_NAME "dashd") + set(BITCOIN_CLI_NAME "dash-cli") + set(BITCOIN_TX_NAME "dash-tx") + set(BITCOIN_WALLET_TOOL_NAME "dash-wallet") + set(BITCOIN_TEST_NAME "test_dash") set(EXEEXT ${CMAKE_EXECUTABLE_SUFFIX}) - configure_file(${PROJECT_SOURCE_DIR}/share/setup.nsi.in ${PROJECT_BINARY_DIR}/bitcoin-win64-setup.nsi @ONLY) + set(nsi_file ${PROJECT_BINARY_DIR}/${PACKAGE_TARNAME}-win64-setup.nsi) + configure_file(${PROJECT_SOURCE_DIR}/share/setup.nsi.in ${nsi_file} @ONLY) + # share/setup.nsi.in carries no OutFile directive; the Autotools recipe pipes + # one in ahead of the script when invoking makensis. Do the same here. + file(READ ${nsi_file} nsi_content) + file(WRITE ${nsi_file} + "OutFile \"${PROJECT_BINARY_DIR}/${PACKAGE_TARNAME}-${PACKAGE_VERSION}-win64-setup${EXEEXT}\"\n${nsi_content}" + ) endfunction() diff --git a/cmake/module/Maintenance.cmake b/cmake/module/Maintenance.cmake index 1d3f5f927980..7773a95ca093 100644 --- a/cmake/module/Maintenance.cmake +++ b/cmake/module/Maintenance.cmake @@ -23,46 +23,53 @@ function(add_maintenance_targets) return() endif() - if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - set(exe_format MACHO) - elseif(WIN32) - set(exe_format PE) - else() - set(exe_format ELF) - endif() - - # In CMake, the components of the compiler invocation are separated into distinct variables: - # - CMAKE_CXX_COMPILER: the full path to the compiler binary itself (e.g., /usr/bin/clang++). - # - CMAKE_CXX_COMPILER_ARG1: a string containing initial compiler options (e.g., --target=x86_64-apple-darwin -nostdlibinc). - # By concatenating these variables, we form the complete command line to be passed to a Python script via the CXX environment variable. - string(STRIP "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1}" cxx_compiler_command) - add_custom_target(test-security-check - COMMAND ${CMAKE_COMMAND} -E env CXX=${cxx_compiler_command} CXXFLAGS=${CMAKE_CXX_FLAGS} LDFLAGS=${CMAKE_EXE_LINKER_FLAGS} ${PYTHON_COMMAND} ${PROJECT_SOURCE_DIR}/contrib/devtools/test-security-check.py TestSecurityChecks.test_${exe_format} - COMMAND ${CMAKE_COMMAND} -E env CXX=${cxx_compiler_command} CXXFLAGS=${CMAKE_CXX_FLAGS} LDFLAGS=${CMAKE_EXE_LINKER_FLAGS} ${PYTHON_COMMAND} ${PROJECT_SOURCE_DIR}/contrib/devtools/test-symbol-check.py TestSymbolChecks.test_${exe_format} - VERBATIM - ) - - foreach(target IN ITEMS bitcoind bitcoin-qt bitcoin-cli bitcoin-tx bitcoin-util bitcoin-wallet test_bitcoin bench_bitcoin) + foreach(target IN ITEMS bitcoind bitcoin-node bitcoin-gui bitcoin-qt bitcoin-cli bitcoin-tx bitcoin-util bitcoin-wallet bitcoin-chainstate test_bitcoin test_bitcoin-qt bench_bitcoin) if(TARGET ${target}) + list(APPEND executable_targets ${target}) list(APPEND executables $) endif() endforeach() add_custom_target(check-symbols COMMAND ${CMAKE_COMMAND} -E echo "Running symbol and dynamic library checks..." - COMMAND ${PYTHON_COMMAND} ${PROJECT_SOURCE_DIR}/contrib/devtools/symbol-check.py ${executables} + COMMAND ${PYTHON_COMMAND} ${PROJECT_SOURCE_DIR}/contrib/guix/symbol-check.py ${executables} + VERBATIM + ) + + add_custom_target(check-stdlib-paths + COMMAND ${CMAKE_COMMAND} -E echo "Checking for embedded standard library header paths..." + COMMAND ${PYTHON_COMMAND} ${PROJECT_SOURCE_DIR}/contrib/guix/stdlib-path-check.py ${executables} VERBATIM ) if(ENABLE_HARDENING) add_custom_target(check-security COMMAND ${CMAKE_COMMAND} -E echo "Checking binary security..." - COMMAND ${PYTHON_COMMAND} ${PROJECT_SOURCE_DIR}/contrib/devtools/security-check.py ${executables} + COMMAND ${PYTHON_COMMAND} ${PROJECT_SOURCE_DIR}/contrib/guix/security-check.py ${executables} VERBATIM ) else() add_custom_target(check-security) endif() + + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + find_program(DSYMUTIL_COMMAND dsymutil) + if(DSYMUTIL_COMMAND) + execute_process(COMMAND ${DSYMUTIL_COMMAND} --help OUTPUT_VARIABLE dsymutil_help ERROR_QUIET) + if(dsymutil_help MATCHES "-flat") + set(dsymutil_flat -flat) + endif() + foreach(target IN LISTS executable_targets) + set(dwarf_dir $.dSYM/Contents/Resources/DWARF) + list(APPEND dsym_commands + COMMAND ${CMAKE_COMMAND} -E make_directory ${dwarf_dir} + COMMAND ${DSYMUTIL_COMMAND} ${dsymutil_flat} -o ${dwarf_dir}/$ $ + ) + endforeach() + add_custom_target(osx_debug ${dsym_commands} VERBATIM) + add_dependencies(osx_debug ${executable_targets}) + endif() + endif() endfunction() function(add_windows_deploy_target) @@ -72,7 +79,7 @@ function(add_windows_deploy_target) include(GenerateSetupNsi) generate_setup_nsi() add_custom_command( - OUTPUT ${PROJECT_BINARY_DIR}/bitcoin-win64-setup.exe + OUTPUT ${PROJECT_BINARY_DIR}/${PACKAGE_TARNAME}-${PACKAGE_VERSION}-win64-setup.exe COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/release COMMAND ${CMAKE_STRIP} $ -o ${PROJECT_BINARY_DIR}/release/$ COMMAND ${CMAKE_STRIP} $ -o ${PROJECT_BINARY_DIR}/release/$ @@ -81,10 +88,10 @@ function(add_windows_deploy_target) COMMAND ${CMAKE_STRIP} $ -o ${PROJECT_BINARY_DIR}/release/$ COMMAND ${CMAKE_STRIP} $ -o ${PROJECT_BINARY_DIR}/release/$ COMMAND ${CMAKE_STRIP} $ -o ${PROJECT_BINARY_DIR}/release/$ - COMMAND makensis -V2 ${PROJECT_BINARY_DIR}/bitcoin-win64-setup.nsi + COMMAND makensis -V2 ${PROJECT_BINARY_DIR}/${PACKAGE_TARNAME}-win64-setup.nsi VERBATIM ) - add_custom_target(deploy DEPENDS ${PROJECT_BINARY_DIR}/bitcoin-win64-setup.exe) + add_custom_target(deploy DEPENDS ${PROJECT_BINARY_DIR}/${PACKAGE_TARNAME}-${PACKAGE_VERSION}-win64-setup.exe) endif() endfunction() diff --git a/cmake/module/ProcessConfigurations.cmake b/cmake/module/ProcessConfigurations.cmake index 5286d10267be..f9647cf237b2 100644 --- a/cmake/module/ProcessConfigurations.cmake +++ b/cmake/module/ProcessConfigurations.cmake @@ -106,6 +106,25 @@ function(remove_cxx_flag_from_all_configs flag) endforeach() endfunction() +function(append_flag_to_config lang config flag) + string(TOUPPER "${config}" config_uppercase) + set(flags_var CMAKE_${lang}_FLAGS_${config_uppercase}) + set(flags "${${flags_var}}") + separate_arguments(flags) + # Appending unconditionally would re-append on every reconfigure, because the + # value read back here is the one this function forced into the cache last time. + if(NOT "${flag}" IN_LIST flags) + list(APPEND flags "${flag}") + endif() + list(JOIN flags " " new_flags) + set(${flags_var} "${new_flags}" PARENT_SCOPE) + set(${flags_var} "${new_flags}" + CACHE STRING + "Flags used by the ${lang} compiler during ${config_uppercase} builds." + FORCE + ) +endfunction() + function(replace_cxx_flag_in_config config old_flag new_flag) string(TOUPPER "${config}" config_uppercase) string(REGEX REPLACE "(^| )${old_flag}( |$)" "\\1${new_flag}\\2" new_flags "${CMAKE_CXX_FLAGS_${config_uppercase}}") @@ -120,8 +139,11 @@ endfunction() set_default_config(RelWithDebInfo) # Redefine/adjust per-configuration flags. +# Keep this list in sync with the --enable-debug DEBUG_CPPFLAGS in configure.ac. +# Dash uses DEBUG_CORE, not upstream's DEBUG, which is what span.h and +# init/common.cpp check. target_compile_definitions(core_interface_debug INTERFACE - DEBUG + DEBUG_CORE DEBUG_LOCKORDER DEBUG_LOCKCONTENTION RPC_DOC_CHECK @@ -137,6 +159,39 @@ else() # Prefer -O2 optimization level. (-O3 is CMake's default for Release for many compilers.) replace_cxx_flag_in_config(Release -O3 -O2) + # Autotools always keeps at least -g1 on non-debug builds so libbacktrace can + # still symbolize a crash, with -fno-omit-frame-pointer to keep the result + # usable under optimization; see the non-debug branch in configure.ac, which + # sets both DEBUG_CFLAGS and DEBUG_CXXFLAGS. These belong on the configuration + # rather than on stacktraces_interface: flags carried on a target are appended + # after the per-configuration ones, so a debug level set there would clamp + # every configuration to it. RelWithDebInfo already carries -g and only needs + # the frame pointer. + include(CheckCCompilerFlag) + try_append_cxx_flags("-g1" RESULT_VAR cxx_supports_g1) + check_c_compiler_flag("-g1" C_SUPPORTS_G1) + foreach(config IN ITEMS Release MinSizeRel) + if(cxx_supports_g1) + append_flag_to_config(CXX ${config} -g1) + endif() + if(C_SUPPORTS_G1) + append_flag_to_config(C ${config} -g1) + endif() + endforeach() + unset(cxx_supports_g1) + + try_append_cxx_flags("-fno-omit-frame-pointer" RESULT_VAR cxx_supports_no_omit_fp) + check_c_compiler_flag("-fno-omit-frame-pointer" C_SUPPORTS_NO_OMIT_FP) + foreach(config IN ITEMS Release RelWithDebInfo MinSizeRel) + if(cxx_supports_no_omit_fp) + append_flag_to_config(CXX ${config} -fno-omit-frame-pointer) + endif() + if(C_SUPPORTS_NO_OMIT_FP) + append_flag_to_config(C ${config} -fno-omit-frame-pointer) + endif() + endforeach() + unset(cxx_supports_no_omit_fp) + are_flags_overridden(CMAKE_CXX_FLAGS_DEBUG cxx_flags_debug_overridden) if(NOT cxx_flags_debug_overridden) # Redefine flags used by the CXX compiler during DEBUG builds. diff --git a/cmake/module/TryAppendLinkerFlag.cmake b/cmake/module/TryAppendLinkerFlag.cmake index 749120d4458d..57220fbb913c 100644 --- a/cmake/module/TryAppendLinkerFlag.cmake +++ b/cmake/module/TryAppendLinkerFlag.cmake @@ -60,10 +60,10 @@ function(try_append_linker_flag flag) endif() elseif(DEFINED TALF_IF_CHECK_FAILED) if(DEFINED TALF_TARGET) - target_link_options(${TALF_TARGET} INTERFACE ${TACXXF_IF_CHECK_FAILED}) + target_link_options(${TALF_TARGET} INTERFACE ${TALF_IF_CHECK_FAILED}) endif() if(DEFINED TALF_VAR) - string(STRIP "${${TALF_VAR}} ${TACXXF_IF_CHECK_FAILED}" ${TALF_VAR}) + string(STRIP "${${TALF_VAR}} ${TALF_IF_CHECK_FAILED}" ${TALF_VAR}) endif() endif() diff --git a/cmake/script/GenerateBuildInfo.cmake b/cmake/script/GenerateBuildInfo.cmake index 4a640b9636f2..486ce750e1d2 100644 --- a/cmake/script/GenerateBuildInfo.cmake +++ b/cmake/script/GenerateBuildInfo.cmake @@ -30,8 +30,11 @@ else() set(WORKING_DIR ${CMAKE_CURRENT_SOURCE_DIR}) endif() -set(GIT_TAG) -set(GIT_COMMIT) +# NOTE: Unlike upstream, clientversion.cpp only knows about +# BUILD_GIT_DESCRIPTION, so this emits the same `git describe` string +# that share/genbuild.sh produces. Otherwise every non-release build +# reports its version as "vX.Y.Z-unk". +set(GIT_DESCRIPTION) if(NOT "$ENV{BITCOIN_GENBUILD_NO_GIT}" STREQUAL "1") find_package(Git QUIET) if(Git_FOUND) @@ -52,59 +55,18 @@ if(NOT "$ENV{BITCOIN_GENBUILD_NO_GIT}" STREQUAL "1") ) execute_process( - COMMAND ${GIT_EXECUTABLE} describe --abbrev=0 + COMMAND ${GIT_EXECUTABLE} describe --abbrev=12 --dirty WORKING_DIRECTORY ${WORKING_DIR} - OUTPUT_VARIABLE MOST_RECENT_TAG + OUTPUT_VARIABLE GIT_DESCRIPTION OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET ) - - execute_process( - COMMAND ${GIT_EXECUTABLE} rev-list -1 ${MOST_RECENT_TAG} - WORKING_DIRECTORY ${WORKING_DIR} - OUTPUT_VARIABLE MOST_RECENT_TAG_COMMIT - OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_QUIET - ) - - execute_process( - COMMAND ${GIT_EXECUTABLE} rev-parse HEAD - WORKING_DIRECTORY ${WORKING_DIR} - OUTPUT_VARIABLE HEAD_COMMIT - OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_QUIET - ) - - execute_process( - COMMAND ${GIT_EXECUTABLE} diff-index --quiet HEAD -- - WORKING_DIRECTORY ${WORKING_DIR} - RESULT_VARIABLE IS_DIRTY - ) - - if(HEAD_COMMIT STREQUAL MOST_RECENT_TAG_COMMIT AND NOT IS_DIRTY) - # If latest commit is tagged and not dirty, then use the tag name. - set(GIT_TAG ${MOST_RECENT_TAG}) - else() - # Otherwise, generate suffix from git, i.e. string like "0e0a5173fae3-dirty". - execute_process( - COMMAND ${GIT_EXECUTABLE} rev-parse --short=12 HEAD - WORKING_DIRECTORY ${WORKING_DIR} - OUTPUT_VARIABLE GIT_COMMIT - OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_QUIET - ) - if(IS_DIRTY) - string(APPEND GIT_COMMIT "-dirty") - endif() - endif() endif() endif() endif() -if(GIT_TAG) - set(NEWINFO "#define BUILD_GIT_TAG \"${GIT_TAG}\"") -elseif(GIT_COMMIT) - set(NEWINFO "#define BUILD_GIT_COMMIT \"${GIT_COMMIT}\"") +if(GIT_DESCRIPTION) + set(NEWINFO "#define BUILD_GIT_DESCRIPTION \"${GIT_DESCRIPTION}\"") else() set(NEWINFO "// No build information available") endif() diff --git a/cmake/script/GenerateHeaderFromJson.cmake b/cmake/script/GenerateHeaderFromJson.cmake index 0c2f2f39cb4b..213cc5c3a4d7 100644 --- a/cmake/script/GenerateHeaderFromJson.cmake +++ b/cmake/script/GenerateHeaderFromJson.cmake @@ -5,18 +5,19 @@ file(READ ${JSON_SOURCE_PATH} hex_content HEX) string(REGEX MATCHALL "([A-Za-z0-9][A-Za-z0-9])" bytes "${hex_content}") -file(WRITE ${HEADER_PATH} "namespace json_tests{\n") +file(WRITE ${HEADER_PATH} "#include \n") +file(APPEND ${HEADER_PATH} "namespace json_tests{\n") get_filename_component(json_source_basename ${JSON_SOURCE_PATH} NAME_WE) -file(APPEND ${HEADER_PATH} "static const unsigned char ${json_source_basename}[] = {\n") +file(APPEND ${HEADER_PATH} "static const std::string ${json_source_basename}{\n") set(i 0) foreach(byte ${bytes}) math(EXPR i "${i} + 1") math(EXPR remainder "${i} % 8") if(remainder EQUAL 0) - file(APPEND ${HEADER_PATH} "0x${byte},\n") + file(APPEND ${HEADER_PATH} "char(0x${byte}),\n") else() - file(APPEND ${HEADER_PATH} "0x${byte}, ") + file(APPEND ${HEADER_PATH} "char(0x${byte}), ") endif() endforeach() diff --git a/cmake/tests.cmake b/cmake/tests.cmake index 279132980017..ebbd116574d8 100644 --- a/cmake/tests.cmake +++ b/cmake/tests.cmake @@ -4,7 +4,7 @@ if(TARGET bitcoin-util AND TARGET bitcoin-tx AND PYTHON_COMMAND) add_test(NAME util_test_runner - COMMAND ${CMAKE_COMMAND} -E env BITCOINUTIL=$ BITCOINTX=$ ${PYTHON_COMMAND} ${PROJECT_BINARY_DIR}/test/util/test_runner.py + COMMAND ${CMAKE_COMMAND} -E env DASHUTIL=$ DASHTX=$ ${PYTHON_COMMAND} ${PROJECT_BINARY_DIR}/test/util/test_runner.py ) endif() diff --git a/depends/Makefile b/depends/Makefile index fe70c172dd15..2716a4df0f74 100644 --- a/depends/Makefile +++ b/depends/Makefile @@ -309,6 +309,7 @@ $(host_prefix)/toolchain.cmake : toolchain.cmake.in $(host_prefix)/.stamp_$(fina -e 's|@qt_packages@|$(qt_packages_)|' \ -e 's|@qrencode_packages@|$(qrencode_packages_)|' \ -e 's|@zmq_packages@|$(zmq_packages_)|' \ + -e 's|@zstd_packages@|$(zstd_packages_)|' \ -e 's|@wallet_packages@|$(wallet_packages_)|' \ -e 's|@bdb_packages@|$(bdb_packages_)|' \ -e 's|@sqlite_packages@|$(sqlite_packages_)|' \ @@ -317,6 +318,7 @@ $(host_prefix)/toolchain.cmake : toolchain.cmake.in $(host_prefix)/.stamp_$(fina -e 's|@usdt_packages@|$(usdt_packages_)|' \ -e 's|@no_harden@|$(NO_HARDEN)|' \ -e 's|@multiprocess@|$(MULTIPROCESS)|' \ + -e 's|@platform_gui@|$(PLATFORM_GUI)|' \ $< > $@ touch $@ diff --git a/depends/toolchain.cmake.in b/depends/toolchain.cmake.in index c733c81edf77..be07e6583c45 100644 --- a/depends/toolchain.cmake.in +++ b/depends/toolchain.cmake.in @@ -118,6 +118,13 @@ else() set(WITH_ZMQ ON CACHE BOOL "") endif() +set(zstd_packages @zstd_packages@) +if("${zstd_packages}" STREQUAL "") + set(WITH_ZSTD OFF CACHE BOOL "") +else() + set(WITH_ZSTD ON CACHE BOOL "") +endif() + set(wallet_packages @wallet_packages@) if("${wallet_packages}" STREQUAL "") set(ENABLE_WALLET OFF CACHE BOOL "") @@ -166,6 +173,12 @@ else() set(ENABLE_HARDENING ON CACHE BOOL "") endif() +if(NOT "@platform_gui@" STREQUAL "") + set(ENABLE_PLATFORM_GUI ON CACHE BOOL "") +else() + set(ENABLE_PLATFORM_GUI OFF CACHE BOOL "") +endif() + if("@multiprocess@" STREQUAL "1") set(WITH_MULTIPROCESS ON CACHE BOOL "") set(LibmultiprocessNative_DIR "${CMAKE_FIND_ROOT_PATH}/native/lib/cmake/Libmultiprocess" CACHE PATH "") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fcf9a4093192..b26d8edfa9ca 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -45,18 +45,14 @@ endif() message("") message("Configuring secp256k1 subtree...") set(SECP256K1_DISABLE_SHARED ON CACHE BOOL "" FORCE) -set(SECP256K1_ENABLE_MODULE_ECDH OFF CACHE BOOL "" FORCE) +# The ECDH module is required by the wallet's Platform key provider +# (DashPay contact request encryption, wallet/platformkeys.cpp). +set(SECP256K1_ENABLE_MODULE_ECDH ON CACHE BOOL "" FORCE) set(SECP256K1_ENABLE_MODULE_RECOVERY ON CACHE BOOL "" FORCE) set(SECP256K1_BUILD_BENCHMARK OFF CACHE BOOL "" FORCE) set(SECP256K1_BUILD_TESTS ${BUILD_TESTS} CACHE BOOL "" FORCE) set(SECP256K1_BUILD_EXHAUSTIVE_TESTS ${BUILD_TESTS} CACHE BOOL "" FORCE) set(SECP256K1_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) -include(GetTargetInterface) -# -fsanitize and related flags apply to both C++ and C, -# so we can pass them down to libsecp256k1 as CFLAGS. -get_target_interface(core_sanitizer_cxx_flags "" sanitize_interface COMPILE_OPTIONS) -set(SECP256K1_LATE_CFLAGS ${core_sanitizer_cxx_flags} CACHE STRING "" FORCE) -unset(core_sanitizer_cxx_flags) # We want to build libsecp256k1 with the most tested RelWithDebInfo configuration. enable_language(C) foreach(config IN LISTS CMAKE_BUILD_TYPE CMAKE_CONFIGURATION_TYPES) @@ -74,16 +70,9 @@ endif() set(CMAKE_EXPORT_COMPILE_COMMANDS OFF) add_subdirectory(secp256k1) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -string(APPEND CMAKE_C_COMPILE_OBJECT " ${APPEND_CPPFLAGS} ${APPEND_CFLAGS}") - -set(BUILD_BLS_JS_BINDINGS OFF CACHE STRING "" FORCE) -set(BUILD_BLS_PYTHON_BINDINGS OFF CACHE STRING "" FORCE) -set(BUILD_BLS_TESTS OFF CACHE STRING "" FORCE) -set(BUILD_BLS_BENCHMARKS OFF CACHE STRING "" FORCE) -add_subdirectory(dashbls EXCLUDE_FROM_ALL) # Stable, backwards-compatible consensus functionality. -add_library(bitcoin_consensus STATIC EXCLUDE_FROM_ALL +set(consensus_sources arith_uint256.cpp bls/bls.cpp consensus/merkle.cpp @@ -100,16 +89,94 @@ add_library(bitcoin_consensus STATIC EXCLUDE_FROM_ALL util/strencodings.cpp util/string.cpp ) -set_target_properties(bitcoin_consensus PROPERTIES OUTPUT_NAME dashconsensus) +# Internal-only; the installable library below is the public dashconsensus. +add_library(bitcoin_consensus STATIC EXCLUDE_FROM_ALL ${consensus_sources}) target_link_libraries(bitcoin_consensus PRIVATE core_interface bitcoin_crypto - Boost::headers dashbls secp256k1 + $ ) +# Dash still ships the public consensus library that upstream dropped in +# bitcoin#29648, so build and install it here too. It gets its own compilation +# of the consensus and crypto sources because the public library is built +# without the optimised SHA-256 backends; see libdashconsensus_la in +# src/Makefile.am. This has to stay below add_subdirectory(crypto), which is +# what sets crypto_base_sources and crypto_sph_sources in this scope. +if(BUILD_CONSENSUS_LIB) + add_library(dashconsensus SHARED + ${consensus_sources} + ${crypto_base_sources} + ${crypto_sph_sources} + ) + target_compile_definitions(dashconsensus + PRIVATE + BUILD_BITCOIN_INTERNAL + DISABLE_OPTIMIZED_SHA256 + SPH_SMALL_FOOTPRINT_CUBEHASH=1 + SPH_SMALL_FOOTPRINT_JH=1 + ) + target_link_libraries(dashconsensus + PRIVATE + core_interface + dashbls + secp256k1 + ) + # libdashconsensus_la carries no -version-info, so libtool builds it as + # 0:0:0 and installs libdashconsensus.so.0.0.0 with an .so.0 soname. Match + # that here, otherwise consumers linked against an Autotools install cannot + # resolve DT_NEEDED against a CMake one. + set_target_properties(dashconsensus PROPERTIES VERSION 0.0.0 SOVERSION 0) + if(MINGW) + # libtool includes the ABI version in the DLL name, but not its import library. + set_target_properties(dashconsensus PROPERTIES RUNTIME_OUTPUT_NAME dashconsensus-0) + endif() + if(APPLE) + # libtool derives the Mach-O versions as (current - age + 1), so 0:0:0 + # yields 1.0.0 where CMake would otherwise take them from the properties + # above and emit 0.0.0. dyld refuses a library whose compatibility version + # is below the one recorded in the consumer, so set them explicitly. + set_target_properties(dashconsensus PROPERTIES + MACHO_COMPATIBILITY_VERSION 1.0.0 + MACHO_CURRENT_VERSION 1.0.0 + MACOSX_RPATH OFF + INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}" + ) + endif() + install(TARGETS dashconsensus + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) + # Automake's include_HEADERS strips the directory, installing the header + # flat as /bitcoinconsensus.h, which is the layout the + # pkg-config file's "Cflags: -I${includedir}" expects. Match it. + install(FILES script/bitcoinconsensus.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + ) + set(prefix ${CMAKE_INSTALL_PREFIX}) + set(exec_prefix "\${prefix}") + if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}") + set(libdir "${CMAKE_INSTALL_LIBDIR}") + else() + set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") + endif() + if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}") + set(includedir "${CMAKE_INSTALL_INCLUDEDIR}") + else() + set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") + endif() + configure_file(${PROJECT_SOURCE_DIR}/libdashconsensus.pc.in + ${PROJECT_BINARY_DIR}/libdashconsensus.pc @ONLY + ) + install(FILES ${PROJECT_BINARY_DIR}/libdashconsensus.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig + ) +endif() + if(WITH_ZMQ) add_subdirectory(zmq) endif() @@ -122,8 +189,14 @@ add_library(bitcoin_common STATIC EXCLUDE_FROM_ALL chainparams.cpp chainparamsbase.cpp coins.cpp + common/args.cpp common/bloom.cpp + common/config.cpp + common/init.cpp + common/interfaces.cpp common/run_command.cpp + common/settings.cpp + common/system.cpp common/url.cpp compressor.cpp core_read.cpp @@ -134,8 +207,8 @@ add_library(bitcoin_common STATIC EXCLUDE_FROM_ALL evo/providertx_util.cpp external_signer.cpp governance/common.cpp - governance/core_write.cpp init/common.cpp + kernel/chainparams.cpp key.cpp key_io.cpp llmq/core_write.cpp @@ -167,11 +240,10 @@ target_link_libraries(bitcoin_common core_interface bitcoin_consensus bitcoin_util - leveldb univalue dashbls secp256k1 - Boost::headers + $ $ $<$:ws2_32> ) @@ -187,13 +259,14 @@ if(ENABLE_WALLET) init/bitcoin-wallet.cpp wallet/wallettool.cpp ) - add_windows_resources(bitcoin-wallet bitcoin-wallet-res.rc) + add_windows_resources(bitcoin-wallet dash-wallet-res.rc) target_link_libraries(bitcoin-wallet core_interface bitcoin_wallet bitcoin_common bitcoin_util univalue + dashbls Boost::headers ) set_target_properties(bitcoin-wallet PROPERTIES OUTPUT_NAME dash-wallet) @@ -221,7 +294,6 @@ add_library(bitcoin_node STATIC EXCLUDE_FROM_ALL chainlock/signing.cpp coinjoin/coinjoin.cpp coinjoin/server.cpp - coinjoin/walletman.cpp chain.cpp consensus/tx_verify.cpp dbwrapper.cpp @@ -230,19 +302,21 @@ add_library(bitcoin_node STATIC EXCLUDE_FROM_ALL evo/assetlocktx.cpp evo/cbtx.cpp evo/creditpool.cpp - evo/chainhelper.cpp evo/deterministicmns.cpp evo/dmnstate.cpp evo/evodb.cpp evo/mnauth.cpp evo/mnhftx.cpp evo/providertx.cpp + evo/providertx_service.cpp evo/simplifiedmns.cpp evo/smldiff.cpp + evo/snapshot.cpp evo/specialtx.cpp evo/specialtx_filter.cpp evo/specialtxman.cpp flatfile.cpp + governance/collateral.cpp governance/governance.cpp governance/net_governance.cpp governance/object.cpp @@ -259,11 +333,19 @@ add_library(bitcoin_node STATIC EXCLUDE_FROM_ALL index/base.cpp index/blockfilterindex.cpp index/coinstatsindex.cpp + index/govcollateralindex.cpp index/spentindex.cpp index/timestampindex.cpp index/txindex.cpp init.cpp + kernel/chain.cpp + kernel/checks.cpp kernel/coinstats.cpp + kernel/context.cpp + kernel/cs_main.cpp + kernel/disconnected_transactions.cpp + kernel/mempool_persist.cpp + kernel/mempool_removal_reason.cpp instantsend/db.cpp instantsend/instantsend.cpp instantsend/lock.cpp @@ -281,7 +363,8 @@ add_library(bitcoin_node STATIC EXCLUDE_FROM_ALL llmq/net_quorum.cpp llmq/net_signing.cpp llmq/observer.cpp - llmq/options.cpp + llmq/options_args.cpp + llmq/quorumproofs.cpp llmq/quorums.cpp llmq/quorumsman.cpp llmq/signhash.cpp @@ -298,23 +381,34 @@ add_library(bitcoin_node STATIC EXCLUDE_FROM_ALL netfulfilledman.cpp net_processing.cpp netgroup.cpp + node/blockmanager_args.cpp node/blockstorage.cpp node/caches.cpp node/chainstate.cpp + node/chainstatemanager_args.cpp node/coin.cpp + node/coins_view_args.cpp node/connection_types.cpp node/context.cpp + node/database_args.cpp node/eviction.cpp node/interface_ui.cpp node/interfaces.cpp + node/kernel_notifications.cpp + node/mempool_args.cpp + node/mempool_persist_args.cpp node/miner.cpp node/minisketchwrapper.cpp + node/peerman_args.cpp node/psbt.cpp node/sync_manager.cpp node/transaction.cpp node/txreconciliation.cpp + node/utxo_snapshot.cpp + node/validation_cache_args.cpp noui.cpp policy/fees.cpp + policy/fees_args.cpp policy/packages.cpp policy/settings.cpp pow.cpp @@ -322,9 +416,9 @@ add_library(bitcoin_node STATIC EXCLUDE_FROM_ALL rpc/blockchain.cpp rpc/coinjoin.cpp rpc/evo.cpp - rpc/evo_util.cpp rpc/fees.cpp rpc/governance.cpp + rpc/json_help.cpp rpc/masternode.cpp rpc/mempool.cpp rpc/mining.cpp @@ -347,6 +441,7 @@ add_library(bitcoin_node STATIC EXCLUDE_FROM_ALL txdb.cpp txmempool.cpp txorphanage.cpp + txrequest.cpp validation.cpp validationinterface.cpp versionbits.cpp @@ -362,7 +457,7 @@ target_link_libraries(bitcoin_node leveldb minisketch univalue - Boost::headers + $ $ $ $ @@ -378,10 +473,11 @@ if(BUILD_DAEMON) bitcoind.cpp init/bitcoind.cpp ) - add_windows_resources(bitcoind bitcoind-res.rc) + add_windows_resources(bitcoind dashd-res.rc) target_link_libraries(bitcoind core_interface bitcoin_node + dashbls $ ) set_target_properties(bitcoind PROPERTIES OUTPUT_NAME dashd) @@ -396,8 +492,10 @@ if(WITH_MULTIPROCESS) core_interface bitcoin_node bitcoin_ipc + dashbls $ ) + set_target_properties(bitcoin-node PROPERTIES OUTPUT_NAME dash-node) list(APPEND installable_targets bitcoin-node) endif() @@ -416,7 +514,7 @@ target_link_libraries(bitcoin_cli # Bitcoin Core RPC client if(BUILD_CLI) add_executable(bitcoin-cli bitcoin-cli.cpp) - add_windows_resources(bitcoin-cli bitcoin-cli-res.rc) + add_windows_resources(bitcoin-cli dash-cli-res.rc) target_link_libraries(bitcoin-cli core_interface bitcoin_cli @@ -431,7 +529,7 @@ endif() if(BUILD_TX) add_executable(bitcoin-tx bitcoin-tx.cpp) - add_windows_resources(bitcoin-tx bitcoin-tx-res.rc) + add_windows_resources(bitcoin-tx dash-tx-res.rc) target_link_libraries(bitcoin-tx core_interface bitcoin_common @@ -461,11 +559,8 @@ if(BUILD_GUI) endif() -if(BUILD_KERNEL_LIB AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/kernel/bitcoinkernel.cpp) - add_subdirectory(kernel) -endif() - if(BUILD_UTIL_CHAINSTATE) + add_subdirectory(kernel) add_executable(bitcoin-chainstate bitcoin-chainstate.cpp ) @@ -481,16 +576,10 @@ if(BUILD_UTIL_CHAINSTATE) target_link_libraries(bitcoin-chainstate PRIVATE core_interface - bitcoin_common - bitcoin_node - bitcoin_util - Boost::headers - dashbls - leveldb - univalue - $ + bitcoinkernel ) set_target_properties(bitcoin-chainstate PROPERTIES OUTPUT_NAME dash-chainstate) + list(APPEND installable_targets bitcoin-chainstate) endif() diff --git a/src/bench/CMakeLists.txt b/src/bench/CMakeLists.txt index fb8154e11671..8ce707bd35e7 100644 --- a/src/bench/CMakeLists.txt +++ b/src/bench/CMakeLists.txt @@ -20,11 +20,14 @@ add_executable(bench_bitcoin bls_dkg.cpp bls_pubkey_agg.cpp block_assemble.cpp + blockfilter_index.cpp ccoins_caching.cpp chacha20.cpp checkblock.cpp checkqueue.cpp + disconnected_transactions.cpp crypto_hash.cpp + descriptors.cpp duplicate_inputs.cpp ecdsa.cpp ellswift.cpp @@ -37,6 +40,7 @@ add_executable(bench_bitcoin mempool_eviction.cpp mempool_stress.cpp merkle_root.cpp + net_processing.cpp peer_eviction.cpp poly1305.cpp pool.cpp @@ -45,10 +49,12 @@ add_executable(bench_bitcoin rollingbloom.cpp rpc_blockchain.cpp rpc_mempool.cpp + streams_findbyte.cpp strencodings.cpp string_cast.cpp util_time.cpp verify_script.cpp + xor.cpp ) set_target_properties(bench_bitcoin PROPERTIES OUTPUT_NAME bench_dash) @@ -67,6 +73,7 @@ if(ENABLE_WALLET) coin_selection.cpp wallet_balance.cpp wallet_create.cpp + wallet_create_tx.cpp wallet_loading.cpp ) target_link_libraries(bench_bitcoin bitcoin_wallet) diff --git a/src/crypto/CMakeLists.txt b/src/crypto/CMakeLists.txt index b0c2762bc53f..471553daed1b 100644 --- a/src/crypto/CMakeLists.txt +++ b/src/crypto/CMakeLists.txt @@ -2,7 +2,7 @@ # Distributed under the MIT software license, see the accompanying # file COPYING or https://opensource.org/license/mit/. -add_library(bitcoin_crypto STATIC EXCLUDE_FROM_ALL +set(crypto_base_sources aes.cpp chacha20.cpp chacha20poly1305.cpp @@ -19,21 +19,9 @@ add_library(bitcoin_crypto STATIC EXCLUDE_FROM_ALL sha3.cpp sha512.cpp siphash.cpp - x11/aes.cpp - x11/blake.c - x11/bmw.c - x11/cubehash.c - x11/dispatch.cpp - x11/echo.cpp - x11/groestl.c - x11/jh.c - x11/keccak.c - x11/luffa.c - x11/shavite.cpp - x11/simd.c - x11/skein.c ../support/cleanse.cpp ) +add_library(bitcoin_crypto STATIC EXCLUDE_FROM_ALL ${crypto_base_sources}) target_link_libraries(bitcoin_crypto PRIVATE @@ -80,9 +68,88 @@ if(HAVE_ARM_SHANI) target_link_libraries(bitcoin_crypto PRIVATE bitcoin_crypto_arm_shani) endif() -add_library(bitcoin_crypto_sph INTERFACE) -target_compile_definitions(bitcoin_crypto_sph INTERFACE - SPH_SMALL_FOOTPRINT_CUBEHASH=1 - SPH_SMALL_FOOTPRINT_JH=1 +# The sphlib sources sit on the X11 proof-of-work path, so Autotools builds +# them as their own library with -O3 (SPHLIB_FLAGS in configure.ac). Mirror +# that here instead of letting them inherit the default optimisation level. +set(crypto_sph_sources + x11/aes.cpp + x11/blake.c + x11/bmw.c + x11/cubehash.c + x11/dispatch.cpp + x11/echo.cpp + x11/groestl.c + x11/jh.c + x11/keccak.c + x11/luffa.c + x11/shavite.cpp + x11/simd.c + x11/skein.c ) +add_library(bitcoin_crypto_sph STATIC EXCLUDE_FROM_ALL ${crypto_sph_sources}) +target_compile_definitions(bitcoin_crypto_sph + PRIVATE + SPH_SMALL_FOOTPRINT_CUBEHASH=1 + SPH_SMALL_FOOTPRINT_JH=1 +) +if(NOT MSVC) + target_compile_options(bitcoin_crypto_sph PRIVATE $<$>:-O3>) +endif() +target_link_libraries(bitcoin_crypto_sph PRIVATE core_interface) target_link_libraries(bitcoin_crypto PRIVATE bitcoin_crypto_sph) + +# X11 hashing backends. The generic implementations in bitcoin_crypto_sph are +# always built; these libraries provide the SIMD variants that x11/dispatch.cpp +# selects at run time. Keep the definitions in sync with cmake/bitcoin-config.h.in, +# which is what dispatch.cpp checks when deciding whether a backend exists. +# They link into bitcoin_crypto_sph rather than bitcoin_crypto because that is +# where dispatch.cpp lives, and a static archive has to follow the objects that +# reference it on the linker command line. +if(HAVE_SSSE3) + add_library(bitcoin_crypto_x11_ssse3 STATIC EXCLUDE_FROM_ALL + x11/ssse3/echo.cpp + ) + target_compile_definitions(bitcoin_crypto_x11_ssse3 PUBLIC ENABLE_SSSE3) + target_compile_options(bitcoin_crypto_x11_ssse3 PRIVATE ${SSSE3_CXXFLAGS}) + target_link_libraries(bitcoin_crypto_x11_ssse3 PRIVATE core_interface) + target_link_libraries(bitcoin_crypto_sph PRIVATE bitcoin_crypto_x11_ssse3) +endif() + +if(HAVE_X86_AESNI) + add_library(bitcoin_crypto_x11_x86_aesni STATIC EXCLUDE_FROM_ALL + x11/x86_aesni/echo.cpp + x11/x86_aesni/shavite.cpp + ) + target_compile_definitions(bitcoin_crypto_x11_x86_aesni PUBLIC ENABLE_SSE41 ENABLE_X86_AESNI) + target_compile_options(bitcoin_crypto_x11_x86_aesni PRIVATE ${X86_AESNI_CXXFLAGS}) + target_link_libraries(bitcoin_crypto_x11_x86_aesni PRIVATE core_interface) + target_link_libraries(bitcoin_crypto_sph PRIVATE bitcoin_crypto_x11_x86_aesni) +endif() + +if(HAVE_ARM_AES) + add_library(bitcoin_crypto_x11_arm_aes STATIC EXCLUDE_FROM_ALL + x11/arm_crypto/echo.cpp + x11/arm_crypto/shavite.cpp + ) + target_compile_definitions(bitcoin_crypto_x11_arm_aes PUBLIC ENABLE_ARM_AES) + target_compile_options(bitcoin_crypto_x11_arm_aes PRIVATE ${ARM_AES_CXXFLAGS}) + target_link_libraries(bitcoin_crypto_x11_arm_aes PRIVATE core_interface) + target_link_libraries(bitcoin_crypto_sph PRIVATE bitcoin_crypto_x11_arm_aes) +endif() + +if(HAVE_ARM_NEON) + add_library(bitcoin_crypto_x11_arm_neon STATIC EXCLUDE_FROM_ALL + x11/arm_neon/echo.cpp + ) + target_compile_definitions(bitcoin_crypto_x11_arm_neon PUBLIC ENABLE_ARM_NEON) + target_compile_options(bitcoin_crypto_x11_arm_neon PRIVATE ${ARM_NEON_CXXFLAGS}) + target_link_libraries(bitcoin_crypto_x11_arm_neon PRIVATE core_interface) + target_link_libraries(bitcoin_crypto_sph PRIVATE bitcoin_crypto_x11_arm_neon) +endif() + +# The public dashconsensus library compiles these again with its own +# definitions, so hand the lists up with absolute paths. +list(TRANSFORM crypto_base_sources PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/") +list(TRANSFORM crypto_sph_sources PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/") +set(crypto_base_sources ${crypto_base_sources} PARENT_SCOPE) +set(crypto_sph_sources ${crypto_sph_sources} PARENT_SCOPE) diff --git a/src/kernel/CMakeLists.txt b/src/kernel/CMakeLists.txt index ffb1a857ac17..7ab5e57fef2b 100644 --- a/src/kernel/CMakeLists.txt +++ b/src/kernel/CMakeLists.txt @@ -1,24 +1,28 @@ -# Copyright (c) 2024-present The Bitcoin Core developers +# Copyright (c) 2026 The Dash Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or https://opensource.org/license/mit/. -# TODO: libbitcoinkernel is a work in progress consensus engine -# library, as more and more modules are decoupled from the -# consensus engine, this list will shrink to only those -# which are absolutely necessary. -add_library(bitcoinkernel +# Match libdashkernel_la_SOURCES in src/Makefile.am. The kernel supplies its +# own globals and helpers instead of pulling in the full node and RPC layers. +add_library(bitcoinkernel STATIC EXCLUDE_FROM_ALL bitcoinkernel.cpp - chain.cpp - checks.cpp - chainparams.cpp - coinstats.cpp - context.cpp - cs_main.cpp - disconnected_transactions.cpp - mempool_removal_reason.cpp ../arith_uint256.cpp + ../base58.cpp + ../batchedlogger.cpp + ../bech32.cpp + ../blockfilter.cpp + ../bls/bls.cpp + ../bls/bls_worker.cpp ../chain.cpp + ../chainlock/chainlock.cpp + ../chainlock/clsig.cpp + ../chainparams.cpp + ../chainparamsbase.cpp ../coins.cpp + ../common/args.cpp + ../common/bloom.cpp + ../common/config.cpp + ../common/settings.cpp ../compressor.cpp ../consensus/merkle.cpp ../consensus/tx_check.cpp @@ -27,80 +31,129 @@ add_library(bitcoinkernel ../dbwrapper.cpp ../deploymentinfo.cpp ../deploymentstatus.cpp + ../evo/assetlocktx.cpp + ../evo/cbtx.cpp + ../evo/creditpool.cpp + ../evo/deterministicmns.cpp + ../evo/dmnstate.cpp + ../evo/evodb.cpp + ../evo/mnhftx.cpp + ../evo/netinfo.cpp + ../evo/providertx.cpp + ../evo/providertx_util.cpp + ../evo/simplifiedmns.cpp + ../evo/smldiff.cpp + ../evo/specialtx.cpp + ../evo/specialtx_filter.cpp + ../evo/specialtxman.cpp ../flatfile.cpp + ../gsl/assert.cpp ../hash.cpp + ../index/addressindex_util.cpp + ../instantsend/db.cpp + ../instantsend/instantsend.cpp + ../instantsend/lock.cpp + chain.cpp + chainparams.cpp + checks.cpp + coinstats.cpp + context.cpp + cs_main.cpp + disconnected_transactions.cpp + mempool_persist.cpp + mempool_removal_reason.cpp + ../key.cpp + ../key_io.cpp + ../llmq/blockprocessor.cpp + ../llmq/commitment.cpp + ../llmq/context.cpp + ../llmq/dkgsessionmgr.cpp + ../llmq/quorums.cpp + ../llmq/quorumsman.cpp + ../llmq/signhash.cpp + ../llmq/signing.cpp + ../llmq/snapshot.cpp + ../llmq/utils.cpp ../logging.cpp + ../masternode/meta.cpp + ../masternode/payments.cpp + ../merkleblock.cpp + ../messagesigner.cpp + ../netaddress.cpp + ../netbase.cpp ../node/blockstorage.cpp ../node/chainstate.cpp + ../node/interface_ui.cpp ../node/utxo_snapshot.cpp ../policy/feerate.cpp + ../policy/fees.cpp ../policy/packages.cpp ../policy/policy.cpp - ../policy/rbf.cpp ../policy/settings.cpp - ../policy/truc_policy.cpp ../pow.cpp ../primitives/block.cpp ../primitives/transaction.cpp + ../protocol.cpp ../pubkey.cpp ../random.cpp ../randomenv.cpp + ../saltedhasher.cpp + ../scheduler.cpp ../script/interpreter.cpp ../script/script.cpp ../script/script_error.cpp ../script/sigcache.cpp - ../script/solver.cpp - ../signet.cpp + ../script/standard.cpp + ../shutdown.cpp ../streams.cpp + ../spork.cpp + ../support/cleanse.cpp ../support/lockedpool.cpp ../sync.cpp + ../timedata.cpp ../txdb.cpp ../txmempool.cpp ../uint256.cpp + ../util/batchpriority.cpp + ../util/bytevectorhash.cpp ../util/chaintype.cpp ../util/check.cpp - ../util/feefrac.cpp + ../util/exception.cpp ../util/fs.cpp ../util/fs_helpers.cpp ../util/hasher.cpp + ../util/message.cpp ../util/moneystr.cpp - ../util/rbf.cpp + ../util/ranges_set.cpp ../util/serfloat.cpp - ../util/signalinterrupt.cpp + ../util/sock.cpp ../util/strencodings.cpp ../util/string.cpp ../util/syserror.cpp + ../util/thread.cpp + ../util/threadinterrupt.cpp ../util/threadnames.cpp ../util/time.cpp ../util/tokenpipe.cpp + ../util/zstd.cpp ../validation.cpp ../validationinterface.cpp ../versionbits.cpp + ../warnings.cpp + $ ) +target_compile_definitions(bitcoinkernel PRIVATE BUILD_BITCOIN_INTERNAL) target_link_libraries(bitcoinkernel PRIVATE core_interface - bitcoin_clientversion bitcoin_crypto - leveldb - secp256k1 + $ + $<$:ws2_32> PUBLIC + $ Boost::headers -) - -# libbitcoinkernel requires default symbol visibility, explicitly -# specify that here so that things still work even when user -# configures with -DREDUCE_EXPORTS=ON -# -# Note this is a quick hack that will be removed as we -# incrementally define what to export from the library. -set_target_properties(bitcoinkernel PROPERTIES - CXX_VISIBILITY_PRESET default -) - -include(GNUInstallDirs) -install(TARGETS bitcoinkernel - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + dashbls + leveldb + univalue + secp256k1 ) diff --git a/src/qt/CMakeLists.txt b/src/qt/CMakeLists.txt index cf4cd71cdd58..86a3bb07c799 100644 --- a/src/qt/CMakeLists.txt +++ b/src/qt/CMakeLists.txt @@ -91,6 +91,8 @@ add_library(bitcoinqt STATIC EXCLUDE_FROM_ALL $<$:macnotificationhandler.mm> $<$:macos_appnap.h> $<$:macos_appnap.mm> + masternodemodel.cpp + masternodemodel.h modaloverlay.cpp modaloverlay.h networkstyle.cpp @@ -111,6 +113,8 @@ add_library(bitcoinqt STATIC EXCLUDE_FROM_ALL proposalinfo.h proposalmodel.cpp proposalmodel.h + proposalvotedialog.cpp + proposalvotedialog.h qvalidatedlineedit.cpp qvalidatedlineedit.h qvaluecombobox.cpp @@ -181,12 +185,20 @@ if(ENABLE_WALLET) descriptiondialog.h editaddressdialog.cpp editaddressdialog.h + masternodedialogs.cpp + masternodedialogs.h masternodelist.cpp masternodelist.h - masternodemodel.cpp - masternodemodel.h + masternodeoperationrunner.cpp + masternodeoperationrunner.h + masternodewidgets.cpp + masternodewidgets.h + masternodewizard.cpp + masternodewizard.h mnemonicverificationdialog.cpp mnemonicverificationdialog.h + mnsharesession.cpp + mnsharesession.h openuridialog.cpp openuridialog.h overviewpage.cpp @@ -215,6 +227,12 @@ if(ENABLE_WALLET) sendcoinsdialog.h sendcoinsentry.cpp sendcoinsentry.h + sharedmncreatedialog.cpp + sharedmncreatedialog.h + sharedmndialogs.cpp + sharedmndialogs.h + sharedmnwidgets.cpp + sharedmnwidgets.h signverifymessagedialog.cpp signverifymessagedialog.h transactiondesc.cpp @@ -251,6 +269,10 @@ if(WITH_DBUS) target_link_libraries(bitcoinqt PRIVATE Qt5::DBus) endif() +if(ENABLE_PLATFORM_GUI) + target_link_libraries(bitcoinqt PRIVATE PkgConfig::dash_sdk_cxx) +endif() + if(qt_lib_type STREQUAL "STATIC_LIBRARY") # We want to define static plugins to link ourselves, thus preventing # automatic linking against a "sane" set of default static plugins. @@ -271,6 +293,7 @@ target_link_libraries(bitcoin-qt core_interface bitcoinqt bitcoin_node + dashbls ) import_plugins(bitcoin-qt) @@ -291,6 +314,7 @@ if(WITH_MULTIPROCESS) bitcoin_ipc dashbls ) + set_target_properties(bitcoin-gui PROPERTIES OUTPUT_NAME dash-gui) import_plugins(bitcoin-gui) list(APPEND installable_targets bitcoin-gui) if(WIN32) diff --git a/src/qt/test/CMakeLists.txt b/src/qt/test/CMakeLists.txt index 582ed7146639..cb97e7db2a5d 100644 --- a/src/qt/test/CMakeLists.txt +++ b/src/qt/test/CMakeLists.txt @@ -5,18 +5,26 @@ add_executable(test_bitcoin-qt apptests.cpp optiontests.cpp + proposalvotetests.cpp rpcnestedtests.cpp test_main.cpp + trafficgraphdatatests.cpp uritests.cpp util.cpp ../../init/bitcoin-qt.cpp ) +set_target_properties(test_bitcoin-qt PROPERTIES OUTPUT_NAME test_dash-qt) + target_link_libraries(test_bitcoin-qt core_interface bitcoinqt test_util bitcoin_node + # The Dash-specific headers reachable from these tests include dbwrapper.h, + # so the LevelDB headers have to be on the include path. + leveldb + dashbls Boost::headers Qt5::Test ) @@ -27,19 +35,20 @@ if(ENABLE_WALLET) target_sources(test_bitcoin-qt PRIVATE addressbooktests.cpp + coincontroltreewidgettests.cpp + masternodemaintenancetests.cpp + masternodetestutil.cpp + masternodewidgettests.cpp + mnsharesessiontests.cpp + providertransactiontests.cpp + sharedmnwalkthroughtests.cpp + sharedmnwidgettests.cpp + sharedmnwizardtests.cpp wallettests.cpp ../../wallet/test/wallet_test_fixture.cpp ) endif() -if(NOT QT_IS_STATIC) - add_custom_command( - TARGET test_bitcoin-qt POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different $>> $/plugins/platforms - VERBATIM - ) -endif() - add_test(NAME test_bitcoin-qt COMMAND test_bitcoin-qt ) diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt index a5d51f903213..5d495f2984a3 100644 --- a/src/test/CMakeLists.txt +++ b/src/test/CMakeLists.txt @@ -46,6 +46,7 @@ add_executable(test_bitcoin base32_tests.cpp base58_tests.cpp base64_tests.cpp + baseindex_tests.cpp bech32_tests.cpp bip32_tests.cpp bip324_tests.cpp @@ -62,8 +63,12 @@ add_executable(test_bitcoin cachemultimap_tests.cpp checkdatasig_tests.cpp checkqueue_tests.cpp + coinjoin_dstxmanager_tests.cpp + coinjoin_inouts_tests.cpp + coinjoin_queue_tests.cpp coins_tests.cpp coinstatsindex_tests.cpp + common_url_tests.cpp compilerbug_tests.cpp compress_tests.cpp crypto_tests.cpp @@ -72,36 +77,53 @@ add_executable(test_bitcoin denialofservice_tests.cpp descriptor_tests.cpp dip0020opcodes_tests.cpp + dip14_tests.cpp + disconnected_transactions.cpp dynamic_activation_thresholds_tests.cpp evo_assetlocks_tests.cpp evo_cbtx_tests.cpp + evo_db_tests.cpp evo_deterministicmns_tests.cpp evo_islock_tests.cpp + evo_mnauth_tests.cpp evo_mnhf_tests.cpp evo_netinfo_tests.cpp + evo_sharedmn_tests.cpp evo_simplifiedmns_tests.cpp + evo_snapshot_tests.cpp evo_trivialvalidation.cpp evo_utils_tests.cpp flatfile_tests.cpp fs_tests.cpp getarg_tests.cpp + governance_collateral_tests.cpp + governance_inv_tests.cpp governance_superblock_tests.cpp governance_validators_tests.cpp + governance_vote_processing_tests.cpp + governance_vote_sync_tests.cpp + governance_vote_wire_tests.cpp hash_tests.cpp httpserver_tests.cpp i2p_tests.cpp + index_migration_tests.cpp interfaces_tests.cpp key_io_tests.cpp key_tests.cpp limitedmap_tests.cpp + llmq_blockprocessor_tests.cpp llmq_chainlock_tests.cpp llmq_commitment_tests.cpp llmq_dkg_tests.cpp llmq_hash_tests.cpp + llmq_invalid_type_tests.cpp llmq_params_tests.cpp + llmq_qgetdata_tests.cpp llmq_snapshot_tests.cpp llmq_utils_tests.cpp logging_tests.cpp + masternode_params_tests.cpp + masternode_payments_tests.cpp mempool_tests.cpp merkle_tests.cpp merkleblock_tests.cpp @@ -114,12 +136,14 @@ add_executable(test_bitcoin net_tests.cpp netbase_tests.cpp orphanage_tests.cpp + peerman_tests.cpp pmt_tests.cpp policyestimator_tests.cpp pool_tests.cpp pow_tests.cpp prevector_tests.cpp raii_event_tests.cpp + quorum_proofs_tests.cpp random_tests.cpp ratecheck_tests.cpp rest_tests.cpp @@ -143,6 +167,7 @@ add_executable(test_bitcoin skiplist_tests.cpp sock_tests.cpp span_tests.cpp + spork_tests.cpp streams_tests.cpp subsidy_tests.cpp sync_tests.cpp @@ -150,12 +175,15 @@ add_executable(test_bitcoin timedata_tests.cpp torcontrol_tests.cpp transaction_tests.cpp + translation_tests.cpp txindex_tests.cpp txpackage_tests.cpp txreconciliation_tests.cpp + txrequest_tests.cpp txvalidation_tests.cpp txvalidationcache_tests.cpp uint256_tests.cpp + unordered_lru_cache_tests.cpp util_tests.cpp util_threadnames_tests.cpp validation_block_tests.cpp @@ -180,33 +208,17 @@ target_link_libraries(test_bitcoin secp256k1 Boost::headers $ + $ ) if(ENABLE_WALLET) add_subdirectory(${PROJECT_SOURCE_DIR}/src/wallet/test wallet) endif() -if(WITH_MULTIPROCESS) - add_library(bitcoin_ipc_test STATIC EXCLUDE_FROM_ALL - ipc_test.cpp - ) - - target_capnp_sources(bitcoin_ipc_test ${PROJECT_SOURCE_DIR} - ipc_test.capnp - ) - - target_link_libraries(bitcoin_ipc_test - PRIVATE - core_interface - univalue - ) - - target_sources(test_bitcoin - PRIVATE - ipc_tests.cpp - ) - target_link_libraries(test_bitcoin bitcoin_ipc_test) -endif() +# NOTE: Upstream also builds an IPC test library here from ipc_test.cpp, +# ipc_test.capnp and ipc_tests.cpp. Dash has not backported those sources +# (bitcoin#28921), and referencing them makes -DWITH_MULTIPROCESS=ON fail +# during generation. Restore this block along with the test sources. function(add_boost_test source_file) if(NOT EXISTS ${source_file}) diff --git a/src/test/fuzz/CMakeLists.txt b/src/test/fuzz/CMakeLists.txt index 62259888af39..7baca6d0431e 100644 --- a/src/test/fuzz/CMakeLists.txt +++ b/src/test/fuzz/CMakeLists.txt @@ -14,6 +14,7 @@ add_executable(fuzz base_encode_decode.cpp bech32.cpp bip324.cpp + bitset.cpp block.cpp block_header.cpp blockfilter.cpp @@ -36,6 +37,7 @@ add_executable(fuzz decode_tx.cpp descriptor_parse.cpp deserialize.cpp + dkg_message_framing.cpp eval_script.cpp fee_rate.cpp fees.cpp @@ -67,6 +69,7 @@ add_executable(fuzz parse_numbers.cpp parse_script.cpp parse_univalue.cpp + partially_downloaded_block.cpp policy_estimator.cpp policy_estimator_io.cpp poolresource.cpp @@ -106,16 +109,21 @@ add_executable(fuzz tx_out.cpp tx_pool.cpp txorphan.cpp + txrequest.cpp utxo_snapshot.cpp utxo_total_supply.cpp validation_load_mempool.cpp + vecdeque.cpp versionbits.cpp ) target_link_libraries(fuzz core_interface test_fuzz + test_util bitcoin_cli + bitcoin_node bitcoin_common + dashbls minisketch leveldb univalue @@ -124,6 +132,11 @@ target_link_libraries(fuzz $ ) +# When the fuzzing engine does not supply main(), fuzz.cpp has to. +if(NOT FUZZ_BINARY_LINKS_WITHOUT_MAIN_FUNCTION) + target_compile_definitions(fuzz PRIVATE PROVIDE_FUZZ_MAIN_FUNCTION) +endif() + if(ENABLE_WALLET) add_subdirectory(${PROJECT_SOURCE_DIR}/src/wallet/test/fuzz wallet) endif() diff --git a/src/test/fuzz/util/CMakeLists.txt b/src/test/fuzz/util/CMakeLists.txt index c45acba82e9a..93aace474727 100644 --- a/src/test/fuzz/util/CMakeLists.txt +++ b/src/test/fuzz/util/CMakeLists.txt @@ -3,6 +3,8 @@ # file COPYING or https://opensource.org/license/mit/. add_library(test_fuzz STATIC EXCLUDE_FROM_ALL + descriptor.cpp + mempool.cpp net.cpp ../fuzz.cpp ../util.cpp diff --git a/src/test/util/CMakeLists.txt b/src/test/util/CMakeLists.txt index 86b76f8a50e2..2bb9daee5e64 100644 --- a/src/test/util/CMakeLists.txt +++ b/src/test/util/CMakeLists.txt @@ -8,24 +8,24 @@ add_library(test_util STATIC EXCLUDE_FROM_ALL index.cpp json.cpp logging.cpp + masternode.cpp mining.cpp net.cpp + random.cpp script.cpp setup_common.cpp str.cpp transaction_utils.cpp txmempool.cpp validation.cpp - $<$:wallet.cpp> $<$:${PROJECT_SOURCE_DIR}/src/wallet/test/util.cpp> ) target_link_libraries(test_util PRIVATE core_interface - Boost::headers + $ dashbls - leveldb PUBLIC univalue ) diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index 783e6a7a6c74..d534eb01e044 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -4,25 +4,27 @@ add_library(bitcoin_util STATIC EXCLUDE_FROM_ALL asmap.cpp + batchpriority.cpp bip32.cpp bytevectorhash.cpp + chaintype.cpp check.cpp edge.cpp error.cpp + exception.cpp fees.cpp - getuniquepath.cpp + fs.cpp + fs_helpers.cpp hasher.cpp message.cpp moneystr.cpp readwritefile.cpp ranges_set.cpp serfloat.cpp - settings.cpp sock.cpp spanparsing.cpp strencodings.cpp string.cpp - system.cpp syserror.cpp thread.cpp threadinterrupt.cpp @@ -30,19 +32,17 @@ add_library(bitcoin_util STATIC EXCLUDE_FROM_ALL time.cpp tokenpipe.cpp wpipe.cpp + zstd.cpp ../bls/bls_ies.cpp ../bls/bls_worker.cpp ../coinjoin/common.cpp ../coinjoin/options.cpp - ../fs.cpp - ../interfaces/echo.cpp - ../interfaces/handler.cpp - ../interfaces/init.cpp ../logging.cpp ../messagesigner.cpp ../random.cpp ../randomenv.cpp ../stacktraces.cpp + ../streams.cpp ../support/cleanse.cpp ../support/lockedpool.cpp ../sync.cpp @@ -51,10 +51,13 @@ add_library(bitcoin_util STATIC EXCLUDE_FROM_ALL target_link_libraries(bitcoin_util PRIVATE core_interface + $ bitcoin_clientversion bitcoin_crypto - Boost::headers + $ dashbls univalue $<$:ws2_32> + PUBLIC + $ ) diff --git a/src/wallet/CMakeLists.txt b/src/wallet/CMakeLists.txt index a6f2a2596989..d570742596fd 100644 --- a/src/wallet/CMakeLists.txt +++ b/src/wallet/CMakeLists.txt @@ -7,6 +7,7 @@ add_library(bitcoin_wallet STATIC EXCLUDE_FROM_ALL ../coinjoin/client.cpp ../coinjoin/interfaces.cpp ../coinjoin/util.cpp + ../coinjoin/walletman.cpp bip39.cpp coinjoin.cpp coincontrol.cpp @@ -20,6 +21,7 @@ add_library(bitcoin_wallet STATIC EXCLUDE_FROM_ALL hdchain.cpp interfaces.cpp load.cpp + platformkeys.cpp receive.cpp rpc/addresses.cpp rpc/backup.cpp @@ -42,6 +44,7 @@ target_link_libraries(bitcoin_wallet core_interface bitcoin_common leveldb + secp256k1 dashbls univalue Boost::headers diff --git a/src/wallet/test/CMakeLists.txt b/src/wallet/test/CMakeLists.txt index 3b4bcbc1316e..44a9f471ddaf 100644 --- a/src/wallet/test/CMakeLists.txt +++ b/src/wallet/test/CMakeLists.txt @@ -8,12 +8,13 @@ target_sources(test_bitcoin PRIVATE init_test_fixture.cpp wallet_test_fixture.cpp - availablecoins_tests.cpp bip39_tests.cpp coinjoin_tests.cpp coinselector_tests.cpp + group_outputs_tests.cpp init_tests.cpp ismine_tests.cpp + platformkeys_tests.cpp psbt_wallet_tests.cpp rpc_util_tests.cpp scriptpubkeyman_tests.cpp @@ -22,6 +23,7 @@ target_sources(test_bitcoin wallet_tests.cpp wallet_transaction_tests.cpp walletdb_tests.cpp + walletload_tests.cpp ) if(USE_BDB) target_sources(test_bitcoin diff --git a/src/wallet/test/fuzz/CMakeLists.txt b/src/wallet/test/fuzz/CMakeLists.txt index 48edf6302301..fa3fce606854 100644 --- a/src/wallet/test/fuzz/CMakeLists.txt +++ b/src/wallet/test/fuzz/CMakeLists.txt @@ -6,7 +6,9 @@ target_sources(fuzz PRIVATE coincontrol.cpp coinselection.cpp + fees.cpp $<$:${CMAKE_CURRENT_LIST_DIR}/notifications.cpp> parse_iso8601.cpp + $<$:${CMAKE_CURRENT_LIST_DIR}/scriptpubkeyman.cpp> ) target_link_libraries(fuzz bitcoin_wallet) diff --git a/src/zmq/CMakeLists.txt b/src/zmq/CMakeLists.txt index 8ecb236b4600..e7e7658dddd3 100644 --- a/src/zmq/CMakeLists.txt +++ b/src/zmq/CMakeLists.txt @@ -19,6 +19,10 @@ target_link_libraries(bitcoin_zmq PRIVATE core_interface univalue + # zmqpublishnotifier.cpp reaches dbwrapper.h through node/blockstorage.h + # and bls.h through chainlock/chainlock.h. + leveldb + dashbls $ $ ) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 9fd4e6e84ea1..03aa770e0210 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -24,6 +24,7 @@ function(create_test_config) set_configure_variable(BUILD_DAEMON BUILD_BITCOIND) set_configure_variable(BUILD_FUZZ_BINARY ENABLE_FUZZ_BINARY) set_configure_variable(WITH_ZMQ ENABLE_ZMQ) + set_configure_variable(WITH_ZSTD ENABLE_ZSTD) set_configure_variable(ENABLE_EXTERNAL_SIGNER ENABLE_EXTERNAL_SIGNER) set_configure_variable(WITH_USDT ENABLE_USDT_TRACEPOINTS) From 22ee09562db5994a3e9e72ec60a97e1204b2d7f0 Mon Sep 17 00:00:00 2001 From: TheCharlatan Date: Sat, 30 Nov 2024 00:05:08 +0100 Subject: [PATCH 3/9] Merge bitcoin/bitcoin#31395: build: Set shared linker flags in toolchain file These are required when cross-compiling shared libraries such as the kernel library. Dash builds libdashconsensus as a shared library by default, so without this the macOS cross build links it with the host's GNU ld instead of ld64.lld ("unrecognised emulation mode: llvm"): -fuse-ld=lld and the other depends LDFLAGS only reached executables. (cherry picked from commit a8e04704f930de168fdddbb1c040dd70fbbe8ff7) Co-Authored-By: Claude Opus 5.5 --- depends/toolchain.cmake.in | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/depends/toolchain.cmake.in b/depends/toolchain.cmake.in index be07e6583c45..818416913616 100644 --- a/depends/toolchain.cmake.in +++ b/depends/toolchain.cmake.in @@ -55,12 +55,21 @@ set(DEPENDS_COMPILE_DEFINITIONS_DEBUG @CPPFLAGS_DEBUG@) if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_INIT) set(CMAKE_EXE_LINKER_FLAGS_INIT "@LDFLAGS@") endif() +if(NOT DEFINED CMAKE_SHARED_LINKER_FLAGS_INIT) + set(CMAKE_SHARED_LINKER_FLAGS_INIT "@LDFLAGS@") +endif() if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT) set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "@LDFLAGS_RELEASE@") endif() +if(NOT DEFINED CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT) + set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT "@LDFLAGS_RELEASE@") +endif() if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT) set(CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "@LDFLAGS_DEBUG@") endif() +if(NOT DEFINED CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT) + set(CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT "@LDFLAGS_DEBUG@") +endif() set(CMAKE_AR "@AR@") set(CMAKE_RANLIB "@RANLIB@") From 1ac032ca1cd230087e6b2249e67989ce41329cb3 Mon Sep 17 00:00:00 2001 From: laanwj <126646+laanwj@users.noreply.github.com> Date: Tue, 1 Oct 2024 19:04:24 +0200 Subject: [PATCH 4/9] Merge bitcoin/bitcoin#31013: depends: For mingw cross compile use -gcc-posix to prevent library conflict CMake parses some paths from the spec of the C compiler, assuming it will be the linker, resulting in the link to end up with `-L/usr/lib/gcc/x86_64-w64-mingw32/12-win32` on debian bookworm if both -win32 and -posix variants are installed, and -win32 is the default alternative. This results in the wrong C++ library being linked, missing std::threads::hardware_concurrency and other threading functions. To fix this, use the -posix variant of gcc as well when available. This fixes a regression compared to autotools, where this scenario worked. The Dash CI image installs both variants with -win32 as the default. There the mismatched libstdc++ makes test_dash.exe deadlock under Wine in its first test fixture ("RtlLeaveCriticalSection ... is not acquired"). (cherry picked from commit ae56b3230b287eef5a5657d3089abebffde51484) Co-Authored-By: Claude Opus 5.5 --- depends/hosts/mingw32.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/depends/hosts/mingw32.mk b/depends/hosts/mingw32.mk index d838e40ed4eb..b9bc4acf18a4 100644 --- a/depends/hosts/mingw32.mk +++ b/depends/hosts/mingw32.mk @@ -1,3 +1,6 @@ +ifneq ($(shell $(SHELL) $(.SHELLFLAGS) "command -v $(host)-gcc-posix"),) +mingw32_CC := $(host)-gcc-posix +endif ifneq ($(shell $(SHELL) $(.SHELLFLAGS) "command -v $(host)-g++-posix"),) mingw32_CXX := $(host)-g++-posix endif From 0feb3b3d727dd141f88fe0bf6c378e2a2cd4defe Mon Sep 17 00:00:00 2001 From: pasta Date: Wed, 11 Nov 2026 05:20:00 +0000 Subject: [PATCH 5/9] ci: build and test every job with CMake Configure every CI job with CMake and depends' toolchain file instead of ./configure, as bitcoin#30454 did for upstream's CI. * ci/dash/build_src.sh configures build-ci/dashcore-$BUILD_TARGET with cmake and builds the job's GOAL with cmake --build. The build directory keeps the path the workflows already expect, so bundling and the test jobs are unchanged. The Autotools distdir round trip is gone along with `make dist`. Bench and fuzz binaries are still built everywhere, as Autotools did by default. CMake writes compile_commands.json itself, so the tidy job no longer runs Bear; the paths Bear's config excluded are dropped by the existing jq filter instead. * ci/dash/test_unittests.sh runs ctest instead of `make check`. * Each ci/test/00_setup_env_*.sh maps its configure flags to the matching CMake options. Compilers come from depends' toolchain unless the job used a different one at configure time; extra preprocessor, compiler and linker flags go through APPEND_CPPFLAGS, APPEND_CFLAGS, APPEND_CXXFLAGS and APPEND_LDFLAGS, so depends' own flags are kept. The nowallet job no longer builds a shared libdashkernel: the CMake build has no such target. The multiprocess Debug build keeps C code at -O2 and C++ at -O0, as before. * The ASan job builds against system libraries, so no toolchain file turns on the optional features those libraries provide. It names UPnP, NAT-PMP, zstd and USDT explicitly; ./configure detected them on its own. * The win64 job builds `install` instead of `deploy`. CMake's deploy target always runs makensis, which the CI image lacks; Autotools skipped the installer silently when makensis was missing, so CI never built it before either. Guix still builds the installer. * The fuzz and MSan jobs repeat the standard-library debug defines of their DEBUG=1 depends build in APPEND_CPPFLAGS. config.site applied those defines to every build; the toolchain file applies them to Debug builds only, and these jobs build RelWithDebInfo. * The sanitizer jobs now also instrument C code, including the mimalloc allocator in dashbls, whose random number generator relies on wrapping unsigned arithmetic. Suppress unsigned-integer-overflow for it. Co-Authored-By: Claude Opus 5.5 Co-Authored-By: Claude Fable 5.2 --- ci/dash/build_src.sh | 43 ++++++------------- ci/dash/bundle-artifacts.sh | 4 +- ci/dash/lint-tidy.sh | 8 ++-- ci/dash/test_unittests.sh | 2 +- ci/test/00_setup_env_aarch64.sh | 2 +- ci/test/00_setup_env_mac_cross.sh | 2 +- ci/test/00_setup_env_mac_native.sh | 2 +- ci/test/00_setup_env_native_asan.sh | 14 ++++-- ci/test/00_setup_env_native_fuzz.sh | 14 ++++-- ci/test/00_setup_env_native_fuzz_with_msan.sh | 8 +++- .../00_setup_env_native_fuzz_with_valgrind.sh | 9 +++- ci/test/00_setup_env_native_msan.sh | 24 +++++------ ci/test/00_setup_env_native_multiprocess.sh | 12 +++--- ...up_env_native_nowallet_libbitcoinkernel.sh | 2 +- .../00_setup_env_native_previous_releases.sh | 8 +++- ci/test/00_setup_env_native_tsan.sh | 3 +- ci/test/00_setup_env_native_valgrind.sh | 8 +++- ci/test/00_setup_env_win64.sh | 7 ++- test/sanitizer_suppressions/ubsan | 1 + 19 files changed, 97 insertions(+), 76 deletions(-) diff --git a/ci/dash/build_src.sh b/ci/dash/build_src.sh index a705d10edda7..b96398920c01 100755 --- a/ci/dash/build_src.sh +++ b/ci/dash/build_src.sh @@ -15,52 +15,35 @@ unset CC CXX DISPLAY; ccache --zero-stats -if [ -n "$CONFIG_SHELL" ]; then - export CONFIG_SHELL="$CONFIG_SHELL" -fi +BUILD_DIR="build-ci/dashcore-${BUILD_TARGET}" -BITCOIN_CONFIG_ALL="--enable-external-signer --disable-dependency-tracking --bindir=$BASE_OUTDIR/bin --libdir=$BASE_OUTDIR/lib" +BITCOIN_CONFIG_ALL="-DBUILD_BENCH=ON -DBUILD_FUZZ_BINARY=ON -DENABLE_EXTERNAL_SIGNER=ON" if [ -z "$NO_DEPENDS" ]; then - BITCOIN_CONFIG_ALL="${BITCOIN_CONFIG_ALL} --prefix=$DEPENDS_DIR/$HOST" -else - BITCOIN_CONFIG_ALL="${BITCOIN_CONFIG_ALL} --prefix=$BASE_OUTDIR" + BITCOIN_CONFIG_ALL="${BITCOIN_CONFIG_ALL} -DCMAKE_TOOLCHAIN_FILE=${DEPENDS_DIR}/${HOST}/toolchain.cmake" fi +BITCOIN_CONFIG_ALL="${BITCOIN_CONFIG_ALL} -DCMAKE_INSTALL_PREFIX=${BASE_OUTDIR}" if [ -z "$NO_WERROR" ]; then - BITCOIN_CONFIG_ALL="${BITCOIN_CONFIG_ALL} --enable-werror" + BITCOIN_CONFIG_ALL="${BITCOIN_CONFIG_ALL} -DWERROR=ON" +fi +if [ "${RUN_TIDY}" = "true" ]; then + BITCOIN_CONFIG_ALL="${BITCOIN_CONFIG_ALL} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON" fi - -( test -n "$CONFIG_SHELL" && eval '"$CONFIG_SHELL" -c "./autogen.sh"' ) || ./autogen.sh rm -rf build-ci -mkdir build-ci -cd build-ci +mkdir -p "${BUILD_DIR}" -bash -c "../configure $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG" || ( cat config.log && false) -make distdir VERSION="$BUILD_TARGET" - -cd "dashcore-$BUILD_TARGET" -bash -c "./configure $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG" || ( cat config.log && false) - -# This step influences compilation and therefore will always be a part of the -# compile step -if [ "${RUN_TIDY}" = "true" ]; then - MAYBE_BEAR="bear --config src/.bear-tidy-config" - MAYBE_TOKEN="--" -fi +bash -c "cmake -S . -B ${BUILD_DIR} $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG" || ( cat "${BUILD_DIR}/CMakeFiles/CMakeConfigureLog.yaml" && false ) -bash -c "${MAYBE_BEAR} ${MAYBE_TOKEN} make ${MAKEJOBS} ${GOAL}" || ( echo "Build failure. Verbose build follows." && make "$GOAL" V=1 ; false ) +bash -c "cmake --build ${BUILD_DIR} ${MAKEJOBS} --target all ${GOAL}" || ( echo "Build failure. Verbose build follows." && cmake --build "${BUILD_DIR}" --target all ${GOAL} --verbose ; false ) ccache --version | head -n 1 && ccache --show-stats -# A standard library header path in an executable means a source location was -# captured inside one, which both misreports where a failure came from and, on -# darwin, embeds a path that differs between builders. if [ "${RUN_STDLIB_PATH_CHECK}" = "true" ]; then - make -C src --jobs=1 check-stdlib-paths + cmake --build "${BUILD_DIR}" --target check-stdlib-paths fi if [ "${RUN_CHECK_NO_RUST}" = "true" ]; then - "${BASE_ROOT_DIR}/contrib/devtools/check-no-rust.py" src/dashd src/dash-cli src/dash-tx src/dash-util src/dash-wallet src/bench/bench_dash src/test/fuzz/fuzz + ( cd "${BUILD_DIR}" && "${BASE_ROOT_DIR}/contrib/devtools/check-no-rust.py" src/dashd src/dash-cli src/dash-tx src/dash-util src/dash-wallet src/bench/bench_dash src/test/fuzz/fuzz ) fi if [ -n "$USE_VALGRIND" ]; then diff --git a/ci/dash/bundle-artifacts.sh b/ci/dash/bundle-artifacts.sh index 30bafa80b968..e932ff5eeee2 100755 --- a/ci/dash/bundle-artifacts.sh +++ b/ci/dash/bundle-artifacts.sh @@ -44,8 +44,8 @@ if [ "${VERB}" = "create" ]; then ".libs" # Test binaries that only the unit tests, run before bundling, need "src/bench/bench_dash" - "src/dashbls/runbench" - "src/dashbls/runtest" + "dashbls_runbench" + "dashbls_runtest" "src/qt/test/test_dash-qt" "src/test/fuzz/fuzz" "src/test/test_dash" diff --git a/ci/dash/lint-tidy.sh b/ci/dash/lint-tidy.sh index d26299e65481..d7e0c0ef4906 100755 --- a/ci/dash/lint-tidy.sh +++ b/ci/dash/lint-tidy.sh @@ -50,12 +50,10 @@ cmake --build "${TIDY_BUILD_DIR}" --target bitcoin-tidy-tests "${MAKEJOBS}" cd "${BASE_ROOT_DIR}/build-ci/dashcore-${BUILD_TARGET}/src" -# Filter out files by regex here, because regex may not be -# accepted in src/.bear-tidy-config # Filter out: -# * qt qrc and moc generated files -# * secp256k1 -jq 'map(select(.file | test("src/qt/qrc_.*\\.cpp$|/moc_.*\\.cpp$|src/secp256k1/src/") | not))' ../compile_commands.json > tmp.json +# * generated Qt sources (moc, qrc and uic output under the *_autogen directories) +# * subtrees and other vendored code +jq 'map(select(.file | test("_autogen/|src/(secp256k1|crc32c|crypto/x11|dashbls|gsl|immer|leveldb|minisketch|univalue)/|src/bench/nanobench\\.cpp$") | not))' ../compile_commands.json > tmp.json mv tmp.json ../compile_commands.json CAST_LINT_DB="${PWD}/../cstyle-cast-compile-db" diff --git a/ci/dash/test_unittests.sh b/ci/dash/test_unittests.sh index 0c33ebbd8655..bd4ab6da1a2e 100755 --- a/ci/dash/test_unittests.sh +++ b/ci/dash/test_unittests.sh @@ -36,6 +36,6 @@ else if [ "$RUN_UNIT_TESTS_SEQUENTIAL" = "true" ]; then ./src/test/test_dash --catch_system_errors=no -l test_suite else - make "$MAKEJOBS" check VERBOSE=1 + QT_QPA_PLATFORM=minimal ctest "$MAKEJOBS" --output-on-failure fi fi diff --git a/ci/test/00_setup_env_aarch64.sh b/ci/test/00_setup_env_aarch64.sh index 40906d17e471..3abc1e3a67a6 100755 --- a/ci/test/00_setup_env_aarch64.sh +++ b/ci/test/00_setup_env_aarch64.sh @@ -24,4 +24,4 @@ export RUN_UNIT_TESTS=false export RUN_FUNCTIONAL_TESTS=false export GOAL="install" export DEP_OPTS="CC=aarch64-linux-gnu-gcc-11 CXX=aarch64-linux-gnu-g++-11" -export BITCOIN_CONFIG="--enable-reduce-exports CC=aarch64-linux-gnu-gcc-11 CXX=aarch64-linux-gnu-g++-11" +export BITCOIN_CONFIG="-DREDUCE_EXPORTS=ON" diff --git a/ci/test/00_setup_env_mac_cross.sh b/ci/test/00_setup_env_mac_cross.sh index d50b906b6758..54d26d1b77ee 100755 --- a/ci/test/00_setup_env_mac_cross.sh +++ b/ci/test/00_setup_env_mac_cross.sh @@ -16,5 +16,5 @@ export XCODE_BUILD_ID=17B100 export RUN_UNIT_TESTS=false export RUN_FUNCTIONAL_TESTS=false export GOAL="all deploy" -export BITCOIN_CONFIG="--with-gui --enable-reduce-exports --disable-miner" +export BITCOIN_CONFIG="-DBUILD_GUI=ON -DREDUCE_EXPORTS=ON -DENABLE_MINER=OFF" export RUN_STDLIB_PATH_CHECK=true diff --git a/ci/test/00_setup_env_mac_native.sh b/ci/test/00_setup_env_mac_native.sh index fab58f824c67..7b6a27fe626f 100755 --- a/ci/test/00_setup_env_mac_native.sh +++ b/ci/test/00_setup_env_mac_native.sh @@ -12,7 +12,7 @@ export HOST=x86_64-apple-darwin # Therefore, `--break-system-packages` is needed. export PIP_PACKAGES="--break-system-packages zmq" export GOAL="install" -export BITCOIN_CONFIG="--with-gui --with-miniupnpc --with-natpmp --enable-reduce-exports --disable-miner" +export BITCOIN_CONFIG="-DBUILD_GUI=ON -DWITH_MINIUPNPC=ON -DWITH_NATPMP=ON -DREDUCE_EXPORTS=ON -DENABLE_MINER=OFF" export CI_OS_NAME="macos" export NO_DEPENDS=1 export OSX_SDK="" diff --git a/ci/test/00_setup_env_native_asan.sh b/ci/test/00_setup_env_native_asan.sh index e4c6e68dce4f..0babd182a45a 100755 --- a/ci/test/00_setup_env_native_asan.sh +++ b/ci/test/00_setup_env_native_asan.sh @@ -12,8 +12,14 @@ export NO_DEPENDS=1 export TEST_RUNNER_EXTRA="--timeout-factor=4 -j4" # Increase timeout because sanitizers slow down export CI_LIMIT_STACK_SIZE=1 export GOAL="install" -export BITCOIN_CONFIG="--enable-zmq --enable-crash-hooks --with-gui=qt5 --without-bdb --with-sqlite \ ---with-sanitizers=address,float-divide-by-zero,integer,undefined \ -CPPFLAGS='-DARENA_DEBUG' \ -CC='clang-19 -ftrivial-auto-var-init=pattern' CXX='clang++-19 -ftrivial-auto-var-init=pattern'" +export BITCOIN_CONFIG="\ + -DWITH_ZMQ=ON -DENABLE_CRASH_HOOKS=ON -DBUILD_GUI=ON -DWITH_BDB=OFF -DWITH_SQLITE=ON \ + -DWITH_MINIUPNPC=ON -DWITH_NATPMP=ON -DWITH_ZSTD=ON -DWITH_USDT=ON \ + -DSANITIZERS=address,float-divide-by-zero,integer,undefined \ + -DCMAKE_C_COMPILER=clang-19 \ + -DCMAKE_CXX_COMPILER=clang++-19 \ + -DAPPEND_CFLAGS='-ftrivial-auto-var-init=pattern' \ + -DAPPEND_CXXFLAGS='-ftrivial-auto-var-init=pattern' \ + -DAPPEND_CPPFLAGS='-DARENA_DEBUG' \ +" export PYZMQ=true diff --git a/ci/test/00_setup_env_native_fuzz.sh b/ci/test/00_setup_env_native_fuzz.sh index 6d2293e8ced0..5ac0b5fed305 100755 --- a/ci/test/00_setup_env_native_fuzz.sh +++ b/ci/test/00_setup_env_native_fuzz.sh @@ -9,11 +9,19 @@ export LC_ALL=C.UTF-8 export CONTAINER_NAME=ci_native_fuzz export PACKAGES="clang llvm libevent-dev libboost-dev" export DEP_OPTS="NO_UPNP=1 DEBUG=1" -export CPPFLAGS="-DDEBUG_LOCKORDER -DARENA_DEBUG" export PYZMQ=true export RUN_UNIT_TESTS=false export RUN_FUNCTIONAL_TESTS=false export RUN_FUZZ_TESTS=true export GOAL="install" -export BITCOIN_CONFIG="--enable-zmq --enable-fuzz --with-sanitizers=fuzzer,address,undefined,float-divide-by-zero,integer \ -CC='clang-19 -ftrivial-auto-var-init=pattern' CXX='clang++-19 -ftrivial-auto-var-init=pattern'" +# depends' toolchain file applies its DEBUG=1 defines to Debug builds only, so +# repeat the libstdc++ debug mode here to keep it on in this build. +export BITCOIN_CONFIG="\ + -DBUILD_FOR_FUZZING=ON -DWITH_ZMQ=ON \ + -DSANITIZERS=fuzzer,address,undefined,float-divide-by-zero,integer \ + -DCMAKE_C_COMPILER=clang-19 \ + -DCMAKE_CXX_COMPILER=clang++-19 \ + -DAPPEND_CFLAGS='-ftrivial-auto-var-init=pattern' \ + -DAPPEND_CXXFLAGS='-ftrivial-auto-var-init=pattern' \ + -DAPPEND_CPPFLAGS='-DDEBUG_LOCKORDER -DARENA_DEBUG -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC' \ +" diff --git a/ci/test/00_setup_env_native_fuzz_with_msan.sh b/ci/test/00_setup_env_native_fuzz_with_msan.sh index f1c358082d5c..f62ea8ae5175 100755 --- a/ci/test/00_setup_env_native_fuzz_with_msan.sh +++ b/ci/test/00_setup_env_native_fuzz_with_msan.sh @@ -18,7 +18,13 @@ export PACKAGES="ninja-build" export DEP_OPTS="DEBUG=1 NO_BDB=1 NO_QT=1 CC=clang CXX=clang++ CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}'" export GOAL="install" # _FORTIFY_SOURCE is not compatible with MSAN. -export BITCOIN_CONFIG="--enable-fuzz --with-sanitizers=fuzzer,memory CPPFLAGS='-DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE -U_FORTIFY_SOURCE'" +# depends' toolchain file applies its DEBUG=1 defines to Debug builds only, so +# repeat the libc++ debug hardening mode here to keep it on in this build. +export BITCOIN_CONFIG="\ + -DBUILD_FOR_FUZZING=ON \ + -DSANITIZERS=fuzzer,memory \ + -DAPPEND_CPPFLAGS='-DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE -U_FORTIFY_SOURCE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG' \ +" export USE_MEMORY_SANITIZER="true" export RUN_UNIT_TESTS="false" export RUN_FUNCTIONAL_TESTS="false" diff --git a/ci/test/00_setup_env_native_fuzz_with_valgrind.sh b/ci/test/00_setup_env_native_fuzz_with_valgrind.sh index 829357b5b493..181316f6f584 100755 --- a/ci/test/00_setup_env_native_fuzz_with_valgrind.sh +++ b/ci/test/00_setup_env_native_fuzz_with_valgrind.sh @@ -15,5 +15,12 @@ export RUN_FUZZ_TESTS=true export FUZZ_TESTS_CONFIG="--valgrind" export GOAL="install" # Temporarily pin dwarf 4, until valgrind can understand clang's dwarf 5 -export BITCOIN_CONFIG="--enable-fuzz --with-sanitizers=fuzzer CC=clang-19 CXX=clang++-19 CFLAGS=-gdwarf-4 CXXFLAGS=-gdwarf-4" +export BITCOIN_CONFIG="\ + -DBUILD_FOR_FUZZING=ON \ + -DSANITIZERS=fuzzer \ + -DCMAKE_C_COMPILER=clang-19 \ + -DCMAKE_CXX_COMPILER=clang++-19 \ + -DCMAKE_C_FLAGS='-gdwarf-4' \ + -DCMAKE_CXX_FLAGS='-gdwarf-4' \ +" export CCACHE_MAXSIZE=200M diff --git a/ci/test/00_setup_env_native_msan.sh b/ci/test/00_setup_env_native_msan.sh index c47f66ba4d96..732123393a98 100755 --- a/ci/test/00_setup_env_native_msan.sh +++ b/ci/test/00_setup_env_native_msan.sh @@ -21,20 +21,18 @@ export MSAN_AND_LIBCXX_FLAGS="${MSAN_FLAGS} ${LIBCXX_FLAGS}" # assembly, which MSan cannot see through. export DEP_OPTS="DEBUG=1 NO_BDB=1 NO_QT=1 NO_UPNP=1 NO_NATPMP=1 CC=clang-19 CXX=clang++-19 CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}' CPPFLAGS='-D__BLST_NO_ASM__'" export GOAL="install" -# CC/CXX/CFLAGS/CXXFLAGS are repeated here rather than left to depends' -# config.site. Upstream dropped them in bitcoin#29800 because its -# ci/test/03_test_script.sh sets CONFIG_SITE explicitly (bitcoin#26683); -# ci/dash/build_src.sh still uses the older --prefix form, and this is the only -# target whose compiler differs from the system default, so nothing else in -# Dash's CI exercises that hand-off. +# The compilers and flags come from DEP_OPTS through depends' toolchain file. # _FORTIFY_SOURCE is not compatible with MSAN. -# --with-asm=no keeps secp256k1 off hand-written assembly, which MSan cannot -# see through. -# --disable-mimalloc selects the plain malloc secure allocator; mimalloc seeds +# depends' toolchain file applies its DEBUG=1 defines to Debug builds only, so +# repeat the libc++ debug hardening mode here to keep it on in this build. +# SECP256K1_ASM=OFF keeps secp256k1 off hand-written assembly, which MSan +# cannot see through. +# ENABLE_MIMALLOC=OFF selects the plain malloc secure allocator; mimalloc seeds # itself with a raw getrandom syscall before main(), which MSan cannot track. -export BITCOIN_CONFIG="--with-sanitizers=memory --with-gui=no --without-bdb --with-sqlite \ ---with-asm=no --disable-mimalloc \ -CC=clang-19 CXX=clang++-19 CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}' \ -CPPFLAGS='-U_FORTIFY_SOURCE'" +export BITCOIN_CONFIG="\ + -DSANITIZERS=memory -DBUILD_GUI=OFF -DWITH_BDB=OFF -DWITH_SQLITE=ON \ + -DSECP256K1_ASM=OFF -DENABLE_MIMALLOC=OFF \ + -DAPPEND_CPPFLAGS='-U_FORTIFY_SOURCE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG' \ +" export USE_MEMORY_SANITIZER="true" export TEST_RUNNER_TIMEOUT_FACTOR=40 diff --git a/ci/test/00_setup_env_native_multiprocess.sh b/ci/test/00_setup_env_native_multiprocess.sh index eab9574be7a1..725f6c264715 100755 --- a/ci/test/00_setup_env_native_multiprocess.sh +++ b/ci/test/00_setup_env_native_multiprocess.sh @@ -32,10 +32,10 @@ export DEP_OPTS="MULTIPROCESS=1 CC=clang-19 CXX=clang++-19" export RUN_TIDY=true export GOAL="install" export TEST_RUNNER_EXTRA="--v2transport" -export BITCOIN_CONFIG="--enable-debug CC=clang-19 CXX=clang++-19" # Use clang to avoid OOM -# Additional flags for RUN_TIDY. -O0 only for C++: depends' -O2 comes after the debug -O0, so Dash -# code needs it here, while the C code (secp256k1, most of X11) is left at depends' -O2 -export BITCOIN_CONFIG="${BITCOIN_CONFIG} --disable-hardening CFLAGS='-g0' CXXFLAGS='-O0 -g0 -Wno-error=documentation'" -# --enable-debug turns on the lock-order and lock-contention tracking; they cost a third and ~3% of dashd CPU on this -O0 build -export BITCOIN_CONFIG="${BITCOIN_CONFIG} CPPFLAGS='-UDEBUG_LOCKORDER -UDEBUG_LOCKCONTENTION'" +export BITCOIN_CONFIG="-DCMAKE_BUILD_TYPE=Debug" +# Additional flags for RUN_TIDY. -O0 only for C++, while the C code (secp256k1, most of X11) stays at -O2 +export BITCOIN_CONFIG="${BITCOIN_CONFIG} -DENABLE_HARDENING=OFF -DCMAKE_C_FLAGS_DEBUG='-O2 -g0' -DCMAKE_CXX_FLAGS_DEBUG='-ftrapv -O0 -g0'" +export BITCOIN_CONFIG="${BITCOIN_CONFIG} -DAPPEND_CXXFLAGS='-Wno-error=documentation'" +# The Debug build turns on the lock-order and lock-contention tracking; they cost a third and ~3% of dashd CPU on this -O0 build +export BITCOIN_CONFIG="${BITCOIN_CONFIG} -DAPPEND_CPPFLAGS='-UDEBUG_LOCKORDER -UDEBUG_LOCKCONTENTION'" export BITCOIND=dash-node # Used in functional tests diff --git a/ci/test/00_setup_env_native_nowallet_libbitcoinkernel.sh b/ci/test/00_setup_env_native_nowallet_libbitcoinkernel.sh index 7a57cfb0ba47..c2e47812c52d 100755 --- a/ci/test/00_setup_env_native_nowallet_libbitcoinkernel.sh +++ b/ci/test/00_setup_env_native_nowallet_libbitcoinkernel.sh @@ -11,4 +11,4 @@ export HOST=x86_64-pc-linux-gnu export PACKAGES="python3-zmq" export DEP_OPTS="NO_WALLET=1 CC=gcc-14 CXX=g++-14" export GOAL="install" -export BITCOIN_CONFIG="--enable-reduce-exports CC=gcc-14 CXX=g++-14 --enable-experimental-util-chainstate --with-experimental-kernel-lib --enable-shared" +export BITCOIN_CONFIG="-DREDUCE_EXPORTS=ON -DBUILD_UTIL_CHAINSTATE=ON" diff --git a/ci/test/00_setup_env_native_previous_releases.sh b/ci/test/00_setup_env_native_previous_releases.sh index f0fa020ebbbf..fb167f59ee6c 100755 --- a/ci/test/00_setup_env_native_previous_releases.sh +++ b/ci/test/00_setup_env_native_previous_releases.sh @@ -17,6 +17,12 @@ export RUN_UNIT_TESTS_SEQUENTIAL="true" export RUN_UNIT_TESTS="false" export GOAL="install" export DOWNLOAD_PREVIOUS_RELEASES="true" -export BITCOIN_CONFIG="--enable-zmq --with-libs=no --enable-reduce-exports CPPFLAGS='-DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE -DDEBUG_LOCKORDER -DDEBUG_LOCKCONTENTION' LDFLAGS=-static-libstdc++ CC=gcc-14 CXX=g++-14" +export BITCOIN_CONFIG="\ + -DWITH_ZMQ=ON -DBUILD_CONSENSUS_LIB=OFF -DREDUCE_EXPORTS=ON \ + -DCMAKE_C_COMPILER=gcc-14 \ + -DCMAKE_CXX_COMPILER=g++-14 \ + -DAPPEND_CPPFLAGS='-DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE -DDEBUG_LOCKORDER -DDEBUG_LOCKCONTENTION' \ + -DAPPEND_LDFLAGS='-static-libstdc++' \ +" export RUN_STDLIB_PATH_CHECK=true export RUN_CHECK_NO_RUST="true" diff --git a/ci/test/00_setup_env_native_tsan.sh b/ci/test/00_setup_env_native_tsan.sh index efb398f112fe..05267a5608be 100755 --- a/ci/test/00_setup_env_native_tsan.sh +++ b/ci/test/00_setup_env_native_tsan.sh @@ -32,6 +32,5 @@ export DEP_OPTS="CC=clang-19 CXX='clang++-19 -stdlib=libc++'" export TEST_RUNNER_EXTRA="--extended --exclude feature_pruning,feature_dbcrash,wallet_multiwallet.py" # Temporarily suppress ASan heap-use-after-free (see issue #14163) export TEST_RUNNER_EXTRA="${TEST_RUNNER_EXTRA} --timeout-factor=4" # Increase timeout because sanitizers slow down export GOAL="install" -export BITCOIN_CONFIG="--enable-zmq --without-zstd --with-sanitizers=thread CC=clang-19 CXX=clang++-19" -export CPPFLAGS="-DARENA_DEBUG -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES" +export BITCOIN_CONFIG="-DWITH_ZMQ=ON -DWITH_ZSTD=OFF -DSANITIZERS=thread -DAPPEND_CPPFLAGS='-DARENA_DEBUG -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES'" export PYZMQ=true diff --git a/ci/test/00_setup_env_native_valgrind.sh b/ci/test/00_setup_env_native_valgrind.sh index e545bbcbc2c4..8b0c04e1e3cb 100755 --- a/ci/test/00_setup_env_native_valgrind.sh +++ b/ci/test/00_setup_env_native_valgrind.sh @@ -12,4 +12,10 @@ export NO_DEPENDS=1 export TEST_RUNNER_EXTRA="--exclude feature_init,rpc_bind,feature_bind_extra --timeout-factor=4" # feature_init excluded for now, see https://github.com/bitcoin/bitcoin/issues/30011 ; bind tests excluded for now, see https://github.com/bitcoin/bitcoin/issues/17765#issuecomment-602068547 export GOAL="install" # Temporarily pin dwarf 4, until valgrind can understand clang's dwarf 5 -export BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --with-gui=no CC=clang-19 CXX=clang++-19 CFLAGS=-gdwarf-4 CXXFLAGS=-gdwarf-4" # TODO enable GUI +export BITCOIN_CONFIG="\ + -DWITH_ZMQ=ON -DWITH_BDB=ON -DWARN_INCOMPATIBLE_BDB=OFF -DBUILD_GUI=OFF \ + -DCMAKE_C_COMPILER=clang-19 \ + -DCMAKE_CXX_COMPILER=clang++-19 \ + -DCMAKE_C_FLAGS='-gdwarf-4' \ + -DCMAKE_CXX_FLAGS='-gdwarf-4' \ +" # TODO enable GUI diff --git a/ci/test/00_setup_env_win64.sh b/ci/test/00_setup_env_win64.sh index de3bdf1c33a6..fd44daba5c1c 100755 --- a/ci/test/00_setup_env_win64.sh +++ b/ci/test/00_setup_env_win64.sh @@ -11,9 +11,12 @@ export HOST=x86_64-w64-mingw32 export DPKG_ADD_ARCH="i386" export PACKAGES="nsis g++-mingw-w64-x86-64-posix wine-binfmt wine64 wine32 file" export RUN_FUNCTIONAL_TESTS=false -export GOAL="deploy" +# The CI image has no makensis, so the NSIS installer (the deploy target) is +# only built by Guix. +export GOAL="install" # Prior to 11.0.0, the mingw-w64 headers were missing noreturn attributes, causing warnings when # cross-compiling for Windows. https://sourceforge.net/p/mingw-w64/bugs/306/ # https://github.com/mingw-w64/mingw-w64/commit/1690994f515910a31b9fb7c7bd3a52d4ba987abe -export BITCOIN_CONFIG="--enable-gui --enable-reduce-exports --disable-miner CXXFLAGS='-Wno-return-type -Wno-error=maybe-uninitialized -Wno-error=array-bounds'" +export BITCOIN_CONFIG="-DBUILD_GUI=ON -DREDUCE_EXPORTS=ON -DENABLE_MINER=OFF \ +-DAPPEND_CXXFLAGS='-Wno-return-type -Wno-error=maybe-uninitialized -Wno-error=array-bounds'" export DIRECT_WINE_EXEC_TESTS=true diff --git a/test/sanitizer_suppressions/ubsan b/test/sanitizer_suppressions/ubsan index 5e8b81c77c63..7f90604abaa7 100644 --- a/test/sanitizer_suppressions/ubsan +++ b/test/sanitizer_suppressions/ubsan @@ -11,6 +11,7 @@ nonnull-attribute:dashbls/ # Suppressions in dependencies that are developed outside this repository. unsigned-integer-overflow:*/include/c++/ unsigned-integer-overflow:FuzzedDataProvider::ConsumeIntegralInRange +unsigned-integer-overflow:dashbls/depends/mimalloc/ unsigned-integer-overflow:leveldb/ unsigned-integer-overflow:minisketch/ unsigned-integer-overflow:secp256k1* From 2584f0b8183157499c334192cee1fe149a0cc170 Mon Sep 17 00:00:00 2001 From: pasta Date: Wed, 11 Nov 2026 06:05:04 +0000 Subject: [PATCH 6/9] guix: build releases with CMake Configure, build, check and install Dash Core with CMake and depends' toolchain file in the Guix build, as bitcoin#30454 did upstream (e821f0a37a0). CONFIGFLAGS now holds CMake options, the host flags go through APPEND_CFLAGS, APPEND_CXXFLAGS and APPEND_LDFLAGS, the Windows installer and the macOS zip are produced by the deploy targets, and debug symbols are split with the configured build/split-debug.sh. Unlike upstream, macOS releases keep their dSYM debug archives through the osx_debug target, Windows releases still build without the miner, and the library directory is pinned to lib/ so the consensus library lands where the release archives expect it. Guix still exports C_INCLUDE_PATH and CPLUS_INCLUDE_PATH, so depends prefixes the darwin compilers with `env -u ...`. Name env by its full path: CMake does not search PATH for the first word of the OBJCXX compiler, and the Qt configure fails with "CMAKE_OBJCXX_COMPILER: env is not a full path and was not found in the PATH". Also move the Debian packaging and the GitHub Actions deploy image to CMake. Co-Authored-By: Claude Opus 5.5 --- .../deploy/Dockerfile.GitHubActions.Dispatch | 20 +++--- contrib/debian/control | 16 ++--- contrib/debian/dash-qt.install | 2 +- contrib/debian/dash-tx.install | 2 +- contrib/debian/dashd.install | 4 +- contrib/debian/rules | 18 +---- contrib/guix/README.md | 5 ++ contrib/guix/libexec/build.sh | 65 +++++++++---------- depends/hosts/darwin.mk | 6 +- 9 files changed, 61 insertions(+), 77 deletions(-) diff --git a/contrib/containers/deploy/Dockerfile.GitHubActions.Dispatch b/contrib/containers/deploy/Dockerfile.GitHubActions.Dispatch index c6452786809b..7136c1f2ddb0 100644 --- a/contrib/containers/deploy/Dockerfile.GitHubActions.Dispatch +++ b/contrib/containers/deploy/Dockerfile.GitHubActions.Dispatch @@ -8,6 +8,7 @@ RUN apt-get update && \ bsdmainutils \ build-essential \ ca-certificates \ + cmake \ curl \ g++-aarch64-linux-gnu \ libtool \ @@ -28,19 +29,14 @@ RUN case "$TARGETPLATFORM" in \ *) exit 1 ;; \ esac -RUN ./autogen.sh && \ - case "$TARGETPLATFORM" in \ - "linux/arm64") ./configure --prefix=`pwd`/depends/aarch64-linux-gnu ;; \ - "linux/amd64") ./configure --prefix=`pwd`/depends/x86_64-pc-linux-gnu ;; \ +RUN case "$TARGETPLATFORM" in \ + "linux/arm64") cmake -S . -B build --toolchain "$PWD/depends/aarch64-linux-gnu/toolchain.cmake" ;; \ + "linux/amd64") cmake -S . -B build --toolchain "$PWD/depends/x86_64-pc-linux-gnu/toolchain.cmake" ;; \ + *) exit 1 ;; \ esac -RUN make -j`nproc | awk '{x=$1/2; print x}'` && make install - -RUN mkdir built-target && \ - case "$TARGETPLATFORM" in \ - "linux/arm64") cp depends/aarch64-linux-gnu/bin/dash* /home/dash/built-target ;; \ - "linux/amd64") cp depends/x86_64-pc-linux-gnu/bin/dash* /home/dash/built-target ;; \ -esac +RUN cmake --build build -j`nproc | awk '{x=$1/2; print x}'` && \ + cmake --install build --prefix /home/dash/built-target FROM ubuntu:jammy LABEL maintainer="Dash Developers " @@ -66,7 +62,7 @@ RUN apt-get update && \ ca-certificates \ && rm -rf /var/lib/apt/lists/* -COPY --from=builder /home/dash/built-target/dash* /usr/local/bin +COPY --from=builder /home/dash/built-target/bin/dash* /usr/local/bin USER dash diff --git a/contrib/debian/control b/contrib/debian/control index 46c1ebafd5b5..d6dc1ed9c891 100644 --- a/contrib/debian/control +++ b/contrib/debian/control @@ -5,20 +5,20 @@ Maintainer: Holger Schinzel Uploaders: Holger Schinzel Build-Depends: debhelper, devscripts, - automake, - libtool, + cmake (>= 3.22), bash-completion, libdb4.8++-dev, + libsqlite3-dev, pkg-config, - libevent-dev, - libboost-filesystem1.48-dev | libboost-filesystem-dev (>> 1.47), - libboost-thread1.48-dev | libboost-thread-dev (>> 1.47), - libboost-test1.48-dev | libboost-test-dev (>> 1.47), + libevent-dev (>= 2.1.8), + libboost-filesystem-dev (>= 1.73), + libboost-thread-dev (>= 1.73), + libboost-test-dev (>= 1.73), libminiupnpc8-dev | libminiupnpc-dev, - qt4-qmake, libqt4-dev, + qtbase5-dev (>= 5.15), qttools5-dev-tools, qttools5-dev, libqrencode-dev, - python, + python3, libzmq3-dev Standards-Version: 3.9.2 Homepage: https://www.dash.org/ diff --git a/contrib/debian/dash-qt.install b/contrib/debian/dash-qt.install index c034a13668aa..4689087c5bc9 100644 --- a/contrib/debian/dash-qt.install +++ b/contrib/debian/dash-qt.install @@ -1,4 +1,4 @@ -usr/local/bin/dash-qt usr/bin +usr/bin/dash-qt usr/bin share/pixmaps/dash32.xpm usr/share/pixmaps share/pixmaps/dash16.xpm usr/share/pixmaps share/pixmaps/dash128.png usr/share/pixmaps diff --git a/contrib/debian/dash-tx.install b/contrib/debian/dash-tx.install index 51d421975dda..194014e970cb 100644 --- a/contrib/debian/dash-tx.install +++ b/contrib/debian/dash-tx.install @@ -1 +1 @@ -usr/local/bin/dash-tx usr/bin +usr/bin/dash-tx usr/bin diff --git a/contrib/debian/dashd.install b/contrib/debian/dashd.install index 65878933fa99..538da5113028 100644 --- a/contrib/debian/dashd.install +++ b/contrib/debian/dashd.install @@ -1,2 +1,2 @@ -usr/local/bin/dashd usr/bin -usr/local/bin/dash-cli usr/bin +usr/bin/dashd usr/bin +usr/bin/dash-cli usr/bin diff --git a/contrib/debian/rules b/contrib/debian/rules index d55a3fa6bf01..7150bee42405 100755 --- a/contrib/debian/rules +++ b/contrib/debian/rules @@ -1,23 +1,11 @@ #!/usr/bin/make -f # -*- mode: makefile; coding: utf-8 -*- -#DEB_MAKE_CHECK_TARGET = test_dash -#build/dashd:: -# $(if $(filter nocheck,$(DEB_BUILD_OPTIONS)),,src/test_dash) - %: - dh --with bash-completion $@ - -override_dh_auto_clean: - if [ -f Makefile ]; then $(MAKE) distclean; fi - rm -rf Makefile.in aclocal.m4 configure src/Makefile.in src/bitcoin-config.h.in src/build-aux src/qt/Makefile.in src/qt/test/Makefile.in src/test/Makefile.in - -QT=$(shell dpkg-vendor --derives-from Ubuntu && echo qt4 || echo qt5) + dh --with bash-completion --buildsystem=cmake --builddirectory=build $@ -# Yea, autogen should be run on the source archive, but I like doing git archive override_dh_auto_configure: - ./autogen.sh - ./configure --with-gui=$(QT) + dh_auto_configure -- -DBUILD_GUI=ON -DWITH_BDB=ON -DWITH_MINIUPNPC=ON -DWITH_ZMQ=ON override_dh_auto_test: - make check + $(if $(filter nocheck,$(DEB_BUILD_OPTIONS)),,ctest --test-dir build --output-on-failure) diff --git a/contrib/guix/README.md b/contrib/guix/README.md index 16e79b1f6684..fe4097c97a27 100644 --- a/contrib/guix/README.md +++ b/contrib/guix/README.md @@ -273,6 +273,11 @@ details. _(defaults to the value of `nproc` outside the container)_ +* _**CONFIGFLAGS**_ + + Additional CMake configuration options, for example + `CONFIGFLAGS="-DENABLE_CRASH_HOOKS=ON"`. Options are separated by whitespace. + * _**SOURCE_DATE_EPOCH**_ Override the reference UNIX timestamp used for bit-for-bit reproducibility, diff --git a/contrib/guix/libexec/build.sh b/contrib/guix/libexec/build.sh index 94df97112159..be59445fbcbc 100755 --- a/contrib/guix/libexec/build.sh +++ b/contrib/guix/libexec/build.sh @@ -211,23 +211,20 @@ mkdir -p "$OUTDIR" ########################### # CONFIGFLAGS -CONFIGFLAGS+=" --enable-reduce-exports --disable-bench --disable-gui-tests --disable-fuzz-binary" +CONFIGFLAGS+=" -DREDUCE_EXPORTS=ON -DBUILD_BENCH=OFF -DBUILD_GUI_TESTS=OFF -DBUILD_FUZZ_BINARY=OFF" case "$HOST" in - *mingw*) CONFIGFLAGS+=" --disable-miner" ;; + *mingw*) CONFIGFLAGS+=" -DENABLE_MINER=OFF" ;; esac # CFLAGS HOST_CFLAGS="-O2 -g" HOST_CFLAGS+=$(find /gnu/store -maxdepth 1 -mindepth 1 -type d -exec echo -n " -ffile-prefix-map={}=/usr" \;) case "$HOST" in - *linux*) HOST_CFLAGS+=" -ffile-prefix-map=${PWD}=." ;; + *linux*) HOST_CFLAGS+=" -ffile-prefix-map=${DISTSRC}/src=." ;; *mingw*) HOST_CFLAGS+=" -fno-ident" ;; *darwin*) - # Optimization and target flags come from depends' config.site; only - # the debug level is requested here. The shipped dSYM debug artifacts - # previously carried full -g2 DWARF via the since-removed -gdwarf-4 - # backtrace flag escalating configure's -g1 floor, so keep requesting - # it explicitly. + # Keep full debug information for the shipped dSYM artifacts; the + # depends toolchain supplies optimization and target flags. HOST_CFLAGS="-g" ;; esac @@ -256,46 +253,41 @@ mkdir -p "$DISTSRC" # Extract the source tarball tar --strip-components=1 -xf "${GIT_ARCHIVE}" - ./autogen.sh - # Configure this DISTSRC for $HOST # shellcheck disable=SC2086 - env CONFIG_SITE="${BASEPREFIX}/${HOST}/share/config.site" \ - ./configure --prefix=/ \ - --disable-ccache \ - --disable-maintainer-mode \ - --disable-dependency-tracking \ - ${CONFIGFLAGS} \ - ${HOST_CFLAGS:+CFLAGS="${HOST_CFLAGS}"} \ - ${HOST_CXXFLAGS:+CXXFLAGS="${HOST_CXXFLAGS}"} \ - ${HOST_LDFLAGS:+LDFLAGS="${HOST_LDFLAGS}"} - - sed -i.old 's/-lstdc++ //g' {./,src/secp256k1/}{config.status,libtool} - + cmake -S . -B build \ + --toolchain "${BASEPREFIX}/${HOST}/toolchain.cmake" \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DWITH_CCACHE=OFF \ + "-DAPPEND_CFLAGS=${HOST_CFLAGS}" \ + "-DAPPEND_CXXFLAGS=${HOST_CXXFLAGS}" \ + "-DAPPEND_LDFLAGS=${HOST_LDFLAGS}" \ + ${CONFIGFLAGS} # Build Dash Core - make --jobs="$JOBS" ${V:+V=1} + cmake --build build -j "$JOBS" ${V:+--verbose} # Make macos-specific debug symbols case "$HOST" in *darwin*) - make -C src/ osx_debug + cmake --build build --target osx_debug ${V:+--verbose} ;; esac # Perform basic security checks on a series of executables. - make -C src --jobs=1 check-security ${V:+V=1} + cmake --build build -j 1 --target check-security ${V:+--verbose} # Check that executables only contain allowed version symbols. - make -C src --jobs=1 check-symbols ${V:+V=1} + cmake --build build -j 1 --target check-symbols ${V:+--verbose} # Check that no executable embeds a standard library header path. - make -C src --jobs=1 check-stdlib-paths ${V:+V=1} + cmake --build build -j 1 --target check-stdlib-paths ${V:+--verbose} mkdir -p "$OUTDIR" # Make the os-specific installers case "$HOST" in *mingw*) - make deploy ${V:+V=1} BITCOIN_WIN_INSTALLER="${OUTDIR}/${DISTNAME}-win64-setup-unsigned.exe" + cmake --build build -j "$JOBS" --target deploy ${V:+--verbose} + mv build/dashcore-*-win64-setup.exe "${OUTDIR}/${DISTNAME}-win64-setup-unsigned.exe" ;; esac @@ -305,15 +297,18 @@ mkdir -p "$DISTSRC" INSTALLPATH="${PWD}/installed/${DISTNAME}" mkdir -p "${INSTALLPATH}" # Install built Dash Core to $INSTALLPATH - make install DESTDIR="${INSTALLPATH}" ${V:+V=1} + cmake --install build --prefix "${INSTALLPATH}" ${V:+--verbose} case "$HOST" in *darwin*) - make deploydir ${V:+V=1} + # CMake versions before 3.27 pass unsupported flags to llvm-strip. + find build -name 'cmake_install.cmake' -exec sed -i 's| -u -r | |g' {} + + cmake --build build --target deploy ${V:+--verbose} + mv build/dist/Dash-Core.zip "${OUTDIR}/${DISTNAME}-${HOST}-unsigned.zip" mkdir -p "unsigned-app-${HOST}" cp --target-directory="unsigned-app-${HOST}" \ contrib/macdeploy/detached-sig-create.sh - mv --target-directory="unsigned-app-${HOST}" dist + mv --target-directory="unsigned-app-${HOST}" build/dist ( cd "unsigned-app-${HOST}" find . -print0 \ @@ -322,7 +317,6 @@ mkdir -p "$DISTSRC" | gzip -9n > "${OUTDIR}/${DISTNAME}-${HOST}-unsigned.tar.gz" \ || ( rm -f "${OUTDIR}/${DISTNAME}-${HOST}-unsigned.tar.gz" && exit 1 ) ) - make deploy ${V:+V=1} OSX_ZIP="${OUTDIR}/${DISTNAME}-${HOST}-unsigned.zip" ;; esac ( @@ -334,8 +328,7 @@ mkdir -p "$DISTSRC" ;; esac - # Prune libtool and object archives - find . -name "lib*.la" -delete + # Prune static and import libraries find . -name "lib*.a" -delete # Prune pkg-config files @@ -344,14 +337,14 @@ mkdir -p "$DISTSRC" case "$HOST" in *darwin*) # Copy dSYM-s - find ../src -name "*.dSYM" -exec cp -ra {} "${DISTNAME}/bin" \; + find ../build -name "*.dSYM" -exec cp -ra {} "${DISTNAME}/bin" \; ;; *) # Split binaries and libraries from their debug symbols { find "${DISTNAME}/bin" -type f -executable -print0 find "${DISTNAME}/lib" -type f -print0 - } | xargs -0 -P"$JOBS" -I{} "${DISTSRC}/contrib/devtools/split-debug.sh" {} {} {}.dbg + } | xargs -0 -P"$JOBS" -I{} "${DISTSRC}/build/split-debug.sh" {} {} {}.dbg case "$HOST" in *linux*) diff --git a/depends/hosts/darwin.mk b/depends/hosts/darwin.mk index 971347de5ae9..7a22db66b095 100644 --- a/depends/hosts/darwin.mk +++ b/depends/hosts/darwin.mk @@ -66,9 +66,11 @@ darwin_STRIP=$(shell $(SHELL) $(.SHELLFLAGS) "command -v llvm-strip") # `env` as the compiler and the absolute clang path as a second source # file), so an unconditional prefix silently disables ccache for every # darwin compile. Unlike upstream (bitcoin#30451, which dropped the prefix -# entirely), our Guix environment still sets these variables. +# entirely), our Guix environment still sets these variables. `env` is named +# by its full path because CMake's OBJCXX compiler lookup does not search +# PATH for the first word of the compiler command. ifneq ($(origin C_INCLUDE_PATH) $(origin CPLUS_INCLUDE_PATH),undefined undefined) -darwin_env_unset=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH +darwin_env_unset=$(shell command -v env) -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH endif darwin_CC=$(darwin_env_unset) $(clang_prog) --target=$(host) \ From e162a2ad4c5a1d711f41491b90768a861a6f5e3d Mon Sep 17 00:00:00 2001 From: pasta Date: Wed, 11 Nov 2026 09:34:39 +0000 Subject: [PATCH 7/9] guix: make the build-id check reliable and report its failures Binaries built with USDT tracing carry enough notes that `readelf -n` prints more than a pipe buffer. Both the build-id lookup (`awk ...; exit`) and the check (`grep -q`) stop reading at the first match, so readelf can die of SIGPIPE, which pipefail turns into a failure: a binary that has a build-id is reported as missing one, or the lookup aborts the script. Read all of the output instead. The check's result was also read with `$?` after a failing command substitution, which `set -e` never lets run, so the script exited without printing which binaries failed. Capture the status with `||` instead. Co-Authored-By: Claude Opus 5.5 --- contrib/guix/libexec/build.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/contrib/guix/libexec/build.sh b/contrib/guix/libexec/build.sh index be59445fbcbc..d3946328838e 100755 --- a/contrib/guix/libexec/build.sh +++ b/contrib/guix/libexec/build.sh @@ -358,7 +358,10 @@ mkdir -p "$DISTSRC" find "${DISTNAME}/lib" -type f -print0 } | while IFS= read -r -d '' elf; do if file "$elf" | grep -q "ELF.*executable\|ELF.*shared object"; then - build_id=$("${HOST}"-readelf -n "$elf" 2>/dev/null | awk '/Build ID/ {print $3; exit}') + # Read all of readelf's output: notes such as USDT probes can exceed a + # pipe buffer, and a reader that exits early kills readelf with SIGPIPE, + # which pipefail turns into a failure. + build_id=$("${HOST}"-readelf -n "$elf" 2>/dev/null | awk '/Build ID/ && !id {id = $3} END {print id}') if [ -n "$build_id" ] && [ -f "${elf}.dbg" ]; then dir="${DISTNAME}/usr/lib/debug/.build-id/${build_id:0:2}" mkdir -p "$dir" @@ -369,6 +372,7 @@ mkdir -p "$DISTSRC" done # Verify build-ids and debug links + verification_status=0 verification_output=$( { find "${DISTNAME}/bin" -type f -executable -print0 @@ -378,7 +382,7 @@ mkdir -p "$DISTSRC" while IFS= read -r -d '' elf; do if file "$elf" | grep -q "ELF.*executable\|ELF.*shared object"; then # Check for build-id - if ! "${HOST}"-readelf -n "$elf" 2>/dev/null | grep -q "Build ID"; then + if ! "${HOST}"-readelf -n "$elf" 2>/dev/null | grep "Build ID" >/dev/null; then echo "ERROR: No build-id found in $elf" >&2 verification_failed=1 fi @@ -392,8 +396,7 @@ mkdir -p "$DISTSRC" done exit "$verification_failed" } 2>&1 - ) - verification_status=$? + ) || verification_status=$? if [ "$verification_status" -ne 0 ]; then echo "$verification_output" >&2 exit 1 From 69db23113500fa711c519465daaab68c47cb05b6 Mon Sep 17 00:00:00 2001 From: pasta Date: Sat, 25 Jul 2026 12:06:25 -0500 Subject: [PATCH 8/9] doc: describe the CMake build Replace the Autotools instructions in the build guides, the developer notes, the depends and test documentation and the agent guide with their CMake equivalents, as bitcoin#30454 did upstream: configure with `cmake -B build` (and depends' toolchain file), build with `cmake --build build`, run unit tests with ctest and functional tests from build/test/functional. Configure flags are mapped to the CMake options that replace them. Add a release note for the switch. Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 55 ++++++++++----------- README.md | 10 ++-- contrib/macdeploy/README.md | 4 +- depends/README.md | 24 ++++----- doc/benchmarking.md | 14 +++--- doc/build-freebsd.md | 26 ++++------ doc/build-netbsd.md | 30 +++++------ doc/build-openbsd.md | 37 +++++--------- doc/build-osx.md | 51 +++++++++---------- doc/build-unix.md | 82 +++++++++++++++---------------- doc/build-windows.md | 19 ++++--- doc/dependencies.md | 7 ++- doc/design/libraries.md | 4 +- doc/developer-notes.md | 72 ++++++++++++++------------- doc/fuzzing.md | 69 +++++++++++++------------- doc/multiprocess.md | 16 +++--- doc/multisig-tutorial.md | 56 ++++++++++----------- doc/offline-signing-tutorial.md | 28 +++++------ doc/productivity.md | 50 ++++++++++--------- doc/release-notes-7481.md | 20 ++++++++ doc/release-process.md | 2 +- doc/tracing.md | 6 +-- doc/translation_process.md | 12 +++-- doc/translation_strings_policy.md | 2 +- doc/zmq.md | 9 ++-- src/qt/README.md | 20 ++++---- src/test/README.md | 41 +++++++++------- test/README.md | 46 +++++++++-------- 28 files changed, 407 insertions(+), 405 deletions(-) create mode 100644 doc/release-notes-7481.md diff --git a/AGENTS.md b/AGENTS.md index 329bc2361a0f..bb860dab5c83 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -30,7 +30,7 @@ Short version, in order of preference: be": a violation means someone has a bug worth investigating, but execution stays well-defined. A negative rate-limit counter is the archetype - somebody decremented twice, we may be more DoS-exposed than intended, but nothing is - corrupt. It aborts in `--enable-debug` and `--enable-fuzz` builds (CI's + corrupt. It aborts in `Debug` and `BUILD_FOR_FUZZING=ON` builds (CI's `linux64_multiprocess` and fuzz jobs) while a failure is silent in release, so it must never take down a production node. The expression is always evaluated. @@ -88,40 +88,35 @@ Use portable parallelism in examples. Linux-only CPU-count helpers are not available on every supported developer host. ```bash -./autogen.sh - JOBS="$(getconf _NPROCESSORS_ONLN 2>/dev/null || sysctl -n hw.ncpu)" JOBS="$(( JOBS > 1 ? JOBS - 1 : 1 ))" make -C depends -j"$JOBS" -# Use the depends prefix printed for your platform, for example -# depends/x86_64-pc-linux-gnu or depends/aarch64-apple-darwin24.3.0. -./configure --prefix="$(pwd)/depends/[platform-triplet]" - -make -j"$JOBS" +# Use the toolchain generated for your platform, for example +# depends/x86_64-pc-linux-gnu/toolchain.cmake. +cmake -B build --toolchain depends/[platform-triplet]/toolchain.cmake +cmake --build build -j"$JOBS" ``` -Useful developer configure flags: +Useful developer configuration options: ```bash -./configure --prefix="$(pwd)/depends/[platform-triplet]" \ - --disable-hardening \ - --enable-crash-hooks \ - --enable-debug \ - --enable-reduce-exports \ - --enable-stacktraces \ - --enable-suppress-external-warnings \ - --enable-werror +cmake -B build --toolchain depends/[platform-triplet]/toolchain.cmake \ + -DENABLE_HARDENING=OFF \ + -DENABLE_CRASH_HOOKS=ON \ + -DCMAKE_BUILD_TYPE=Debug \ + -DREDUCE_EXPORTS=ON \ + -DENABLE_STACKTRACES=ON \ + -DWERROR=ON ``` To generate `compile_commands.json` or run clang-tidy, see `doc/developer-notes.md` under "Running clang-tidy". When adding, removing, or renaming C++ source files, update the build system in -the same change. Most source/test files need `src/Makefile.am` or -`src/Makefile.test.include` updates, and new Dash-specific files must also be -appended to `test/util/data/non-backported.txt`. +the same change. Update the relevant `CMakeLists.txt`, and new Dash-specific +files must also be appended to `test/util/data/non-backported.txt`. ## Writing Tests @@ -141,20 +136,20 @@ Choose tests based on the files touched. ```bash # All unit tests -make check +ctest --test-dir build # One Boost test suite or case -./src/test/test_dash --run_test=getarg_tests +./build/src/test/test_dash --run_test=getarg_tests # All functional tests -test/functional/test_runner.py +build/test/functional/test_runner.py # One functional test -test/functional/test_runner.py wallet_hd.py +build/test/functional/test_runner.py wallet_hd.py # Parallel functional tests JOBS="$(getconf _NPROCESSORS_ONLN 2>/dev/null || sysctl -n hw.ncpu)" -test/functional/test_runner.py -j"$JOBS" +build/test/functional/test_runner.py -j"$JOBS" # Lint test/lint/all-lint.py @@ -271,19 +266,19 @@ Be extra careful around: ```bash # Run dashd with broad logging -./src/dashd -debug=all -printtoconsole +./build/src/dashd -debug=all -printtoconsole # Run a functional test against a custom binary -test/functional/test_runner.py --dashd=/path/to/dashd wallet_hd.py +build/test/functional/test_runner.py --dashd=/path/to/dashd wallet_hd.py # Keep failed functional-test datadirs -test/functional/test_runner.py --nocleanup --tracerpc -l DEBUG wallet_hd.py +build/test/functional/test_runner.py --nocleanup --tracerpc -l DEBUG wallet_hd.py # Debug a unit-test binary -gdb ./src/test/test_dash +gdb ./build/src/test/test_dash # Profile a functional test -test/functional/test_runner.py --perf wallet_hd.py +build/test/functional/test_runner.py --perf wallet_hd.py perf report -i /path/to/datadir/test.perf.data --stdio | c++filt ``` diff --git a/README.md b/README.md index 937b55e4127e..b6a7386e913d 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ and useful hints for developers can be found in [doc/developer-notes.md](doc/dev Build / Compile from Source --------------------------- -The `./configure`, `make`, and `cmake` steps, as well as build dependencies, are in [./doc/](/doc) as well: +The CMake build steps, as well as build dependencies, are in [./doc/](/doc) as well: - **Linux**: [./doc/build-unix.md](/doc/build-unix.md) \ Ubuntu, Debian, Fedora, Arch, and others @@ -71,13 +71,13 @@ lots of money. ### Automated Testing Developers are strongly encouraged to write [unit tests](src/test/README.md) for new code, and to -submit new unit tests for old code. Unit tests can be compiled and run -(assuming they weren't disabled during the generation of the build system) with: `ctest`. Further details on running -and extending unit tests can be found in [/src/test/README.md](/src/test/README.md). +submit new unit tests for old code. Build with `cmake --build build`, then run +unit tests with `ctest --test-dir build` (assuming they were not disabled during +configuration). Further details on running and extending unit tests can be found in [/src/test/README.md](/src/test/README.md). There are also [regression and integration tests](/test), written in Python. -These tests can be run (if the [test dependencies](/test) are installed) with: `test/functional/test_runner.py` +These tests can be run (if the [test dependencies](/test) are installed) with: `build/test/functional/test_runner.py` The CI (Continuous Integration) systems make sure that every pull request is built for Windows, Linux, and macOS, and that unit/sanity tests are run automatically. diff --git a/contrib/macdeploy/README.md b/contrib/macdeploy/README.md index addfe5891358..e25f64f4575b 100644 --- a/contrib/macdeploy/README.md +++ b/contrib/macdeploy/README.md @@ -3,10 +3,10 @@ The `macdeployqtplus` script should not be run manually. Instead, after building as usual: ```bash -make deploy +cmake --build build --target deploy ``` -When complete, it will have produced `Dash-Core.zip`. +When complete, it will have produced `build/Dash-Core.zip`. ## SDK Extraction diff --git a/depends/README.md b/depends/README.md index 05b81deaeb44..8c75066c90b9 100644 --- a/depends/README.md +++ b/depends/README.md @@ -55,17 +55,16 @@ To build dependencies for the current arch+OS: ## Configuring Dash Core -**Dash Core's `configure` script by default will ignore the depends output.** In -order for it to pick up libraries, tools, and settings from the depends build, -you must set the `CONFIG_SITE` environment variable to point to a `config.site` settings file. -Make sure that `CONFIG_SITE` is an absolute path. -In the above example, a file named `depends/x86_64-w64-mingw32/share/config.site` will be -created. To use it during compilation: +**CMake by default will ignore the depends output.** To use libraries, tools, +and settings from the depends build, specify the generated toolchain file. +For example, after `make -C depends HOST=x86_64-w64-mingw32` from the source root: - CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure + cmake -B build --toolchain depends/x86_64-w64-mingw32/toolchain.cmake + cmake --build build -The default install prefix when using `config.site` is `--prefix=depends/`, -so depends build outputs will be installed in that location. +For a native build, use `depends//toolchain.cmake` for +your platform. See [Dependency Options](#dependency-options) for settings that +also configure Dash Core features. ## Dependency Options @@ -91,7 +90,7 @@ The following can be set when running make: `make FOO=bar` - `NO_USDT`: Don't download/build/cache packages needed for enabling USDT tracepoints - `MULTIPROCESS`: build libmultiprocess (experimental, requires cmake) - `PLATFORM_GUI`: build the Rust toolchain and `dash-sdk-cxx` (the Dash Platform SDK's C++ binding) needed for - `--enable-platform-gui` (which config.site then enables unless the GUI or wallet is off); cannot be combined with `NO_QT` + `-DENABLE_PLATFORM_GUI=ON` (which the toolchain file then sets unless the GUI or wallet is off); cannot be combined with `NO_QT` or `NO_WALLET`. Not supported in Guix or release builds (the build refuses `GUIX_ENVIRONMENT`); CI builds and tests it on x86_64 Linux only. Uses a pinned prebuilt Rust toolchain and protoc. Not available for `powerpc64-linux-gnu`, or for hosts `packages/rust_stdlib.mk` has no entry for, such as `powerpc64le-linux-gnu`. @@ -104,8 +103,9 @@ The following can be set when running make: `make FOO=bar` - `LTO`: Enable options needed for LTO. Does not add `-flto` related options to *FLAGS. - `NO_HARDEN=1`: Don't use hardening options when building packages -If some packages are not built, for example `make NO_WALLET=1`, the appropriate -options will be passed to Dash Core's configure. In this case, `--disable-wallet`. +If some packages are not built, for example `make NO_WALLET=1`, the appropriate CMake +cache variables will be set when configuring Dash Core with the toolchain file. +In this case, `-DENABLE_WALLET=OFF`. ## Cross compilation diff --git a/doc/benchmarking.md b/doc/benchmarking.md index 0ea678033388..6f3908a03378 100644 --- a/doc/benchmarking.md +++ b/doc/benchmarking.md @@ -8,16 +8,18 @@ thread queue, wallet balance. Running --------------------- -For benchmarking, you only need to compile `dash_bench`. The bench runner -warns if you configure with `--enable-debug`, but consider if building without +For benchmarking, you only need to build the `bench_bitcoin` target (which +produces `bench_dash`). The bench runner warns if you configure with +`-DCMAKE_BUILD_TYPE=Debug`, but consider if building without it will impact the benchmark(s) you are interested in by unlatching log printers and lock analysis. - make -C src dash_bench + cmake -B build -DBUILD_BENCH=ON + cmake --build build --target bench_bitcoin After compiling Dash Core, the benchmarks can be run with: - src/bench/bench_dash + build/src/bench/bench_dash The output will look similar to: ``` @@ -39,7 +41,7 @@ The output will look similar to: Help --------------------- - src/bench/bench_dash -? + build/src/bench/bench_dash -? To print the various options, like listing the benchmarks without running them or using a regex filter to only run certain benchmarks. @@ -62,7 +64,7 @@ inventories whose hashes are absent locally and clear the request state after every iteration. Use an optimized build to measure CPU cost; debug builds additionally enable expensive container and lock-order checks. - src/bench/bench_dash -filter='InventoryBatch.*' -min-time=5000 + build/src/bench/bench_dash -filter='InventoryBatch.*' -min-time=5000 Going Further -------------------- diff --git a/doc/build-freebsd.md b/doc/build-freebsd.md index 040c53bfaf40..35f2a249e3b4 100644 --- a/doc/build-freebsd.md +++ b/doc/build-freebsd.md @@ -10,7 +10,7 @@ This guide describes how to build dashd, command-line utilities, and GUI on Free Run the following as root to install the base dependencies for building. ```bash -pkg install autoconf automake boost-libs git gmake libevent libtool pkgconf libbacktrace zstd +pkg install cmake boost-libs git gmake libevent pkgconf libbacktrace zstd ``` @@ -63,14 +63,14 @@ sh/bash: export BDB_PREFIX=[path displayed above] #### GUI Dependencies ###### Qt5 -Dash Core includes a GUI built with the cross-platform Qt Framework. To compile the GUI, we need to install the necessary parts of Qt. Skip if you don't intend to use the GUI. +Dash Core includes a GUI built with the cross-platform Qt Framework. To compile the GUI, install the necessary parts of Qt and pass `-DBUILD_GUI=ON` to CMake. Skip if you don't intend to use the GUI. ```bash pkg install qt5-buildtools qt5-core qt5-gui qt5-linguisttools qt5-testlib qt5-widgets ``` ###### libqrencode -The GUI can encode addresses in a QR Code. To build in QR support for the GUI, install `libqrencode`. Skip if not using the GUI or don't want QR code functionality. +The GUI can encode addresses in a QR Code. To build in QR support for the GUI, install `libqrencode`. Pass `-DWITH_QRENCODE=OFF` if you do not want QR code functionality. ```bash pkg install libqrencode ``` @@ -79,7 +79,7 @@ pkg install libqrencode #### Notifications ###### ZeroMQ -Dash Core can provide notifications via ZeroMQ. If the package is installed, support will be compiled in. +Dash Core can provide notifications via ZeroMQ. Pass `-DWITH_ZMQ=ON` to CMake to enable support. ```bash pkg install libzmq4 ``` @@ -102,31 +102,25 @@ There are many ways to configure Dash Core, here are a few common examples: ##### Descriptor Wallet and GUI: This explicitly enables the GUI and disables legacy wallet support, assuming `sqlite` and `qt` are installed. ```bash -./autogen.sh -./configure --without-bdb --with-gui=yes MAKE=gmake +cmake -B build -DWITH_BDB=OFF -DBUILD_GUI=ON ``` ##### Descriptor & Legacy Wallet. No GUI: This enables support for both wallet types and disables the GUI, assuming `sqlite3` and `db4` are both installed. ```bash -./autogen.sh -./configure --with-gui=no \ - BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" \ - BDB_CFLAGS="-I${BDB_PREFIX}/include" \ - MAKE=gmake +cmake -B build -DBUILD_GUI=OFF -DWITH_BDB=ON \ + -DBerkeleyDB_INCLUDE_DIR:PATH="${BDB_PREFIX}/include" ``` ##### No Wallet or GUI ``` bash -./autogen.sh -./configure --without-wallet --with-gui=no MAKE=gmake +cmake -B build -DENABLE_WALLET=OFF -DBUILD_GUI=OFF ``` ### 2. Compile -**Important**: Use `gmake` (the non-GNU `make` will exit with an error). ```bash -gmake # use "-j N" for N parallel jobs -gmake check # Run tests if Python 3 is available +cmake --build build # use "-j N" for N parallel jobs +ctest --test-dir build # Some tests require Python 3 ``` diff --git a/doc/build-netbsd.md b/doc/build-netbsd.md index 77ee94a30a5e..b3b9ec46e897 100644 --- a/doc/build-netbsd.md +++ b/doc/build-netbsd.md @@ -14,11 +14,11 @@ Install the required dependencies the usual way you [install software on NetBSD] The example commands below use `pkgin`. ```bash -pkgin install autoconf automake libtool pkg-config git gmake boost-headers libevent zstd +pkgin install cmake pkg-config git gmake boost-headers libevent zstd ``` -NetBSD may ship with an older version of `gcc` than is needed to build C++20 (GCC 11.1+ is required). You should install a newer `gcc` and pass it to the configure script. +NetBSD may ship with an older version of `gcc` than is needed to build C++20 (GCC 11.1+ is required). You should install a newer `gcc` and select it when configuring with CMake. For example, grab `gcc12`: ``` @@ -27,11 +27,9 @@ pkgin install gcc12 Then, when configuring, pass the following: ```bash -./configure - ... - CC="/usr/pkg/gcc12/bin/gcc" \ - CXX="/usr/pkg/gcc12/bin/g++" \ - ... +cmake -B build \ + -DCMAKE_C_COMPILER="/usr/pkg/gcc12/bin/gcc" \ + -DCMAKE_CXX_COMPILER="/usr/pkg/gcc12/bin/g++" ``` See [dependencies.md](dependencies.md) for a complete overview. @@ -68,13 +66,14 @@ pkgin install db4 #### GUI Dependencies -Dash Core includes a GUI built with the cross-platform Qt Framework. To compile the GUI, Qt 5 is required. +Dash Core includes a GUI built with the cross-platform Qt Framework. To compile the GUI, Qt 5 is required. Pass `-DBUILD_GUI=ON` to CMake. ```bash pkgin install qt5-qtbase qt5-qttools ``` -The GUI can encode addresses in a QR Code. To build in QR support for the GUI, install `qrencode`. +The GUI can encode addresses in a QR Code. Install `qrencode`, or pass +`-DWITH_QRENCODE=OFF` to disable this feature. ```bash pkgin install qrencode @@ -91,8 +90,6 @@ pkgin install python312 ### Building Dash Core -**Note**: Use `gmake` (the non-GNU `make` will exit with an error). - ### 1. Configuration @@ -100,19 +97,16 @@ There are many ways to configure Dash Core. Here is an example that explicitly disables the wallet and GUI: ```bash -./autogen.sh -./configure --without-wallet --with-gui=no \ - CPPFLAGS="-I/usr/pkg/include" \ - MAKE=gmake +cmake -B build -DENABLE_WALLET=OFF -DBUILD_GUI=OFF ``` -For a full list of configuration options, see the output of `./configure --help` +For a full list of configuration options, run `cmake -B build -LH`. ### 2. Compile Build and run the tests: ```bash -gmake # use "-j N" here for N parallel jobs -gmake check # Run tests if Python 3 is available +cmake --build build # use "-j N" for N parallel jobs +ctest --test-dir build # Some tests require Python 3 ``` diff --git a/doc/build-openbsd.md b/doc/build-openbsd.md index ba87afa9061f..971bfed0e457 100644 --- a/doc/build-openbsd.md +++ b/doc/build-openbsd.md @@ -10,9 +10,9 @@ This guide describes how to build dashd, command-line utilities, and GUI on Open Run the following as root to install the base dependencies for building. ```bash -pkg_add bash git gmake libevent libtool boost zstd -# Select the newest version of the following packages: -pkg_add autoconf automake python +pkg_add cmake git gmake libevent boost zstd +# Select Python 3.10 or newer: +pkg_add python ``` See [dependencies.md](dependencies.md) for a complete overview. @@ -58,7 +58,7 @@ export BDB_PREFIX="/path/to/dash/depends/x86_64-unknown-openbsd" #### GUI Dependencies ###### Qt5 -Dash Core includes a GUI built with the cross-platform Qt Framework. To compile the GUI, Qt 5 is required. +Dash Core includes a GUI built with the cross-platform Qt Framework. To compile the GUI, Qt 5 is required. Pass `-DBUILD_GUI=ON` to CMake. ```bash pkg_add qt5 @@ -66,7 +66,7 @@ pkg_add qt5 ###### libqrencode -The GUI can encode addresses in a QR Code. To build in QR support for the GUI, install `libqrencode`. Skip if not using the GUI or don't want QR code functionality. +The GUI can encode addresses in a QR Code. To build in QR support for the GUI, install `libqrencode`. Pass `-DWITH_QRENCODE=OFF` if you do not want QR code functionality. ```bash pkg_add libqrencode ``` @@ -75,25 +75,13 @@ pkg_add libqrencode #### Notifications ###### ZeroMQ -Dash Core can provide notifications via ZeroMQ. If the package is installed, support will be compiled in. +Dash Core can provide notifications via ZeroMQ. Pass `-DWITH_ZMQ=ON` to CMake to enable support. ```bash pkg_add zeromq ``` ## Building Dash Core -**Important**: Use `gmake` (the non-GNU `make` will exit with an error). - -Preparation: -```bash - -# Adapt the following for the version you installed (major.minor only): -export AUTOCONF_VERSION=2.71 -export AUTOMAKE_VERSION=1.16 - -./autogen.sh -``` - ### 1. Configuration There are many ways to configure Dash Core, here are a few common examples: @@ -102,25 +90,22 @@ There are many ways to configure Dash Core, here are a few common examples: This enables the GUI and descriptor wallet support, assuming `sqlite` and `qt5` are installed. ```bash -./configure MAKE=gmake +cmake -B build -DBUILD_GUI=ON ``` ##### Descriptor & Legacy Wallet. No GUI: This enables support for both wallet types and disables the GUI: ```bash -./configure --with-gui=no \ - BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" \ - BDB_CFLAGS="-I${BDB_PREFIX}/include" \ - MAKE=gmake +cmake -B build -DBUILD_GUI=OFF -DWITH_BDB=ON \ + -DBerkeleyDB_INCLUDE_DIR:PATH="${BDB_PREFIX}/include" ``` ### 2. Compile -**Important**: Use `gmake` (the non-GNU `make` will exit with an error). ```bash -gmake # use "-j N" for N parallel jobs -gmake check # Run tests if Python 3 is available +cmake --build build # use "-j N" for N parallel jobs +ctest --test-dir build # Some tests require Python 3 ``` ## Resource limits diff --git a/doc/build-osx.md b/doc/build-osx.md index c4eb2d177418..3905afbd49f6 100644 --- a/doc/build-osx.md +++ b/doc/build-osx.md @@ -47,7 +47,7 @@ To install, run the following from your terminal: See [dependencies.md](dependencies.md) for a complete overview. ``` bash -brew install automake libtool boost pkg-config libevent zstd +brew install cmake boost pkg-config libevent zstd ``` ### 4. Clone Dash repository @@ -88,7 +88,7 @@ brew install berkeley-db@4 ###### Qt Dash Core includes a GUI built with the cross-platform Qt Framework. -To compile the GUI, we need to install `qt@5`. +To compile the GUI, install `qt@5` and pass `-DBUILD_GUI=ON` to CMake. Skip if you don't intend to use the GUI. ``` bash @@ -101,7 +101,7 @@ See the notes in [#7714](https://github.com/dashpay/dash/issues/7714). ###### qrencode The GUI can encode addresses in a QR Code. To build in QR support for the GUI, install `qrencode`. -Skip if not using the GUI or don't want QR code functionality. +If you do not want QR code functionality, pass `-DWITH_QRENCODE=OFF` to CMake. ``` bash brew install qrencode @@ -128,7 +128,8 @@ Skip if you do not need this functionality. brew install libnatpmp ``` -Note: UPnP and NAT-PMP support will be compiled in and disabled by default. +Enable UPnP support with `-DWITH_MINIUPNPC=ON` and NAT-PMP support with +`-DWITH_NATPMP=ON`. Both remain disabled at runtime by default. Check out the [further configuration](#further-configuration) section for more information. --- @@ -142,7 +143,7 @@ Skip if you do not need ZMQ functionality. brew install zeromq ``` -ZMQ is automatically compiled in and enabled if the dependency is detected. +Enable ZMQ notifications with `-DWITH_ZMQ=ON`. Check out the [further configuration](#further-configuration) section for more information. For more information on ZMQ, see: [zmq.md](zmq.md) @@ -162,7 +163,7 @@ brew install python #### Deploy Dependencies -You can deploy a `.zip` containing the Dash Core application using `make deploy`. +You can deploy a `.zip` containing the Dash Core application using `cmake --build build --target deploy`. It is required that you have `python` installed. ## Building Dash Core @@ -173,31 +174,25 @@ There are many ways to configure Dash Core, here are a few common examples: ##### Wallet (BDB + SQlite) Support, No GUI: -If `berkeley-db@4` is installed, then legacy wallet support will be built. -If `sqlite` is installed, then descriptor wallet support will also be built. -Additionally, this explicitly disables the GUI. +This enables legacy wallet support in addition to descriptor wallets. +If `berkeley-db@4` or `sqlite` is unavailable, configuration fails. The GUI is disabled by default. ``` bash -./autogen.sh -./configure --with-gui=no +cmake -B build -DWITH_BDB=ON -DBUILD_GUI=OFF ``` ##### Wallet (only SQlite) and GUI Support: This explicitly enables the GUI and disables legacy wallet support. -If `qt` is not installed, this will throw an error. -If `sqlite` is installed then descriptor wallet functionality will be built. -If `sqlite` is not installed, then wallet functionality will be disabled. +If `qt@5` or `sqlite` is unavailable, configuration fails. ``` bash -./autogen.sh -./configure --without-bdb --with-gui=yes +cmake -B build -DWITH_BDB=OFF -DBUILD_GUI=ON ``` ##### No Wallet or GUI ``` bash -./autogen.sh -./configure --without-wallet --with-gui=no +cmake -B build -DENABLE_WALLET=OFF -DBUILD_GUI=OFF ``` ##### Further Configuration @@ -206,7 +201,7 @@ You may want to dig deeper into the configuration options to achieve your desire Examine the output of the following command for a full list of configuration options: ``` bash -./configure -help +cmake -B build -LH ``` ### 2. Compile @@ -215,8 +210,8 @@ After configuration, you are ready to compile. Run the following in your terminal to compile Dash Core: ``` bash -make # use "-j N" here for N parallel jobs -make check # Run tests if Python 3 is available +cmake --build build # use "-j N" for N parallel jobs +ctest --test-dir build # Some tests require Python 3 ``` ### 3. Deploy (optional) @@ -224,13 +219,13 @@ make check # Run tests if Python 3 is available You can also create a `.zip` containing the `.app` bundle by running the following command: ``` bash -make deploy +cmake --build build --target deploy ``` ## Running Dash Core -Dash Core should now be available at `./src/dashd`. -If you compiled support for the GUI, it should be available at `./src/qt/dash-qt`. +Dash Core should now be available at `./build/src/dashd`. +If you compiled support for the GUI, it should be available at `./build/src/qt/dash-qt`. The first time you run `dashd` or `dash-qt`, it will start downloading the blockchain. This process could take many hours, or even days on slower than average systems. @@ -260,8 +255,8 @@ tail -f $HOME/Library/Application\ Support/DashCore/debug.log ## Other commands: ```shell -./src/dashd -daemon # Starts the dashd daemon. -./src/dash-cli --help # Outputs a list of command-line options. -./src/dash-cli help # Outputs a list of RPC commands when the daemon is running. -./src/qt/dash-qt -server # Starts the dash-qt server mode, allows dash-cli control +./build/src/dashd -daemon # Starts the dashd daemon. +./build/src/dash-cli --help # Outputs a list of command-line options. +./build/src/dash-cli help # Outputs a list of RPC commands when the daemon is running. +./build/src/qt/dash-qt -server # Starts the dash-qt server mode, allows dash-cli control ``` diff --git a/doc/build-unix.md b/doc/build-unix.md index d68b295c1d2f..9643bdf547a7 100644 --- a/doc/build-unix.md +++ b/doc/build-unix.md @@ -8,10 +8,9 @@ To Build --------------------- ```sh -./autogen.sh -./configure -make # use "-j N" for N parallel jobs -make install # optional +cmake -B build +cmake --build build # use "-j N" for N parallel jobs +cmake --install build # optional ``` See below for instructions on how to [install the dependencies on popular Linux @@ -22,11 +21,11 @@ distributions](#linux-distribution-specific-instructions), or the C++ compilers are memory-hungry. It is recommended to have at least 1.5 GB of memory available when compiling Dash Core. On systems with less, gcc can be -tuned to conserve memory with additional CXXFLAGS: +tuned to conserve memory with additional `CMAKE_CXX_FLAGS`: ```sh -./configure CXXFLAGS="--param ggc-min-expand=1 --param ggc-min-heapsize=32768" +cmake -B build -DCMAKE_CXX_FLAGS="--param ggc-min-expand=1 --param ggc-min-heapsize=32768" ``` @@ -39,7 +38,7 @@ tuned to conserve memory with additional CXXFLAGS: Build requirements: ```sh -sudo apt-get install build-essential libtool autotools-dev automake pkg-config bsdmainutils bison python3 +sudo apt-get install build-essential cmake pkg-config python3 ``` Now, you can either build from self-compiled [depends](#dependencies) or install the required dependencies: @@ -60,27 +59,27 @@ sudo apt-get install libsqlite3-dev Berkeley DB is only required for the legacy wallet. Ubuntu and Debian have their own `libdb-dev` and `libdb++-dev` packages, but these will install Berkeley DB 5.3 or later. This will break binary wallet compatibility with the distributed executables, which are based on BerkeleyDB 4.8. If you do not care about wallet compatibility, pass -`--with-incompatible-bdb` to configure. Otherwise, you can build Berkeley DB [yourself](#berkeley-db). +`-DWITH_BDB=ON -DWARN_INCOMPATIBLE_BDB=OFF` to CMake. Otherwise, you can build Berkeley DB [yourself](#berkeley-db). To build Dash Core without wallet, see [*Disable-wallet mode*](#disable-wallet-mode) -zstd compresses block and undo files on disk (see: `--with-zstd`, package `libzstd-dev` +zstd compresses block and undo files on disk (see: `-DWITH_ZSTD=ON`, package `libzstd-dev` on Debian and Ubuntu, `libzstd-devel` on Fedora); a build without it cannot read block files that contain compressed records. -Optional port mapping libraries (see: `--with-miniupnpc` and `--with-natpmp`): +Optional port mapping libraries (see: `-DWITH_MINIUPNPC=ON` and `-DWITH_NATPMP=ON`): ```sh sudo apt-get install libminiupnpc-dev libnatpmp-dev ``` -ZMQ dependencies (provides ZMQ API): +ZMQ dependencies (enable notifications with `-DWITH_ZMQ=ON`): ```sh sudo apt-get install libzmq3-dev ``` -User-Space, Statically Defined Tracing (USDT) dependencies: +User-Space, Statically Defined Tracing (USDT) dependencies (enable with `-DWITH_USDT=ON`): ```sh sudo apt install systemtap-sdt-dev @@ -88,9 +87,8 @@ sudo apt install systemtap-sdt-dev GUI dependencies: -If you want to build dash-qt, make sure that the required packages for Qt development -are installed. Qt 5 is necessary to build the GUI. -To build without GUI pass `--without-gui`. +To build dash-qt, install the required Qt 5 development packages and pass +`-DBUILD_GUI=ON` to CMake. The GUI is disabled by default. To build with Qt 5 you need the following: @@ -104,14 +102,14 @@ Additionally, to support Wayland protocol for modern desktop environments: sudo apt-get install qtwayland5 ``` -libqrencode (optional) can be installed with: +For QR encoding support, install libqrencode: ```sh sudo apt-get install libqrencode-dev ``` -Once these are installed, they will be found by configure and a dash-qt executable will be -built by default. +QR encoding is enabled when building the GUI. If libqrencode is not installed, +pass `-DWITH_QRENCODE=OFF` to disable QR encoding. ### Fedora @@ -121,7 +119,7 @@ built by default. Build requirements: ```sh -sudo dnf install gcc-c++ libtool make autoconf automake python3 +sudo dnf install gcc-c++ cmake make pkgconf-pkg-config python3 ``` Now, you can either build from self-compiled [depends](#dependencies) or install the required dependencies: @@ -130,7 +128,7 @@ Now, you can either build from self-compiled [depends](#dependencies) or install sudo dnf install libevent-devel boost-devel ``` -Note: Fedora repositories do not include libbacktrace. To build Dash Core without stack trace support, configure with `--disable-stacktraces`. +Note: Fedora repositories do not include libbacktrace. To build Dash Core without stack trace support, configure with `-DENABLE_STACKTRACES=OFF`. SQLite is required for the descriptor wallet: @@ -141,27 +139,27 @@ sudo dnf install sqlite-devel Berkeley DB is only required for the legacy wallet. Fedora releases have only `libdb-devel` and `libdb-cxx-devel` packages, but these will install Berkeley DB 5.3 or later. This will break binary wallet compatibility with the distributed executables, which are based on Berkeley DB 4.8. If you do not care about wallet compatibility, -pass `--with-incompatible-bdb` to configure. Otherwise, you can build Berkeley DB [yourself](#berkeley-db). +pass `-DWITH_BDB=ON -DWARN_INCOMPATIBLE_BDB=OFF` to CMake. Otherwise, you can build Berkeley DB [yourself](#berkeley-db). To build Dash Core without wallet, see [*Disable-wallet mode*](#disable-wallet-mode) -zstd compresses block and undo files on disk (see: `--with-zstd`, package `libzstd-dev` +zstd compresses block and undo files on disk (see: `-DWITH_ZSTD=ON`, package `libzstd-dev` on Debian and Ubuntu, `libzstd-devel` on Fedora); a build without it cannot read block files that contain compressed records. -Optional port mapping libraries (see: `--with-miniupnpc` and `--with-natpmp`): +Optional port mapping libraries (see: `-DWITH_MINIUPNPC=ON` and `-DWITH_NATPMP=ON`): ```sh sudo dnf install miniupnpc-devel libnatpmp-devel ``` -ZMQ dependencies (provides ZMQ API): +ZMQ dependencies (enable notifications with `-DWITH_ZMQ=ON`): ```sh sudo dnf install zeromq-devel ``` -User-Space, Statically Defined Tracing (USDT) dependencies: +User-Space, Statically Defined Tracing (USDT) dependencies (enable with `-DWITH_USDT=ON`): ```sh sudo dnf install systemtap-sdt-devel @@ -169,9 +167,8 @@ sudo dnf install systemtap-sdt-devel GUI dependencies: -If you want to build dash-qt, make sure that the required packages for Qt development -are installed. Qt 5 is necessary to build the GUI. -To build without GUI pass `--without-gui`. +To build dash-qt, install the required Qt 5 development packages and pass +`-DBUILD_GUI=ON` to CMake. The GUI is disabled by default. To build with Qt 5 you need the following: @@ -185,14 +182,14 @@ Additionally, to support Wayland protocol for modern desktop environments: sudo dnf install qt5-qtwayland ``` -libqrencode (optional) can be installed with: +For QR encoding support, install libqrencode: ```sh sudo dnf install qrencode-devel ``` -Once these are installed, they will be found by configure and a dash-qt executable will be -built by default. +QR encoding is enabled when building the GUI. If libqrencode is not installed, +pass `-DWITH_QRENCODE=OFF` to disable QR encoding. ## Dependencies @@ -214,9 +211,8 @@ and configure using the following: ```bash export BDB_PREFIX="/path/to/dash/depends/x86_64-pc-linux-gnu" -./configure \ - BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" \ - BDB_CFLAGS="-I${BDB_PREFIX}/include" +cmake -B build -DWITH_BDB=ON \ + -DBerkeleyDB_INCLUDE_DIR:PATH="${BDB_PREFIX}/include" ``` **Note**: Make sure that `BDB_PREFIX` is an absolute path. @@ -228,18 +224,18 @@ Disable-wallet mode When the intention is to only run a P2P node, without a wallet, Dash Core can be compiled in disable-wallet mode with: - ./configure --disable-wallet + cmake -B build -DENABLE_WALLET=OFF In this case there is no dependency on SQLite or Berkeley DB. Mining is also possible in disable-wallet mode using the `getblocktemplate` RPC call. -Additional Configure Flags +Additional Configuration Options -------------------------- -A list of additional configure flags can be displayed with: +A list of configuration options can be displayed with: ```sh -./configure --help +cmake -B build -LH ``` @@ -248,13 +244,13 @@ Setup and Build Example: Arch Linux This example lists the steps necessary to setup and build a command line only distribution of the latest changes on Arch Linux: ```sh -pacman --sync --needed autoconf automake base-devel boost cmake gcc git libbacktrace libevent libtool make patch pkgconf python sqlite zstd +pacman --sync --needed base-devel boost cmake gcc git libbacktrace libevent make pkgconf python sqlite zstd git clone https://github.com/dashpay/dash.git cd dash/ -./autogen.sh -./configure -make check -./src/dashd +cmake -B build +cmake --build build +ctest --test-dir build +./build/src/dashd ``` If you intend to work with legacy Berkeley DB wallets, see [Berkeley DB](#berkeley-db) section. diff --git a/doc/build-windows.md b/doc/build-windows.md index ec2fe1dbed07..fcd5597a33e3 100644 --- a/doc/build-windows.md +++ b/doc/build-windows.md @@ -8,6 +8,8 @@ The options known to work for building Dash Core on Windows are: * On Linux, using the [Mingw-w64](https://www.mingw-w64.org/) cross compiler tool chain. * On Windows, using [Windows Subsystem for Linux (WSL)](https://learn.microsoft.com/en-us/windows/wsl/about) and Mingw-w64. +Native MSVC builds are currently unsupported. + Other options which may work, but which have not been extensively tested are (please contribute instructions): * On Windows, using a POSIX compatibility layer application such as [cygwin](https://www.cygwin.com/) or [msys2](https://www.msys2.org/). @@ -39,15 +41,16 @@ results in `Autoconf` configure scripts being able to execute Windows Portable E unexpected behaviour during the build, such as Win32 error dialogs for missing libraries. The recommended approach is to temporarily disable WSL support for Win32 applications. +Install the cross compiler and NSIS (for the optional installer): + + sudo apt install g++-mingw-w64-x86-64-posix nsis + Build using: sudo bash -c "echo 0 > /proc/sys/fs/binfmt_misc/status" # Disable WSL support for Win32 applications. - cd depends - make HOST=x86_64-w64-mingw32 - cd .. - ./autogen.sh - CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --prefix=/ - make # use "-j N" for N parallel jobs + make -C depends HOST=x86_64-w64-mingw32 # use "-j N" for N parallel jobs + cmake -B build --toolchain depends/x86_64-w64-mingw32/toolchain.cmake + cmake --build build # use "-j N" for N parallel jobs sudo bash -c "echo 1 > /proc/sys/fs/binfmt_misc/status" # Enable WSL support for Win32 applications. ## Depends system @@ -62,8 +65,8 @@ executables to a directory on the Windows drive in the same directory structure as they appear in the release `.zip` archive. This can be done in the following way. This will install to `c:\workspace\dash`, for example: - make install DESTDIR=/mnt/c/workspace/dash + cmake --install build --prefix /mnt/c/workspace/dash You can also create an installer using: - make deploy + cmake --build build --target deploy diff --git a/doc/dependencies.md b/doc/dependencies.md index 67d0de1c4618..9ed41564b880 100644 --- a/doc/dependencies.md +++ b/doc/dependencies.md @@ -6,8 +6,7 @@ You can find installation instructions in the `build-*.md` file for your platfor | Dependency | Minimum required | | --- | --- | -| [Autoconf](https://www.gnu.org/software/autoconf/) | [2.69](https://github.com/bitcoin/bitcoin/pull/17769) | -| [Automake](https://www.gnu.org/software/automake/) | [1.13](https://github.com/bitcoin/bitcoin/pull/18290) | +| [CMake](https://cmake.org) | 3.22 | | [Clang](https://clang.llvm.org) | [16.0](https://github.com/bitcoin/bitcoin/pull/30263) | | [GCC](https://gcc.gnu.org) | [11.1](https://github.com/bitcoin/bitcoin/pull/29091) | | [Python](https://www.python.org) (scripts, tests) | [3.10](https://github.com/bitcoin/bitcoin/pull/30527) | @@ -37,8 +36,8 @@ You can find installation instructions in the `build-*.md` file for your platfor | [qrencode](../depends/packages/qrencode.mk) | [link](https://fukuchi.org/works/qrencode/) | [4.1.1](https://github.com/bitcoin/bitcoin/pull/27312) | | No | | [Qt](../depends/packages/qt.mk) | [link](https://download.qt.io/official_releases/qt/) | [5.15.18](https://github.com/dashpay/dash/pull/6949) | 5.15 | No | -### Dash Platform GUI (`--enable-platform-gui`, depends `PLATFORM_GUI=1` only) -`--enable-platform-gui` is an opt-in developer build. Official release binaries are built without it (Guix refuses +### Dash Platform GUI (`-DENABLE_PLATFORM_GUI=ON`, depends `PLATFORM_GUI=1` only) +`-DENABLE_PLATFORM_GUI=ON` is an opt-in developer build. Official release binaries are built without it (Guix refuses `PLATFORM_GUI`), and CI builds and tests it on x86_64 Linux only. Rust and protoc are pinned prebuilt binaries verified by SHA256. diff --git a/doc/design/libraries.md b/doc/design/libraries.md index 62001f151d88..282c643961ea 100644 --- a/doc/design/libraries.md +++ b/doc/design/libraries.md @@ -8,7 +8,7 @@ | *libbitcoinconsensus* | Shared library build of static *libdash_consensus* library | | *libbitcoin_kernel* | Consensus engine and support library used for validation by *libbitcoin_node* and also exposed as a [shared library](../shared-libraries.md). | | *libbitcoinqt* | GUI functionality used by *dash-qt* and *dash-gui* executables | -| *libbitcoin_ipc* | IPC functionality used by *dash-node*, *dash-wallet*, *dash-gui* executables to communicate when [`--enable-multiprocess`](multiprocess.md) is used. | +| *libbitcoin_ipc* | IPC functionality used by *dash-node*, *dash-wallet*, *dash-gui* executables to communicate when [`-DWITH_MULTIPROCESS=ON`](../multiprocess.md) is used. | | *libbitcoin_node* | P2P and RPC server functionality used by *dashd* and *dash-qt* executables. | | *libbitcoin_util* | Home for common functionality shared by different executables and libraries. Similar to *libbitcoin_common*, but lower-level (see [Dependencies](#dependencies)). | | *libbitcoin_wallet* | Wallet functionality used by *dashd* and *dash-wallet* executables. | @@ -21,7 +21,7 @@ Note: libbitcoin_kernel is a subject to be backported & dashified. - Most libraries are internal libraries and have APIs which are completely unstable! There are few or no restrictions on backwards compatibility or rules about external dependencies. Exceptions are *libdash_consensus* and *libdash_kernel* which have external interfaces documented at [../shared-libraries.md](../shared-libraries.md). -- Generally each library should have a corresponding source directory and namespace. Source code organization is a work in progress, so it is true that some namespaces are applied inconsistently, and if you look at [`libbitcoin_*_SOURCES`](../../src/Makefile.am) lists you can see that many libraries pull in files from outside their source directory. But when working with libraries, it is good to follow a consistent pattern like: +- Generally each library should have a corresponding source directory and namespace. Source code organization is a work in progress, so it is true that some namespaces are applied inconsistently, and if you look at the source lists in [`src/CMakeLists.txt`](../../src/CMakeLists.txt) you can see that many libraries pull in files from outside their source directory. But when working with libraries, it is good to follow a consistent pattern like: - *libbitcoin_node* code lives in `src/node/` in the `node::` namespace - *libbitcoin_wallet* code lives in `src/wallet/` in the `wallet::` namespace diff --git a/doc/developer-notes.md b/doc/developer-notes.md index 1dbdb5cc02ad..291b17a4bdc6 100644 --- a/doc/developer-notes.md +++ b/doc/developer-notes.md @@ -215,14 +215,15 @@ int main() To run clang-tidy on Ubuntu/Debian, install the dependencies: ```sh -apt install clang-tidy bear clang +apt install clang-tidy clang ``` -Then, pass clang as compiler to configure, and use bear to produce the `compile_commands.json`: +Configure with clang as the compiler and ask CMake to generate +`build/compile_commands.json`: ```sh -./autogen.sh && ./configure CC=clang CXX=clang++ -make clean && bear --config src/.bear-tidy-config -- make -j $(nproc) +cmake -B build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON +cmake --build build -j N # replace N with the number of parallel jobs ``` The output is denoised of errors from external dependencies. @@ -230,13 +231,13 @@ The output is denoised of errors from external dependencies. To run clang-tidy on all source files: ```sh -( cd ./src/ && run-clang-tidy -j $(nproc) ) +( cd ./src/ && run-clang-tidy -p ../build ) ``` To run clang-tidy on the changed source lines: ```sh -git diff | ( cd ./src/ && clang-tidy-diff -p2 -j $(nproc) ) +git diff | ( cd ./src/ && clang-tidy-diff -p2 -path ../build ) ``` Coding Style (Python) @@ -339,11 +340,11 @@ Recommendations: ### Generating Documentation -The documentation can be generated with `make docs` and cleaned up with `make -clean-docs`. The resulting files are located in `doc/doxygen/html`; open +The documentation can be generated with `cmake --build build --target docs`. +The resulting files are located in `build/doc/doxygen/html`; open `index.html` in that directory to view the homepage. -Before running `make docs`, you'll need to install these dependencies: +Before configuring and building the `docs` target, you'll need to install these dependencies: Linux: `sudo apt install doxygen graphviz` @@ -354,7 +355,7 @@ Development tips and tricks ### Compiling for debugging -Run configure with `--enable-debug` to add additional compiler flags that +Configure with `-DCMAKE_BUILD_TYPE=Debug` to add additional compiler flags that produce better debugging builds. ### Show sources in debugging @@ -412,8 +413,8 @@ see [test/functional/](/test/functional) for tests that run in `-regtest` mode. ### DEBUG_LOCKORDER Dash Core is a multi-threaded application, and deadlocks or other -multi-threading bugs can be very difficult to track down. The `--enable-debug` -configure option adds `-DDEBUG_LOCKORDER` to the compiler flags. This inserts +multi-threading bugs can be very difficult to track down. The `-DCMAKE_BUILD_TYPE=Debug` +configuration option adds `-DDEBUG_LOCKORDER` to the compiler flags. This inserts run-time checks to keep track of which locks are held and adds warnings to the `debug.log` file if inconsistencies are detected. @@ -423,10 +424,9 @@ Defining `DEBUG_LOCKCONTENTION` adds a "lock" logging category to the logging RPC that, when enabled, logs the location and duration of each lock contention to the `debug.log` file. -The `--enable-debug` configure option adds `-DDEBUG_LOCKCONTENTION` to the +The `-DCMAKE_BUILD_TYPE=Debug` configuration option adds `-DDEBUG_LOCKCONTENTION` to the compiler flags. You may also enable it manually for a non-debug build by running -configure with `-DDEBUG_LOCKCONTENTION` added to your CPPFLAGS, -i.e. `CPPFLAGS="-DDEBUG_LOCKCONTENTION"`, then build and run dashd. +CMake with `-DAPPEND_CPPFLAGS="-DDEBUG_LOCKCONTENTION"`, then build and run dashd. You can then use the `-debug=lock` configuration option at dashd startup or `dash-cli logging '["lock"]'` at runtime to turn on lock contention logging. @@ -466,7 +466,7 @@ the undefined behavior or corruption that continuing would cause. turn that into a guaranteed outage for every user running the release. Never let an `Assume` be the thing that kills a production node. The expression is always evaluated, in every build; failures abort only where - `-DABORT_ON_FAILED_ASSUME` is defined — `--enable-debug` and `--enable-fuzz` + `-DABORT_ON_FAILED_ASSUME` is defined — `CMAKE_BUILD_TYPE=Debug` and `BUILD_FOR_FUZZING=ON` builds, i.e. CI's `linux64_multiprocess` and fuzz jobs — and are silent in release. That coverage is partial: an invariant you actually care about also needs a test, and code downstream must still cope with the violated case. @@ -511,34 +511,38 @@ which includes known Valgrind warnings in our dependencies that cannot be fixed in-tree. Example use: ```shell -$ valgrind --suppressions=contrib/valgrind.supp src/test/test_dash +$ valgrind --suppressions=contrib/valgrind.supp build/src/test/test_dash $ valgrind --suppressions=contrib/valgrind.supp --leak-check=full \ - --show-leak-kinds=all src/test/test_dash --log_level=test_suite -$ valgrind -v --leak-check=full src/dashd -printtoconsole -$ ./test/functional/test_runner.py --valgrind + --show-leak-kinds=all build/src/test/test_dash --log_level=test_suite +$ valgrind -v --leak-check=full build/src/dashd -printtoconsole +$ ./build/test/functional/test_runner.py --valgrind ``` ### Compiling for test coverage -LCOV can be used to generate a test coverage report based upon `make check` +LCOV can be used to generate a test coverage report based upon `ctest` execution. LCOV must be installed on your system (e.g. the `lcov` package on Debian/Ubuntu). To enable LCOV report generation during test runs: ```shell -./configure --enable-lcov -make -make cov +cmake -B build -DCMAKE_BUILD_TYPE=Coverage +cmake --build build +cmake -P build/Coverage.cmake -# A coverage report will now be accessible at `./test_dash.coverage/index.html`, -# which covers unit tests, and `./total.coverage/index.html`, which covers +# A coverage report will now be accessible at `./build/test_bitcoin.coverage/index.html`, +# which covers unit tests, and `./build/total.coverage/index.html`, which covers # unit and functional tests. ``` -Additional LCOV options can be specified using `LCOV_OPTS`, but may be dependant +Additional LCOV options can be specified using `LCOV_OPTS`, but may be dependent on the version of LCOV. For example, when using LCOV `2.x`, branch coverage can be -enabled by setting `LCOV_OPTS="--rc branch_coverage=1"`, when configuring. +enabled by setting `LCOV_OPTS="--rc branch_coverage=1"`: + +``` +cmake -DLCOV_OPTS="--rc branch_coverage=1" -P build/Coverage.cmake +``` ### Performance profiling with perf @@ -589,7 +593,7 @@ See the functional test documentation for how to invoke perf within tests. Dash Core can be compiled with various "sanitizers" enabled, which add instrumentation for issues regarding things like memory safety, thread race conditions, or undefined behavior. This is controlled with the -`--with-sanitizers` configure flag, which should be a comma separated list of +`-DSANITIZERS` CMake option, which should be a comma separated list of sanitizers to enable. The sanitizer list should correspond to supported `-fsanitize=` options in your compiler. These sanitizers have runtime overhead, so they are most useful when testing changes or producing debugging builds. @@ -598,16 +602,16 @@ Some examples: ```bash # Enable both the address sanitizer and the undefined behavior sanitizer -./configure --with-sanitizers=address,undefined +cmake -B build -DSANITIZERS=address,undefined # Enable the thread sanitizer -./configure --with-sanitizers=thread +cmake -B build -DSANITIZERS=thread ``` If you are compiling with GCC you will typically need to install corresponding "san" libraries to actually compile with these flags, e.g. libasan for the address sanitizer, libtsan for the thread sanitizer, and libubsan for the -undefined sanitizer. If you are missing required libraries, the configure script +undefined sanitizer. If you are missing required libraries, CMake will fail with a linker error when testing the sanitizer flags. The test suite should pass cleanly with the `thread` and `undefined` sanitizers. You @@ -623,7 +627,7 @@ See the CI config for more examples, and upstream documentation for more informa about any additional options. Not all sanitizer options can be enabled at the same time, e.g. trying to build -with `--with-sanitizers=address,thread` will fail in the configure script as +with `-DSANITIZERS=address,thread` will fail during CMake configuration as these sanitizers are mutually incompatible. Refer to your compiler manual to learn more about these options and which sanitizers are supported by your compiler. @@ -648,7 +652,7 @@ The code is multi-threaded and uses mutexes and the Deadlocks due to inconsistent lock ordering (thread 1 locks `cs_main` and then `cs_wallet`, while thread 2 locks them in the opposite order: result, deadlock as each waits for the other to release its lock) are a problem. Compile with -`-DDEBUG_LOCKORDER` (or use `--enable-debug`) to get lock order inconsistencies +`-DAPPEND_CPPFLAGS="-DDEBUG_LOCKORDER"` (or use `-DCMAKE_BUILD_TYPE=Debug`) to get lock order inconsistencies reported in the `debug.log` file. Re-architecting the core code so there are better-defined interfaces diff --git a/doc/fuzzing.md b/doc/fuzzing.md index 2bd7461889f3..5ffea882c1a4 100644 --- a/doc/fuzzing.md +++ b/doc/fuzzing.md @@ -7,17 +7,17 @@ To quickly get started fuzzing Dash Core using [libFuzzer](https://llvm.org/docs ```sh $ git clone https://github.com/dashpay/dash $ cd dash/ -$ ./autogen.sh -$ CC=clang CXX=clang++ ./configure --enable-fuzz --with-sanitizers=address,fuzzer,undefined +$ cmake -B build_fuzz -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \ + -DBUILD_FOR_FUZZING=ON -DSANITIZERS=address,fuzzer,undefined # macOS users: If you have problem with this step then make sure to read "macOS hints for # libFuzzer" on https://github.com/dashpay/dash/blob/develop/doc/fuzzing.md#macos-hints-for-libfuzzer -$ make -$ FUZZ=process_message src/test/fuzz/fuzz +$ cmake --build build_fuzz +$ FUZZ=process_message build_fuzz/src/test/fuzz/fuzz # abort fuzzing using ctrl-c ``` There is also a runner script to execute all fuzz targets. Refer to -`./test/fuzz/test_runner.py --help` for more details. +`./build_fuzz/test/fuzz/test_runner.py --help` for more details. ## Overview of Bitcoin Core fuzzing @@ -33,7 +33,7 @@ If you specify a corpus directory then any new coverage increasing inputs will b ```sh $ mkdir -p process_message-seeded-from-thin-air/ -$ FUZZ=process_message src/test/fuzz/fuzz process_message-seeded-from-thin-air/ +$ FUZZ=process_message build_fuzz/src/test/fuzz/fuzz process_message-seeded-from-thin-air/ INFO: Seed: 840522292 INFO: Loaded 1 modules (424174 inline 8-bit counters): 424174 [0x55e121ef9ab8, 0x55e121f613a6), INFO: Loaded 1 PC tables (424174 PCs): 424174 [0x55e121f613a8,0x55e1225da288), @@ -77,7 +77,7 @@ of the test. Just make sure to use double-dash to distinguish them from the fuzzer's own arguments: ```sh -$ FUZZ=address_deserialize_v2 src/test/fuzz/fuzz -runs=1 fuzz_seed_corpus/address_deserialize_v2 --checkaddrman=5 --printtoconsole=1 +$ FUZZ=address_deserialize_v2 build_fuzz/src/test/fuzz/fuzz -runs=1 fuzz_seed_corpus/address_deserialize_v2 --checkaddrman=5 --printtoconsole=1 ``` ## Fuzzing corpora @@ -88,7 +88,7 @@ To fuzz `process_message` using the [`bitcoin-core/qa-assets`](https://github.co ```sh $ git clone https://github.com/bitcoin-core/qa-assets -$ FUZZ=process_message src/test/fuzz/fuzz qa-assets/fuzz_seed_corpus/process_message/ +$ FUZZ=process_message build_fuzz/src/test/fuzz/fuzz qa-assets/fuzz_seed_corpus/process_message/ INFO: Seed: 1346407872 INFO: Loaded 1 modules (424174 inline 8-bit counters): 424174 [0x55d8a9004ab8, 0x55d8a906c3a6), INFO: Loaded 1 PC tables (424174 PCs): 424174 [0x55d8a906c3a8,0x55d8a96e5288), @@ -101,7 +101,7 @@ INFO: seed corpus: files: 991 min: 1b max: 1858b total: 288291b rss: 150Mb ## Run without sanitizers for increased throughput -Fuzzing on a harness compiled with `--with-sanitizers=address,fuzzer,undefined` is good for finding bugs. However, the very slow execution even under libFuzzer will limit the ability to find new coverage. A good approach is to perform occasional long runs without the additional bug-detectors (configure `--with-sanitizers=fuzzer`) and then merge new inputs into a corpus as described in the qa-assets repo (https://github.com/bitcoin-core/qa-assets/blob/main/.github/PULL_REQUEST_TEMPLATE.md). Patience is useful; even with improved throughput, libFuzzer may need days and 10s of millions of executions to reach deep/hard targets. +Fuzzing on a harness compiled with `-DSANITIZERS=address,fuzzer,undefined` is good for finding bugs. However, the very slow execution even under libFuzzer will limit the ability to find new coverage. A good approach is to perform occasional long runs without the additional bug-detectors (configure `-DSANITIZERS=fuzzer`) and then merge new inputs into a corpus as described in the qa-assets repo (https://github.com/bitcoin-core/qa-assets/blob/main/.github/PULL_REQUEST_TEMPLATE.md). Patience is useful; even with improved throughput, libFuzzer may need days and 10s of millions of executions to reach deep/hard targets. ## Reproduce a fuzzer crash reported by the CI @@ -112,7 +112,7 @@ Fuzzing on a harness compiled with `--with-sanitizers=address,fuzzer,undefined` more slowly with sanitizers enabled, but a crash should be reproducible very quickly from a crash case) - run the fuzzer with the case number appended to the seed corpus path: - `FUZZ=process_message src/test/fuzz/fuzz + `FUZZ=process_message build_fuzz/src/test/fuzz/fuzz qa-assets/fuzz_seed_corpus/process_message/1bc91feec9fc00b107d97dc225a9f2cdaa078eb6` ## Submit improved coverage @@ -131,10 +131,12 @@ You may also need to take care of giving the correct path for `clang` and `clang++`, like `CC=/path/to/clang CXX=/path/to/clang++` if the non-systems `clang` does not come first in your path. -Full configure that was tested on macOS with `brew` installed `llvm`: +To select the LLVM installed by Homebrew on macOS: ```sh -./configure --enable-fuzz --with-sanitizers=fuzzer,address,undefined CC=$(brew --prefix llvm)/bin/clang CXX=$(brew --prefix llvm)/bin/clang++ +cmake -B build_fuzz -DBUILD_FOR_FUZZING=ON -DSANITIZERS=fuzzer,address,undefined \ + -DCMAKE_C_COMPILER="$(brew --prefix llvm)/bin/clang" \ + -DCMAKE_CXX_COMPILER="$(brew --prefix llvm)/bin/clang++" ``` Read the [libFuzzer documentation](https://llvm.org/docs/LibFuzzer.html) for more information. This [libFuzzer tutorial](https://github.com/google/fuzzing/blob/master/tutorial/libFuzzerTutorial.md) might also be of interest. @@ -150,16 +152,17 @@ $ git clone https://github.com/dashpay/dash $ cd dash/ $ git clone https://github.com/AFLplusplus/AFLplusplus $ make -C AFLplusplus/ source-only -$ ./autogen.sh # If afl-clang-lto is not available, see # https://github.com/AFLplusplus/AFLplusplus#a-selecting-the-best-afl-compiler-for-instrumenting-the-target -$ CC=$(pwd)/AFLplusplus/afl-clang-lto CXX=$(pwd)/AFLplusplus/afl-clang-lto++ ./configure --enable-fuzz -$ make -# For macOS you may need to ignore x86 compilation checks when running "make". If so, -# try compiling using: AFL_NO_X86=1 make +$ cmake -B build_fuzz -DBUILD_FOR_FUZZING=ON \ + -DCMAKE_C_COMPILER="$(pwd)/AFLplusplus/afl-clang-lto" \ + -DCMAKE_CXX_COMPILER="$(pwd)/AFLplusplus/afl-clang-lto++" +$ cmake --build build_fuzz +# For macOS you may need to ignore x86 compilation checks. If so, +# try compiling using: AFL_NO_X86=1 cmake --build build_fuzz $ mkdir -p inputs/ outputs/ $ echo A > inputs/thin-air-input -$ FUZZ=bech32 AFLplusplus/afl-fuzz -i inputs/ -o outputs/ -- src/test/fuzz/fuzz +$ FUZZ=bech32 AFLplusplus/afl-fuzz -i inputs/ -o outputs/ -- build_fuzz/src/test/fuzz/fuzz # You may have to change a few kernel parameters to test optimally - afl-fuzz # will print an error and suggestion if so. ``` @@ -175,15 +178,16 @@ To quickly get started fuzzing Dash Core using [Honggfuzz](https://github.com/go ```sh $ git clone https://github.com/dashpay/dash $ cd dash/ -$ ./autogen.sh $ git clone https://github.com/google/honggfuzz $ cd honggfuzz/ $ make $ cd .. -$ CC=$(pwd)/honggfuzz/hfuzz_cc/hfuzz-clang CXX=$(pwd)/honggfuzz/hfuzz_cc/hfuzz-clang++ ./configure --enable-fuzz --with-sanitizers=address,undefined -$ make +$ cmake -B build_fuzz -DBUILD_FOR_FUZZING=ON -DSANITIZERS=address,undefined \ + -DCMAKE_C_COMPILER="$(pwd)/honggfuzz/hfuzz_cc/hfuzz-clang" \ + -DCMAKE_CXX_COMPILER="$(pwd)/honggfuzz/hfuzz_cc/hfuzz-clang++" +$ cmake --build build_fuzz $ mkdir -p inputs/ -$ FUZZ=process_message honggfuzz/honggfuzz -i inputs/ -- src/test/fuzz/fuzz +$ FUZZ=process_message honggfuzz/honggfuzz -i inputs/ -- build_fuzz/src/test/fuzz/fuzz ``` Read the [Honggfuzz documentation](https://github.com/google/honggfuzz/blob/master/docs/USAGE.md) for more information. @@ -204,15 +208,13 @@ $ mkdir bitcoin-honggfuzz-p2p/ $ cd bitcoin-honggfuzz-p2p/ $ git clone https://github.com/dashpay/dash/ $ cd dash/ -$ ./autogen.sh $ git clone https://github.com/google/honggfuzz $ cd honggfuzz/ $ make $ cd .. -$ CC=$(pwd)/honggfuzz/hfuzz_cc/hfuzz-clang \ - CXX=$(pwd)/honggfuzz/hfuzz_cc/hfuzz-clang++ \ - ./configure --disable-wallet --with-gui=no \ - --with-sanitizers=address,undefined +$ cmake -B build -DENABLE_WALLET=OFF -DBUILD_GUI=OFF -DSANITIZERS=address,undefined \ + -DCMAKE_C_COMPILER="$(pwd)/honggfuzz/hfuzz_cc/hfuzz-clang" \ + -DCMAKE_CXX_COMPILER="$(pwd)/honggfuzz/hfuzz_cc/hfuzz-clang++" $ git apply << "EOF" diff --git a/src/compat/compat.h b/src/compat/compat.h index 8195bceaec..cce2b31ff0 100644 @@ -254,11 +256,11 @@ index 7601a6ea84..702d0f56ce 100644 SanitizeString(msg.m_type), msg.m_message_size, HexStr(Span{hash}.first(CMessageHeader::CHECKSUM_SIZE)), EOF -$ make -C src/ dashd +$ cmake --build build --target bitcoind $ mkdir -p inputs/ $ honggfuzz/honggfuzz --exit_upon_crash --quiet --timeout 4 -n 1 -Q \ -E HFND_TCP_PORT=18444 -f inputs/ -- \ - src/dashd -regtest -discover=0 -dns=0 -dnsseed=0 -listenonion=0 \ + build/src/dashd -regtest -discover=0 -dns=0 -dnsseed=0 -listenonion=0 \ -nodebuglogfile -bind=127.0.0.1:18444 -logthreadnames \ -debug ``` @@ -298,11 +300,10 @@ $ cd Eclipser $ git checkout v1.x $ make $ cd .. -$ ./autogen.sh -$ ./configure --enable-fuzz -$ make +$ cmake -B build_fuzz -DBUILD_FOR_FUZZING=ON +$ cmake --build build_fuzz $ mkdir -p outputs/ -$ FUZZ=bech32 dotnet Eclipser/build/Eclipser.dll fuzz -p src/test/fuzz/fuzz -t 36000 -o outputs --src stdin +$ FUZZ=bech32 dotnet Eclipser/build/Eclipser.dll fuzz -p build_fuzz/src/test/fuzz/fuzz -t 36000 -o outputs --src stdin ``` This will perform 10 hours of fuzzing. @@ -320,7 +321,7 @@ Fuzzing with Eclipser will likely be much more effective if using an existing co ```sh $ git clone https://github.com/bitcoin-core/qa-assets -$ FUZZ=bech32 dotnet Eclipser/build/Eclipser.dll fuzz -p src/test/fuzz/fuzz -t 36000 -i qa-assets/fuzz_seed_corpus/bech32 outputs --src stdin +$ FUZZ=bech32 dotnet Eclipser/build/Eclipser.dll fuzz -p build_fuzz/src/test/fuzz/fuzz -t 36000 -i qa-assets/fuzz_seed_corpus/bech32 outputs --src stdin ``` Note that fuzzing with Eclipser on certain targets (those that create 'full nodes', e.g. `process_message*`) will, diff --git a/doc/multiprocess.md b/doc/multiprocess.md index c37eca134960..bcb3d7eb631c 100644 --- a/doc/multiprocess.md +++ b/doc/multiprocess.md @@ -4,7 +4,7 @@ _This document describes usage of the multiprocess feature. For design informati ## Build Option -On unix systems, the `--enable-multiprocess` build option can be passed to `./configure` to build new `dash-node`, `dash-wallet`, and `dash-gui` executables alongside existing `dashd` and `dash-qt` executables. +On unix systems, the `-DWITH_MULTIPROCESS=ON` option can be passed to CMake to build `dash-node` alongside `dashd`, and `dash-gui` alongside `dash-qt` when the GUI is enabled. ## Debugging @@ -17,15 +17,17 @@ The multiprocess feature requires [Cap'n Proto](https://capnproto.org/) and [lib ``` cd make -C depends NO_QT=1 MULTIPROCESS=1 -CONFIG_SITE=$PWD/depends/x86_64-pc-linux-gnu/share/config.site ./configure -make -src/dash-node -regtest -printtoconsole -debug=ipc -DASHD=dash-node test/functional/test_runner.py +cmake -B build --toolchain depends/x86_64-pc-linux-gnu/toolchain.cmake +cmake --build build +build/src/dash-node -regtest -printtoconsole -debug=ipc +DASHD=dash-node build/test/functional/test_runner.py ``` -The configure script will pick up settings and library locations from the depends directory, so there is no need to pass `--enable-multiprocess` as a separate flag when using the depends system (it's controlled by the `MULTIPROCESS=1` option). +The toolchain file supplies settings and library locations from depends, so there +is no need to pass `-DWITH_MULTIPROCESS=ON` separately when using the depends +system (it is controlled by the `MULTIPROCESS=1` option). -Alternately, you can install [Cap'n Proto](https://capnproto.org/) and [libmultiprocess](https://github.com/bitcoin-core/libmultiprocess) packages on your system, and just run `./configure --enable-multiprocess` without using the depends system. The configure script will be able to locate the installed packages via [pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/). See [Installation](https://github.com/bitcoin-core/libmultiprocess/blob/master/doc/install.md) section of the libmultiprocess readme for install steps. See [build-unix.md](build-unix.md) and [build-osx.md](build-osx.md) for information about installing dependencies in general. +Alternately, you can install [Cap'n Proto](https://capnproto.org/) and [libmultiprocess](https://github.com/bitcoin-core/libmultiprocess) packages on your system, and just run `cmake -B build -DWITH_MULTIPROCESS=ON` without using the depends system. CMake will locate the installed packages using their CMake package configuration files. See [Installation](https://github.com/bitcoin-core/libmultiprocess/blob/master/doc/install.md) section of the libmultiprocess readme for install steps. See [build-unix.md](build-unix.md) and [build-osx.md](build-osx.md) for information about installing dependencies in general. ## Usage diff --git a/doc/multisig-tutorial.md b/doc/multisig-tutorial.md index 82dca25b99cd..991986087381 100644 --- a/doc/multisig-tutorial.md +++ b/doc/multisig-tutorial.md @@ -9,7 +9,7 @@ This tutorial uses [jq](https://github.com/stedolan/jq) JSON processor to proces Before starting this tutorial, start the dash node on the testnet network. ```bash -./src/dashd -testnet -daemon +./build/src/dashd -testnet -daemon ``` This tutorial also uses the default PKH derivation path to get the xpubs and does conform to [BIP 45](https://github.com/bitcoin/bips/blob/master/bip-0045.mediawiki) or [BIP 87](https://github.com/bitcoin/bips/blob/master/bip-0087.mediawiki). @@ -27,7 +27,7 @@ These three wallets should not be used directly for privacy reasons (public key ```bash for ((n=1;n<=3;n++)) do - ./src/dash-cli -testnet createwallet "participant_${n}" + ./build/src/dash-cli -testnet createwallet "participant_${n}" done ``` @@ -47,9 +47,9 @@ declare -A xpubs for ((n=1;n<=3;n++)) do - xpubs["internal_xpub_${n}"]=$(./src/dash-cli -testnet -rpcwallet="participant_${n}" listdescriptors | jq '.descriptors | [.[] | select(.desc | startswith("pkh") and contains("/1/*"))][0] | .desc' | grep -Po '(?<=\().*(?=\))') + xpubs["internal_xpub_${n}"]=$(./build/src/dash-cli -testnet -rpcwallet="participant_${n}" listdescriptors | jq '.descriptors | [.[] | select(.desc | startswith("pkh") and contains("/1/*"))][0] | .desc' | grep -Po '(?<=\().*(?=\))') - xpubs["external_xpub_${n}"]=$(./src/dash-cli -testnet -rpcwallet="participant_${n}" listdescriptors | jq '.descriptors | [.[] | select(.desc | startswith("pkh") and contains("/0/*") )][0] | .desc' | grep -Po '(?<=\().*(?=\))') + xpubs["external_xpub_${n}"]=$(./build/src/dash-cli -testnet -rpcwallet="participant_${n}" listdescriptors | jq '.descriptors | [.[] | select(.desc | startswith("pkh") and contains("/0/*") )][0] | .desc' | grep -Po '(?<=\().*(?=\))') done ``` @@ -69,8 +69,8 @@ Define the external and internal multisig descriptors, add the checksum and then external_desc="wsh(sortedmulti(2,${xpubs["external_xpub_1"]},${xpubs["external_xpub_2"]},${xpubs["external_xpub_3"]}))" internal_desc="wsh(sortedmulti(2,${xpubs["internal_xpub_1"]},${xpubs["internal_xpub_2"]},${xpubs["internal_xpub_3"]}))" -external_desc_sum=$(./src/dash-cli -testnet getdescriptorinfo $external_desc | jq '.descriptor') -internal_desc_sum=$(./src/dash-cli -testnet getdescriptorinfo $internal_desc | jq '.descriptor') +external_desc_sum=$(./build/src/dash-cli -testnet getdescriptorinfo $external_desc | jq '.descriptor') +internal_desc_sum=$(./build/src/dash-cli -testnet getdescriptorinfo $internal_desc | jq '.descriptor') multisig_ext_desc="{\"desc\": $external_desc_sum, \"active\": true, \"internal\": false, \"timestamp\": \"now\"}" multisig_int_desc="{\"desc\": $internal_desc_sum, \"active\": true, \"internal\": true, \"timestamp\": \"now\"}" @@ -92,7 +92,7 @@ There are other fields that can be added to the descriptors: * `internal`: Indicates whether matching outputs should be treated as something other than incoming payments (e.g. change). * `timestamp`: Sets the time from which to start rescanning the blockchain for the descriptor, in UNIX epoch time. -Documentation for these and other parameters can be found by typing `./src/dash-cli help importdescriptors`. +Documentation for these and other parameters can be found by typing `./build/src/dash-cli help importdescriptors`. `multisig_desc` concatenates external and internal descriptors in a JSON array and then it will be used to create the multisig wallet. @@ -105,17 +105,17 @@ Then import the descriptors created in the previous step using the `importdescri After that, `getwalletinfo` can be used to check if the wallet was created successfully. ```bash -./src/dash-cli -testnet -named createwallet wallet_name="multisig_wallet_01" disable_private_keys=true blank=true +./build/src/dash-cli -testnet -named createwallet wallet_name="multisig_wallet_01" disable_private_keys=true blank=true -./src/dash-cli -testnet -rpcwallet="multisig_wallet_01" importdescriptors "$multisig_desc" +./build/src/dash-cli -testnet -rpcwallet="multisig_wallet_01" importdescriptors "$multisig_desc" -./src/dash-cli -testnet -rpcwallet="multisig_wallet_01" getwalletinfo +./build/src/dash-cli -testnet -rpcwallet="multisig_wallet_01" getwalletinfo ``` Once the wallets have already been created and this tutorial needs to be repeated or resumed, it is not necessary to recreate them, just load them with the command below: ```bash -for ((n=1;n<=3;n++)); do ./src/dash-cli -testnet loadwallet "participant_${n}"; done +for ((n=1;n<=3;n++)); do ./build/src/dash-cli -testnet loadwallet "participant_${n}"; done ``` ### 1.4 Fund the wallet @@ -129,9 +129,9 @@ The url used by the script can also be accessed directly. At time of writing, th Coins received by the wallet must have at least 1 confirmation before they can be spent. It is necessary to wait for a new block to be mined before continuing. ```bash -receiving_address=$(./src/dash-cli -testnet -rpcwallet="multisig_wallet_01" getnewaddress) +receiving_address=$(./build/src/dash-cli -testnet -rpcwallet="multisig_wallet_01" getnewaddress) -./contrib/testnet/getcoins.py -c ./src/dash-cli -a $receiving_address +./contrib/testnet/getcoins.py -c ./build/src/dash-cli -a $receiving_address ``` To copy the receiving address onto the clipboard, use the following command. This can be useful when getting coins via the testnet faucet mentioned above. @@ -143,7 +143,7 @@ echo -n "$receiving_address" | xclip -sel clip The `getbalances` RPC may be used to check the balance. Coins with `trusted` status can be spent. ```bash -./src/dash-cli -testnet -rpcwallet="multisig_wallet_01" getbalances +./build/src/dash-cli -testnet -rpcwallet="multisig_wallet_01" getbalances ``` ### 1.5 Create a PSBT @@ -159,13 +159,13 @@ For simplicity, the destination address is taken from the `participant_1` wallet The `walletcreatefundedpsbt` RPC is used to create and fund a transaction in the PSBT format. It is the first step in creating the PSBT. ```bash -balance=$(./src/dash-cli -testnet -rpcwallet="multisig_wallet_01" getbalance) +balance=$(./build/src/dash-cli -testnet -rpcwallet="multisig_wallet_01" getbalance) amount=$(echo "$balance * 0.8" | bc -l | sed -e 's/^\./0./' -e 's/^-\./-0./') -destination_addr=$(./src/dash-cli -testnet -rpcwallet="participant_1" getnewaddress) +destination_addr=$(./build/src/dash-cli -testnet -rpcwallet="participant_1" getnewaddress) -funded_psbt=$(./src/dash-cli -testnet -named -rpcwallet="multisig_wallet_01" walletcreatefundedpsbt outputs="{\"$destination_addr\": $amount}" | jq -r '.psbt') +funded_psbt=$(./build/src/dash-cli -testnet -named -rpcwallet="multisig_wallet_01" walletcreatefundedpsbt outputs="{\"$destination_addr\": $amount}" | jq -r '.psbt') ``` There is also the `createpsbt` RPC, which serves the same purpose, but it has no access to the wallet or to the UTXO set. It is functionally the same as `createrawtransaction` and just drops the raw transaction into an otherwise blank PSBT. [[source](https://bitcointalk.org/index.php?topic=5131043.msg50573609#msg50573609)] In most cases, `walletcreatefundedpsbt` solves the problem. @@ -179,9 +179,9 @@ Optionally, the PSBT can be decoded to a JSON format using `decodepsbt` RPC. The `analyzepsbt` RPC analyzes and provides information about the current status of a PSBT and its inputs, e.g. missing signatures. ```bash -./src/dash-cli -testnet decodepsbt $funded_psbt +./build/src/dash-cli -testnet decodepsbt $funded_psbt -./src/dash-cli -testnet analyzepsbt $funded_psbt +./build/src/dash-cli -testnet analyzepsbt $funded_psbt ``` ### 1.7 Update the PSBT @@ -191,9 +191,9 @@ In the code above, two PSBTs are created. One signed by `participant_1` wallet a The `walletprocesspsbt` is used by the wallet to sign a PSBT. ```bash -psbt_1=$(./src/dash-cli -testnet -rpcwallet="participant_1" walletprocesspsbt $funded_psbt | jq '.psbt') +psbt_1=$(./build/src/dash-cli -testnet -rpcwallet="participant_1" walletprocesspsbt $funded_psbt | jq '.psbt') -psbt_2=$(./src/dash-cli -testnet -rpcwallet="participant_2" walletprocesspsbt $funded_psbt | jq '.psbt') +psbt_2=$(./build/src/dash-cli -testnet -rpcwallet="participant_2" walletprocesspsbt $funded_psbt | jq '.psbt') ``` ### 1.8 Combine the PSBT @@ -201,7 +201,7 @@ psbt_2=$(./src/dash-cli -testnet -rpcwallet="participant_2" walletprocesspsbt $f The PSBT, if signed separately by the co-signers, must be combined into one transaction before being finalized. This is done by `combinepsbt` RPC. ```bash -combined_psbt=$(./src/dash-cli -testnet combinepsbt "[$psbt_1, $psbt_2]") +combined_psbt=$(./build/src/dash-cli -testnet combinepsbt "[$psbt_1, $psbt_2]") ``` There is an RPC called `joinpsbts`, but it has a different purpose than `combinepsbt`. `joinpsbts` joins the inputs from multiple distinct PSBTs into one PSBT. @@ -215,9 +215,9 @@ The `finalizepsbt` RPC is used to produce a network serialized transaction which It checks that all inputs have complete scriptSigs and scriptWitnesses and, if so, encodes them into network serialized transactions. ```bash -finalized_psbt_hex=$(./src/dash-cli -testnet finalizepsbt $combined_psbt | jq -r '.hex') +finalized_psbt_hex=$(./build/src/dash-cli -testnet finalizepsbt $combined_psbt | jq -r '.hex') -./src/dash-cli -testnet sendrawtransaction $finalized_psbt_hex +./build/src/dash-cli -testnet sendrawtransaction $finalized_psbt_hex ``` ### 1.10 Alternative Workflow (PSBT sequential signatures) @@ -227,11 +227,11 @@ Instead of each wallet signing the original PSBT and combining them later, the w After that, the rest of the process is the same: the PSBT is finalized and transmitted to the network. ```bash -psbt_1=$(./src/dash-cli -testnet -rpcwallet="participant_1" walletprocesspsbt $funded_psbt | jq -r '.psbt') +psbt_1=$(./build/src/dash-cli -testnet -rpcwallet="participant_1" walletprocesspsbt $funded_psbt | jq -r '.psbt') -psbt_2=$(./src/dash-cli -testnet -rpcwallet="participant_2" walletprocesspsbt $psbt_1 | jq -r '.psbt') +psbt_2=$(./build/src/dash-cli -testnet -rpcwallet="participant_2" walletprocesspsbt $psbt_1 | jq -r '.psbt') -finalized_psbt_hex=$(./src/dash-cli -testnet finalizepsbt $psbt_2 | jq -r '.hex') +finalized_psbt_hex=$(./build/src/dash-cli -testnet finalizepsbt $psbt_2 | jq -r '.hex') -./src/dash-cli -testnet sendrawtransaction $finalized_psbt_hex +./build/src/dash-cli -testnet sendrawtransaction $finalized_psbt_hex ``` diff --git a/doc/offline-signing-tutorial.md b/doc/offline-signing-tutorial.md index c09adab5f8c9..ba35fc28aaf1 100644 --- a/doc/offline-signing-tutorial.md +++ b/doc/offline-signing-tutorial.md @@ -25,7 +25,7 @@ We are going to first create an `offline_wallet` on the offline host. We will th 1. On the offline machine create a wallet named `offline_wallet` secured by a wallet `passphrase`. This wallet will contain private keys and must remain unconnected to any networks at all times. ```sh -[offline]$ ./src/dash-cli -testnet -named createwallet \ +[offline]$ ./build/src/dash-cli -testnet -named createwallet \ wallet_name="offline_wallet" \ passphrase="** enter passphrase **" @@ -40,7 +40,7 @@ We are going to first create an `offline_wallet` on the offline host. We will th 2. Export the public key-only descriptors from the offline host to a JSON file named `descriptors.json`. We use `jq` here to extract the `.descriptors` field from the full RPC response. ```sh -[offline]$ ./src/dash-cli -testnet -rpcwallet="offline_wallet" listdescriptors \ +[offline]$ ./build/src/dash-cli -testnet -rpcwallet="offline_wallet" listdescriptors \ | jq -r '.descriptors' \ >> /path/to/descriptors.json ``` @@ -58,7 +58,7 @@ The `watch_only_wallet` wallet will be used to track and validate incoming trans > `disable_private_keys` indicates that the wallet should refuse to import private keys, i.e. will be a dedicated watch-only wallet. ```sh -[online]$ ./src/dash-cli -testnet -named createwallet \ +[online]$ ./build/src/dash-cli -testnet -named createwallet \ wallet_name="watch_only_wallet" \ disable_private_keys=true @@ -70,7 +70,7 @@ The `watch_only_wallet` wallet will be used to track and validate incoming trans 2. Import the `offline_wallet`s public key descriptors to the online `watch_only_wallet` using the `descriptors.json` file created on the offline wallet. ```sh -[online]$ ./src/dash-cli -testnet -rpcwallet="watch_only_wallet" importdescriptors "$(cat /path/to/descriptors.json)" +[online]$ ./build/src/dash-cli -testnet -rpcwallet="watch_only_wallet" importdescriptors "$(cat /path/to/descriptors.json)" [ { @@ -94,7 +94,7 @@ At this point, it's important to understand that both the `offline_wallet` and o 1. Generate an address to receive coins. You can use _either_ the `offline_wallet` or the online `watch_only_wallet` to generate this address, as they will produce the same addresses. For the sake of this guide, we'll use the online `watch_only_wallet` to generate the address. ```sh -[online]$ ./src/dash-cli -testnet -rpcwallet="watch_only_wallet" getnewaddress +[online]$ ./build/src/dash-cli -testnet -rpcwallet="watch_only_wallet" getnewaddress ``` @@ -104,7 +104,7 @@ At this point, it's important to understand that both the `offline_wallet` and o 3. Confirm that coins were received using the online `watch_only_wallet`. Note that the transaction may take a few moments before being received on your local node, depending on its connectivity. Just re-run the command periodically until the transaction is received. ```sh -[online]$ ./src/dash-cli -testnet -rpcwallet="watch_only_wallet" listunspent +[online]$ ./build/src/dash-cli -testnet -rpcwallet="watch_only_wallet" listunspent [ { @@ -133,7 +133,7 @@ At this point, it's important to understand that both the `offline_wallet` and o 2. Create a funded but unsigned PSBT to the destination address with the online `watch_only_wallet` by using `send [{"address":amount},...]` and export the unsigned PSBT to a file `funded_psbt.txt` for easy portability to the `offline_wallet` for signing: ```sh -[online]$ ./src/dash-cli -testnet -rpcwallet="watch_only_wallet" send \ +[online]$ ./build/src/dash-cli -testnet -rpcwallet="watch_only_wallet" send \ '{"": 0.009}' \ | jq -r '.psbt' \ >> /path/to/funded_psbt.txt @@ -150,13 +150,13 @@ cHNidP8B... Decode and analyze the unsigned PSBT on the `offline_wallet` using the `funded_psbt.txt` file: ```sh -[offline]$ ./src/dash-cli -testnet decodepsbt $(cat /path/to/funded_psbt.txt) +[offline]$ ./build/src/dash-cli -testnet decodepsbt $(cat /path/to/funded_psbt.txt) { ... } -[offline]$ ./src/dash-cli -testnet analyzepsbt $(cat /path/to/funded_psbt.txt) +[offline]$ ./build/src/dash-cli -testnet analyzepsbt $(cat /path/to/funded_psbt.txt) { "inputs": [ @@ -187,13 +187,13 @@ Notice that the analysis of the PSBT shows that "signatures" are missing and sho Use the walletpassphrase command to unlock the `offline_wallet` with the passphrase. You should specify the passphrase and a timeout (in seconds) for how long you want the wallet to remain unlocked. ```sh -[offline]$ ./src/dash-cli -testnet -rpcwallet="offline_wallet" walletpassphrase "** enter passphrase **" 60 +[offline]$ ./build/src/dash-cli -testnet -rpcwallet="offline_wallet" walletpassphrase "** enter passphrase **" 60 ``` 2. Process, sign and finalize the PSBT on the `offline_wallet` using the `walletprocesspsbt` command, saving the output to a file `final_psbt.txt`. ```sh -[offline]$ ./src/dash-cli -testnet -rpcwallet="offline_wallet" walletprocesspsbt \ +[offline]$ ./build/src/dash-cli -testnet -rpcwallet="offline_wallet" walletprocesspsbt \ $(cat /path/to/funded_psbt.txt) \ | jq -r .hex \ >> /path/to/final_psbt.txt @@ -203,7 +203,7 @@ Use the walletpassphrase command to unlock the `offline_wallet` with the passphr Broadcast the funded, signed and finalized PSBT `final_psbt.txt` using `sendrawtransaction` with an online node: ```sh -[online]$ ./src/dash-cli -testnet sendrawtransaction $(cat /path/to/final_psbt.txt) +[online]$ ./build/src/dash-cli -testnet sendrawtransaction $(cat /path/to/final_psbt.txt) ``` @@ -213,7 +213,7 @@ Broadcast the funded, signed and finalized PSBT `final_psbt.txt` using `sendrawt Confirm the updated balance of the offline wallet using the `watch_only_wallet`. ```sh -[online]$ ./src/dash-cli -testnet -rpcwallet="watch_only_wallet" getbalances +[online]$ ./build/src/dash-cli -testnet -rpcwallet="watch_only_wallet" getbalances { "mine": { @@ -232,7 +232,7 @@ Confirm the updated balance of the offline wallet using the `watch_only_wallet`. You can also show transactions related to the wallet using `listtransactions` ```sh -[online]$ ./src/dash-cli -testnet -rpcwallet="watch_only_wallet" listtransactions +[online]$ ./build/src/dash-cli -testnet -rpcwallet="watch_only_wallet" listtransactions { ... diff --git a/doc/productivity.md b/doc/productivity.md index ef2bd1a90ad8..42f18296a58b 100644 --- a/doc/productivity.md +++ b/doc/productivity.md @@ -6,8 +6,8 @@ Table of Contents * [General](#general) * [Cache compilations with `ccache`](#cache-compilations-with-ccache) - * [Disable features with `./configure`](#disable-features-with-configure) - * [Make use of your threads with `make -j`](#make-use-of-your-threads-with-make--j) + * [Disable features when generating the build system](#disable-features-when-generating-the-build-system) + * [Make use of your threads with `-j`](#make-use-of-your-threads-with--j) * [Only build what you need](#only-build-what-you-need) * [Compile on multiple machines](#compile-on-multiple-machines) * [Multiple working directories with `git worktrees`](#multiple-working-directories-with-git-worktrees) @@ -31,7 +31,7 @@ The easiest way to faster compile times is to cache compiles. `ccache` is a way > ccache is a compiler cache. It speeds up recompilation by caching the result of previous compilations and detecting when the same compilation is being done again. Supported languages are C, C++, Objective-C and Objective-C++. -Install `ccache` through your distribution's package manager, and run `./configure` with your normal flags to pick it up. +Install `ccache` through your distribution's package manager, and run `cmake -B build` with your normal configuration options to pick it up. To use ccache for all your C/C++ projects, follow the symlinks method [here](https://ccache.dev/manual/latest.html#_run_modes) to set it up. @@ -46,41 +46,43 @@ Note: base_dir is required for ccache to share cached compiles of the same file You _must not_ set base_dir to "/", or anywhere that contains system headers (according to the ccache docs). -### Disable features with `./configure` +### Disable features when generating the build system -After running `./autogen.sh`, which generates the `./configure` file, use `./configure --help` to identify features that you can disable to save on compilation time. A few common flags: +The GUI, benchmarks, port mapping and legacy wallet support are disabled by default. +Use `-DENABLE_WALLET=OFF` to also disable wallet functionality, or `-DBUILD_TESTS=OFF` +to skip the unit tests. Run `cmake -B build -LH` to see the full list of available +options. GUI tools such as `ccmake` and `cmake-gui` can also be helpful. -```sh ---without-miniupnpc ---without-natpmp ---disable-bench ---disable-wallet ---without-gui -``` - -If you do need the wallet enabled, it is common for devs to add `--with-incompatible-bdb`. This uses your system bdb version for the wallet, so you don't have to find a copy of bdb 4.8. Wallets from such a build will be incompatible with any release binary (and vice versa), so use with caution on mainnet. +To enable legacy wallets with a system Berkeley DB version other than 4.8, pass +`-DWITH_BDB=ON -DWARN_INCOMPATIBLE_BDB=OFF`. Wallets from such a build will be +incompatible with release binaries, so use with caution on mainnet. -### Make use of your threads with `make -j` +### Make use of your threads with `-j` -If you have multiple threads on your machine, you can tell `make` to utilize all of them with: +If you have multiple threads on your machine, you can select the number of parallel build jobs with: ```sh -make -j"$(($(nproc)+1))" +JOBS="$(getconf _NPROCESSORS_ONLN 2>/dev/null || sysctl -n hw.ncpu)" +JOBS="$(( JOBS > 1 ? JOBS - 1 : 1 ))" +cmake --build build -j"$JOBS" ``` ### Only build what you need -When rebuilding during development, note that running `make`, without giving a target, will do a lot of work you probably don't need. It will build the GUI (unless you've disabled it) and all the tests (which take much longer to build than the app does). +When rebuilding during development, note that running `cmake --build build`, without giving a target, will do a lot of work you probably don't need. It will build the GUI (if you've enabled it) and all the tests (which take much longer to build than the app does). Obviously, it is important to build and run the tests at appropriate times -- but when you just want a quick compile to check your work, consider picking one or a set of build targets relevant to what you're working on, e.g.: ```sh -make src/dashd src/dash-cli -make src/qt/dash-qt -make -C src dash_bench +cmake --build build --target bitcoind bitcoin-cli +cmake --build build --target bitcoin-qt +cmake --build build --target bench_bitcoin ``` -(You can and should combine this with `-j`, as above, for a parallel build.) +These target names currently retain their upstream names; they produce Dash +executables such as `build/src/dashd` and `build/src/qt/dash-qt`. Enable the GUI +with `-DBUILD_GUI=ON` or benchmarks with `-DBUILD_BENCH=ON` before building those +targets. You can combine `--target` with `-j`, as above, for a parallel build. ### Compile on multiple machines @@ -110,9 +112,9 @@ To squash in `git commit --fixup` commits without rebasing over an updated maste git rebase -i --autosquash "$(git merge-base master HEAD)" ``` -To execute `make check` on every commit since last diverged from master, but without rebasing over an updated master, we can do the following: +To execute `cmake --build build && ctest --test-dir build` on every commit since last diverged from master, but without rebasing over an updated master, we can do the following: ```sh -git rebase -i --exec "make check" "$(git merge-base master HEAD)" +git rebase -i --exec "cmake --build build && ctest --test-dir build" "$(git merge-base master HEAD)" ``` ----- diff --git a/doc/release-notes-7481.md b/doc/release-notes-7481.md new file mode 100644 index 000000000000..b6675a95869a --- /dev/null +++ b/doc/release-notes-7481.md @@ -0,0 +1,20 @@ +Build System +------------ + +Dash Core is now built with CMake. The Autotools build system +(`autogen.sh`, `configure` and the `Makefile.am` files) has been removed, +following Bitcoin Core's migration. See the build guides in `doc/` for the +new instructions; in short: + +```sh +cmake -B build +cmake --build build +ctest --test-dir build +``` + +Builds using depends pass its toolchain file instead of `--prefix`, for +example `cmake -B build --toolchain depends/x86_64-pc-linux-gnu/toolchain.cmake`. +Configure options now map to CMake options, for example `--disable-wallet` +becomes `-DENABLE_WALLET=OFF` and `--with-gui` becomes `-DBUILD_GUI=ON`; run +`cmake -B build -LH` to list them. Functional tests are run from the build +directory with `build/test/functional/test_runner.py`. diff --git a/doc/release-process.md b/doc/release-process.md index 224477fe5547..29024444dab8 100644 --- a/doc/release-process.md +++ b/doc/release-process.md @@ -9,7 +9,7 @@ Before every minor and major release: * [ ] Review ["Needs backport" labels](https://github.com/dashpay/dash/labels?q=backport). * [ ] Update DIPs with any changes introduced by this release (see [this pull request](https://github.com/dashpay/dips/pull/142) for an example) -* [ ] Update version in `configure.ac` (don't forget to set `CLIENT_VERSION_IS_RELEASE` to `true`) +* [ ] Update version in `CMakeLists.txt` (don't forget to set `CLIENT_VERSION_IS_RELEASE` to `true`) * [ ] Write release notes (see below). To clear the release notes: `cp doc/release-notes-empty-template.md doc/release-notes.md` * [ ] Update flatpak [metainfo file](contrib/flatpak/org.dash.dash-core.metainfo.xml) with latest release tag and estimated release date * [ ] Update the following variables in [`src/kernel/chainparams.cpp`](/src/kernel/chainparams.cpp) for mainnet and testnet: diff --git a/doc/tracing.md b/doc/tracing.md index d7a1139cac88..8e60fbb6a28e 100644 --- a/doc/tracing.md +++ b/doc/tracing.md @@ -347,7 +347,7 @@ USDT support. To list probes in Dash Core, use `info probes` in `gdb`: ``` -$ gdb ./src/dashd +$ gdb ./build/src/dashd … (gdb) info probes Type Provider Name Where Semaphore Object @@ -363,7 +363,7 @@ The `readelf` tool can be used to display the USDT tracepoints in Dash Core. Look for the notes with the description `NT_STAPSDT`. ``` -$ readelf -n ./src/dashd | grep NT_STAPSDT -A 4 -B 2 +$ readelf -n ./build/src/dashd | grep NT_STAPSDT -A 4 -B 2 Displaying notes found in: .note.stapsdt Owner Data size Description stapsdt 0x0000005d NT_STAPSDT (SystemTap probe descriptors) @@ -387,7 +387,7 @@ between distributions. For example, on [ubuntu binary]: https://github.com/iovisor/bcc/blob/master/INSTALL.md#ubuntu---binary ``` -$ tplist -l ./src/dashd -v +$ tplist -l ./build/src/dashd -v b'net':b'outbound_message' [sema 0x0] 1 location(s) 6 argument(s) diff --git a/doc/translation_process.md b/doc/translation_process.md index a511b7eeb3b1..a7dae07c8f73 100644 --- a/doc/translation_process.md +++ b/doc/translation_process.md @@ -16,10 +16,11 @@ We use automated scripts to help extract translations in both Qt, and non-Qt sou `src/qt/locale/dash_en.ts` is treated in a special way. It is used as the source for all other translations. Whenever a string in the source code is changed, this file must be updated to reflect those changes. A custom script is used to extract strings from the non-Qt parts. This script makes use of `gettext`, so make sure that utility is installed (ie, `apt-get install gettext` on Ubuntu/Debian). Once this has been updated, `lupdate` (included in the Qt SDK) is used to update `dash_en.ts`. -To automatically regenerate the `dash_en.ts` file, run the following commands: +To automatically regenerate the `dash_en.ts` file, configure a GUI build and +run the following commands from the source root: ```sh -cd src/ -make translate +cmake -B build -DBUILD_GUI=ON +cmake --build build --target translate ``` **Example Qt translation** @@ -59,8 +60,9 @@ To assist in updating translations, we have created a script to help. 1. `python contrib/devtools/update-translations.py` It fetches the translations, post-processes them, `git add`s new files from -`src/qt/locale/` and regenerates `src/qt/dash_locale.qrc` and -`src/Makefile.qt_locale.include`. +`src/qt/locale/` and regenerates `src/qt/dash_locale.qrc`. CMake discovers +`src/qt/locale/*.ts` when configuring, so run `cmake -B build` again after +adding or removing translations. **Do not directly download translations** one by one from the Transifex website, as we do a few post-processing steps before committing the translations. diff --git a/doc/translation_strings_policy.md b/doc/translation_strings_policy.md index 45216cb254b0..deae60f58160 100644 --- a/doc/translation_strings_policy.md +++ b/doc/translation_strings_policy.md @@ -97,4 +97,4 @@ The second example reduces the number of pluralized words that translators have During a string freeze (often before a major release), no translation strings are to be added, modified or removed. -This can be checked by executing `make translate` in the `src` directory, then verifying that `dash_en.ts` remains unchanged. +This can be checked by executing `cmake --build build --target translate` from the source root, then verifying that `dash_en.ts` remains unchanged. diff --git a/doc/zmq.md b/doc/zmq.md index d9e2709b2f81..2f7afc1d1bd6 100644 --- a/doc/zmq.md +++ b/doc/zmq.md @@ -46,11 +46,12 @@ operation. ## Enabling -By default, the ZeroMQ feature is automatically compiled in if the -necessary prerequisites are found. To disable, use --disable-zmq -during the *configure* step of building dashd: +ZeroMQ support is disabled by default. Install the prerequisites and enable it +when configuring Dash Core: - $ ./configure --disable-zmq (other options) + $ cmake -B build -DWITH_ZMQ=ON + +Use `-DWITH_ZMQ=OFF` to disable it. To actually enable operation, one must set the appropriate options on the command line or in the configuration file. diff --git a/src/qt/README.md b/src/qt/README.md index 77f7033106bc..e5dc327c6858 100644 --- a/src/qt/README.md +++ b/src/qt/README.md @@ -6,12 +6,12 @@ The current precise version for Qt 5 is specified in [qt.mk](/depends/packages/q See build instructions: [Unix](/doc/build-unix.md), [macOS](/doc/build-osx.md), [Windows](/doc/build-windows.md), [FreeBSD](/doc/build-freebsd.md), [NetBSD](/doc/build-netbsd.md), [OpenBSD](/doc/build-openbsd.md) -When following your systems build instructions, make sure to install the `Qt` dependencies. +When following your systems build instructions, install the `Qt` dependencies and configure CMake with `-DBUILD_GUI=ON`. To run: ```sh -./src/qt/dash-qt +./build/src/qt/dash-qt ``` ## Files and Directories @@ -100,12 +100,12 @@ sudo apt-get install qtcreator #### Setup Qt Creator 1. Make sure you've installed all dependencies specified in your systems build instructions -2. Follow the compile instructions for your system, run `./configure` with the `--enable-debug` flag -3. Start Qt Creator. At the start page, do: `New` -> `Import Project` -> `Import Existing Project` -4. Enter `dash-qt` as the Project Name and enter the absolute path to `src/qt` as Location -5. Check over the file selection, you may need to select the `forms` directory (necessary if you intend to edit *.ui files) -6. Confirm the `Summary` page -7. In the `Projects` tab, select `Manage Kits...` +2. Follow the compile instructions for your system, configure with `cmake -B build -DBUILD_GUI=ON -DCMAKE_BUILD_TYPE=Debug` +3. Start Qt Creator and open the top-level `CMakeLists.txt` using `File` -> `Open File or Project...` +4. Select a kit with the compiler and debugger you intend to use +5. Set the build directory to the `build` directory configured above +6. Check that the CMake configuration includes `BUILD_GUI=ON` and `CMAKE_BUILD_TYPE=Debug` +7. In the `Projects` tab, select `Manage Kits...` if you need to adjust the kit **macOS** - Under `Kits`: select the default "Desktop" kit @@ -120,6 +120,6 @@ sudo apt-get install qtcreator - Under `Compilers`: select `"GCC (x86 64bit in /usr/bin)"` - Under `Debuggers`: select `"GDB"` as debugger -8. While in the `Projects` tab, ensure that you have the `dash-qt` executable specified under `Run` - - If the executable is not specified: click `"Choose..."`, navigate to `src/qt`, and select `dash-qt` +8. While in the `Projects` tab, select the `bitcoin-qt` target under `Run` (its executable is named `dash-qt`) + - If the executable is not specified: click `"Choose..."`, navigate to `build/src/qt`, and select `dash-qt` 9. You're all set! Start developing, building, and debugging the Dash Core GUI diff --git a/src/test/README.md b/src/test/README.md index 2f69c24f86bc..d2a1572069ff 100644 --- a/src/test/README.md +++ b/src/test/README.md @@ -12,22 +12,23 @@ that runs all of the unit tests. The main source file for the test library is fo ### Compiling/running unit tests -Unit tests will be automatically compiled if dependencies were met in `./configure` -and tests weren't explicitly disabled. +Unit tests are compiled by default unless disabled with `-DBUILD_TESTS=OFF` +when configuring with CMake. -After configuring, they can be run with `make check`, which includes unit tests from -subtrees, or `make && make -C src check-unit` for just the unit tests. +Assuming the build directory is named `build`, run them with +`ctest --test-dir build`, which includes unit tests from subtrees. -To run the unit tests manually, launch `src/test/test_dash`. To recompile -after a test file was modified, run `make` and then run the test again. If you -modify a non-test file, use `make -C src/test` to recompile only what's needed -to run the unit tests. +To run the unit tests manually, launch `build/src/test/test_dash`. To recompile +after a test file was modified, run `cmake --build build` and then run the test again. If you +modify a non-test file, use `cmake --build build --target test_bitcoin` to recompile +only what is needed to run the unit tests. The target retains its upstream name +and produces the `test_dash` executable. To add more unit tests, add `BOOST_AUTO_TEST_CASE` functions to the existing .cpp files in the `test/` directory or add new .cpp files that implement new `BOOST_AUTO_TEST_SUITE` sections. -To run the GUI unit tests manually, launch `src/qt/test/test_dash-qt` +To run the GUI unit tests manually, launch `build/src/qt/test/test_dash-qt` To add more GUI unit tests, add them to the `src/qt/test/` directory and the `src/qt/test/test_main.cpp` file. @@ -38,7 +39,7 @@ the `src/qt/test/test_main.cpp` file. For example, to run just the `getarg_tests` suite of tests: ```bash -test_dash --log_level=all --run_test=getarg_tests +build/src/test/test_dash --log_level=all --run_test=getarg_tests ``` `log_level` controls the verbosity of the test framework, which logs when a @@ -47,7 +48,7 @@ line arguments accepted by `dashd`. Use `--` to separate both types of arguments: ```bash -test_dash --log_level=all --run_test=getarg_tests -- -printtoconsole=1 +build/src/test/test_dash --log_level=all --run_test=getarg_tests -- -printtoconsole=1 ``` The `-printtoconsole=1` after the two dashes redirects the debug log, which @@ -57,15 +58,16 @@ would normally go to a file in the test datadir ... or to run just the doubledash test: ```bash -test_dash --run_test=getarg_tests/doubledash +build/src/test/test_dash --run_test=getarg_tests/doubledash ``` -Run `test_dash --help` for the full list. +Run `build/src/test/test_dash --help` for the full list. ### Adding test cases To add a new unit test file to our test suite you need -to add the file to `src/Makefile.test.include`. The pattern is to create +to add the file to `src/test/CMakeLists.txt`, or `src/wallet/test/CMakeLists.txt` +for wallet-related tests. The pattern is to create one test file for each class or source file for which you want to create unit tests. The file naming convention is `_tests.cpp` and such files should wrap their tests in a test suite @@ -74,8 +76,9 @@ see `uint256_tests.cpp`. ### Logging and debugging in unit tests -`make check` will write to a log file `foo_tests.cpp.log` and display this file -on failure. For running individual tests verbosely, refer to the section +`ctest --test-dir build` writes logs to `build/Testing/Temporary/LastTest.log`. +Use `--output-on-failure` to display logs automatically when a test fails. For +running individual tests verbosely, refer to the section [above](#running-individual-tests). To write to logs from unit tests you need to use specific message methods @@ -85,13 +88,13 @@ For debugging you can launch the `test_dash` executable with `gdb` or `lldb` and start debugging, just like you would with any other program: ```bash -gdb src/test/test_dash +gdb build/src/test/test_dash ``` #### Segmentation faults If you hit a segmentation fault during a test run, you can diagnose where the fault -is happening by running `gdb ./src/test/test_dash` and then using the `bt` command +is happening by running `gdb ./build/src/test/test_dash` and then using the `bt` command within gdb. Another tool that can be used to resolve segmentation faults is @@ -109,7 +112,7 @@ Running the tests and hitting a segmentation fault should now produce a file cal You can then explore the core dump using ```bash -gdb src/test/test_dash core +gdb build/src/test/test_dash core (gbd) bt # produce a backtrace for where a segfault occurred ``` diff --git a/test/README.md b/test/README.md index 1c01e782e16e..5d2234b040df 100644 --- a/test/README.md +++ b/test/README.md @@ -13,7 +13,7 @@ interfaces. - [util](/test/util) which tests the utilities (dash-tx, ...). - [lint](/test/lint/) which perform various static analysis checks. -The util tests are run as part of `make check` target. The fuzz tests, functional +The util tests are run by `ctest --test-dir build`. The fuzz tests, functional tests and lint scripts can be run as explained in the sections below. # Running tests locally @@ -47,22 +47,26 @@ set PYTHONUTF8=1 #### Running the tests -Individual tests can be run by directly calling the test script, e.g.: +CMake generates `build/test/config.ini` with the build paths and enabled features. +Run the scripts under `build/test/` so they use that configuration. The examples +below assume a build directory named `build` and commands run from the source root. + +When calling an individual test script directly, specify the generated configuration, e.g.: ``` -test/functional/wallet_hd.py +build/test/functional/wallet_hd.py --configfile=build/test/config.ini ``` -or can be run through the test_runner harness, eg: +The test runner passes the generated configuration to each test automatically: ``` -test/functional/test_runner.py wallet_hd.py +build/test/functional/test_runner.py wallet_hd.py ``` You can run any combination (incl. duplicates) of tests by calling: ``` -test/functional/test_runner.py ... +build/test/functional/test_runner.py ... ``` Wildcard test names can be passed, if the paths are coherent and the test runner @@ -70,34 +74,34 @@ is called from a `bash` shell or similar that does the globbing. For example, to run all the wallet tests: ``` -test/functional/test_runner.py test/functional/wallet* -functional/test_runner.py functional/wallet* (called from the test/ directory) -test_runner.py wallet* (called from the test/functional/ directory) +build/test/functional/test_runner.py build/test/functional/wallet* +functional/test_runner.py functional/wallet* (called from the build/test/ directory) +test_runner.py wallet* (called from the build/test/functional/ directory) ``` but not ``` -test/functional/test_runner.py wallet* +build/test/functional/test_runner.py wallet* ``` Combinations of wildcards can be passed: ``` -test/functional/test_runner.py ./test/functional/tool* test/functional/mempool* +build/test/functional/test_runner.py ./build/test/functional/tool* build/test/functional/mempool* test_runner.py tool* mempool* ``` Run the regression test suite with: ``` -test/functional/test_runner.py +build/test/functional/test_runner.py ``` Run all possible tests with ``` -test/functional/test_runner.py --extended +build/test/functional/test_runner.py --extended ``` In order to run backwards compatibility tests, first run: @@ -112,7 +116,7 @@ By default, up to 4 tests will be run in parallel by test_runner. To specify how many jobs to run, append `--jobs=n` The individual tests and the test_runner harness have many command-line -options. Run `test/functional/test_runner.py -h` to see them all. +options. Run `build/test/functional/test_runner.py -h` to see them all. #### Speed up test runs with a RAM disk @@ -141,7 +145,7 @@ For example running the test suite with `--jobs=100` might need a 4 GiB RAM disk To use, run the test suite specifying the RAM disk as the `cachedir` and `tmpdir`: ```bash -test/functional/test_runner.py --cachedir=/mnt/tmp/cache --tmpdir=/mnt/tmp +build/test/functional/test_runner.py --cachedir=/mnt/tmp/cache --tmpdir=/mnt/tmp ``` Once finished with the tests and the disk, and to free the RAM, simply unmount the disk: @@ -162,7 +166,7 @@ Configure the RAM disk size, expressed as the number of blocks, at the end of th (`4096 MiB * 2048 blocks/MiB = 8388608 blocks` for 4 GiB). To run the tests using the RAM disk: ```bash -test/functional/test_runner.py --cachedir=/Volumes/ramdisk/cache --tmpdir=/Volumes/ramdisk/tmp +build/test/functional/test_runner.py --cachedir=/Volumes/ramdisk/cache --tmpdir=/Volumes/ramdisk/tmp ``` To unmount: @@ -204,14 +208,14 @@ pkill -9 dashd ##### Data directory cache A pre-mined blockchain with 200 blocks is generated the first time a -functional test is run and is stored in test/cache. This speeds up +functional test is run and is stored in build/test/cache. This speeds up test startup times since new blockchains don't need to be generated for each test. However, the cache may get into a bad state, in which case tests will fail. If this happens, remove the cache directory (and make sure dashd processes are stopped as above): ```bash -rm -rf test/cache +rm -rf build/test/cache killall dashd ``` @@ -247,7 +251,7 @@ aggregate log by running the `combine_logs.py` script. The output can be plain text, colorized text or html. For example: ``` -test/functional/combine_logs.py -c | less -r +build/test/functional/combine_logs.py -c | less -r ``` will pipe the colorized logs from the test into less. @@ -308,7 +312,7 @@ See this link for considerations: https://www.kernel.org/doc/Documentation/secur Often while debugging RPC calls in functional tests, the test might time out before the process can return a response. Use `--timeout-factor 0` to disable all RPC timeouts for that particular -functional test. Ex: `test/functional/wallet_hd.py --timeout-factor 0`. +functional test. Ex: `build/test/functional/wallet_hd.py --configfile=build/test/config.ini --timeout-factor 0`. ##### Profiling @@ -332,7 +336,7 @@ For ways to generate more granular profiles, see the README in ### Util tests -Util tests can be run locally by running `test/util/test_runner.py`. +Util tests can be run locally by running `build/test/util/test_runner.py`. Use the `-v` option for verbose output. ### Lint tests From bc908d12b73f2f21f9671381bf2f3b6cb5d09c6e Mon Sep 17 00:00:00 2001 From: pasta Date: Wed, 11 Nov 2026 05:40:24 +0000 Subject: [PATCH 9/9] partial Merge bitcoin/bitcoin#30664: build: Remove Autotools-based build system Remove configure.ac, autogen.sh, the Makefile.am files, the src/Makefile.*.include fragments, build-aux/m4, share/genbuild.sh and depends' config.site, now that CI, Guix and the documentation use CMake. This is Dash's counterpart of upstream merge commit ef6f49ecaf4: the same removal, applied to Dash's own set of Autotools files. Also drop what only Autotools used: the Bear configuration for the tidy job, the convenience Makefiles in src/, src/qt and src/test, the generated univalue source list, the .gitignore entries for in-tree build products, the Makefile sections in .editorconfig, and the Makefile.qt_locale.include that update-translations.py regenerated (the CMake build globs src/qt/locale/*.ts). Comments and messages that pointed at configure, configure.ac or `make check` now point at their CMake counterparts, and gen-manpages.py, gen-dash-conf.sh and ci/dash/build-docker.sh default to the build/ directory. The vendored subtrees keep their own build files, and depends packages still use their upstream Autotools builds. Co-Authored-By: Claude Opus 5.5 Co-Authored-By: Claude Fable 5.2 --- .editorconfig | 8 - .github/workflows/build-depends.yml | 2 +- .gitignore | 146 +- CMakeLists.txt | 20 +- Makefile.am | 324 --- autogen.sh | 29 - build-aux/m4/ax_boost_base.m4 | 256 -- build-aux/m4/ax_check_compile_flag.m4 | 53 - build-aux/m4/ax_check_link_flag.m4 | 53 - build-aux/m4/ax_check_preproc_flag.m4 | 53 - build-aux/m4/ax_cxx_compile_stdcxx.m4 | 1005 -------- build-aux/m4/ax_pthread.m4 | 522 ---- build-aux/m4/bitcoin_find_bdb48.m4 | 97 - build-aux/m4/bitcoin_qt.m4 | 389 --- build-aux/m4/bitcoin_subdir_to_include.m4 | 18 - build-aux/m4/l_atomic.m4 | 65 - build-aux/m4/l_socket.m4 | 36 - ci/dash/build-docker.sh | 6 +- cmake/dashbls.cmake | 9 +- cmake/module/GenerateSetupNsi.cmake | 5 +- cmake/module/ProcessConfigurations.cmake | 8 +- cmake/script/GenerateBuildInfo.cmake | 6 +- configure.ac | 2195 ----------------- contrib/devtools/README.md | 8 +- contrib/devtools/check-no-rust.py | 2 +- contrib/devtools/gen-dash-conf.sh | 2 +- contrib/devtools/gen-manpages.py | 2 +- .../devtools/test_deterministic_coverage.sh | 6 +- contrib/devtools/update-translations.py | 6 - depends/.gitignore | 1 - depends/Makefile | 63 +- depends/config.site.in | 162 -- doc/.gitignore | 1 - doc/man/Makefile.am | 27 - share/genbuild.sh | 39 - share/qt/extract_strings_qt.py | 2 +- src/.bear-tidy-config | 26 - src/CMakeLists.txt | 10 +- src/Makefile.am | 1580 ------------ src/Makefile.bench.include | 117 - src/Makefile.crc32c.include | 81 - src/Makefile.dashbls.include | 136 - src/Makefile.leveldb.include | 153 -- src/Makefile.minisketch.include | 39 - src/Makefile.qt.include | 568 ----- src/Makefile.qt_locale.include | 22 - src/Makefile.qttest.include | 110 - src/Makefile.test.include | 503 ---- src/Makefile.test_fuzz.include | 28 - src/Makefile.test_util.include | 58 - src/Makefile.univalue.include | 6 - src/bench/.gitignore | 1 - src/clientversion.cpp | 2 +- src/crypto/CMakeLists.txt | 5 +- src/ipc/capnp/.gitignore | 2 - src/kernel/CMakeLists.txt | 3 +- src/qt/Makefile | 0 src/qt/test/Makefile | 6 - src/test/Makefile | 6 - src/test/bls_tests.cpp | 2 +- src/univalue/.gitignore | 32 - src/univalue/lib/.gitignore | 2 - src/univalue/sources.mk | 86 - src/univalue/test/.gitignore | 7 - src/util/fs_helpers.cpp | 2 +- test/functional/.gitignore | 1 - test/functional/test_runner.py | 2 +- test/lint/lint-spelling.py | 2 +- test/util/test_runner.py | 2 +- 69 files changed, 50 insertions(+), 9176 deletions(-) delete mode 100644 Makefile.am delete mode 100755 autogen.sh delete mode 100644 build-aux/m4/ax_boost_base.m4 delete mode 100644 build-aux/m4/ax_check_compile_flag.m4 delete mode 100644 build-aux/m4/ax_check_link_flag.m4 delete mode 100644 build-aux/m4/ax_check_preproc_flag.m4 delete mode 100644 build-aux/m4/ax_cxx_compile_stdcxx.m4 delete mode 100644 build-aux/m4/ax_pthread.m4 delete mode 100644 build-aux/m4/bitcoin_find_bdb48.m4 delete mode 100644 build-aux/m4/bitcoin_qt.m4 delete mode 100644 build-aux/m4/bitcoin_subdir_to_include.m4 delete mode 100644 build-aux/m4/l_atomic.m4 delete mode 100644 build-aux/m4/l_socket.m4 delete mode 100644 configure.ac delete mode 100644 depends/config.site.in delete mode 100644 doc/.gitignore delete mode 100644 doc/man/Makefile.am delete mode 100755 share/genbuild.sh delete mode 100644 src/.bear-tidy-config delete mode 100644 src/Makefile.am delete mode 100644 src/Makefile.bench.include delete mode 100644 src/Makefile.crc32c.include delete mode 100644 src/Makefile.dashbls.include delete mode 100644 src/Makefile.leveldb.include delete mode 100644 src/Makefile.minisketch.include delete mode 100644 src/Makefile.qt.include delete mode 100644 src/Makefile.qt_locale.include delete mode 100644 src/Makefile.qttest.include delete mode 100644 src/Makefile.test.include delete mode 100644 src/Makefile.test_fuzz.include delete mode 100644 src/Makefile.test_util.include delete mode 100644 src/Makefile.univalue.include delete mode 100644 src/bench/.gitignore delete mode 100644 src/ipc/capnp/.gitignore delete mode 100644 src/qt/Makefile delete mode 100644 src/qt/test/Makefile delete mode 100644 src/test/Makefile delete mode 100644 src/univalue/.gitignore delete mode 100644 src/univalue/lib/.gitignore delete mode 100644 src/univalue/sources.mk delete mode 100644 src/univalue/test/.gitignore diff --git a/.editorconfig b/.editorconfig index ae7e92d1c8a8..4caeb9474b7c 100644 --- a/.editorconfig +++ b/.editorconfig @@ -16,11 +16,3 @@ indent_size = 4 # .cirrus.yml, .fuzzbuzz.yml, etc. [*.yml] indent_size = 2 - -# Makefiles -[{*.am,Makefile.*.include}] -indent_style = tab - -# Autoconf scripts -[configure.ac] -indent_size = 2 diff --git a/.github/workflows/build-depends.yml b/.github/workflows/build-depends.yml index 7afb5663bf23..8d7f11c787ad 100644 --- a/.github/workflows/build-depends.yml +++ b/.github/workflows/build-depends.yml @@ -88,7 +88,7 @@ jobs: DEP_HASH="$(echo -n "${BUILD_TARGET}" "${DEP_OPTS}" "${HOST}" | sha256sum | head -c 64)" echo "DEP_HASH=${DEP_HASH}" >> "${GITHUB_OUTPUT}" DOCKERFILE_HASH="${{ hashFiles('contrib/containers/ci/ci.Dockerfile', 'contrib/containers/ci/ci-slim.Dockerfile') }}" - DEPENDS_INPUTS_HASH="${{ hashFiles('depends/Makefile', 'depends/funcs.mk', 'depends/gen_id', 'depends/config.guess', 'depends/config.sub', 'depends/config.site.in', 'depends/builders/**', 'depends/hosts/**', 'depends/packages/**', 'depends/patches/**') }}" + DEPENDS_INPUTS_HASH="${{ hashFiles('depends/Makefile', 'depends/funcs.mk', 'depends/gen_id', 'depends/config.guess', 'depends/config.sub', 'depends/toolchain.cmake.in', 'depends/builders/**', 'depends/hosts/**', 'depends/packages/**', 'depends/patches/**') }}" CACHE_KEY_PREFIX="depends-${DOCKERFILE_HASH}-${BASE_IMAGE_DIGEST}-${RUNS_ON}-${BUILD_TARGET}" CACHE_KEY="${CACHE_KEY_PREFIX}-${DEP_HASH}-${DEPENDS_INPUTS_HASH}" echo "cache-key-prefix=${CACHE_KEY_PREFIX}" >> "${GITHUB_OUTPUT}" diff --git a/.gitignore b/.gitignore index 280135f58152..45219158e58d 100644 --- a/.gitignore +++ b/.gitignore @@ -5,158 +5,21 @@ reset-files.bash # Build subdirectories. /*build* -!/build-aux -!/build_msvc -*.tar.gz - -*.exe -src/dash -src/dashd -src/dash-cli -src/dash-gui -src/dash-node -src/dash-tx -src/dash-util -src/dash-chainstate -src/dash-wallet -src/test/fuzz/fuzz -src/test/test_dash -src/dashbls/runtest -src/qt/test/test_dash-qt -src/qt/res/css/colors/* -src/bench/bench_dash - -# autoreconf -Makefile.in -aclocal.m4 -autom4te.cache/ -build-aux/config.guess -build-aux/config.sub -build-aux/depcomp -build-aux/install-sh -build-aux/ltmain.sh -build-aux/m4/libtool.m4 -build-aux/m4/lt~obsolete.m4 -build-aux/m4/ltoptions.m4 -build-aux/m4/ltsugar.m4 -build-aux/m4/ltversion.m4 -build-aux/missing -build-aux/compile -build-aux/test-driver -config.cache -config.log -config.status -config.status.old -configure -libtool -src/config/bitcoin-config.h -src/config/bitcoin-config.h.in -src/config/stamp-h1 -src/obj -share/setup.nsi -share/qt/Info.plist - -src/qt/*.moc -src/qt/moc_*.cpp -src/qt/forms/ui_*.h - -src/qt/test/moc*.cpp -libconftest.dylib* - -.deps -.dirstamp -.libs -.*.swp -*~ -*.bak -*.rej -*.orig *.pyc -*.o -*.o-* -*.a -*.pb.cc -*.pb.h -*.dat - -*.log -*.trs -*.zip - -*.json.h -*.raw.h # Only ignore unexpected patches *.patch !contrib/guix/patches/*.patch !depends/patches/**/*.patch -#libtool object files -*.lo -*.la - -# Compilation and Qt preprocessor part -*.qm -Makefile -!depends/Makefile -dash-qt -Dash-Qt.app - -# Qt Creator -Makefile.am.user - -# Unit-tests -Makefile.test -dash-qt_test - -# Resources cpp -qrc_*.cpp - -# Mac specific -.DS_Store -build -*.dSYM +/CMakeUserPresets.json # Previous releases -releases - -#lcov -*.gcno -*.gcda -/*.info -test_dash.coverage/ -total.coverage/ -fuzz.coverage/ -coverage_percent.txt -/cov_tool_wrapper.sh -qa-assets/ - -#build tests -linux-coverage-build -linux-build -win32-build -test/config.ini -test/cache/* -test/.mypy_cache/ - -!src/leveldb*/Makefile +/releases .cproject .project -.autotools -/doc/doxygen/ - -libdashconsensus.pc -contrib/devtools/split-debug.sh -src/qt/dash-qt.bash -qa/pull-tester/tests-config.sh - -#development symlinks -dash-cli -dashd -dash-qt -make /contrib/containers/deploy/bin @@ -164,11 +27,6 @@ make .idea cmake-build-debug -# clang-check -*.plist - -dist/ - /guix-build-* /ci/scratch/ diff --git a/CMakeLists.txt b/CMakeLists.txt index d5e2cf84ce53..5e50e227491b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -142,13 +142,11 @@ option(ENABLE_MINER "Enable the in-wallet miner and its RPCs." ON) option(ENABLE_MIMALLOC "Use mimalloc for BLS secret memory until BLSInit() installs the locked pool." ON) -# Dash, unlike upstream, still provides the public libdashconsensus API -# (--with-libs under Autotools, enabled by default). +# Dash, unlike upstream, still provides the public libdashconsensus API. option(BUILD_CONSENSUS_LIB "Build the public dashconsensus shared library." ON) -# Matches the Autotools `--enable-stacktraces=auto` default: enabled when -# libbacktrace and its prerequisites are found, otherwise disabled with a -# warning. See the detection block further down. +# Enabled when libbacktrace and its prerequisites are found, otherwise +# disabled with a warning. See the detection block further down. option(ENABLE_STACKTRACES "Gather and print exception stack traces. Requires libbacktrace." ON) cmake_dependent_option(ENABLE_CRASH_HOOKS "Hook into exception/signal/assert handling to gather stack traces." OFF "ENABLE_STACKTRACES" OFF) @@ -277,7 +275,7 @@ target_link_libraries(core_interface INTERFACE target_compile_definitions(core_interface INTERFACE HAVE_CONFIG_H # gsl/pointers.h pulls in and defines stream operators unless this - # is set. Keep it in sync with CORE_CPPFLAGS in configure.ac. + # is set. GSL_NO_IOSTREAMS ) @@ -535,8 +533,8 @@ else() IF_CHECK_PASSED "-Wno-unused-parameter" ) - # Warnings that are suppressed outright. Keep in sync with NOWARN_CXXFLAGS in - # configure.ac; without these a WERROR build fails on GCC or Clang. + # Warnings that are suppressed outright; without these a WERROR build fails + # on GCC or Clang. if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") # -Wdeprecated-literal-operator causes problems with clang 20. # TODO: remove it once we update hana. @@ -658,10 +656,8 @@ if(WERROR) unset(werror_flag) endif() -# Autotools puts the warning and -Werror flags in CXXFLAGS only; AM_CFLAGS -# carries neither. Restrict them to C++ here as well, so that the vendored -# sphlib C sources under crypto/x11 are held to the same standard as they are -# by the Autotools build. +# The warning and -Werror flags apply to C++ only, so that they do not reach +# the vendored sphlib C sources under crypto/x11. get_target_property(warn_interface_flags warn_interface INTERFACE_COMPILE_OPTIONS) if(warn_interface_flags) set_target_properties(warn_interface PROPERTIES diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index 2eaf58ff3c54..000000000000 --- a/Makefile.am +++ /dev/null @@ -1,324 +0,0 @@ -# Copyright (c) 2013-2020 The Bitcoin Core developers -# Copyright (c) 2014-2018 The Dash Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. - -# Pattern rule to print variables, e.g. make print-top_srcdir -print-%: FORCE - @echo '$*'='$($*)' - -ACLOCAL_AMFLAGS = -I build-aux/m4 -SUBDIRS = src -if ENABLE_MAN -SUBDIRS += doc/man -endif -.PHONY: deploy FORCE -.INTERMEDIATE: $(COVERAGE_INFO) - -if BUILD_BITCOIN_LIBS -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = libdashconsensus.pc -endif - -BITCOIND_BIN=$(top_builddir)/src/$(BITCOIN_DAEMON_NAME)$(EXEEXT) -BITCOIN_QT_BIN=$(top_builddir)/src/qt/$(BITCOIN_GUI_NAME)$(EXEEXT) -BITCOIN_TEST_BIN=$(top_builddir)/src/test/$(BITCOIN_TEST_NAME)$(EXEEXT) -BITCOIN_CLI_BIN=$(top_builddir)/src/$(BITCOIN_CLI_NAME)$(EXEEXT) -BITCOIN_TX_BIN=$(top_builddir)/src/$(BITCOIN_TX_NAME)$(EXEEXT) -BITCOIN_UTIL_BIN=$(top_builddir)/src/$(BITCOIN_UTIL_NAME)$(EXEEXT) -BITCOIN_WALLET_BIN=$(top_builddir)/src/$(BITCOIN_WALLET_TOOL_NAME)$(EXEEXT) -BITCOIN_NODE_BIN=$(top_builddir)/src/$(BITCOIN_MP_NODE_NAME)$(EXEEXT) -BITCOIN_GUI_BIN=$(top_builddir)/src/$(BITCOIN_MP_GUI_NAME)$(EXEEXT) -BITCOIN_WIN_INSTALLER=$(PACKAGE)-$(PACKAGE_VERSION)-win64-setup$(EXEEXT) - -empty := -space := $(empty) $(empty) - -OSX_APP=Dash-Qt.app -OSX_VOLNAME = $(subst $(space),-,$(PACKAGE_NAME)) -OSX_ZIP = $(OSX_VOLNAME).zip -OSX_DEPLOY_SCRIPT=$(top_srcdir)/contrib/macdeploy/macdeployqtplus -OSX_INSTALLER_ICONS=$(top_srcdir)/src/qt/res/icons/dash.icns -OSX_PLIST=$(top_builddir)/share/qt/Info.plist #not installed - -DIST_CONTRIB = \ - $(top_srcdir)/contrib/debian/copyright \ - $(top_srcdir)/test/sanitizer_suppressions/lsan \ - $(top_srcdir)/test/sanitizer_suppressions/tsan \ - $(top_srcdir)/test/sanitizer_suppressions/ubsan \ - $(top_srcdir)/contrib/linearize/linearize-data.py \ - $(top_srcdir)/contrib/linearize/linearize-hashes.py - -DIST_SHARE = \ - $(top_srcdir)/share/genbuild.sh \ - $(top_srcdir)/share/rpcauth - -BIN_CHECKS=$(top_srcdir)/contrib/guix/symbol-check.py \ - $(top_srcdir)/contrib/guix/security-check.py \ - $(top_srcdir)/contrib/guix/stdlib-path-check.py \ - $(top_srcdir)/contrib/devtools/utils.py - -WINDOWS_PACKAGING = $(top_srcdir)/share/pixmaps/dash.ico \ - $(top_srcdir)/share/pixmaps/nsis-header.bmp \ - $(top_srcdir)/share/pixmaps/nsis-wizard.bmp \ - $(top_srcdir)/doc/README_windows.txt - -OSX_PACKAGING = $(OSX_DEPLOY_SCRIPT) $(OSX_INSTALLER_ICONS) \ - $(top_srcdir)/contrib/macdeploy/detached-sig-create.sh - -COVERAGE_INFO = $(COV_TOOL_WRAPPER) baseline.info \ - test_dash_filtered.info total_coverage.info \ - baseline_filtered.info functional_test.info functional_test_filtered.info \ - test_dash_coverage.info test_dash.info fuzz.info fuzz_filtered.info fuzz_coverage.info - -dist-hook: - -$(GIT) archive --format=tar HEAD -- src/clientversion.cpp | $(AMTAR) -C $(top_distdir) -xf - - -if TARGET_WINDOWS -$(BITCOIN_WIN_INSTALLER): all-recursive - $(MKDIR_P) $(top_builddir)/release - STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIND_BIN) $(top_builddir)/release - STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_QT_BIN) $(top_builddir)/release - STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_TEST_BIN) $(top_builddir)/release - STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_CLI_BIN) $(top_builddir)/release - STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_TX_BIN) $(top_builddir)/release - STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_WALLET_BIN) $(top_builddir)/release - STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_UTIL_BIN) $(top_builddir)/release - @test -f $(MAKENSIS) && echo 'OutFile "$@"' | cat $(top_builddir)/share/setup.nsi - | $(MAKENSIS) -V2 - || \ - echo error: could not build $@ - @echo built $@ - -deploy: $(BITCOIN_WIN_INSTALLER) -endif - -if TARGET_DARWIN -$(OSX_APP)/Contents/PkgInfo: - $(MKDIR_P) $(@D) - @echo "APPL????" > $@ - -$(OSX_APP)/Contents/Resources/empty.lproj: - $(MKDIR_P) $(@D) - @touch $@ - -$(OSX_APP)/Contents/Info.plist: $(OSX_PLIST) - $(MKDIR_P) $(@D) - $(INSTALL_DATA) $< $@ - -$(OSX_APP)/Contents/Resources/dash.icns: $(OSX_INSTALLER_ICONS) - $(MKDIR_P) $(@D) - $(INSTALL_DATA) $< $@ - -$(OSX_APP)/Contents/MacOS/Dash-Qt: all-recursive - $(MKDIR_P) $(@D) - STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_QT_BIN) $@ - -$(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings: - $(MKDIR_P) $(@D) - echo '{ CFBundleDisplayName = "$(PACKAGE_NAME)"; CFBundleName = "$(PACKAGE_NAME)"; }' > $@ - -OSX_APP_BUILT=$(OSX_APP)/Contents/PkgInfo $(OSX_APP)/Contents/Resources/empty.lproj \ - $(OSX_APP)/Contents/Resources/dash.icns $(OSX_APP)/Contents/Info.plist \ - $(OSX_APP)/Contents/MacOS/Dash-Qt $(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings - -if BUILD_DARWIN -$(OSX_ZIP): $(OSX_APP_BUILT) $(OSX_PACKAGING) - $(PYTHON) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) $(OSX_VOLNAME) -translations-dir=$(QT_TRANSLATION_DIR) -zip - -deploydir: $(OSX_ZIP) -else !BUILD_DARWIN -APP_DIST_DIR=$(top_builddir)/dist - -$(OSX_ZIP): deploydir - if [ -n "$(SOURCE_DATE_EPOCH)" ]; then find $(APP_DIST_DIR) -exec touch -d @$(SOURCE_DATE_EPOCH) {} +; fi - cd $(APP_DIST_DIR) && find . | sort | $(ZIP) -X@ $@ - -$(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Dash-Qt: $(OSX_APP_BUILT) $(OSX_PACKAGING) - OBJDUMP=$(OBJDUMP) $(PYTHON) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) $(OSX_VOLNAME) -translations-dir=$(QT_TRANSLATION_DIR) - -deploydir: $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Dash-Qt -endif !BUILD_DARWIN - -deploy: $(OSX_ZIP) -endif - -$(BITCOIN_QT_BIN): FORCE - $(MAKE) -C src qt/$(@F) - -$(BITCOIND_BIN): FORCE - $(MAKE) -C src $(@F) - -$(BITCOIN_CLI_BIN): FORCE - $(MAKE) -C src $(@F) - -$(BITCOIN_TX_BIN): FORCE - $(MAKE) -C src $(@F) - -$(BITCOIN_UTIL_BIN): FORCE - $(MAKE) -C src $(@F) - -$(BITCOIN_WALLET_BIN): FORCE - $(MAKE) -C src $(@F) - -$(BITCOIN_NODE_BIN): FORCE - $(MAKE) -C src $(@F) - -$(BITCOIN_GUI_BIN): FORCE - $(MAKE) -C src $(@F) - -if USE_LCOV -LCOV_FILTER_PATTERN = \ - -p "/usr/local/" \ - -p "/usr/include/" \ - -p "/usr/lib/" \ - -p "/usr/lib64/" \ - -p "src/dashbls/" \ - -p "src/immer/" \ - -p "src/leveldb/" \ - -p "src/crc32c/" \ - -p "src/bench/" \ - -p "src/crypto/ctaes" \ - -p "src/minisketch" \ - -p "src/secp256k1" \ - -p "depends" - -DIR_FUZZ_SEED_CORPUS ?= qa-assets/fuzz_seed_corpus - -$(COV_TOOL_WRAPPER): - @echo 'exec $(COV_TOOL) "$$@"' > $(COV_TOOL_WRAPPER) - @chmod +x $(COV_TOOL_WRAPPER) - -baseline.info: $(COV_TOOL_WRAPPER) - $(LCOV) -c -i -d $(abs_builddir)/src -o $@ - -baseline_filtered.info: baseline.info - $(abs_builddir)/contrib/filter-lcov.py $(LCOV_FILTER_PATTERN) $< $@ - $(LCOV) -a $@ $(LCOV_OPTS) -o $@ - -fuzz.info: baseline_filtered.info - @test/fuzz/test_runner.py $(DIR_FUZZ_SEED_CORPUS) -l DEBUG - $(LCOV) -c $(LCOV_OPTS) -d $(abs_builddir)/src --t fuzz-tests -o $@ - $(LCOV) -z $(LCOV_OPTS) -d $(abs_builddir)/src - -fuzz_filtered.info: fuzz.info - $(abs_builddir)/contrib/filter-lcov.py $(LCOV_FILTER_PATTERN) $< $@ - $(LCOV) -a $@ $(LCOV_OPTS) -o $@ - -test_dash.info: baseline_filtered.info - $(MAKE) -C src/ check - $(LCOV) -c $(LCOV_OPTS) -d $(abs_builddir)/src -t test_dash -o $@ - $(LCOV) -z $(LCOV_OPTS) -d $(abs_builddir)/src - -test_dash_filtered.info: test_dash.info - $(abs_builddir)/contrib/filter-lcov.py $(LCOV_FILTER_PATTERN) $< $@ - $(LCOV) -a $@ $(LCOV_OPTS) -o $@ - -functional_test.info: test_dash_filtered.info - @test/functional/test_runner.py $(EXTENDED_FUNCTIONAL_TESTS) - $(LCOV) -c $(LCOV_OPTS) -d $(abs_builddir)/src --t functional-tests -o $@ - $(LCOV) -z $(LCOV_OPTS) -d $(abs_builddir)/src - -functional_test_filtered.info: functional_test.info - $(abs_builddir)/contrib/filter-lcov.py $(LCOV_FILTER_PATTERN) $< $@ - $(LCOV) -a $@ $(LCOV_OPTS) -o $@ - -fuzz_coverage.info: fuzz_filtered.info - $(LCOV) -a $(LCOV_OPTS) baseline_filtered.info -a fuzz_filtered.info -o $@ | $(GREP) "\%" | $(AWK) '{ print substr($$3,2,50) "/" $$5 }' > coverage_percent.txt - -test_dash_coverage.info: baseline_filtered.info test_dash_filtered.info - $(LCOV) -a $(LCOV_OPTS) baseline_filtered.info -a test_dash_filtered.info -o $@ - -total_coverage.info: test_dash_filtered.info functional_test_filtered.info - $(LCOV) -a $(LCOV_OPTS) baseline_filtered.info -a test_dash_filtered.info -a functional_test_filtered.info -o $@ | $(GREP) "\%" | $(AWK) '{ print substr($$3,2,50) "/" $$5 }' > coverage_percent.txt - -fuzz.coverage/.dirstamp: fuzz_coverage.info - $(GENHTML) -s $(LCOV_OPTS) $< -o $(@D) - @touch $@ - -test_dash.coverage/.dirstamp: test_dash_coverage.info - $(GENHTML) -s $(LCOV_OPTS) $< -o $(@D) - @touch $@ - -total.coverage/.dirstamp: total_coverage.info - $(GENHTML) -s $(LCOV_OPTS) $< -o $(@D) - @touch $@ - -cov_fuzz: fuzz.coverage/.dirstamp - -cov: test_dash.coverage/.dirstamp total.coverage/.dirstamp - -endif - -dist_noinst_SCRIPTS = autogen.sh - -EXTRA_DIST = $(DIST_SHARE) $(DIST_CONTRIB) $(WINDOWS_PACKAGING) $(OSX_PACKAGING) $(BIN_CHECKS) - -EXTRA_DIST += \ - test/functional \ - test/fuzz - -EXTRA_DIST += \ - test/util/test_runner.py \ - test/util/data/bitcoin-util-test.json \ - test/util/data/blanktxv1.hex \ - test/util/data/blanktxv1.json \ - test/util/data/blanktxv2.hex \ - test/util/data/blanktxv2.json \ - test/util/data/tt-delin1-out.hex \ - test/util/data/tt-delin1-out.json \ - test/util/data/tt-delout1-out.hex \ - test/util/data/tt-delout1-out.json \ - test/util/data/tt-locktime317000-out.hex \ - test/util/data/tt-locktime317000-out.json \ - test/util/data/tx394b54bb.hex \ - test/util/data/txcreate1.hex \ - test/util/data/txcreate1.json \ - test/util/data/txcreate2.hex \ - test/util/data/txcreate2.json \ - test/util/data/txcreatedata1.hex \ - test/util/data/txcreatedata1.json \ - test/util/data/txcreatedata2.hex \ - test/util/data/txcreatedata2.json \ - test/util/data/txcreatedata_seq0.hex \ - test/util/data/txcreatedata_seq0.json \ - test/util/data/txcreatedata_seq1.hex \ - test/util/data/txcreatedata_seq1.json \ - test/util/data/txcreatemultisig1.hex \ - test/util/data/txcreatemultisig1.json \ - test/util/data/txcreatemultisig2.hex \ - test/util/data/txcreatemultisig2.json \ - test/util/data/txcreateoutpubkey1.hex \ - test/util/data/txcreateoutpubkey1.json \ - test/util/data/txcreatescript1.hex \ - test/util/data/txcreatescript1.json \ - test/util/data/txcreatescript2.hex \ - test/util/data/txcreatescript2.json \ - test/util/data/txcreatescript5.hex \ - test/util/data/txcreatescript6.hex \ - test/util/data/txcreatesignv1.hex \ - test/util/data/txcreatesignv1.json \ - test/util/data/txcreatesignv2.hex \ - test/util/rpcauth-test.py - -CLEANFILES = $(OSX_ZIP) $(BITCOIN_WIN_INSTALLER) - -DISTCHECK_CONFIGURE_FLAGS = --enable-man - -doc/doxygen/.stamp: doc/Doxyfile FORCE - $(MKDIR_P) $(@D) - $(DOXYGEN) $^ - $(AM_V_at) touch $@ - -if HAVE_DOXYGEN -docs: doc/doxygen/.stamp -else -docs: - @echo "error: doxygen not found" -endif - -clean-docs: - rm -rf doc/doxygen - -clean-local: clean-docs - rm -rf coverage_percent.txt test_dash.coverage/ total.coverage/ fuzz.coverage/ test/tmp/ cache/ $(OSX_APP) - rm -rf test/functional/__pycache__ test/functional/test_framework/__pycache__ test/cache share/rpcauth/__pycache__ - rm -rf dist/ diff --git a/autogen.sh b/autogen.sh deleted file mode 100755 index 69c892ffa0e7..000000000000 --- a/autogen.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# Copyright (c) 2013-2019 The Bitcoin Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. - -export LC_ALL=C -set -e -srcdir="$(dirname "$0")" -cd "$srcdir" -if [ -z "${LIBTOOLIZE}" ] && GLIBTOOLIZE="$(command -v glibtoolize)"; then - LIBTOOLIZE="${GLIBTOOLIZE}" - export LIBTOOLIZE -fi -command -v autoreconf >/dev/null || \ - (echo "configuration failed, please install autoconf first" && exit 1) -autoreconf --install --force --warnings=all - -if expr "'$(build-aux/config.guess --timestamp)" \< "'$(depends/config.guess --timestamp)" > /dev/null; then - chmod ug+w build-aux/config.guess - chmod ug+w src/secp256k1/build-aux/config.guess - cp depends/config.guess build-aux - cp depends/config.guess src/secp256k1/build-aux -fi -if expr "'$(build-aux/config.sub --timestamp)" \< "'$(depends/config.sub --timestamp)" > /dev/null; then - chmod ug+w build-aux/config.sub - chmod ug+w src/secp256k1/build-aux/config.sub - cp depends/config.sub build-aux - cp depends/config.sub src/secp256k1/build-aux -fi diff --git a/build-aux/m4/ax_boost_base.m4 b/build-aux/m4/ax_boost_base.m4 deleted file mode 100644 index f6620882a21e..000000000000 --- a/build-aux/m4/ax_boost_base.m4 +++ /dev/null @@ -1,256 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_boost_base.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_BOOST_BASE([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# -# DESCRIPTION -# -# Test for the Boost C++ headers of a particular version (or newer) -# -# If no path to the installed boost library is given the macro searchs -# under /usr, /usr/local, /opt, /opt/local and /opt/homebrew and evaluates -# the $BOOST_ROOT environment variable. Further documentation is available -# at . -# -# This macro calls: -# -# AC_SUBST(BOOST_CPPFLAGS) -# -# And sets: -# -# HAVE_BOOST -# -# Note that this macro has been modified compared to upstream. -# -# LICENSE -# -# Copyright (c) 2008 Thomas Porschberg -# Copyright (c) 2009 Peter Adolphs -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 51 - -# example boost program (need to pass version) -m4_define([_AX_BOOST_BASE_PROGRAM], - [AC_LANG_PROGRAM([[ -#include -]],[[ -(void) ((void)sizeof(char[1 - 2*!!((BOOST_VERSION) < ($1))])); -]])]) - -AC_DEFUN([AX_BOOST_BASE], -[ -AC_ARG_WITH([boost], - [AS_HELP_STRING([--with-boost@<:@=ARG@:>@], - [use Boost library from a standard location (ARG=yes), - from the specified location (ARG=), - or disable it (ARG=no) - @<:@ARG=yes@:>@ ])], - [ - AS_CASE([$withval], - [no],[want_boost="no";_AX_BOOST_BASE_boost_path=""], - [yes],[want_boost="yes";_AX_BOOST_BASE_boost_path=""], - [want_boost="yes";_AX_BOOST_BASE_boost_path="$withval"]) - ], - [want_boost="yes"]) - -BOOST_CPPFLAGS="" -AS_IF([test "x$want_boost" = "xyes"], - [_AX_BOOST_BASE_RUNDETECT([$1],[$2],[$3])]) -AC_SUBST(BOOST_CPPFLAGS) -]) - - -# convert a version string in $2 to numeric and affect to polymorphic var $1 -AC_DEFUN([_AX_BOOST_BASE_TONUMERICVERSION],[ - AS_IF([test "x$2" = "x"],[_AX_BOOST_BASE_TONUMERICVERSION_req="1.20.0"],[_AX_BOOST_BASE_TONUMERICVERSION_req="$2"]) - _AX_BOOST_BASE_TONUMERICVERSION_req_shorten=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '\([[0-9]]*\.[[0-9]]*\)'` - _AX_BOOST_BASE_TONUMERICVERSION_req_major=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '\([[0-9]]*\)'` - AS_IF([test "x$_AX_BOOST_BASE_TONUMERICVERSION_req_major" = "x"], - [AC_MSG_ERROR([You should at least specify libboost major version])]) - _AX_BOOST_BASE_TONUMERICVERSION_req_minor=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '[[0-9]]*\.\([[0-9]]*\)'` - AS_IF([test "x$_AX_BOOST_BASE_TONUMERICVERSION_req_minor" = "x"], - [_AX_BOOST_BASE_TONUMERICVERSION_req_minor="0"]) - _AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` - AS_IF([test "X$_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor" = "X"], - [_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor="0"]) - _AX_BOOST_BASE_TONUMERICVERSION_RET=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req_major \* 100000 \+ $_AX_BOOST_BASE_TONUMERICVERSION_req_minor \* 100 \+ $_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor` - AS_VAR_SET($1,$_AX_BOOST_BASE_TONUMERICVERSION_RET) -]) - -dnl Run the detection of boost should be run only if $want_boost -AC_DEFUN([_AX_BOOST_BASE_RUNDETECT],[ - _AX_BOOST_BASE_TONUMERICVERSION(WANT_BOOST_VERSION,[$1]) - succeeded=no - - - AC_REQUIRE([AC_CANONICAL_HOST]) - dnl On 64-bit systems check for system libraries in both lib64 and lib. - dnl The former is specified by FHS, but e.g. Debian does not adhere to - dnl this (as it rises problems for generic multi-arch support). - dnl The last entry in the list is chosen by default when no libraries - dnl are found, e.g. when only header-only libraries are installed! - AS_CASE([${host_cpu}], - [x86_64],[libsubdirs="lib64 libx32 lib lib64"], - [mips*64*],[libsubdirs="lib64 lib32 lib lib64"], - [ppc64|powerpc64|s390x|sparc64|aarch64|ppc64le|powerpc64le|riscv64|e2k],[libsubdirs="lib64 lib lib64"], - [libsubdirs="lib"] - ) - - dnl allow for real multi-arch paths e.g. /usr/lib/x86_64-linux-gnu. Give - dnl them priority over the other paths since, if libs are found there, they - dnl are almost assuredly the ones desired. - AS_CASE([${host_cpu}], - [i?86],[multiarch_libsubdir="lib/i386-${host_os}"], - [armv7l],[multiarch_libsubdir="lib/arm-${host_os}"], - [multiarch_libsubdir="lib/${host_cpu}-${host_os}"] - ) - - dnl first we check the system location for boost libraries - dnl this location is chosen if boost libraries are installed with the --layout=system option - dnl or if you install boost with RPM - AS_IF([test "x$_AX_BOOST_BASE_boost_path" != "x"],[ - AC_MSG_CHECKING([for boostlib >= $1 ($WANT_BOOST_VERSION) includes in "$_AX_BOOST_BASE_boost_path/include"]) - AS_IF([test -d "$_AX_BOOST_BASE_boost_path/include" && test -r "$_AX_BOOST_BASE_boost_path/include"],[ - AC_MSG_RESULT([yes]) - BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path/include" - for _AX_BOOST_BASE_boost_path_tmp in $multiarch_libsubdir $libsubdirs; do - AC_MSG_CHECKING([for boostlib >= $1 ($WANT_BOOST_VERSION) lib path in "$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp"]) - AS_IF([test -d "$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp" && test -r "$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp" ],[ - AC_MSG_RESULT([yes]) - break; - ], - [AC_MSG_RESULT([no])]) - done],[ - AC_MSG_RESULT([no])]) - ],[ - if test X"$cross_compiling" = Xyes; then - search_libsubdirs=$multiarch_libsubdir - else - search_libsubdirs="$multiarch_libsubdir $libsubdirs" - fi - for _AX_BOOST_BASE_boost_path_tmp in /usr /usr/local /opt /opt/local /opt/homebrew ; do - if test -d "$_AX_BOOST_BASE_boost_path_tmp/include/boost" && test -r "$_AX_BOOST_BASE_boost_path_tmp/include/boost" ; then - for libsubdir in $search_libsubdirs ; do - if ls "$_AX_BOOST_BASE_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi - done - BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path_tmp/include" - break; - fi - done - ]) - - AC_MSG_CHECKING([for Boost headers >= $1 ($WANT_BOOST_VERSION)]) - CPPFLAGS_SAVED="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" - export CPPFLAGS - - AC_REQUIRE([AC_PROG_CXX]) - AC_LANG_PUSH(C++) - AC_COMPILE_IFELSE([_AX_BOOST_BASE_PROGRAM($WANT_BOOST_VERSION)],[ - AC_MSG_RESULT(yes) - succeeded=yes - found_system=yes - ],[ - ]) - AC_LANG_POP([C++]) - - - - dnl if we found no boost with system layout we search for boost libraries - dnl built and installed without the --layout=system option or for a staged(not installed) version - if test "x$succeeded" != "xyes" ; then - CPPFLAGS="$CPPFLAGS_SAVED" - BOOST_CPPFLAGS= - - _version=0 - if test -n "$_AX_BOOST_BASE_boost_path" ; then - if test -d "$_AX_BOOST_BASE_boost_path" && test -r "$_AX_BOOST_BASE_boost_path"; then - for i in `ls -d $_AX_BOOST_BASE_boost_path/include/boost-* 2>/dev/null`; do - _version_tmp=`echo $i | sed "s#$_AX_BOOST_BASE_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'` - V_CHECK=`expr $_version_tmp \> $_version` - if test "x$V_CHECK" = "x1" ; then - _version=$_version_tmp - fi - VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` - BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path/include/boost-$VERSION_UNDERSCORE" - done - dnl if nothing found search for layout used in Windows distributions - if test -z "$BOOST_CPPFLAGS"; then - if test -d "$_AX_BOOST_BASE_boost_path/boost" && test -r "$_AX_BOOST_BASE_boost_path/boost"; then - BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path" - fi - fi - fi - else - if test "x$cross_compiling" != "xyes" ; then - for _AX_BOOST_BASE_boost_path in /usr /usr/local /opt /opt/local /opt/homebrew ; do - if test -d "$_AX_BOOST_BASE_boost_path" && test -r "$_AX_BOOST_BASE_boost_path" ; then - for i in `ls -d $_AX_BOOST_BASE_boost_path/include/boost-* 2>/dev/null`; do - _version_tmp=`echo $i | sed "s#$_AX_BOOST_BASE_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'` - V_CHECK=`expr $_version_tmp \> $_version` - if test "x$V_CHECK" = "x1" ; then - _version=$_version_tmp - best_path=$_AX_BOOST_BASE_boost_path - fi - done - fi - done - - VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` - BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE" - fi - - if test -n "$BOOST_ROOT" ; then - for libsubdir in $libsubdirs ; do - if ls "$BOOST_ROOT/stage/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi - done - if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/$libsubdir" && test -r "$BOOST_ROOT/stage/$libsubdir"; then - version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'` - stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'` - stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'` - V_CHECK=`expr $stage_version_shorten \>\= $_version` - if test "x$V_CHECK" = "x1" ; then - AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT) - BOOST_CPPFLAGS="-I$BOOST_ROOT" - fi - fi - fi - fi - - CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" - export CPPFLAGS - - AC_LANG_PUSH(C++) - AC_COMPILE_IFELSE([_AX_BOOST_BASE_PROGRAM($WANT_BOOST_VERSION)],[ - AC_MSG_RESULT(yes) - succeeded=yes - found_system=yes - ],[ - ]) - AC_LANG_POP([C++]) - fi - - if test "x$succeeded" != "xyes" ; then - if test "x$_version" = "x0" ; then - AC_MSG_NOTICE([[We could not detect the boost libraries (version $1 or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in . See http://randspringer.de/boost for more documentation.]]) - else - AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).]) - fi - # execute ACTION-IF-NOT-FOUND (if present): - ifelse([$3], , :, [$3]) - else - AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available]) - # execute ACTION-IF-FOUND (if present): - ifelse([$2], , :, [$2]) - fi - - CPPFLAGS="$CPPFLAGS_SAVED" -]) diff --git a/build-aux/m4/ax_check_compile_flag.m4 b/build-aux/m4/ax_check_compile_flag.m4 deleted file mode 100644 index bd753b34d7dc..000000000000 --- a/build-aux/m4/ax_check_compile_flag.m4 +++ /dev/null @@ -1,53 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) -# -# DESCRIPTION -# -# Check whether the given FLAG works with the current language's compiler -# or gives an error. (Warnings, however, are ignored) -# -# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on -# success/failure. -# -# If EXTRA-FLAGS is defined, it is added to the current language's default -# flags (e.g. CFLAGS) when the check is done. The check is thus made with -# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to -# force the compiler to issue an error when a bad flag is given. -# -# INPUT gives an alternative input source to AC_COMPILE_IFELSE. -# -# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this -# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. -# -# LICENSE -# -# Copyright (c) 2008 Guido U. Draheim -# Copyright (c) 2011 Maarten Bosmans -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 6 - -AC_DEFUN([AX_CHECK_COMPILE_FLAG], -[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF -AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl -AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ - ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS - _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" - AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], - [AS_VAR_SET(CACHEVAR,[yes])], - [AS_VAR_SET(CACHEVAR,[no])]) - _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) -AS_VAR_IF(CACHEVAR,yes, - [m4_default([$2], :)], - [m4_default([$3], :)]) -AS_VAR_POPDEF([CACHEVAR])dnl -])dnl AX_CHECK_COMPILE_FLAGS diff --git a/build-aux/m4/ax_check_link_flag.m4 b/build-aux/m4/ax_check_link_flag.m4 deleted file mode 100644 index 03a30ce4c739..000000000000 --- a/build-aux/m4/ax_check_link_flag.m4 +++ /dev/null @@ -1,53 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) -# -# DESCRIPTION -# -# Check whether the given FLAG works with the linker or gives an error. -# (Warnings, however, are ignored) -# -# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on -# success/failure. -# -# If EXTRA-FLAGS is defined, it is added to the linker's default flags -# when the check is done. The check is thus made with the flags: "LDFLAGS -# EXTRA-FLAGS FLAG". This can for example be used to force the linker to -# issue an error when a bad flag is given. -# -# INPUT gives an alternative input source to AC_LINK_IFELSE. -# -# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this -# macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG. -# -# LICENSE -# -# Copyright (c) 2008 Guido U. Draheim -# Copyright (c) 2011 Maarten Bosmans -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 6 - -AC_DEFUN([AX_CHECK_LINK_FLAG], -[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF -AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl -AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [ - ax_check_save_flags=$LDFLAGS - LDFLAGS="$LDFLAGS $4 $1" - AC_LINK_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], - [AS_VAR_SET(CACHEVAR,[yes])], - [AS_VAR_SET(CACHEVAR,[no])]) - LDFLAGS=$ax_check_save_flags]) -AS_VAR_IF(CACHEVAR,yes, - [m4_default([$2], :)], - [m4_default([$3], :)]) -AS_VAR_POPDEF([CACHEVAR])dnl -])dnl AX_CHECK_LINK_FLAGS diff --git a/build-aux/m4/ax_check_preproc_flag.m4 b/build-aux/m4/ax_check_preproc_flag.m4 deleted file mode 100644 index e43560fbd3b6..000000000000 --- a/build-aux/m4/ax_check_preproc_flag.m4 +++ /dev/null @@ -1,53 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_check_preproc_flag.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CHECK_PREPROC_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) -# -# DESCRIPTION -# -# Check whether the given FLAG works with the current language's -# preprocessor or gives an error. (Warnings, however, are ignored) -# -# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on -# success/failure. -# -# If EXTRA-FLAGS is defined, it is added to the preprocessor's default -# flags when the check is done. The check is thus made with the flags: -# "CPPFLAGS EXTRA-FLAGS FLAG". This can for example be used to force the -# preprocessor to issue an error when a bad flag is given. -# -# INPUT gives an alternative input source to AC_PREPROC_IFELSE. -# -# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this -# macro in sync with AX_CHECK_{COMPILE,LINK}_FLAG. -# -# LICENSE -# -# Copyright (c) 2008 Guido U. Draheim -# Copyright (c) 2011 Maarten Bosmans -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 6 - -AC_DEFUN([AX_CHECK_PREPROC_FLAG], -[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF -AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]cppflags_$4_$1])dnl -AC_CACHE_CHECK([whether _AC_LANG preprocessor accepts $1], CACHEVAR, [ - ax_check_save_flags=$CPPFLAGS - CPPFLAGS="$CPPFLAGS $4 $1" - AC_PREPROC_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], - [AS_VAR_SET(CACHEVAR,[yes])], - [AS_VAR_SET(CACHEVAR,[no])]) - CPPFLAGS=$ax_check_save_flags]) -AS_VAR_IF(CACHEVAR,yes, - [m4_default([$2], :)], - [m4_default([$3], :)]) -AS_VAR_POPDEF([CACHEVAR])dnl -])dnl AX_CHECK_PREPROC_FLAGS diff --git a/build-aux/m4/ax_cxx_compile_stdcxx.m4 b/build-aux/m4/ax_cxx_compile_stdcxx.m4 deleted file mode 100644 index 51a35054d08c..000000000000 --- a/build-aux/m4/ax_cxx_compile_stdcxx.m4 +++ /dev/null @@ -1,1005 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional]) -# -# DESCRIPTION -# -# Check for baseline language coverage in the compiler for the specified -# version of the C++ standard. If necessary, add switches to CXX and -# CXXCPP to enable support. VERSION may be '11', '14', '17', or '20' for -# the respective C++ standard version. -# -# The second argument, if specified, indicates whether you insist on an -# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. -# -std=c++11). If neither is specified, you get whatever works, with -# preference for no added switch, and then for an extended mode. -# -# The third argument, if specified 'mandatory' or if left unspecified, -# indicates that baseline support for the specified C++ standard is -# required and that the macro should error out if no mode with that -# support is found. If specified 'optional', then configuration proceeds -# regardless, after defining HAVE_CXX${VERSION} if and only if a -# supporting mode is found. -# -# LICENSE -# -# Copyright (c) 2008 Benjamin Kosnik -# Copyright (c) 2012 Zack Weinberg -# Copyright (c) 2013 Roy Stogner -# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov -# Copyright (c) 2015 Paul Norman -# Copyright (c) 2015 Moritz Klammler -# Copyright (c) 2016, 2018 Krzesimir Nowak -# Copyright (c) 2019 Enji Cooper -# Copyright (c) 2020 Jason Merrill -# Copyright (c) 2021 Jörn Heusipp -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 14 - -dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro -dnl (serial version number 13). - -AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl - m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"], - [$1], [14], [ax_cxx_compile_alternatives="14 1y"], - [$1], [17], [ax_cxx_compile_alternatives="17 1z"], - [$1], [20], [ax_cxx_compile_alternatives="20"], - [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl - m4_if([$2], [], [], - [$2], [ext], [], - [$2], [noext], [], - [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl - m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true], - [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true], - [$3], [optional], [ax_cxx_compile_cxx$1_required=false], - [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])]) - AC_LANG_PUSH([C++])dnl - ac_success=no - - m4_if([$2], [], [dnl - AC_CACHE_CHECK(whether $CXX supports C++$1 features by default, - ax_cv_cxx_compile_cxx$1, - [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [ax_cv_cxx_compile_cxx$1=yes], - [ax_cv_cxx_compile_cxx$1=no])]) - if test x$ax_cv_cxx_compile_cxx$1 = xyes; then - ac_success=yes - fi]) - - m4_if([$2], [noext], [], [dnl - if test x$ac_success = xno; then - for alternative in ${ax_cxx_compile_alternatives}; do - switch="-std=gnu++${alternative}" - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) - AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, - $cachevar, - [ac_save_CXX="$CXX" - CXX="$CXX $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [eval $cachevar=yes], - [eval $cachevar=no]) - CXX="$ac_save_CXX"]) - if eval test x\$$cachevar = xyes; then - CXX="$CXX $switch" - if test -n "$CXXCPP" ; then - CXXCPP="$CXXCPP $switch" - fi - ac_success=yes - break - fi - done - fi]) - - m4_if([$2], [ext], [], [dnl - if test x$ac_success = xno; then - dnl HP's aCC needs +std=c++11 according to: - dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf - dnl Cray's crayCC needs "-h std=c++11" - for alternative in ${ax_cxx_compile_alternatives}; do - for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) - AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, - $cachevar, - [ac_save_CXX="$CXX" - CXX="$CXX $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [eval $cachevar=yes], - [eval $cachevar=no]) - CXX="$ac_save_CXX"]) - if eval test x\$$cachevar = xyes; then - CXX="$CXX $switch" - if test -n "$CXXCPP" ; then - CXXCPP="$CXXCPP $switch" - fi - ac_success=yes - break - fi - done - if test x$ac_success = xyes; then - break - fi - done - fi]) - AC_LANG_POP([C++]) - if test x$ax_cxx_compile_cxx$1_required = xtrue; then - if test x$ac_success = xno; then - AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.]) - fi - fi - if test x$ac_success = xno; then - HAVE_CXX$1=0 - AC_MSG_NOTICE([No compiler with C++$1 support was found]) - else - HAVE_CXX$1=1 - AC_DEFINE(HAVE_CXX$1,1, - [define if the compiler supports basic C++$1 syntax]) - fi - AC_SUBST(HAVE_CXX$1) -]) - - -dnl Test body for checking C++11 support - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 -) - -dnl Test body for checking C++14 support - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 -) - -dnl Test body for checking C++17 support - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 -) - -dnl Test body for checking C++20 support - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_20], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_20 -) - - -dnl Tests for new features in C++11 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ - -// If the compiler admits that it is not ready for C++11, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 201103L - -#error "This is not a C++11 compiler" - -#else - -namespace cxx11 -{ - - namespace test_static_assert - { - - template - struct check - { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); - }; - - } - - namespace test_final_override - { - - struct Base - { - virtual ~Base() {} - virtual void f() {} - }; - - struct Derived : public Base - { - virtual ~Derived() override {} - virtual void f() override {} - }; - - } - - namespace test_double_right_angle_brackets - { - - template < typename T > - struct check {}; - - typedef check single_type; - typedef check> double_type; - typedef check>> triple_type; - typedef check>>> quadruple_type; - - } - - namespace test_decltype - { - - int - f() - { - int a = 1; - decltype(a) b = 2; - return a + b; - } - - } - - namespace test_type_deduction - { - - template < typename T1, typename T2 > - struct is_same - { - static const bool value = false; - }; - - template < typename T > - struct is_same - { - static const bool value = true; - }; - - template < typename T1, typename T2 > - auto - add(T1 a1, T2 a2) -> decltype(a1 + a2) - { - return a1 + a2; - } - - int - test(const int c, volatile int v) - { - static_assert(is_same::value == true, ""); - static_assert(is_same::value == false, ""); - static_assert(is_same::value == false, ""); - auto ac = c; - auto av = v; - auto sumi = ac + av + 'x'; - auto sumf = ac + av + 1.0; - static_assert(is_same::value == true, ""); - static_assert(is_same::value == true, ""); - static_assert(is_same::value == true, ""); - static_assert(is_same::value == false, ""); - static_assert(is_same::value == true, ""); - return (sumf > 0.0) ? sumi : add(c, v); - } - - } - - namespace test_noexcept - { - - int f() { return 0; } - int g() noexcept { return 0; } - - static_assert(noexcept(f()) == false, ""); - static_assert(noexcept(g()) == true, ""); - - } - - namespace test_constexpr - { - - template < typename CharT > - unsigned long constexpr - strlen_c_r(const CharT *const s, const unsigned long acc) noexcept - { - return *s ? strlen_c_r(s + 1, acc + 1) : acc; - } - - template < typename CharT > - unsigned long constexpr - strlen_c(const CharT *const s) noexcept - { - return strlen_c_r(s, 0UL); - } - - static_assert(strlen_c("") == 0UL, ""); - static_assert(strlen_c("1") == 1UL, ""); - static_assert(strlen_c("example") == 7UL, ""); - static_assert(strlen_c("another\0example") == 7UL, ""); - - } - - namespace test_rvalue_references - { - - template < int N > - struct answer - { - static constexpr int value = N; - }; - - answer<1> f(int&) { return answer<1>(); } - answer<2> f(const int&) { return answer<2>(); } - answer<3> f(int&&) { return answer<3>(); } - - void - test() - { - int i = 0; - const int c = 0; - static_assert(decltype(f(i))::value == 1, ""); - static_assert(decltype(f(c))::value == 2, ""); - static_assert(decltype(f(0))::value == 3, ""); - } - - } - - namespace test_uniform_initialization - { - - struct test - { - static const int zero {}; - static const int one {1}; - }; - - static_assert(test::zero == 0, ""); - static_assert(test::one == 1, ""); - - } - - namespace test_lambdas - { - - void - test1() - { - auto lambda1 = [](){}; - auto lambda2 = lambda1; - lambda1(); - lambda2(); - } - - int - test2() - { - auto a = [](int i, int j){ return i + j; }(1, 2); - auto b = []() -> int { return '0'; }(); - auto c = [=](){ return a + b; }(); - auto d = [&](){ return c; }(); - auto e = [a, &b](int x) mutable { - const auto identity = [](int y){ return y; }; - for (auto i = 0; i < a; ++i) - a += b--; - return x + identity(a + b); - }(0); - return a + b + c + d + e; - } - - int - test3() - { - const auto nullary = [](){ return 0; }; - const auto unary = [](int x){ return x; }; - using nullary_t = decltype(nullary); - using unary_t = decltype(unary); - const auto higher1st = [](nullary_t f){ return f(); }; - const auto higher2nd = [unary](nullary_t f1){ - return [unary, f1](unary_t f2){ return f2(unary(f1())); }; - }; - return higher1st(nullary) + higher2nd(nullary)(unary); - } - - } - - namespace test_variadic_templates - { - - template - struct sum; - - template - struct sum - { - static constexpr auto value = N0 + sum::value; - }; - - template <> - struct sum<> - { - static constexpr auto value = 0; - }; - - static_assert(sum<>::value == 0, ""); - static_assert(sum<1>::value == 1, ""); - static_assert(sum<23>::value == 23, ""); - static_assert(sum<1, 2>::value == 3, ""); - static_assert(sum<5, 5, 11>::value == 21, ""); - static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); - - } - - // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae - // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function - // because of this. - namespace test_template_alias_sfinae - { - - struct foo {}; - - template - using member = typename T::member_type; - - template - void func(...) {} - - template - void func(member*) {} - - void test(); - - void test() { func(0); } - - } - -} // namespace cxx11 - -#endif // __cplusplus >= 201103L - -]]) - - -dnl Tests for new features in C++14 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[ - -// If the compiler admits that it is not ready for C++14, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 201402L - -#error "This is not a C++14 compiler" - -#else - -namespace cxx14 -{ - - namespace test_polymorphic_lambdas - { - - int - test() - { - const auto lambda = [](auto&&... args){ - const auto istiny = [](auto x){ - return (sizeof(x) == 1UL) ? 1 : 0; - }; - const int aretiny[] = { istiny(args)... }; - return aretiny[0]; - }; - return lambda(1, 1L, 1.0f, '1'); - } - - } - - namespace test_binary_literals - { - - constexpr auto ivii = 0b0000000000101010; - static_assert(ivii == 42, "wrong value"); - - } - - namespace test_generalized_constexpr - { - - template < typename CharT > - constexpr unsigned long - strlen_c(const CharT *const s) noexcept - { - auto length = 0UL; - for (auto p = s; *p; ++p) - ++length; - return length; - } - - static_assert(strlen_c("") == 0UL, ""); - static_assert(strlen_c("x") == 1UL, ""); - static_assert(strlen_c("test") == 4UL, ""); - static_assert(strlen_c("another\0test") == 7UL, ""); - - } - - namespace test_lambda_init_capture - { - - int - test() - { - auto x = 0; - const auto lambda1 = [a = x](int b){ return a + b; }; - const auto lambda2 = [a = lambda1(x)](){ return a; }; - return lambda2(); - } - - } - - namespace test_digit_separators - { - - constexpr auto ten_million = 100'000'000; - static_assert(ten_million == 100000000, ""); - - } - - namespace test_return_type_deduction - { - - auto f(int& x) { return x; } - decltype(auto) g(int& x) { return x; } - - template < typename T1, typename T2 > - struct is_same - { - static constexpr auto value = false; - }; - - template < typename T > - struct is_same - { - static constexpr auto value = true; - }; - - int - test() - { - auto x = 0; - static_assert(is_same::value, ""); - static_assert(is_same::value, ""); - return x; - } - - } - -} // namespace cxx14 - -#endif // __cplusplus >= 201402L - -]]) - - -dnl Tests for new features in C++17 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[ - -// If the compiler admits that it is not ready for C++17, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 201703L - -#error "This is not a C++17 compiler" - -#else - -#include -#include -#include - -namespace cxx17 -{ - - namespace test_constexpr_lambdas - { - - constexpr int foo = [](){return 42;}(); - - } - - namespace test::nested_namespace::definitions - { - - } - - namespace test_fold_expression - { - - template - int multiply(Args... args) - { - return (args * ... * 1); - } - - template - bool all(Args... args) - { - return (args && ...); - } - - } - - namespace test_extended_static_assert - { - - static_assert (true); - - } - - namespace test_auto_brace_init_list - { - - auto foo = {5}; - auto bar {5}; - - static_assert(std::is_same, decltype(foo)>::value); - static_assert(std::is_same::value); - } - - namespace test_typename_in_template_template_parameter - { - - template typename X> struct D; - - } - - namespace test_fallthrough_nodiscard_maybe_unused_attributes - { - - int f1() - { - return 42; - } - - [[nodiscard]] int f2() - { - [[maybe_unused]] auto unused = f1(); - - switch (f1()) - { - case 17: - f1(); - [[fallthrough]]; - case 42: - f1(); - } - return f1(); - } - - } - - namespace test_extended_aggregate_initialization - { - - struct base1 - { - int b1, b2 = 42; - }; - - struct base2 - { - base2() { - b3 = 42; - } - int b3; - }; - - struct derived : base1, base2 - { - int d; - }; - - derived d1 {{1, 2}, {}, 4}; // full initialization - derived d2 {{}, {}, 4}; // value-initialized bases - - } - - namespace test_general_range_based_for_loop - { - - struct iter - { - int i; - - int& operator* () - { - return i; - } - - const int& operator* () const - { - return i; - } - - iter& operator++() - { - ++i; - return *this; - } - }; - - struct sentinel - { - int i; - }; - - bool operator== (const iter& i, const sentinel& s) - { - return i.i == s.i; - } - - bool operator!= (const iter& i, const sentinel& s) - { - return !(i == s); - } - - struct range - { - iter begin() const - { - return {0}; - } - - sentinel end() const - { - return {5}; - } - }; - - void f() - { - range r {}; - - for (auto i : r) - { - [[maybe_unused]] auto v = i; - } - } - - } - - namespace test_lambda_capture_asterisk_this_by_value - { - - struct t - { - int i; - int foo() - { - return [*this]() - { - return i; - }(); - } - }; - - } - - namespace test_enum_class_construction - { - - enum class byte : unsigned char - {}; - - byte foo {42}; - - } - - namespace test_constexpr_if - { - - template - int f () - { - if constexpr(cond) - { - return 13; - } - else - { - return 42; - } - } - - } - - namespace test_selection_statement_with_initializer - { - - int f() - { - return 13; - } - - int f2() - { - if (auto i = f(); i > 0) - { - return 3; - } - - switch (auto i = f(); i + 4) - { - case 17: - return 2; - - default: - return 1; - } - } - - } - - namespace test_template_argument_deduction_for_class_templates - { - - template - struct pair - { - pair (T1 p1, T2 p2) - : m1 {p1}, - m2 {p2} - {} - - T1 m1; - T2 m2; - }; - - void f() - { - [[maybe_unused]] auto p = pair{13, 42u}; - } - - } - - namespace test_non_type_auto_template_parameters - { - - template - struct B - {}; - - B<5> b1; - B<'a'> b2; - - } - - namespace test_structured_bindings - { - - int arr[2] = { 1, 2 }; - std::pair pr = { 1, 2 }; - - auto f1() -> int(&)[2] - { - return arr; - } - - auto f2() -> std::pair& - { - return pr; - } - - struct S - { - int x1 : 2; - volatile double y1; - }; - - S f3() - { - return {}; - } - - auto [ x1, y1 ] = f1(); - auto& [ xr1, yr1 ] = f1(); - auto [ x2, y2 ] = f2(); - auto& [ xr2, yr2 ] = f2(); - const auto [ x3, y3 ] = f3(); - - } - - namespace test_exception_spec_type_system - { - - struct Good {}; - struct Bad {}; - - void g1() noexcept; - void g2(); - - template - Bad - f(T*, T*); - - template - Good - f(T1*, T2*); - - static_assert (std::is_same_v); - - } - - namespace test_inline_variables - { - - template void f(T) - {} - - template inline T g(T) - { - return T{}; - } - - template<> inline void f<>(int) - {} - - template<> int g<>(int) - { - return 5; - } - - } - -} // namespace cxx17 - -#endif // __cplusplus < 201703L - -]]) - - -dnl Tests for new features in C++20 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_20], [[ - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 202002L - -#error "This is not a C++20 compiler" - -#else - -#include - -namespace cxx20 -{ - -// As C++20 supports feature test macros in the standard, there is no -// immediate need to actually test for feature availability on the -// Autoconf side. - -} // namespace cxx20 - -#endif // __cplusplus < 202002L - -]]) diff --git a/build-aux/m4/ax_pthread.m4 b/build-aux/m4/ax_pthread.m4 deleted file mode 100644 index 9f35d139149f..000000000000 --- a/build-aux/m4/ax_pthread.m4 +++ /dev/null @@ -1,522 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_pthread.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) -# -# DESCRIPTION -# -# This macro figures out how to build C programs using POSIX threads. It -# sets the PTHREAD_LIBS output variable to the threads library and linker -# flags, and the PTHREAD_CFLAGS output variable to any special C compiler -# flags that are needed. (The user can also force certain compiler -# flags/libs to be tested by setting these environment variables.) -# -# Also sets PTHREAD_CC and PTHREAD_CXX to any special C compiler that is -# needed for multi-threaded programs (defaults to the value of CC -# respectively CXX otherwise). (This is necessary on e.g. AIX to use the -# special cc_r/CC_r compiler alias.) -# -# NOTE: You are assumed to not only compile your program with these flags, -# but also to link with them as well. For example, you might link with -# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS -# $PTHREAD_CXX $CXXFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS -# -# If you are only building threaded programs, you may wish to use these -# variables in your default LIBS, CFLAGS, and CC: -# -# LIBS="$PTHREAD_LIBS $LIBS" -# CFLAGS="$CFLAGS $PTHREAD_CFLAGS" -# CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" -# CC="$PTHREAD_CC" -# CXX="$PTHREAD_CXX" -# -# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant -# has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to -# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). -# -# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the -# PTHREAD_PRIO_INHERIT symbol is defined when compiling with -# PTHREAD_CFLAGS. -# -# ACTION-IF-FOUND is a list of shell commands to run if a threads library -# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it -# is not found. If ACTION-IF-FOUND is not specified, the default action -# will define HAVE_PTHREAD. -# -# Please let the authors know if this macro fails on any platform, or if -# you have any other suggestions or comments. This macro was based on work -# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help -# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by -# Alejandro Forero Cuervo to the autoconf macro repository. We are also -# grateful for the helpful feedback of numerous users. -# -# Updated for Autoconf 2.68 by Daniel Richard G. -# -# LICENSE -# -# Copyright (c) 2008 Steven G. Johnson -# Copyright (c) 2011 Daniel Richard G. -# Copyright (c) 2019 Marc Stevens -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation, either version 3 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 31 - -AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) -AC_DEFUN([AX_PTHREAD], [ -AC_REQUIRE([AC_CANONICAL_HOST]) -AC_REQUIRE([AC_PROG_CC]) -AC_REQUIRE([AC_PROG_SED]) -AC_LANG_PUSH([C]) -ax_pthread_ok=no - -# We used to check for pthread.h first, but this fails if pthread.h -# requires special compiler flags (e.g. on Tru64 or Sequent). -# It gets checked for in the link test anyway. - -# First of all, check if the user has set any of the PTHREAD_LIBS, -# etcetera environment variables, and if threads linking works using -# them: -if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then - ax_pthread_save_CC="$CC" - ax_pthread_save_CFLAGS="$CFLAGS" - ax_pthread_save_LIBS="$LIBS" - AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"]) - AS_IF([test "x$PTHREAD_CXX" != "x"], [CXX="$PTHREAD_CXX"]) - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS]) - AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes]) - AC_MSG_RESULT([$ax_pthread_ok]) - if test "x$ax_pthread_ok" = "xno"; then - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" - fi - CC="$ax_pthread_save_CC" - CFLAGS="$ax_pthread_save_CFLAGS" - LIBS="$ax_pthread_save_LIBS" -fi - -# We must check for the threads library under a number of different -# names; the ordering is very important because some systems -# (e.g. DEC) have both -lpthread and -lpthreads, where one of the -# libraries is broken (non-POSIX). - -# Create a list of thread flags to try. Items with a "," contain both -# C compiler flags (before ",") and linker flags (after ","). Other items -# starting with a "-" are C compiler flags, and remaining items are -# library names, except for "none" which indicates that we try without -# any flags at all, and "pthread-config" which is a program returning -# the flags for the Pth emulation library. - -ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" - -# The ordering *is* (sometimes) important. Some notes on the -# individual items follow: - -# pthreads: AIX (must check this before -lpthread) -# none: in case threads are in libc; should be tried before -Kthread and -# other compiler flags to prevent continual compiler warnings -# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) -# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64 -# (Note: HP C rejects this with "bad form for `-t' option") -# -pthreads: Solaris/gcc (Note: HP C also rejects) -# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it -# doesn't hurt to check since this sometimes defines pthreads and -# -D_REENTRANT too), HP C (must be checked before -lpthread, which -# is present but should not be used directly; and before -mthreads, -# because the compiler interprets this as "-mt" + "-hreads") -# -mthreads: Mingw32/gcc, Lynx/gcc -# pthread: Linux, etcetera -# --thread-safe: KAI C++ -# pthread-config: use pthread-config program (for GNU Pth library) - -case $host_os in - - freebsd*) - - # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) - # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) - - ax_pthread_flags="-kthread lthread $ax_pthread_flags" - ;; - - hpux*) - - # From the cc(1) man page: "[-mt] Sets various -D flags to enable - # multi-threading and also sets -lpthread." - - ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags" - ;; - - openedition*) - - # IBM z/OS requires a feature-test macro to be defined in order to - # enable POSIX threads at all, so give the user a hint if this is - # not set. (We don't define these ourselves, as they can affect - # other portions of the system API in unpredictable ways.) - - AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING], - [ -# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS) - AX_PTHREAD_ZOS_MISSING -# endif - ], - [AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])]) - ;; - - solaris*) - - # On Solaris (at least, for some versions), libc contains stubbed - # (non-functional) versions of the pthreads routines, so link-based - # tests will erroneously succeed. (N.B.: The stubs are missing - # pthread_cleanup_push, or rather a function called by this macro, - # so we could check for that, but who knows whether they'll stub - # that too in a future libc.) So we'll check first for the - # standard Solaris way of linking pthreads (-mt -lpthread). - - ax_pthread_flags="-mt,-lpthread pthread $ax_pthread_flags" - ;; -esac - -# Are we compiling with Clang? - -AC_CACHE_CHECK([whether $CC is Clang], - [ax_cv_PTHREAD_CLANG], - [ax_cv_PTHREAD_CLANG=no - # Note that Autoconf sets GCC=yes for Clang as well as GCC - if test "x$GCC" = "xyes"; then - AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG], - [/* Note: Clang 2.7 lacks __clang_[a-z]+__ */ -# if defined(__clang__) && defined(__llvm__) - AX_PTHREAD_CC_IS_CLANG -# endif - ], - [ax_cv_PTHREAD_CLANG=yes]) - fi - ]) -ax_pthread_clang="$ax_cv_PTHREAD_CLANG" - - -# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC) - -# Note that for GCC and Clang -pthread generally implies -lpthread, -# except when -nostdlib is passed. -# This is problematic using libtool to build C++ shared libraries with pthread: -# [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460 -# [2] https://bugzilla.redhat.com/show_bug.cgi?id=661333 -# [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468555 -# To solve this, first try -pthread together with -lpthread for GCC - -AS_IF([test "x$GCC" = "xyes"], - [ax_pthread_flags="-pthread,-lpthread -pthread -pthreads $ax_pthread_flags"]) - -# Clang takes -pthread (never supported any other flag), but we'll try with -lpthread first - -AS_IF([test "x$ax_pthread_clang" = "xyes"], - [ax_pthread_flags="-pthread,-lpthread -pthread"]) - - -# The presence of a feature test macro requesting re-entrant function -# definitions is, on some systems, a strong hint that pthreads support is -# correctly enabled - -case $host_os in - darwin* | hpux* | linux* | osf* | solaris*) - ax_pthread_check_macro="_REENTRANT" - ;; - - aix*) - ax_pthread_check_macro="_THREAD_SAFE" - ;; - - *) - ax_pthread_check_macro="--" - ;; -esac -AS_IF([test "x$ax_pthread_check_macro" = "x--"], - [ax_pthread_check_cond=0], - [ax_pthread_check_cond="!defined($ax_pthread_check_macro)"]) - - -if test "x$ax_pthread_ok" = "xno"; then -for ax_pthread_try_flag in $ax_pthread_flags; do - - case $ax_pthread_try_flag in - none) - AC_MSG_CHECKING([whether pthreads work without any flags]) - ;; - - *,*) - PTHREAD_CFLAGS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\1/"` - PTHREAD_LIBS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\2/"` - AC_MSG_CHECKING([whether pthreads work with "$PTHREAD_CFLAGS" and "$PTHREAD_LIBS"]) - ;; - - -*) - AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag]) - PTHREAD_CFLAGS="$ax_pthread_try_flag" - ;; - - pthread-config) - AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no]) - AS_IF([test "x$ax_pthread_config" = "xno"], [continue]) - PTHREAD_CFLAGS="`pthread-config --cflags`" - PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" - ;; - - *) - AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag]) - PTHREAD_LIBS="-l$ax_pthread_try_flag" - ;; - esac - - ax_pthread_save_CFLAGS="$CFLAGS" - ax_pthread_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - - # Check for various functions. We must include pthread.h, - # since some functions may be macros. (On the Sequent, we - # need a special flag -Kthread to make this header compile.) - # We check for pthread_join because it is in -lpthread on IRIX - # while pthread_create is in libc. We check for pthread_attr_init - # due to DEC craziness with -lpthreads. We check for - # pthread_cleanup_push because it is one of the few pthread - # functions on Solaris that doesn't have a non-functional libc stub. - # We try pthread_create on general principles. - - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include -# if $ax_pthread_check_cond -# error "$ax_pthread_check_macro must be defined" -# endif - static void *some_global = NULL; - static void routine(void *a) - { - /* To avoid any unused-parameter or - unused-but-set-parameter warning. */ - some_global = a; - } - static void *start_routine(void *a) { return a; }], - [pthread_t th; pthread_attr_t attr; - pthread_create(&th, 0, start_routine, 0); - pthread_join(th, 0); - pthread_attr_init(&attr); - pthread_cleanup_push(routine, 0); - pthread_cleanup_pop(0) /* ; */])], - [ax_pthread_ok=yes], - []) - - CFLAGS="$ax_pthread_save_CFLAGS" - LIBS="$ax_pthread_save_LIBS" - - AC_MSG_RESULT([$ax_pthread_ok]) - AS_IF([test "x$ax_pthread_ok" = "xyes"], [break]) - - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" -done -fi - - -# Clang needs special handling, because older versions handle the -pthread -# option in a rather... idiosyncratic way - -if test "x$ax_pthread_clang" = "xyes"; then - - # Clang takes -pthread; it has never supported any other flag - - # (Note 1: This will need to be revisited if a system that Clang - # supports has POSIX threads in a separate library. This tends not - # to be the way of modern systems, but it's conceivable.) - - # (Note 2: On some systems, notably Darwin, -pthread is not needed - # to get POSIX threads support; the API is always present and - # active. We could reasonably leave PTHREAD_CFLAGS empty. But - # -pthread does define _REENTRANT, and while the Darwin headers - # ignore this macro, third-party headers might not.) - - # However, older versions of Clang make a point of warning the user - # that, in an invocation where only linking and no compilation is - # taking place, the -pthread option has no effect ("argument unused - # during compilation"). They expect -pthread to be passed in only - # when source code is being compiled. - # - # Problem is, this is at odds with the way Automake and most other - # C build frameworks function, which is that the same flags used in - # compilation (CFLAGS) are also used in linking. Many systems - # supported by AX_PTHREAD require exactly this for POSIX threads - # support, and in fact it is often not straightforward to specify a - # flag that is used only in the compilation phase and not in - # linking. Such a scenario is extremely rare in practice. - # - # Even though use of the -pthread flag in linking would only print - # a warning, this can be a nuisance for well-run software projects - # that build with -Werror. So if the active version of Clang has - # this misfeature, we search for an option to squash it. - - AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread], - [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG], - [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown - # Create an alternate version of $ac_link that compiles and - # links in two steps (.c -> .o, .o -> exe) instead of one - # (.c -> exe), because the warning occurs only in the second - # step - ax_pthread_save_ac_link="$ac_link" - ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g' - ax_pthread_link_step=`AS_ECHO(["$ac_link"]) | sed "$ax_pthread_sed"` - ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)" - ax_pthread_save_CFLAGS="$CFLAGS" - for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do - AS_IF([test "x$ax_pthread_try" = "xunknown"], [break]) - CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" - ac_link="$ax_pthread_save_ac_link" - AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], - [ac_link="$ax_pthread_2step_ac_link" - AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], - [break]) - ]) - done - ac_link="$ax_pthread_save_ac_link" - CFLAGS="$ax_pthread_save_CFLAGS" - AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no]) - ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" - ]) - - case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in - no | unknown) ;; - *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;; - esac - -fi # $ax_pthread_clang = yes - - - -# Various other checks: -if test "x$ax_pthread_ok" = "xyes"; then - ax_pthread_save_CFLAGS="$CFLAGS" - ax_pthread_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - - # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. - AC_CACHE_CHECK([for joinable pthread attribute], - [ax_cv_PTHREAD_JOINABLE_ATTR], - [ax_cv_PTHREAD_JOINABLE_ATTR=unknown - for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], - [int attr = $ax_pthread_attr; return attr /* ; */])], - [ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break], - []) - done - ]) - AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \ - test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \ - test "x$ax_pthread_joinable_attr_defined" != "xyes"], - [AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], - [$ax_cv_PTHREAD_JOINABLE_ATTR], - [Define to necessary symbol if this constant - uses a non-standard name on your system.]) - ax_pthread_joinable_attr_defined=yes - ]) - - AC_CACHE_CHECK([whether more special flags are required for pthreads], - [ax_cv_PTHREAD_SPECIAL_FLAGS], - [ax_cv_PTHREAD_SPECIAL_FLAGS=no - case $host_os in - solaris*) - ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" - ;; - esac - ]) - AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \ - test "x$ax_pthread_special_flags_added" != "xyes"], - [PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS" - ax_pthread_special_flags_added=yes]) - - AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], - [ax_cv_PTHREAD_PRIO_INHERIT], - [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], - [[int i = PTHREAD_PRIO_INHERIT; - return i;]])], - [ax_cv_PTHREAD_PRIO_INHERIT=yes], - [ax_cv_PTHREAD_PRIO_INHERIT=no]) - ]) - AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \ - test "x$ax_pthread_prio_inherit_defined" != "xyes"], - [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.]) - ax_pthread_prio_inherit_defined=yes - ]) - - CFLAGS="$ax_pthread_save_CFLAGS" - LIBS="$ax_pthread_save_LIBS" - - # More AIX lossage: compile with *_r variant - if test "x$GCC" != "xyes"; then - case $host_os in - aix*) - AS_CASE(["x/$CC"], - [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], - [#handle absolute path differently from PATH based program lookup - AS_CASE(["x$CC"], - [x/*], - [ - AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"]) - AS_IF([test "x${CXX}" != "x"], [AS_IF([AS_EXECUTABLE_P([${CXX}_r])],[PTHREAD_CXX="${CXX}_r"])]) - ], - [ - AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC]) - AS_IF([test "x${CXX}" != "x"], [AC_CHECK_PROGS([PTHREAD_CXX],[${CXX}_r],[$CXX])]) - ] - ) - ]) - ;; - esac - fi -fi - -test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" -test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX" - -AC_SUBST([PTHREAD_LIBS]) -AC_SUBST([PTHREAD_CFLAGS]) -AC_SUBST([PTHREAD_CC]) -AC_SUBST([PTHREAD_CXX]) - -# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -if test "x$ax_pthread_ok" = "xyes"; then - ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1]) - : -else - ax_pthread_ok=no - $2 -fi -AC_LANG_POP -])dnl AX_PTHREAD diff --git a/build-aux/m4/bitcoin_find_bdb48.m4 b/build-aux/m4/bitcoin_find_bdb48.m4 deleted file mode 100644 index 3ef7fab5b5ae..000000000000 --- a/build-aux/m4/bitcoin_find_bdb48.m4 +++ /dev/null @@ -1,97 +0,0 @@ -dnl Copyright (c) 2013-2015 The Bitcoin Core developers -dnl Distributed under the MIT software license, see the accompanying -dnl file COPYING or http://www.opensource.org/licenses/mit-license.php. - -AC_DEFUN([BITCOIN_FIND_BDB48],[ - AC_ARG_VAR([BDB_CFLAGS], [C compiler flags for BerkeleyDB, bypasses autodetection]) - AC_ARG_VAR([BDB_LIBS], [Linker flags for BerkeleyDB, bypasses autodetection]) - - if test "$use_bdb" = "no"; then - use_bdb=no - elif test "$BDB_CFLAGS" = ""; then - AC_MSG_CHECKING([for Berkeley DB C++ headers]) - BDB_CPPFLAGS= - bdbpath=X - bdb48path=X - bdbdirlist= - for _vn in 4.8 48 4 5 5.3 ''; do - for _pfx in b lib ''; do - bdbdirlist="$bdbdirlist ${_pfx}db${_vn}" - done - done - for searchpath in $bdbdirlist ''; do - test -n "${searchpath}" && searchpath="${searchpath}/" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include <${searchpath}db_cxx.h> - ]],[[ - #if !((DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 8) || DB_VERSION_MAJOR > 4) - #error "failed to find bdb 4.8+" - #endif - ]])],[ - if test "$bdbpath" = "X"; then - bdbpath="${searchpath}" - fi - ],[ - continue - ]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include <${searchpath}db_cxx.h> - ]],[[ - #if !(DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 8) - #error "failed to find bdb 4.8" - #endif - ]])],[ - bdb48path="${searchpath}" - break - ],[]) - done - if test "$bdbpath" = "X"; then - use_bdb=no - AC_MSG_RESULT([no]) - AC_MSG_WARN([libdb_cxx headers missing]) - AC_MSG_WARN(AC_PACKAGE_NAME[ requires this library for BDB (legacy) wallet support]) - AC_MSG_WARN([Passing --without-bdb will suppress this warning]) - elif test "$bdb48path" = "X"; then - BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdbpath}],db_cxx) - AC_ARG_WITH([incompatible-bdb],[AS_HELP_STRING([--with-incompatible-bdb], [allow using a bdb version other than 4.8])],[ - AC_MSG_WARN([Found Berkeley DB other than 4.8]) - AC_MSG_WARN([BDB (legacy) wallets opened by this build will not be portable!]) - use_bdb=yes - ],[ - AC_MSG_WARN([Found Berkeley DB other than 4.8]) - AC_MSG_WARN([BDB (legacy) wallets opened by this build would not be portable!]) - AC_MSG_WARN([If this is intended, pass --with-incompatible-bdb]) - AC_MSG_WARN([Passing --without-bdb will suppress this warning]) - use_bdb=no - ]) - else - BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdb48path}],db_cxx) - bdbpath="${bdb48path}" - use_bdb=yes - fi - else - BDB_CPPFLAGS=${BDB_CFLAGS} - fi - AC_SUBST(BDB_CPPFLAGS) - - if test "$use_bdb" = "no"; then - use_bdb=no - elif test "$BDB_LIBS" = ""; then - # TODO: Ideally this could find the library version and make sure it matches the headers being used - for searchlib in db_cxx-4.8 db_cxx db4_cxx; do - AC_CHECK_LIB([$searchlib],[main],[ - BDB_LIBS="-l${searchlib}" - break - ]) - done - if test "$BDB_LIBS" = ""; then - AC_MSG_WARN([libdb_cxx headers missing]) - AC_MSG_WARN(AC_PACKAGE_NAME[ requires this library for BDB (legacy) wallet support]) - AC_MSG_WARN([Passing --without-bdb will suppress this warning]) - fi - fi - if test "$use_bdb" != "no"; then - AC_DEFINE([USE_BDB], [1], [Define if BDB support should be compiled in]) - use_bdb=yes - fi -]) diff --git a/build-aux/m4/bitcoin_qt.m4 b/build-aux/m4/bitcoin_qt.m4 deleted file mode 100644 index 9c501c61d6e9..000000000000 --- a/build-aux/m4/bitcoin_qt.m4 +++ /dev/null @@ -1,389 +0,0 @@ -dnl Copyright (c) 2013-2016 The Bitcoin Core developers -dnl Distributed under the MIT software license, see the accompanying -dnl file COPYING or http://www.opensource.org/licenses/mit-license.php. - -dnl Helper for cases where a qt dependency is not met. -dnl Output: If qt version is auto, set bitcoin_enable_qt to false. Else, exit. -AC_DEFUN([BITCOIN_QT_FAIL],[ - if test "$bitcoin_qt_want_version" = "auto" && test "$bitcoin_qt_force" != "yes"; then - if test "$bitcoin_enable_qt" != "no"; then - AC_MSG_WARN([$1; dash-qt frontend will not be built]) - fi - bitcoin_enable_qt=no - bitcoin_enable_qt_test=no - else - AC_MSG_ERROR([$1]) - fi -]) - -AC_DEFUN([BITCOIN_QT_CHECK],[ - if test "$bitcoin_enable_qt" != "no" && test "$bitcoin_qt_want_version" != "no"; then - true - $1 - else - true - $2 - fi -]) - -dnl BITCOIN_QT_PATH_PROGS([FOO], [foo foo2], [/path/to/search/first], [continue if missing]) -dnl Helper for finding the path of programs needed for Qt. -dnl Inputs: $1: Variable to be set -dnl Inputs: $2: List of programs to search for -dnl Inputs: $3: Look for $2 here before $PATH -dnl Inputs: $4: If "yes", don't fail if $2 is not found. -dnl Output: $1 is set to the path of $2 if found. $2 are searched in order. -AC_DEFUN([BITCOIN_QT_PATH_PROGS],[ - BITCOIN_QT_CHECK([ - if test "$3" != ""; then - AC_PATH_PROGS([$1], [$2], [], [$3]) - else - AC_PATH_PROGS([$1], [$2]) - fi - if test "$$1" = "" && test "$4" != "yes"; then - BITCOIN_QT_FAIL([$1 not found]) - fi - ]) -]) - -dnl Initialize qt input. -dnl This must be called before any other BITCOIN_QT* macros to ensure that -dnl input variables are set correctly. -dnl CAUTION: Do not use this inside of a conditional. -AC_DEFUN([BITCOIN_QT_INIT],[ - dnl enable qt support - AC_ARG_WITH([gui], - [AS_HELP_STRING([--with-gui@<:@=no|qt5|auto@:>@], - [build dash-qt GUI (default=auto)])], - [ - bitcoin_qt_want_version=$withval - if test "$bitcoin_qt_want_version" = "yes"; then - bitcoin_qt_force=yes - bitcoin_qt_want_version=auto - fi - ], - [bitcoin_qt_want_version=auto]) - - AS_IF([test "$with_gui" = "qt5_debug"], - [AS_CASE([$host], - [*darwin*], [qt_lib_suffix=_debug], - [qt_lib_suffix= ]); bitcoin_qt_want_version=qt5], - [qt_lib_suffix= ]) - - AC_ARG_WITH([qt-incdir],[AS_HELP_STRING([--with-qt-incdir=INC_DIR],[specify qt include path (overridden by pkgconfig)])], [qt_include_path=$withval], []) - AC_ARG_WITH([qt-libdir],[AS_HELP_STRING([--with-qt-libdir=LIB_DIR],[specify qt lib path (overridden by pkgconfig)])], [qt_lib_path=$withval], []) - AC_ARG_WITH([qt-plugindir],[AS_HELP_STRING([--with-qt-plugindir=PLUGIN_DIR],[specify qt plugin path (overridden by pkgconfig)])], [qt_plugin_path=$withval], []) - AC_ARG_WITH([qt-translationdir],[AS_HELP_STRING([--with-qt-translationdir=PLUGIN_DIR],[specify qt translation path (overridden by pkgconfig)])], [qt_translation_path=$withval], []) - AC_ARG_WITH([qt-bindir],[AS_HELP_STRING([--with-qt-bindir=BIN_DIR],[specify qt bin path])], [qt_bin_path=$withval], []) - - AC_ARG_WITH([qtdbus], - [AS_HELP_STRING([--with-qtdbus], - [enable DBus support (default is yes if qt is enabled and QtDBus is found)])], - [use_dbus=$withval], - [use_dbus=auto]) - - AC_SUBST(QT_TRANSLATION_DIR,$qt_translation_path) -]) - -dnl Find Qt libraries and includes. -dnl -dnl BITCOIN_QT_CONFIGURE([MINIMUM-VERSION]) -dnl -dnl Outputs: See _BITCOIN_QT_FIND_LIBS -dnl Outputs: Sets variables for all qt-related tools. -dnl Outputs: bitcoin_enable_qt, bitcoin_enable_qt_dbus, bitcoin_enable_qt_test -AC_DEFUN([BITCOIN_QT_CONFIGURE],[ - qt_version=">= $1" - qt_lib_prefix="Qt5" - BITCOIN_QT_CHECK([_BITCOIN_QT_FIND_LIBS]) - - dnl This is ugly and complicated. Yuck. Works as follows: - dnl We check a header to find out whether Qt is built statically. - dnl When Qt is built statically, some plugins must be linked into - dnl the final binary as well. _BITCOIN_QT_CHECK_STATIC_PLUGIN does - dnl a quick link-check and appends the results to QT_LIBS. - BITCOIN_QT_CHECK([ - TEMP_CPPFLAGS=$CPPFLAGS - TEMP_CXXFLAGS=$CXXFLAGS - CPPFLAGS="$QT_INCLUDES $CORE_CPPFLAGS $CPPFLAGS" - CXXFLAGS="$PIC_FLAGS $CORE_CXXFLAGS $CXXFLAGS" - _BITCOIN_QT_IS_STATIC - if test "$bitcoin_cv_static_qt" = "yes"; then - _BITCOIN_QT_CHECK_STATIC_LIBS - - if test "$qt_plugin_path" != ""; then - if test -d "$qt_plugin_path/platforms"; then - QT_LIBS="$QT_LIBS -L$qt_plugin_path/platforms" - fi - if test -d "$qt_plugin_path/styles"; then - QT_LIBS="$QT_LIBS -L$qt_plugin_path/styles" - fi - if test -d "$qt_plugin_path/accessible"; then - QT_LIBS="$QT_LIBS -L$qt_plugin_path/accessible" - fi - fi - - _BITCOIN_QT_CHECK_STATIC_PLUGIN([QMinimalIntegrationPlugin], [-lqminimal]) - AC_DEFINE([QT_QPA_PLATFORM_MINIMAL], [1], [Define this symbol if the minimal qt platform exists]) - if test "$TARGET_OS" = "windows"; then - dnl Linking against wtsapi32 is required. See #17749 and - dnl https://bugreports.qt.io/browse/QTBUG-27097. - AX_CHECK_LINK_FLAG([-lwtsapi32], [QT_LIBS="$QT_LIBS -lwtsapi32"], [AC_MSG_ERROR([could not link against -lwtsapi32])]) - _BITCOIN_QT_CHECK_STATIC_PLUGIN([QWindowsIntegrationPlugin], [-lqwindows]) - _BITCOIN_QT_CHECK_STATIC_PLUGIN([QWindowsVistaStylePlugin], [-lqwindowsvistastyle]) - AC_DEFINE([QT_QPA_PLATFORM_WINDOWS], [1], [Define this symbol if the qt platform is windows]) - elif test "$TARGET_OS" = "linux" -o "$TARGET_OS" = "freebsd"; then - _BITCOIN_QT_CHECK_STATIC_PLUGIN([QXcbIntegrationPlugin], [-lqxcb]) - AC_DEFINE([QT_QPA_PLATFORM_XCB], [1], [Define this symbol if the qt platform is xcb]) - elif test "$TARGET_OS" = "darwin"; then - AX_CHECK_LINK_FLAG([-framework Carbon], [QT_LIBS="$QT_LIBS -framework Carbon"], [AC_MSG_ERROR(could not link against Carbon framework)]) - AX_CHECK_LINK_FLAG([-framework IOSurface], [QT_LIBS="$QT_LIBS -framework IOSurface"], [AC_MSG_ERROR(could not link against IOSurface framework)]) - AX_CHECK_LINK_FLAG([-framework Metal], [QT_LIBS="$QT_LIBS -framework Metal"], [AC_MSG_ERROR(could not link against Metal framework)]) - AX_CHECK_LINK_FLAG([-framework QuartzCore], [QT_LIBS="$QT_LIBS -framework QuartzCore"], [AC_MSG_ERROR(could not link against QuartzCore framework)]) - _BITCOIN_QT_CHECK_STATIC_PLUGIN([QCocoaIntegrationPlugin], [-lqcocoa]) - _BITCOIN_QT_CHECK_STATIC_PLUGIN([QMacStylePlugin], [-lqmacstyle]) - AC_DEFINE([QT_QPA_PLATFORM_COCOA], [1], [Define this symbol if the qt platform is cocoa]) - fi - fi - CPPFLAGS=$TEMP_CPPFLAGS - CXXFLAGS=$TEMP_CXXFLAGS - ]) - - if test "$qt_bin_path" = ""; then - qt_bin_path="`$PKG_CONFIG --variable=host_bins ${qt_lib_prefix}Core 2>/dev/null`" - fi - - if test "$use_hardening" != "no"; then - BITCOIN_QT_CHECK([ - AC_MSG_CHECKING([whether -fPIE can be used with this Qt config]) - TEMP_CPPFLAGS=$CPPFLAGS - TEMP_CXXFLAGS=$CXXFLAGS - CPPFLAGS="$QT_INCLUDES $CORE_CPPFLAGS $CPPFLAGS" - CXXFLAGS="$PIE_FLAGS $CORE_CXXFLAGS $CXXFLAGS" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #ifndef QT_VERSION - # include - #endif - ]], - [[ - #if defined(QT_REDUCE_RELOCATIONS) - choke - #endif - ]])], - [ AC_MSG_RESULT([yes]); QT_PIE_FLAGS=$PIE_FLAGS ], - [ AC_MSG_RESULT([no]); QT_PIE_FLAGS=$PIC_FLAGS] - ) - CPPFLAGS=$TEMP_CPPFLAGS - CXXFLAGS=$TEMP_CXXFLAGS - ]) - else - BITCOIN_QT_CHECK([ - AC_MSG_CHECKING([whether -fPIC is needed with this Qt config]) - TEMP_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$QT_INCLUDES $CORE_CPPFLAGS $CPPFLAGS" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #ifndef QT_VERSION - # include - #endif - ]], - [[ - #if defined(QT_REDUCE_RELOCATIONS) - choke - #endif - ]])], - [ AC_MSG_RESULT([no])], - [ AC_MSG_RESULT([yes]); QT_PIE_FLAGS=$PIC_FLAGS] - ) - CPPFLAGS=$TEMP_CPPFLAGS - ]) - fi - - BITCOIN_QT_PATH_PROGS([MOC], [moc-qt5 moc5 moc], $qt_bin_path) - BITCOIN_QT_PATH_PROGS([UIC], [uic-qt5 uic5 uic], $qt_bin_path) - BITCOIN_QT_PATH_PROGS([RCC], [rcc-qt5 rcc5 rcc], $qt_bin_path) - BITCOIN_QT_PATH_PROGS([LRELEASE], [lrelease-qt5 lrelease5 lrelease], $qt_bin_path) - BITCOIN_QT_PATH_PROGS([LUPDATE], [lupdate-qt5 lupdate5 lupdate],$qt_bin_path, yes) - BITCOIN_QT_PATH_PROGS([LCONVERT], [lconvert-qt5 lconvert5 lconvert], $qt_bin_path, yes) - - BITCOIN_QT_CHECK([ - AC_CACHE_CHECK([whether $RCC accepts --format-version option], - [ac_cv_prog_rcc_accepts_format_version], - [ac_cv_prog_rcc_accepts_format_version=no - echo '' > conftest.qrc - $RCC --format-version 1 conftest.qrc >/dev/null 2>&1 && ac_cv_prog_rcc_accepts_format_version=yes - rm -f conftest.qrc]) - if test "$ac_cv_prog_rcc_accepts_format_version" = yes; then - RCCFLAGS="--format-version 1" - else - RCCFLAGS= - fi - AC_SUBST(RCCFLAGS) - ]) - - MOC_DEFS='-DHAVE_CONFIG_H -I$(srcdir)' - case $host in - *darwin*) - BITCOIN_QT_CHECK([ - MOC_DEFS="${MOC_DEFS} -DQ_OS_MAC" - base_frameworks="-framework Foundation -framework AppKit" - AX_CHECK_LINK_FLAG([$base_frameworks], [QT_LIBS="$QT_LIBS $base_frameworks"], [AC_MSG_ERROR(could not find base frameworks)]) - ]) - ;; - *mingw*) - BITCOIN_QT_CHECK([ - AX_CHECK_LINK_FLAG([-mwindows], [QT_LDFLAGS="$QT_LDFLAGS -mwindows"], [AC_MSG_WARN([-mwindows linker support not detected])]) - ]) - esac - - - dnl enable qt support - AC_MSG_CHECKING([whether to build ]AC_PACKAGE_NAME[ GUI]) - BITCOIN_QT_CHECK([ - bitcoin_enable_qt=yes - bitcoin_enable_qt_test=yes - if test "$have_qt_test" = "no"; then - bitcoin_enable_qt_test=no - fi - bitcoin_enable_qt_dbus=no - if test "$use_dbus" != "no" && test "$have_qt_dbus" = "yes"; then - bitcoin_enable_qt_dbus=yes - fi - if test "$use_dbus" = "yes" && test "$have_qt_dbus" = "no"; then - AC_MSG_ERROR([libQtDBus not found. Install libQtDBus or remove --with-qtdbus.]) - fi - if test "$LUPDATE" = ""; then - AC_MSG_WARN([lupdate tool is required to update Qt translations.]) - fi - if test "$LCONVERT" = ""; then - AC_MSG_WARN([lconvert tool is required to update Qt translations.]) - fi - ],[ - bitcoin_enable_qt=no - ]) - if test $bitcoin_enable_qt = "yes"; then - AC_MSG_RESULT([$bitcoin_enable_qt ($qt_lib_prefix)]) - else - AC_MSG_RESULT([$bitcoin_enable_qt]) - fi - - AC_SUBST(QT_PIE_FLAGS) - AC_SUBST(QT_INCLUDES) - AC_SUBST(QT_LIBS) - AC_SUBST(QT_LDFLAGS) - AC_SUBST(QT_DBUS_INCLUDES) - AC_SUBST(QT_TEST_INCLUDES) - AC_SUBST(QT_SELECT, qt5) - AC_SUBST(MOC_DEFS) -]) - -dnl All macros below are internal and should _not_ be used from configure.ac. - -dnl Internal. Check if the linked version of Qt was built statically. -dnl -dnl _BITCOIN_QT_IS_STATIC -dnl --------------------- -dnl -dnl Requires: INCLUDES and LIBS must be populated as necessary. -dnl Output: bitcoin_cv_static_qt=yes|no -AC_DEFUN([_BITCOIN_QT_IS_STATIC],[ - AC_CACHE_CHECK(for static Qt, bitcoin_cv_static_qt,[ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #ifndef QT_VERSION - # include - #endif - ]], - [[ - #if !defined(QT_STATIC) - choke - #endif - ]])], - [bitcoin_cv_static_qt=yes], - [bitcoin_cv_static_qt=no]) - ]) -]) - -dnl Internal. Check if the link-requirements for a static plugin are met. -dnl -dnl _BITCOIN_QT_CHECK_STATIC_PLUGIN(PLUGIN, LIBRARIES) -dnl -------------------------------------------------- -dnl -dnl Requires: INCLUDES and LIBS must be populated as necessary. -dnl Inputs: $1: A static plugin name. -dnl Inputs: $2: The libraries that resolve $1. -dnl Output: QT_LIBS is prepended or configure exits. -AC_DEFUN([_BITCOIN_QT_CHECK_STATIC_PLUGIN], [ - AC_MSG_CHECKING([for $1 ($2)]) - CHECK_STATIC_PLUGINS_TEMP_LIBS="$LIBS" - LIBS="$2${qt_lib_suffix} $QT_LIBS $LIBS" - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ - #include - Q_IMPORT_PLUGIN($1) - ]])], - [AC_MSG_RESULT([yes]); QT_LIBS="$2${qt_lib_suffix} $QT_LIBS"], - [AC_MSG_RESULT([no]); BITCOIN_QT_FAIL([$1 not found.])]) - LIBS="$CHECK_STATIC_PLUGINS_TEMP_LIBS" -]) - -dnl Internal. Check Qt static libs with PKG_CHECK_MODULES. -dnl -dnl _BITCOIN_QT_CHECK_STATIC_LIBS -dnl ----------------------------- -dnl -dnl Outputs: QT_LIBS is prepended. -AC_DEFUN([_BITCOIN_QT_CHECK_STATIC_LIBS], [ - PKG_CHECK_MODULES([QT_ACCESSIBILITY], [${qt_lib_prefix}AccessibilitySupport${qt_lib_suffix}], [QT_LIBS="$QT_ACCESSIBILITY_LIBS $QT_LIBS"]) - PKG_CHECK_MODULES([QT_DEVICEDISCOVERY], [${qt_lib_prefix}DeviceDiscoverySupport${qt_lib_suffix}], [QT_LIBS="$QT_DEVICEDISCOVERY_LIBS $QT_LIBS"]) - PKG_CHECK_MODULES([QT_EDID], [${qt_lib_prefix}EdidSupport${qt_lib_suffix}], [QT_LIBS="$QT_EDID_LIBS $QT_LIBS"]) - PKG_CHECK_MODULES([QT_EVENTDISPATCHER], [${qt_lib_prefix}EventDispatcherSupport${qt_lib_suffix}], [QT_LIBS="$QT_EVENTDISPATCHER_LIBS $QT_LIBS"]) - PKG_CHECK_MODULES([QT_FB], [${qt_lib_prefix}FbSupport${qt_lib_suffix}], [QT_LIBS="$QT_FB_LIBS $QT_LIBS"]) - PKG_CHECK_MODULES([QT_FONTDATABASE], [${qt_lib_prefix}FontDatabaseSupport${qt_lib_suffix}], [QT_LIBS="$QT_FONTDATABASE_LIBS $QT_LIBS"]) - PKG_CHECK_MODULES([QT_THEME], [${qt_lib_prefix}ThemeSupport${qt_lib_suffix}], [QT_LIBS="$QT_THEME_LIBS $QT_LIBS"]) - if test "$TARGET_OS" = "linux"; then - PKG_CHECK_MODULES([QT_INPUT], [${qt_lib_prefix}InputSupport], [QT_LIBS="$QT_INPUT_LIBS $QT_LIBS"]) - PKG_CHECK_MODULES([QT_SERVICE], [${qt_lib_prefix}ServiceSupport], [QT_LIBS="$QT_SERVICE_LIBS $QT_LIBS"]) - PKG_CHECK_MODULES([QT_XCBQPA], [${qt_lib_prefix}XcbQpa], [QT_LIBS="$QT_XCBQPA_LIBS $QT_LIBS"]) - PKG_CHECK_MODULES([QT_XKBCOMMON], [${qt_lib_prefix}XkbCommonSupport], [QT_LIBS="$QT_XKBCOMMON_LIBS $QT_LIBS"]) - elif test "$TARGET_OS" = "darwin"; then - PKG_CHECK_MODULES([QT_CLIPBOARD], [${qt_lib_prefix}ClipboardSupport${qt_lib_suffix}], [QT_LIBS="$QT_CLIPBOARD_LIBS $QT_LIBS"]) - PKG_CHECK_MODULES([QT_GRAPHICS], [${qt_lib_prefix}GraphicsSupport${qt_lib_suffix}], [QT_LIBS="$QT_GRAPHICS_LIBS $QT_LIBS"]) - PKG_CHECK_MODULES([QT_SERVICE], [${qt_lib_prefix}ServiceSupport${qt_lib_suffix}], [QT_LIBS="$QT_SERVICE_LIBS $QT_LIBS"]) - elif test "$TARGET_OS" = "windows"; then - PKG_CHECK_MODULES([QT_WINDOWSUIAUTOMATION], [${qt_lib_prefix}WindowsUIAutomationSupport${qt_lib_suffix}], [QT_LIBS="$QT_WINDOWSUIAUTOMATION_LIBS $QT_LIBS"]) - fi -]) - -dnl Internal. Find Qt libraries using pkg-config. -dnl -dnl _BITCOIN_QT_FIND_LIBS -dnl --------------------- -dnl -dnl Outputs: All necessary QT_* variables are set. -dnl Outputs: have_qt_test and have_qt_dbus are set (if applicable) to yes|no. -AC_DEFUN([_BITCOIN_QT_FIND_LIBS],[ - BITCOIN_QT_CHECK([ - PKG_CHECK_MODULES([QT_CORE], [${qt_lib_prefix}Core${qt_lib_suffix} $qt_version], [QT_INCLUDES="$QT_CORE_CFLAGS $QT_INCLUDES" QT_LIBS="$QT_CORE_LIBS $QT_LIBS"], - [BITCOIN_QT_FAIL([${qt_lib_prefix}Core${qt_lib_suffix} $qt_version not found])]) - ]) - BITCOIN_QT_CHECK([ - PKG_CHECK_MODULES([QT_GUI], [${qt_lib_prefix}Gui${qt_lib_suffix} $qt_version], [QT_INCLUDES="$QT_GUI_CFLAGS $QT_INCLUDES" QT_LIBS="$QT_GUI_LIBS $QT_LIBS"], - [BITCOIN_QT_FAIL([${qt_lib_prefix}Gui${qt_lib_suffix} $qt_version not found])]) - ]) - BITCOIN_QT_CHECK([ - PKG_CHECK_MODULES([QT_WIDGETS], [${qt_lib_prefix}Widgets${qt_lib_suffix} $qt_version], [QT_INCLUDES="$QT_WIDGETS_CFLAGS $QT_INCLUDES" QT_LIBS="$QT_WIDGETS_LIBS $QT_LIBS"], - [BITCOIN_QT_FAIL([${qt_lib_prefix}Widgets${qt_lib_suffix} $qt_version not found])]) - ]) - BITCOIN_QT_CHECK([ - PKG_CHECK_MODULES([QT_NETWORK], [${qt_lib_prefix}Network${qt_lib_suffix} $qt_version], [QT_INCLUDES="$QT_NETWORK_CFLAGS $QT_INCLUDES" QT_LIBS="$QT_NETWORK_LIBS $QT_LIBS"], - [BITCOIN_QT_FAIL([${qt_lib_prefix}Network${qt_lib_suffix} $qt_version not found])]) - ]) - - BITCOIN_QT_CHECK([ - PKG_CHECK_MODULES([QT_TEST], [${qt_lib_prefix}Test${qt_lib_suffix} $qt_version], [QT_TEST_INCLUDES="$QT_TEST_CFLAGS"; have_qt_test=yes], [have_qt_test=no]) - if test "$use_dbus" != "no"; then - PKG_CHECK_MODULES([QT_DBUS], [${qt_lib_prefix}DBus $qt_version], [QT_DBUS_INCLUDES="$QT_DBUS_CFLAGS"; have_qt_dbus=yes], [have_qt_dbus=no]) - fi - ]) -]) diff --git a/build-aux/m4/bitcoin_subdir_to_include.m4 b/build-aux/m4/bitcoin_subdir_to_include.m4 deleted file mode 100644 index 736270afea5a..000000000000 --- a/build-aux/m4/bitcoin_subdir_to_include.m4 +++ /dev/null @@ -1,18 +0,0 @@ -dnl Copyright (c) 2013-2014 The Bitcoin Core developers -dnl Distributed under the MIT software license, see the accompanying -dnl file COPYING or http://www.opensource.org/licenses/mit-license.php. - -dnl BITCOIN_SUBDIR_TO_INCLUDE([CPPFLAGS-VARIABLE-NAME],[SUBDIRECTORY-NAME],[HEADER-FILE]) -dnl SUBDIRECTORY-NAME must end with a path separator -AC_DEFUN([BITCOIN_SUBDIR_TO_INCLUDE],[ - if test "$2" = ""; then - AC_MSG_RESULT([default]) - else - echo "#include <$2$3.h>" >conftest.cpp - newinclpath=`${CXXCPP} ${CPPFLAGS} -M conftest.cpp 2>/dev/null | [ tr -d '\\n\\r\\\\' | sed -e 's/^.*[[:space:]:]\(\/[^[:space:]]*\)]$3[\.h[[:space:]].*$/\1/' -e t -e d`] - AC_MSG_RESULT([${newinclpath}]) - if test "${newinclpath}" != ""; then - eval "$1=\"\$$1\"' -I${newinclpath}'" - fi - fi -]) diff --git a/build-aux/m4/l_atomic.m4 b/build-aux/m4/l_atomic.m4 deleted file mode 100644 index 859ddaabbb42..000000000000 --- a/build-aux/m4/l_atomic.m4 +++ /dev/null @@ -1,65 +0,0 @@ -dnl Copyright (c) 2015 Tim Kosse -dnl Copying and distribution of this file, with or without modification, are -dnl permitted in any medium without royalty provided the copyright notice -dnl and this notice are preserved. This file is offered as-is, without any -dnl warranty. - -# Clang, when building for 32-bit, -# and linking against libstdc++, requires linking with -# -latomic if using the C++ atomic library. -# Can be tested with: clang++ -std=c++20 test.cpp -m32 -# -# Sourced from http://bugs.debian.org/797228 - -m4_define([_CHECK_ATOMIC_testbody], [[ - #include - #include - #include - - using namespace std::chrono_literals; - - int main() { - std::atomic lock{true}; - lock.exchange(false); - - std::atomic t{0s}; - t.store(2s); - auto t1 = t.load(); - t.compare_exchange_strong(t1, 3s); - - std::atomic d{}; - d.store(3.14); - auto d1 = d.load(); - - std::atomic a{}; - int64_t v = 5; - int64_t r = a.fetch_add(v); - return static_cast(r); - } -]]) - -AC_DEFUN([CHECK_ATOMIC], [ - - AC_LANG_PUSH(C++) - TEMP_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" - - AC_MSG_CHECKING([whether std::atomic can be used without link library]) - - AC_LINK_IFELSE([AC_LANG_SOURCE([_CHECK_ATOMIC_testbody])],[ - AC_MSG_RESULT([yes]) - ],[ - AC_MSG_RESULT([no]) - LIBS="$LIBS -latomic" - AC_MSG_CHECKING([whether std::atomic needs -latomic]) - AC_LINK_IFELSE([AC_LANG_SOURCE([_CHECK_ATOMIC_testbody])],[ - AC_MSG_RESULT([yes]) - ],[ - AC_MSG_RESULT([no]) - AC_MSG_FAILURE([cannot figure out how to use std::atomic]) - ]) - ]) - - CXXFLAGS="$TEMP_CXXFLAGS" - AC_LANG_POP -]) diff --git a/build-aux/m4/l_socket.m4 b/build-aux/m4/l_socket.m4 deleted file mode 100644 index 38923a98fc96..000000000000 --- a/build-aux/m4/l_socket.m4 +++ /dev/null @@ -1,36 +0,0 @@ -# Illumos/SmartOS requires linking with -lsocket if -# using getifaddrs & freeifaddrs - -m4_define([_CHECK_SOCKET_testbody], [[ - #include - #include - - int main() { - struct ifaddrs *ifaddr; - getifaddrs(&ifaddr); - freeifaddrs(ifaddr); - } -]]) - -AC_DEFUN([CHECK_SOCKET], [ - - AC_LANG_PUSH(C++) - - AC_MSG_CHECKING([whether ifaddrs funcs can be used without link library]) - - AC_LINK_IFELSE([AC_LANG_SOURCE([_CHECK_SOCKET_testbody])],[ - AC_MSG_RESULT([yes]) - ],[ - AC_MSG_RESULT([no]) - LIBS="$LIBS -lsocket" - AC_MSG_CHECKING([whether getifaddrs needs -lsocket]) - AC_LINK_IFELSE([AC_LANG_SOURCE([_CHECK_SOCKET_testbody])],[ - AC_MSG_RESULT([yes]) - ],[ - AC_MSG_RESULT([no]) - AC_MSG_FAILURE([cannot figure out how to use getifaddrs]) - ]) - ]) - - AC_LANG_POP -]) diff --git a/ci/dash/build-docker.sh b/ci/dash/build-docker.sh index a2582cb1d83b..3762e4866704 100755 --- a/ci/dash/build-docker.sh +++ b/ci/dash/build-docker.sh @@ -16,9 +16,9 @@ DOCKER_RELATIVE_PATH=contrib/containers/deploy rm -rf "${DOCKER_RELATIVE_PATH:?}/bin" mkdir -p "$DOCKER_RELATIVE_PATH/bin" -cp src/dashd "$DOCKER_RELATIVE_PATH/bin/" -cp src/dash-cli "$DOCKER_RELATIVE_PATH/bin/" -cp src/dash-tx "$DOCKER_RELATIVE_PATH/bin/" +cp build/src/dashd "$DOCKER_RELATIVE_PATH/bin/" +cp build/src/dash-cli "$DOCKER_RELATIVE_PATH/bin/" +cp build/src/dash-tx "$DOCKER_RELATIVE_PATH/bin/" strip "$DOCKER_RELATIVE_PATH/bin/dashd" strip "$DOCKER_RELATIVE_PATH/bin/dash-cli" strip "$DOCKER_RELATIVE_PATH/bin/dash-tx" diff --git a/cmake/dashbls.cmake b/cmake/dashbls.cmake index c2ab975aebc5..221146df0cdb 100644 --- a/cmake/dashbls.cmake +++ b/cmake/dashbls.cmake @@ -2,9 +2,8 @@ # Distributed under the MIT software license, see the accompanying # file COPYING or https://opensource.org/license/mit/. -# Counterpart to src/Makefile.dashbls.include. The dashbls subtree ships no -# build system of its own, so build its sources here and take blst from depends -# or the system. +# The dashbls subtree ships no build system of its own, so build its sources +# here and take blst from depends or the system. if(ENABLE_MIMALLOC) add_library(mimalloc_secure STATIC EXCLUDE_FROM_ALL @@ -65,8 +64,8 @@ target_compile_definitions(dashbls PRIVATE $<$:BLSALLOC_MIMALLOC=1> ) -# The vendored headers are included as system headers, as Autotools does, so -# that Dash's warning set (and WERROR) does not apply to them. +# The vendored headers are included as system headers, so that Dash's warning +# set (and WERROR) does not apply to them. target_include_directories(dashbls SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src/dashbls/include/dashbls diff --git a/cmake/module/GenerateSetupNsi.cmake b/cmake/module/GenerateSetupNsi.cmake index dfdad654476d..1caacb8c18ce 100644 --- a/cmake/module/GenerateSetupNsi.cmake +++ b/cmake/module/GenerateSetupNsi.cmake @@ -7,7 +7,7 @@ function(generate_setup_nsi) set(abs_top_builddir ${PROJECT_BINARY_DIR}) set(PACKAGE_URL ${PROJECT_HOMEPAGE_URL}) # These have to match the executables' OUTPUT_NAMEs, since the deploy target - # stages the files under those names. Keep them in sync with configure.ac. + # stages the files under those names. # PACKAGE_TARNAME comes from the top-level CMakeLists.txt, which is also where # add_windows_deploy_target() reads it from. set(BITCOIN_GUI_NAME "dash-qt") @@ -19,8 +19,7 @@ function(generate_setup_nsi) set(EXEEXT ${CMAKE_EXECUTABLE_SUFFIX}) set(nsi_file ${PROJECT_BINARY_DIR}/${PACKAGE_TARNAME}-win64-setup.nsi) configure_file(${PROJECT_SOURCE_DIR}/share/setup.nsi.in ${nsi_file} @ONLY) - # share/setup.nsi.in carries no OutFile directive; the Autotools recipe pipes - # one in ahead of the script when invoking makensis. Do the same here. + # share/setup.nsi.in carries no OutFile directive, so prepend one. file(READ ${nsi_file} nsi_content) file(WRITE ${nsi_file} "OutFile \"${PROJECT_BINARY_DIR}/${PACKAGE_TARNAME}-${PACKAGE_VERSION}-win64-setup${EXEEXT}\"\n${nsi_content}" diff --git a/cmake/module/ProcessConfigurations.cmake b/cmake/module/ProcessConfigurations.cmake index f9647cf237b2..03abb4936fd7 100644 --- a/cmake/module/ProcessConfigurations.cmake +++ b/cmake/module/ProcessConfigurations.cmake @@ -139,7 +139,6 @@ endfunction() set_default_config(RelWithDebInfo) # Redefine/adjust per-configuration flags. -# Keep this list in sync with the --enable-debug DEBUG_CPPFLAGS in configure.ac. # Dash uses DEBUG_CORE, not upstream's DEBUG, which is what span.h and # init/common.cpp check. target_compile_definitions(core_interface_debug INTERFACE @@ -159,10 +158,9 @@ else() # Prefer -O2 optimization level. (-O3 is CMake's default for Release for many compilers.) replace_cxx_flag_in_config(Release -O3 -O2) - # Autotools always keeps at least -g1 on non-debug builds so libbacktrace can - # still symbolize a crash, with -fno-omit-frame-pointer to keep the result - # usable under optimization; see the non-debug branch in configure.ac, which - # sets both DEBUG_CFLAGS and DEBUG_CXXFLAGS. These belong on the configuration + # Non-debug builds keep at least -g1 so libbacktrace can still symbolize a + # crash, with -fno-omit-frame-pointer to keep the result usable under + # optimization, for both C and C++. These belong on the configuration # rather than on stacktraces_interface: flags carried on a target are appended # after the per-configuration ones, so a debug level set there would clamp # every configuration to it. RelWithDebInfo already carries -g and only needs diff --git a/cmake/script/GenerateBuildInfo.cmake b/cmake/script/GenerateBuildInfo.cmake index 486ce750e1d2..d50d71a8f592 100644 --- a/cmake/script/GenerateBuildInfo.cmake +++ b/cmake/script/GenerateBuildInfo.cmake @@ -2,8 +2,6 @@ # Distributed under the MIT software license, see the accompanying # file COPYING or https://opensource.org/license/mit/. -# This script is a multiplatform port of the share/genbuild.sh shell script. - macro(fatal_error) message(FATAL_ERROR "\n" "Usage:\n" @@ -31,8 +29,8 @@ else() endif() # NOTE: Unlike upstream, clientversion.cpp only knows about -# BUILD_GIT_DESCRIPTION, so this emits the same `git describe` string -# that share/genbuild.sh produces. Otherwise every non-release build +# BUILD_GIT_DESCRIPTION, so this emits a `git describe` string. +# Otherwise every non-release build # reports its version as "vX.Y.Z-unk". set(GIT_DESCRIPTION) if(NOT "$ENV{BITCOIN_GENBUILD_NO_GIT}" STREQUAL "1") diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 3452134db3eb..000000000000 --- a/configure.ac +++ /dev/null @@ -1,2195 +0,0 @@ -AC_PREREQ([2.69]) -dnl Don't forget to push a corresponding tag when updating any of _CLIENT_VERSION_* numbers -define(_CLIENT_VERSION_MAJOR, 24) -define(_CLIENT_VERSION_MINOR, 1) -define(_CLIENT_VERSION_BUILD, 0) -define(_CLIENT_VERSION_IS_RELEASE, false) -define(_COPYRIGHT_YEAR, 2026) -define(_COPYRIGHT_HOLDERS,[The %s developers]) -define(_COPYRIGHT_HOLDERS_SUBSTITUTION,[[Dash Core]]) -AC_INIT([Dash Core],m4_join([.], _CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MINOR, _CLIENT_VERSION_BUILD),[https://github.com/dashpay/dash/issues],[dashcore],[https://dash.org/]) -AC_CONFIG_SRCDIR([src/validation.cpp]) -AC_CONFIG_HEADERS([src/config/bitcoin-config.h]) -AC_CONFIG_AUX_DIR([build-aux]) -AC_CONFIG_MACRO_DIR([build-aux/m4]) - -m4_ifndef([PKG_PROG_PKG_CONFIG], [m4_fatal([PKG_PROG_PKG_CONFIG macro not found. Please install pkg-config and re-run autogen.sh])]) -PKG_PROG_PKG_CONFIG -if test "$PKG_CONFIG" = ""; then - AC_MSG_ERROR([pkg-config not found]) -fi - -# When compiling with depends, the `PKG_CONFIG_PATH` and `PKG_CONFIG_LIBDIR` variables, -# being set in a `config.site` file, are not exported to let the `--config-cache` option -# work properly. -if test -n "$PKG_CONFIG_PATH"; then - PKG_CONFIG="env PKG_CONFIG_PATH=$PKG_CONFIG_PATH $PKG_CONFIG" -fi -if test -n "$PKG_CONFIG_LIBDIR"; then - PKG_CONFIG="env PKG_CONFIG_LIBDIR=$PKG_CONFIG_LIBDIR $PKG_CONFIG" -fi - -BITCOIN_DAEMON_NAME=dashd -BITCOIN_GUI_NAME=dash-qt -BITCOIN_TEST_NAME=test_dash -BITCOIN_CLI_NAME=dash-cli -BITCOIN_TX_NAME=dash-tx -BITCOIN_UTIL_NAME=dash-util -BITCOIN_CHAINSTATE_NAME=dash-chainstate -BITCOIN_WALLET_TOOL_NAME=dash-wallet -dnl Multi Process -BITCOIN_MP_NODE_NAME=dash-node -BITCOIN_MP_GUI_NAME=dash-gui - -dnl Unless the user specified ARFLAGS, force it to be cr -dnl This is also the default as-of libtool 2.4.7 -AC_ARG_VAR([ARFLAGS], [Flags for the archiver, defaults to if not set]) -if test "${ARFLAGS+set}" != "set"; then - ARFLAGS="cr" -fi - -AC_CANONICAL_HOST - -AH_TOP([#ifndef DASH_CONFIG_H]) -AH_TOP([#define DASH_CONFIG_H]) -AH_BOTTOM([#endif //DASH_CONFIG_H]) - -dnl Automake init set-up and checks -AM_INIT_AUTOMAKE([1.13 no-define subdir-objects foreign]) - -AM_MAINTAINER_MODE([enable]) - -dnl make the compilation flags quiet unless V=1 is used -AM_SILENT_RULES([yes]) - -dnl Compiler checks (here before libtool). -if test "${CXXFLAGS+set}" = "set"; then - CXXFLAGS_overridden=yes -else - CXXFLAGS_overridden=no -fi -AC_PROG_CXX - -dnl libtool overrides -case $host in - *mingw*) - dnl By default, libtool for mingw refuses to link static libs into a dll for - dnl fear of mixing pic/non-pic objects, and import/export complications. Since - dnl we have those under control, re-enable that functionality. - lt_cv_deplibs_check_method="pass_all" - - dnl Remove unwanted -DDLL_EXPORT from these variables. - dnl We do not use this macro, but system headers may export unwanted symbols - dnl if it's set. - lt_cv_prog_compiler_pic="-DPIC" - lt_cv_prog_compiler_pic_CXX="-DPIC" - ;; - *darwin*) - dnl Because it prints a verbose warning, lld fails the following check - dnl for "-Wl,-single_module" from libtool.m4: - dnl # If there is a non-empty error log, and "single_module" - dnl # appears in it, assume the flag caused a linker warning - dnl "-single_module" works fine on ld64 and lld, so just bypass the test. - dnl Failure to set this to "yes" causes libtool to use a very broken - dnl link-line for shared libs. - lt_cv_apple_cc_single_mod="yes" - ;; -esac - -dnl Require C++20 compiler (no GNU extensions) -AX_CXX_COMPILE_STDCXX([20], [noext], [mandatory]) - -dnl Unless the user specified OBJCXX, force it to be the same as CXX. This ensures -dnl that we get the same -std flags for both. -m4_ifdef([AC_PROG_OBJCXX],[ -if test "${OBJCXX+set}" = ""; then - OBJCXX="${CXX}" -fi -AC_PROG_OBJCXX -]) - -dnl OpenBSD ships with 2.4.2 -LT_PREREQ([2.4.2]) -dnl Libtool init checks. -LT_INIT([pic-only win32-dll]) - -dnl Check/return PATH for base programs. -AC_PATH_TOOL([AR], [ar]) -AC_PATH_TOOL([GCOV], [gcov]) -AC_PATH_TOOL([LLVM_COV], [llvm-cov]) -AC_PATH_PROG([LCOV], [lcov]) -dnl The minimum supported version is specified in .python-version and should be used if available, see doc/dependencies.md -AC_PATH_PROGS([PYTHON], [python3.9 python3.10 python3.11 python3.12 python3 python]) -AC_PATH_PROG([GENHTML], [genhtml]) -AC_PATH_PROG([GIT], [git]) -AC_PATH_PROG([CCACHE], [ccache]) -AC_PATH_PROG([XGETTEXT], [xgettext]) -AC_PATH_PROG([HEXDUMP], [hexdump]) -AC_PATH_TOOL([OBJCOPY], [objcopy]) -AC_PATH_TOOL([OBJDUMP], [objdump]) -AC_PATH_TOOL([DSYMUTIL], [dsymutil]) -AC_PATH_PROG([DOXYGEN], [doxygen]) -AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"]) - -AC_ARG_ENABLE([wallet], - [AS_HELP_STRING([--disable-wallet], - [disable wallet (enabled by default)])], - [enable_wallet=$enableval], - [enable_wallet=auto]) - -AC_ARG_WITH([sqlite], - [AS_HELP_STRING([--with-sqlite=yes|no|auto], - [enable sqlite wallet support (default: auto, i.e., enabled if wallet is enabled and sqlite is found)])], - [use_sqlite=$withval], - [use_sqlite=auto]) - -AC_ARG_WITH([bdb], - [AS_HELP_STRING([--without-bdb], - [disable bdb wallet support (default is enabled if wallet is enabled)])], - [use_bdb=$withval], - [use_bdb=auto]) - -AC_ARG_WITH([zstd], - [AS_HELP_STRING([--without-zstd], - [disable zstd compression of block and undo files (default is enabled if libzstd is found)])], - [use_zstd=$withval], - [use_zstd=auto]) - -AC_ARG_ENABLE([usdt], - [AS_HELP_STRING([--enable-usdt], - [enable tracepoints for Userspace, Statically Defined Tracing (default is yes if sys/sdt.h is found)])], - [use_usdt=$enableval], - [use_usdt=yes]) - -AC_ARG_WITH([miniupnpc], - [AS_HELP_STRING([--with-miniupnpc], - [enable UPNP (default is yes if libminiupnpc is found)])], - [use_upnp=$withval], - [use_upnp=auto]) - -AC_ARG_WITH([natpmp], - [AS_HELP_STRING([--with-natpmp], - [enable NAT-PMP (default is yes if libnatpmp is found)])], - [use_natpmp=$withval], - [use_natpmp=auto]) - -AC_ARG_ENABLE([mimalloc], - [AS_HELP_STRING([--disable-mimalloc], - [use malloc instead of mimalloc for BLS secret memory until BLSInit() installs the locked pool (default is mimalloc)])], - [use_mimalloc=$enableval], - [use_mimalloc=yes]) - -AC_ARG_ENABLE(tests, - AS_HELP_STRING([--disable-tests],[do not compile tests (default is to compile)]), - [use_tests=$enableval], - [use_tests=yes]) - -AC_ARG_ENABLE(gui-tests, - AS_HELP_STRING([--disable-gui-tests],[do not compile GUI tests (default is to compile if GUI and tests enabled)]), - [use_gui_tests=$enableval], - [use_gui_tests=$use_tests]) - -AC_ARG_ENABLE(bench, - AS_HELP_STRING([--disable-bench],[do not compile benchmarks (default is to compile)]), - [use_bench=$enableval], - [use_bench=yes]) - -AC_ARG_ENABLE([extended-functional-tests], - AS_HELP_STRING([--enable-extended-functional-tests],[enable expensive functional tests when using lcov (default no)]), - [use_extended_functional_tests=$enableval], - [use_extended_functional_tests=no]) - -AC_ARG_ENABLE([fuzz], - AS_HELP_STRING([--enable-fuzz], - [build for fuzzing (default no). enabling this will disable all other targets and override --{enable,disable}-fuzz-binary]), - [enable_fuzz=$enableval], - [enable_fuzz=no]) - -AC_ARG_ENABLE([fuzz-binary], - AS_HELP_STRING([--enable-fuzz-binary], - [enable building of fuzz binary (default yes).]), - [enable_fuzz_binary=$enableval], - [enable_fuzz_binary=yes]) - -AC_ARG_WITH([qrencode], - [AS_HELP_STRING([--with-qrencode], - [enable QR code support (default is yes if qt is enabled and libqrencode is found)])], - [use_qr=$withval], - [use_qr=auto]) - -AC_ARG_ENABLE([hardening], - [AS_HELP_STRING([--disable-hardening], - [do not attempt to harden the resulting executables (default is to harden)])], - [use_hardening=$enableval], - [use_hardening=yes]) - -AC_ARG_ENABLE([reduce-exports], - [AS_HELP_STRING([--enable-reduce-exports], - [attempt to reduce exported symbols in the resulting executables (default is no)])], - [use_reduce_exports=$enableval], - [use_reduce_exports=no]) - -AC_ARG_ENABLE([ccache], - [AS_HELP_STRING([--disable-ccache], - [do not use ccache for building (default is to use if found)])], - [use_ccache=$enableval], - [use_ccache=auto]) - -dnl Suppress warnings from external headers (e.g. Boost, Qt). -dnl May be useful if warnings from external headers clutter the build output -dnl too much, so that it becomes difficult to spot Bitcoin Core warnings -dnl or if they cause a build failure with --enable-werror. -AC_ARG_ENABLE([suppress-external-warnings], - [AS_HELP_STRING([--disable-suppress-external-warnings], - [Do not suppress warnings from external headers (default is to suppress)])], - [suppress_external_warnings=$enableval], - [suppress_external_warnings=yes]) - -AC_ARG_ENABLE([lcov], - [AS_HELP_STRING([--enable-lcov], - [enable lcov testing (default is no)])], - [use_lcov=$enableval], - [use_lcov=no]) - -AC_ARG_ENABLE([zmq], - [AS_HELP_STRING([--disable-zmq], - [disable ZMQ notifications])], - [use_zmq=$enableval], - [use_zmq=yes]) - -AC_ARG_WITH([libmultiprocess], - [AS_HELP_STRING([--with-libmultiprocess=yes|no|auto], - [Build with libmultiprocess library. (default: auto, i.e. detect with pkg-config)])], - [with_libmultiprocess=$withval], - [with_libmultiprocess=auto]) - -AC_ARG_WITH([mpgen], - [AS_HELP_STRING([--with-mpgen=yes|no|auto|PREFIX], - [Build with libmultiprocess codegen tool. Useful to specify different libmultiprocess host system library and build system codegen tool prefixes when cross-compiling (default is host system libmultiprocess prefix)])], - [with_mpgen=$withval], - [with_mpgen=auto]) - -AC_ARG_ENABLE([multiprocess], - [AS_HELP_STRING([--enable-multiprocess], - [build multiprocess dash-node, dash-wallet, and dash-gui executables in addition to monolithic dashd and dash-qt executables. Requires libmultiprocess library. Experimental (default is no)])], - [enable_multiprocess=$enableval], - [enable_multiprocess=no]) - -AC_ARG_ENABLE(man, - [AS_HELP_STRING([--disable-man], - [do not install man pages (default is to install)])],, - enable_man=yes) -AM_CONDITIONAL([ENABLE_MAN], [test "$enable_man" != "no"]) - -dnl Enable debug -AC_ARG_ENABLE([debug], - [AS_HELP_STRING([--enable-debug], - [use compiler flags and macros suited for debugging (default is no)])], - [enable_debug=$enableval], - [enable_debug=no]) - -dnl Enable exception stacktraces -AC_ARG_ENABLE([stacktraces], - [AS_HELP_STRING([--enable-stacktraces], - [gather and print exception stack traces (default is auto, enabled if libbacktrace is available)])], - [enable_stacktraces=$enableval], - [enable_stacktraces=auto]) - -dnl Enable crash hooks -AC_ARG_ENABLE([crash-hooks], - [AS_HELP_STRING([--enable-crash-hooks], - [hook into exception/signal/assert handling to gather stack traces (default is no)])], - [enable_crashhooks=$enableval], - [enable_crashhooks=no]) - -dnl Enable in-wallet miner -AC_ARG_ENABLE([miner], - [AS_HELP_STRING([--enable-miner], - [enable in-wallet miner (default is yes)])], - [enable_miner=$enableval], - [enable_miner=yes]) -AM_CONDITIONAL([ENABLE_MINER], [test "$enable_miner" = "yes"]) -if test "$enable_miner" = "yes"; then - AC_DEFINE(ENABLE_MINER, 1, [Define this symbol if in-wallet miner should be enabled]) -fi - -AC_ARG_ENABLE([platform-gui], - [AS_HELP_STRING([--enable-platform-gui], - [enable Dash Platform (usernames, DashPay contacts) in the GUI; requires the GUI, the wallet and the Dash Platform SDK's C++ binding (dash-sdk-cxx) built by depends with PLATFORM_GUI=1 (default is no)])], - [enable_platform_gui=$enableval], - [enable_platform_gui=no]) - -dnl Enable different -fsanitize options -AC_ARG_WITH([sanitizers], - [AS_HELP_STRING([--with-sanitizers], - [comma separated list of extra sanitizers to build with (default is none enabled)])], - [use_sanitizers=$withval]) - -dnl Turn warnings into errors -AC_ARG_ENABLE([werror], - [AS_HELP_STRING([--enable-werror], - [Treat compiler warnings as errors (default is no)])], - [enable_werror=$enableval], - [enable_werror=no]) - -AC_ARG_ENABLE([external-signer], - [AS_HELP_STRING([--enable-external-signer],[compile external signer support (default is yes)])], - [use_external_signer=$enableval], - [use_external_signer=yes]) - -AC_LANG_PUSH([C++]) - -dnl Always set -g -O2 in our CXXFLAGS. Autoconf will try and set CXXFLAGS to "-g -O2" by default, -dnl so we suppress that (if CXXFLAGS hasn't been overridden by the user), given we are adding it -dnl ourselves. -CORE_CXXFLAGS="$CORE_CXXFLAGS -g -O2" - -if test "$CXXFLAGS_overridden" = "no"; then - CXXFLAGS="" -fi - -dnl Check for a flag to turn compiler warnings into errors. This is helpful for checks which may -dnl appear to succeed because by default they merely emit warnings when they fail. -dnl -dnl Note that this is not necessarily a check to see if -Werror is supported, but rather to see if -dnl a compile with -Werror can succeed. This is important because the compiler may already be -dnl warning about something unrelated, for example about some path issue. If that is the case, -dnl -Werror cannot be used because all of those warnings would be turned into errors. -AX_CHECK_COMPILE_FLAG([-Werror], [CXXFLAG_WERROR="-Werror"], [CXXFLAG_WERROR=""]) - -dnl Check for a flag to turn linker warnings into errors. When flags are passed to linkers via the -dnl compiler driver using a -Wl,-foo flag, linker warnings may be swallowed rather than bubbling up. -dnl See note above, the same applies here as well. -dnl -dnl LDFLAG_WERROR Should only be used when testing -Wl,* -case $host in - *darwin*) - AX_CHECK_LINK_FLAG([-Wl,-fatal_warnings], [LDFLAG_WERROR="-Wl,-fatal_warnings"], [LDFLAG_WERROR=""]) - ;; - *) - AX_CHECK_LINK_FLAG([-Wl,--fatal-warnings], [LDFLAG_WERROR="-Wl,--fatal-warnings"], [LDFLAG_WERROR=""]) - ;; -esac - -if test "$enable_debug" = "yes"; then - - dnl Disable all optimizations - AX_CHECK_COMPILE_FLAG([-O0], [DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -O0"], [], [$CXXFLAG_WERROR]) - - dnl Prefer -g3, fall back to -g if that is unavailable. - AX_CHECK_COMPILE_FLAG( - [-g3], - [DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -g3"], - [AX_CHECK_COMPILE_FLAG([-g], [DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -g"], [], [$CXXFLAG_WERROR])], - [$CXXFLAG_WERROR]) - - AX_CHECK_PREPROC_FLAG([-DDEBUG_CORE], [DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DDEBUG_CORE"], [], [$CXXFLAG_WERROR]) - AX_CHECK_PREPROC_FLAG([-DDEBUG_LOCKORDER], [DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DDEBUG_LOCKORDER"], [], [$CXXFLAG_WERROR]) - AX_CHECK_PREPROC_FLAG([-DDEBUG_LOCKCONTENTION], [DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DDEBUG_LOCKCONTENTION"], [], [$CXXFLAG_WERROR]) - AX_CHECK_PREPROC_FLAG([-DRPC_DOC_CHECK], [DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DRPC_DOC_CHECK"], [], [$CXXFLAG_WERROR]) - AX_CHECK_PREPROC_FLAG([-DABORT_ON_FAILED_ASSUME], [DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DABORT_ON_FAILED_ASSUME"], [], [$CXXFLAG_WERROR]) - AX_CHECK_COMPILE_FLAG([-ftrapv], [DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -ftrapv"], [], [$CXXFLAG_WERROR]) -else - dnl If not debugging, enable more aggressive optimizations for sphlib sources - AX_CHECK_COMPILE_FLAG([-O3], [SPHLIB_FLAGS="$SPHLIB_FLAGS -O3"], [], [$CXXFLAG_WERROR]) - - # We always enable at at least -g1 debug info to support proper stacktraces in crash infos - # Stacktraces will be suboptimal due to optimization, but better than nothing. Also, -fno-omit-frame-pointer - # mitigates this a little bit - if test "$GCC" = "yes"; then - DEBUG_CFLAGS="$DEBUG_CFLAGS -g1 -fno-omit-frame-pointer" - fi - - if test "$GXX" = "yes"; then - DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -g1 -fno-omit-frame-pointer" - fi -fi - -# Needed for MinGW targets when debug symbols are enabled as compiled objects get very large -AX_CHECK_COMPILE_FLAG([-Wa,-mbig-obj], [DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -Wa,-mbig-obj"],,,) - -if test "$use_sanitizers" != ""; then - dnl First check if the compiler accepts flags. If an incompatible pair like - dnl -fsanitize=address,thread is used here, this check will fail. This will also - dnl fail if a bad argument is passed, e.g. -fsanitize=undfeined - AX_CHECK_COMPILE_FLAG( - [-fsanitize=$use_sanitizers], - [SANITIZER_CXXFLAGS="-fsanitize=$use_sanitizers" - SANITIZER_CFLAGS="-fsanitize=$use_sanitizers"], - [AC_MSG_ERROR([compiler did not accept requested flags])]) - - dnl Some compilers (e.g. GCC) require additional libraries like libasan, - dnl libtsan, libubsan, etc. Make sure linking still works with the sanitize - dnl flag. This is a separate check so we can give a better error message when - dnl the sanitize flags are supported by the compiler but the actual sanitizer - dnl libs are missing. - AX_CHECK_LINK_FLAG( - [-fsanitize=$use_sanitizers], - [SANITIZER_LDFLAGS="-fsanitize=$use_sanitizers"], - [AC_MSG_ERROR([linker did not accept requested flags, you are missing required libraries])], - [], - [AC_LANG_PROGRAM([[ - #include - #include - extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { return 0; } - __attribute__((weak)) // allow for libFuzzer linking - ]],[[]])]) -fi - -ERROR_CXXFLAGS= -if test "$enable_werror" = "yes"; then - if test "$CXXFLAG_WERROR" = ""; then - AC_MSG_ERROR([enable-werror set but -Werror is not usable]) - fi - ERROR_CXXFLAGS=$CXXFLAG_WERROR - - dnl -Wdeprecated-literal-operator cause problems with clang 20. Do not treat these warnings as errors. - dnl TODO: remove it once we update hana - AX_CHECK_COMPILE_FLAG([-Wdeprecated-literal-operator], [NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-error=deprecated-literal-operator"], [], [$CXXFLAG_WERROR], [AC_LANG_SOURCE([ - #if !defined(__clang__) || defined(__INTEL_COMPILER) - #error Non-clang compiler detected, not setting flag - #endif - int main(void) { return 0; } - ])]) - - dnl -Wattributes cause problems with some versions of GCC. Do not treat these warnings as errors. - AX_CHECK_COMPILE_FLAG([-Wattributes], [NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-error=attributes"], [], [$CXXFLAG_WERROR], [AC_LANG_SOURCE([ - #if defined(__clang__) || defined(__INTEL_COMPILER) || !defined(__GNUC__) - #error Non-GCC compiler detected, not setting flag - #elif defined(__GNUC__) && __GNUC__ >= 14 - #error GCC >=14 detected, not setting flag - #endif - int main(void) { return 0; } - ])]) - - dnl -Wcpp is triggered due to _FORTIFY_SOURCE=3 on GCC 11 and below as level 3 was introduced in GCC 12. Do not treat these warnings as errors. - AX_CHECK_COMPILE_FLAG([-Wcpp], [NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-error=cpp"], [], [$CXXFLAG_WERROR], [AC_LANG_SOURCE([ - #if defined(__clang__) || defined(__INTEL_COMPILER) || !defined(__GNUC__) - #error Non-GCC compiler detected, not setting flag - #elif defined(__GNUC__) && __GNUC__ >= 12 - #error GCC >=12 detected, not setting flag - #endif - int main(void) { return 0; } - ])]) -fi - -dnl -Warray-bounds cause problems with GCC. Do not treat these warnings as errors. -dnl Suppress -Warray-bounds entirely because of noisy output, currently unhappy with immer implementation. -AX_CHECK_COMPILE_FLAG([-Warray-bounds], [NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-array-bounds"], [], [$CXXFLAG_WERROR], [AC_LANG_SOURCE([ - #if defined(__clang__) || defined(__INTEL_COMPILER) || !defined(__GNUC__) - #error Non-GCC compiler detected, not setting flag - #endif - int main(void) { return 0; } -])]) - -dnl -Wstringop-overread and -Wstringop-overflow are broken in GCC. Suppress warnings entirely to avoid noisy output. -AX_CHECK_COMPILE_FLAG([-Wstringop-overread], [NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-stringop-overread"], [], [$CXXFLAG_WERROR], [AC_LANG_SOURCE([ - #if defined(__clang__) || defined(__INTEL_COMPILER) || !defined(__GNUC__) - #error Non-GCC compiler detected, not setting flag - #endif - int main(void) { return 0; } -])]) -AX_CHECK_COMPILE_FLAG([-Wstringop-overflow], [NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-stringop-overflow"], [], [$CXXFLAG_WERROR], [AC_LANG_SOURCE([ - #if defined(__clang__) || defined(__INTEL_COMPILER) || !defined(__GNUC__) - #error Non-GCC compiler detected, not setting flag - #endif - int main(void) { return 0; } -])]) - -AX_CHECK_COMPILE_FLAG([-Wall], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wall"], [], [$CXXFLAG_WERROR]) -AX_CHECK_COMPILE_FLAG([-Wextra], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wextra"], [], [$CXXFLAG_WERROR]) -AX_CHECK_COMPILE_FLAG([-Wgnu], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wgnu"], [], [$CXXFLAG_WERROR]) -dnl some compilers will ignore -Wformat-security without -Wformat, so just combine the two here. -AX_CHECK_COMPILE_FLAG([-Wformat -Wformat-security], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wformat -Wformat-security"], [], [$CXXFLAG_WERROR]) -AX_CHECK_COMPILE_FLAG([-Wreorder], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wreorder"], [], [$CXXFLAG_WERROR]) -AX_CHECK_COMPILE_FLAG([-Wvla], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wvla"], [], [$CXXFLAG_WERROR]) -AX_CHECK_COMPILE_FLAG([-Wshadow-field], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wshadow-field"], [], [$CXXFLAG_WERROR]) -AX_CHECK_COMPILE_FLAG([-Wthread-safety], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wthread-safety"], [], [$CXXFLAG_WERROR]) -AX_CHECK_COMPILE_FLAG([-Wloop-analysis], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wloop-analysis"], [], [$CXXFLAG_WERROR]) -AX_CHECK_COMPILE_FLAG([-Wredundant-decls], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wredundant-decls"], [], [$CXXFLAG_WERROR]) -AX_CHECK_COMPILE_FLAG([-Wunused-member-function], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wunused-member-function"], [], [$CXXFLAG_WERROR]) -AX_CHECK_COMPILE_FLAG([-Wdate-time], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wdate-time"], [], [$CXXFLAG_WERROR]) -AX_CHECK_COMPILE_FLAG([-Wconditional-uninitialized], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wconditional-uninitialized"], [], [$CXXFLAG_WERROR]) -AX_CHECK_COMPILE_FLAG([-Wduplicated-branches], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wduplicated-branches"], [], [$CXXFLAG_WERROR]) -AX_CHECK_COMPILE_FLAG([-Wduplicated-cond], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wduplicated-cond"], [], [$CXXFLAG_WERROR]) -AX_CHECK_COMPILE_FLAG([-Wlogical-op], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wlogical-op"], [], [$CXXFLAG_WERROR]) -AX_CHECK_COMPILE_FLAG([-Woverloaded-virtual], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Woverloaded-virtual"], [], [$CXXFLAG_WERROR]) -AX_CHECK_COMPILE_FLAG([-Wsuggest-override], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wsuggest-override"], [], [$CXXFLAG_WERROR]) -AX_CHECK_COMPILE_FLAG([-Wimplicit-fallthrough], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wimplicit-fallthrough"], [], [$CXXFLAG_WERROR]) -AX_CHECK_COMPILE_FLAG([-Wunreachable-code], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wunreachable-code"], [], [$CXXFLAG_WERROR]) -AX_CHECK_COMPILE_FLAG([-Wdocumentation], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wdocumentation"], [], [$CXXFLAG_WERROR]) -AX_CHECK_COMPILE_FLAG([-Wself-assign], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wself-assign"], [], [$CXXFLAG_WERROR]) -AX_CHECK_COMPILE_FLAG([-Wundef], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wundef"], [], [$CXXFLAG_WERROR]) - -dnl Some compilers (gcc) ignore unknown -Wno-* options, but warn about all -dnl unknown options if any other warning is produced. Test the -Wfoo case, and -dnl set the -Wno-foo case if it works. -AX_CHECK_COMPILE_FLAG([-Wunused-parameter], [NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-unused-parameter"], [], [$CXXFLAG_WERROR]) - -dnl Don't allow extended (non-ASCII) symbols in identifiers. This is easier for code review. -AX_CHECK_COMPILE_FLAG([-fno-extended-identifiers], [CORE_CXXFLAGS="$CORE_CXXFLAGS -fno-extended-identifiers"], [], [$CXXFLAG_WERROR]) - -dnl Currently all versions of gcc are subject to a class of bugs, see the -dnl gccbug_90348 test case (only reproduces on GCC 11 and earlier) and -dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111843. To work around that, set -dnl -fstack-reuse=none for all gcc builds. (Only gcc understands this flag) -AX_CHECK_COMPILE_FLAG([-fstack-reuse=none], [CORE_CXXFLAGS="$CORE_CXXFLAGS -fstack-reuse=none"]) - -enable_arm_aes=no -enable_arm_crc=no -enable_arm_neon=no -enable_arm_shani=no -enable_ssse3=no -enable_sse42=no -enable_sse41=no -enable_avx2=no -enable_x86_aesni=no -enable_x86_shani=no - -dnl Check for optional instruction set support. Enabling these does _not_ imply that all code will -dnl be compiled with them, rather that specific objects/libs may use them after checking for runtime -dnl compatibility. - -dnl x86 -AX_CHECK_COMPILE_FLAG([-mssse3], [SSSE3_CXXFLAGS="-mssse3"], [], [$CXXFLAG_WERROR]) -AX_CHECK_COMPILE_FLAG([-msse4.2], [SSE42_CXXFLAGS="-msse4.2"], [], [$CXXFLAG_WERROR]) -AX_CHECK_COMPILE_FLAG([-msse4.1], [SSE41_CXXFLAGS="-msse4.1"], [], [$CXXFLAG_WERROR]) -AX_CHECK_COMPILE_FLAG([-mavx -mavx2], [AVX2_CXXFLAGS="-mavx -mavx2"], [], [$CXXFLAG_WERROR]) -AX_CHECK_COMPILE_FLAG([-msse4.1 -maes], [X86_AESNI_CXXFLAGS="-msse4.1 -maes"], [], [$CXXFLAG_WERROR]) -AX_CHECK_COMPILE_FLAG([-msse4 -msha], [X86_SHANI_CXXFLAGS="-msse4 -msha"], [], [$CXXFLAG_WERROR]) - -enable_clmul= -AX_CHECK_COMPILE_FLAG([-mpclmul], [enable_clmul=yes], [], [$CXXFLAG_WERROR], [AC_LANG_PROGRAM([ - #include - #include -], [ - __m128i a = _mm_cvtsi64_si128((uint64_t)7); - __m128i b = _mm_clmulepi64_si128(a, a, 37); - __m128i c = _mm_srli_epi64(b, 41); - __m128i d = _mm_xor_si128(b, c); - uint64_t e = _mm_cvtsi128_si64(d); - return e == 0; -])]) - -if test "$enable_clmul" = "yes"; then - CLMUL_CXXFLAGS="-mpclmul" - AC_DEFINE([HAVE_CLMUL], [1], [Define this symbol if clmul instructions can be used]) -fi - -TEMP_CXXFLAGS="$CXXFLAGS" -CXXFLAGS="$SSSE3_CXXFLAGS $CXXFLAGS" -AC_MSG_CHECKING([for SSSE3 intrinsics]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - ]],[[ - __m64 x = _mm_abs_pi32(_m_from_int(0)); - return 0; - ]])], - [ AC_MSG_RESULT([yes]); enable_ssse3=yes; AC_DEFINE([ENABLE_SSSE3], [1], [Define this symbol to build code that uses SSSE3 intrinsics]) ], - [ AC_MSG_RESULT([no])] -) -CXXFLAGS="$TEMP_CXXFLAGS" - -TEMP_CXXFLAGS="$CXXFLAGS" -CXXFLAGS="$SSE42_CXXFLAGS $CXXFLAGS" -AC_MSG_CHECKING([for SSE4.2 intrinsics]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #if defined(_MSC_VER) - #include - #elif defined(__GNUC__) && defined(__SSE4_2__) - #include - #endif - ]],[[ - uint64_t l = 0; - l = _mm_crc32_u8(l, 0); - l = _mm_crc32_u32(l, 0); - l = _mm_crc32_u64(l, 0); - return l; - ]])], - [ AC_MSG_RESULT([yes]); enable_sse42=yes], - [ AC_MSG_RESULT([no])] -) -CXXFLAGS="$TEMP_CXXFLAGS" - -TEMP_CXXFLAGS="$CXXFLAGS" -CXXFLAGS="$SSE41_CXXFLAGS $CXXFLAGS" -AC_MSG_CHECKING([for SSE4.1 intrinsics]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - ]],[[ - __m128i a = _mm_set1_epi32(0); - __m128i b = _mm_set1_epi32(1); - __m128i r = _mm_blend_epi16(a, b, 0xFF); - return _mm_extract_epi32(r, 3); - ]])], - [ AC_MSG_RESULT([yes]); enable_sse41=yes; AC_DEFINE([ENABLE_SSE41], [1], [Define this symbol to build code that uses SSE4.1 intrinsics]) ], - [ AC_MSG_RESULT([no])] -) -CXXFLAGS="$TEMP_CXXFLAGS" - -TEMP_CXXFLAGS="$CXXFLAGS" -CXXFLAGS="$AVX2_CXXFLAGS $CXXFLAGS" -AC_MSG_CHECKING([for AVX2 intrinsics]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #include - ]],[[ - __m256i l = _mm256_set1_epi32(0); - return _mm256_extract_epi32(l, 7); - ]])], - [ AC_MSG_RESULT([yes]); enable_avx2=yes; AC_DEFINE([ENABLE_AVX2], [1], [Define this symbol to build code that uses AVX2 intrinsics]) ], - [ AC_MSG_RESULT([no])] -) -CXXFLAGS="$TEMP_CXXFLAGS" - -TEMP_CXXFLAGS="$CXXFLAGS" -CXXFLAGS="$X86_SHANI_CXXFLAGS $CXXFLAGS" -AC_MSG_CHECKING([for x86 SHA-NI intrinsics]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #include - ]],[[ - __m128i i = _mm_set1_epi32(0); - __m128i j = _mm_set1_epi32(1); - __m128i k = _mm_set1_epi32(2); - return _mm_extract_epi32(_mm_sha256rnds2_epu32(i, i, k), 0); - ]])], - [ AC_MSG_RESULT([yes]); enable_x86_shani=yes; AC_DEFINE([ENABLE_X86_SHANI], [1], [Define this symbol to build code that uses x86 SHA-NI intrinsics]) ], - [ AC_MSG_RESULT([no])] -) -CXXFLAGS="$TEMP_CXXFLAGS" - -TEMP_CXXFLAGS="$CXXFLAGS" -CXXFLAGS="$X86_AESNI_CXXFLAGS $CXXFLAGS" -AC_MSG_CHECKING([for x86 AES-NI intrinsics]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #include - #include - ]],[[ - __m128i x = _mm_setzero_si128(); - x = _mm_aesenc_si128(x, _mm_setzero_si128()); - return _mm_extract_epi32(x, 0); - ]])], - [ AC_MSG_RESULT([yes]); enable_x86_aesni=yes; AC_DEFINE([ENABLE_X86_AESNI], [1], [Define this symbol to build code that uses x86 AES-NI intrinsics]) ], - [ AC_MSG_RESULT([no])] -) -CXXFLAGS="$TEMP_CXXFLAGS" - -# ARM -AX_CHECK_COMPILE_FLAG([-march=armv8-a+crc+crypto], [ARM_CRC_CXXFLAGS="-march=armv8-a+crc+crypto"], [], [$CXXFLAG_WERROR]) -AX_CHECK_COMPILE_FLAG([-march=armv8-a+crypto], [ARM_AES_CXXFLAGS="-march=armv8-a+crypto"; ARM_SHANI_CXXFLAGS="-march=armv8-a+crypto"], [], [$CXXFLAG_WERROR]) - -TEMP_CXXFLAGS="$CXXFLAGS" -CXXFLAGS="$ARM_AES_CXXFLAGS $CXXFLAGS" -AC_MSG_CHECKING([for ARMv8 AES intrinsics]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - ]],[[ - uint8x16_t a, b; - vaesmcq_u8(vaeseq_u8(a, b)); - return 0; - ]])], - [ AC_MSG_RESULT([yes]); enable_arm_aes=yes; AC_DEFINE([ENABLE_ARM_AES], [1], [Define this symbol to build code that uses ARMv8 AES intrinsics]) ], - [ AC_MSG_RESULT([no])] -) -CXXFLAGS="$TEMP_CXXFLAGS" - -TEMP_CXXFLAGS="$CXXFLAGS" -CXXFLAGS="$ARM_CRC_CXXFLAGS $CXXFLAGS" -AC_MSG_CHECKING([for ARMv8 CRC32 intrinsics]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #include - ]],[[ -#ifdef __aarch64__ - __crc32cb(0, 0); __crc32ch(0, 0); __crc32cw(0, 0); __crc32cd(0, 0); - vmull_p64(0, 0); -#else -#error "crc32c library does not support hardware acceleration on 32-bit ARM" -#endif - ]])], - [ AC_MSG_RESULT([yes]); enable_arm_crc=yes; ], - [ AC_MSG_RESULT([no])] -) -CXXFLAGS="$TEMP_CXXFLAGS" - -ARM_NEON_CXXFLAGS="" -TEMP_CXXFLAGS="$CXXFLAGS" -for flag in "-march=armv8-a" "-march=armv7-a -mfpu=neon"; do - AX_CHECK_COMPILE_FLAG([$flag], [ - CXXFLAGS="$CXXFLAGS $flag" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - ]], [[ - float32x4_t f = vdupq_n_f32(0.0); - return 0; - ]])], [ - ARM_NEON_CXXFLAGS="$flag" - enable_arm_neon=yes - AC_DEFINE([ENABLE_ARM_NEON], [1], [Define this symbol to build code that uses ARM NEON intrinsics]) - break - ]) - CXXFLAGS="$TEMP_CXXFLAGS" - ]) -done -CXXFLAGS="$TEMP_CXXFLAGS" - -TEMP_CXXFLAGS="$CXXFLAGS" -CXXFLAGS="$ARM_SHANI_CXXFLAGS $CXXFLAGS" -AC_MSG_CHECKING([for ARMv8 SHA-NI intrinsics]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #include - ]],[[ - uint32x4_t a, b, c; - vsha256h2q_u32(a, b, c); - vsha256hq_u32(a, b, c); - vsha256su0q_u32(a, b); - vsha256su1q_u32(a, b, c); - ]])], - [ AC_MSG_RESULT([yes]); enable_arm_shani=yes; AC_DEFINE([ENABLE_ARM_SHANI], [1], [Define this symbol to build code that uses ARMv8 SHA-NI intrinsics]) ], - [ AC_MSG_RESULT([no])] -) -CXXFLAGS="$TEMP_CXXFLAGS" - -CORE_CPPFLAGS="$CORE_CPPFLAGS -DHAVE_BUILD_INFO -DGSL_NO_IOSTREAMS" - -AC_ARG_WITH([utils], - [AS_HELP_STRING([--with-utils], - [build dash-cli dash-tx dash-util dash-wallet (default=yes)])], - [build_bitcoin_utils=$withval], - [build_bitcoin_utils=yes]) - -AC_ARG_ENABLE([util-cli], - [AS_HELP_STRING([--enable-util-cli], - [build dash-cli])], - [build_bitcoin_cli=$enableval], - [build_bitcoin_cli=$build_bitcoin_utils]) - -AC_ARG_ENABLE([util-tx], - [AS_HELP_STRING([--enable-util-tx], - [build dash-tx])], - [build_bitcoin_tx=$enableval], - [build_bitcoin_tx=$build_bitcoin_utils]) - -AC_ARG_ENABLE([util-wallet], - [AS_HELP_STRING([--enable-util-wallet], - [build dash-wallet])], - [build_bitcoin_wallet=$enableval], - [build_bitcoin_wallet=$build_bitcoin_utils]) - -AC_ARG_ENABLE([util-util], - [AS_HELP_STRING([--enable-util-util], - [build dash-util])], - [build_bitcoin_util=$enableval], - [build_bitcoin_util=$build_bitcoin_utils]) - -AC_ARG_ENABLE([experimental-util-chainstate], - [AS_HELP_STRING([--enable-experimental-util-chainstate], - [build experimental dash-chainstate executable (default=no)])], - [build_bitcoin_chainstate=$enableval], - [build_bitcoin_chainstate=no]) - - -AC_ARG_WITH([libs], - [AS_HELP_STRING([--with-libs], - [build libraries (default=yes)])], - [build_bitcoin_libs=$withval], - [build_bitcoin_libs=yes]) - -AC_ARG_WITH([experimental-kernel-lib], - [AS_HELP_STRING([--with-experimental-kernel-lib], - [build experimental dashkernel library (default is to build if we're building libraries and the experimental build-chainstate executable)])], - [build_experimental_kernel_lib=$withval], - [build_experimental_kernel_lib=auto]) - -AC_ARG_WITH([daemon], - [AS_HELP_STRING([--with-daemon], - [build dashd daemon (default=yes)])], - [build_bitcoind=$withval], - [build_bitcoind=yes]) - -case $host in - *mingw*) - TARGET_OS=windows - AC_CHECK_LIB([kernel32], [GetModuleFileNameA], [], [AC_MSG_ERROR([libkernel32 missing])]) - AC_CHECK_LIB([user32], [main], [], [AC_MSG_ERROR([libuser32 missing])]) - AC_CHECK_LIB([gdi32], [main], [], [AC_MSG_ERROR([libgdi32 missing])]) - AC_CHECK_LIB([comdlg32], [main], [], [AC_MSG_ERROR([libcomdlg32 missing])]) - AC_CHECK_LIB([winmm], [main], [], [AC_MSG_ERROR([libwinmm missing])]) - AC_CHECK_LIB([shell32], [SHGetSpecialFolderPathW], [], [AC_MSG_ERROR([libshell32 missing])]) - AC_CHECK_LIB([comctl32], [main], [], [AC_MSG_ERROR([libcomctl32 missing])]) - AC_CHECK_LIB([ole32], [CoCreateInstance], [], [AC_MSG_ERROR([libole32 missing])]) - AC_CHECK_LIB([oleaut32], [main], [], [AC_MSG_ERROR([liboleaut32 missing])]) - AC_CHECK_LIB([uuid], [main], [], [AC_MSG_ERROR([libuuid missing])]) - AC_CHECK_LIB([advapi32], [CryptAcquireContextW], [], [AC_MSG_ERROR([libadvapi32 missing])]) - AC_CHECK_LIB([ws2_32], [WSAStartup], [], [AC_MSG_ERROR([libws2_32 missing])]) - AC_CHECK_LIB([shlwapi], [PathRemoveFileSpecW], [], [AC_MSG_ERROR([libshlwapi missing])]) - AC_CHECK_LIB([iphlpapi], [GetAdaptersAddresses], [], [AC_MSG_ERROR([libiphlpapi missing])]) - AC_CHECK_LIB([psapi], [GetProcessMemoryInfo], [], [AC_MSG_ERROR([libpsapi missing])]) - AC_CHECK_LIB([bcrypt], [main], [], [AC_MSG_ERROR([libbcrypt missing])]) - - dnl -static is interpreted by libtool, where it has a different meaning. - dnl In libtool-speak, it's -all-static. - AX_CHECK_LINK_FLAG([-static], [LIBTOOL_APP_LDFLAGS="$LIBTOOL_APP_LDFLAGS -all-static"]) - - AC_PATH_PROG([MAKENSIS], [makensis], [none]) - if test "$MAKENSIS" = "none"; then - AC_MSG_WARN([makensis not found. Cannot create installer.]) - fi - - AC_PATH_TOOL([WINDRES], [windres], [none]) - if test "$WINDRES" = "none"; then - AC_MSG_ERROR([windres not found]) - fi - - CORE_CPPFLAGS="$CORE_CPPFLAGS -DSECP256K1_STATIC" - - CORE_CPPFLAGS="$CORE_CPPFLAGS -D_MT -DWIN32 -D_WINDOWS -D_WIN32_WINNT=0x0A00 -D_WIN32_IE=0x0A00 -DWIN32_LEAN_AND_MEAN" - dnl Prevent the definition of min/max macros. - dnl We always want to use the standard library. - CORE_CPPFLAGS="$CORE_CPPFLAGS -DNOMINMAX" - - dnl libtool insists upon adding -nostdlib and a list of objects/libs to link against. - dnl That breaks our ability to build dll's with static libgcc/libstdc++/libssp. Override - dnl its command here, with the predeps/postdeps removed, and -static inserted. Postdeps are - dnl also overridden to prevent their insertion later. - dnl This should only affect dll's. - archive_cmds_CXX="\$CC -shared \$libobjs \$deplibs \$compiler_flags -static -o \$output_objdir/\$soname \${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker \$lib" - postdeps_CXX= - - dnl We support Windows 10+, however it's not possible to set these values accordingly, - dnl due to a bug in mingw-w64. See https://sourceforge.net/p/mingw-w64/bugs/968/. - dnl As a best effort, target Windows 8. - AX_CHECK_LINK_FLAG([-Wl,--major-subsystem-version -Wl,6 -Wl,--minor-subsystem-version -Wl,2], [CORE_LDFLAGS="$CORE_LDFLAGS -Wl,--major-subsystem-version -Wl,6 -Wl,--minor-subsystem-version -Wl,2"], [], [$LDFLAG_WERROR]) - - dnl Avoid the use of aligned vector instructions when building for Windows. - dnl See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54412. - AX_CHECK_COMPILE_FLAG([-Wa,-muse-unaligned-vector-move], [CORE_CXXFLAGS="$CORE_CXXFLAGS -Wa,-muse-unaligned-vector-move"], [], [$CXXFLAG_WERROR]) - ;; - *darwin*) - TARGET_OS=darwin - if test $cross_compiling != "yes"; then - BUILD_OS=darwin - - AX_CHECK_LINK_FLAG([-Wl,-headerpad_max_install_names], [CORE_LDFLAGS="$CORE_LDFLAGS -Wl,-headerpad_max_install_names"], [], [$LDFLAG_WERROR]) - - AC_CHECK_PROG([BREW], [brew], [brew]) - if test "$BREW" = "brew"; then - dnl These Homebrew packages may be keg-only, meaning that they won't be found - dnl in expected paths because they may conflict with system files. Ask - dnl Homebrew where each one is located, then adjust paths accordingly. - dnl It's safe to add these paths even if the functionality is disabled by - dnl the user (--without-wallet or --without-gui for example). - - dnl Homebrew may create symlinks in /usr/local/include for some packages. - dnl Because MacOS's clang internally adds "-I /usr/local/include" to its search - dnl paths, this will negate efforts to use -isystem for those packages, as they - dnl will be found first in /usr/local. Use the internal "-internal-isystem" - dnl option to system-ify all /usr/local/include paths without adding it to the list - dnl of search paths in case it's not already there. - if test "$suppress_external_warnings" != "no"; then - AX_CHECK_PREPROC_FLAG([-Xclang -internal-isystem -Xclang /usr/local/include/], [CORE_CPPFLAGS="$CORE_CPPFLAGS -Xclang -internal-isystem -Xclang /usr/local/include/"], [], [$CXXFLAG_WERROR]) - fi - - if test "$use_bdb" != "no" && $BREW list --versions berkeley-db@4 >/dev/null && test "$BDB_CFLAGS" = "" && test "$BDB_LIBS" = ""; then - bdb_prefix=$($BREW --prefix berkeley-db@4 2>/dev/null) - dnl This must precede the call to BITCOIN_FIND_BDB48 below. - BDB_CFLAGS="-I$bdb_prefix/include" - BDB_LIBS="-L$bdb_prefix/lib -ldb_cxx-4.8" - fi - - if $BREW list --versions qt@5 >/dev/null; then - export PKG_CONFIG_PATH="$($BREW --prefix qt@5 2>/dev/null)/lib/pkgconfig:$PKG_CONFIG_PATH" - fi - - case $host in - *aarch64*) - dnl The preferred Homebrew prefix for Apple Silicon is /opt/homebrew. - dnl Therefore, as we do not use pkg-config to detect miniupnpc and libnatpmp - dnl packages, we should set the CPPFLAGS and LDFLAGS variables for them - dnl explicitly. - if test "$use_upnp" != "no" && $BREW list --versions miniupnpc >/dev/null; then - miniupnpc_prefix=$($BREW --prefix miniupnpc 2>/dev/null) - if test "$suppress_external_warnings" != "no"; then - MINIUPNPC_CPPFLAGS="-isystem $miniupnpc_prefix/include" - else - MINIUPNPC_CPPFLAGS="-I$miniupnpc_prefix/include" - fi - MINIUPNPC_LIBS="-L$miniupnpc_prefix/lib" - fi - if test "$use_natpmp" != "no" && $BREW list --versions libnatpmp >/dev/null; then - libnatpmp_prefix=$($BREW --prefix libnatpmp 2>/dev/null) - if test "$suppress_external_warnings" != "no"; then - NATPMP_CPPFLAGS="-isystem $libnatpmp_prefix/include" - else - NATPMP_CPPFLAGS="-I$libnatpmp_prefix/include" - fi - NATPMP_LIBS="-L$libnatpmp_prefix/lib" - fi - ;; - esac - fi - else - case $build_os in - *darwin*) - BUILD_OS=darwin - ;; - *) - AC_PATH_TOOL([DSYMUTIL], [dsymutil], dsymutil) - AC_PATH_PROG([ZIP], [zip], [zip]) - - dnl libtool will try to strip the static lib, which is a problem for - dnl cross-builds because strip attempts to call a hard-coded ld, - dnl which may not exist in the path. Stripping the .a is not - dnl necessary, so just disable it. - old_striplib= - ;; - esac - fi - - CORE_CPPFLAGS="$CORE_CPPFLAGS -DMAC_OSX -DOBJC_OLD_DISPATCH_PROTOTYPES=0" - - dnl ignore deprecated-declarations warnings coming from objcxx code - dnl "'NSUserNotificationCenter' is deprecated: first deprecated in macOS 11.0". - OBJCXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations" - ;; - *linux*) - TARGET_OS=linux - ;; - *freebsd*) - TARGET_OS=freebsd - ;; -esac - -if test "$use_extended_functional_tests" != "no"; then - AC_SUBST(EXTENDED_FUNCTIONAL_TESTS, --extended) -fi - -if test "$use_lcov" = "yes"; then - if test "$LCOV" = ""; then - AC_MSG_ERROR([lcov testing requested but lcov not found]) - fi - if test "$PYTHON" = ""; then - AC_MSG_ERROR([lcov testing requested but python not found]) - fi - if test "$GENHTML" = ""; then - AC_MSG_ERROR([lcov testing requested but genhtml not found]) - fi - - AC_MSG_CHECKING([whether compiler is Clang]) - AC_PREPROC_IFELSE([AC_LANG_SOURCE([[ - #if defined(__clang__) && defined(__llvm__) - // Compiler is Clang - #else - # error Compiler is not Clang - #endif - ]])],[ - AC_MSG_RESULT([yes]) - if test "$LLVM_COV" = ""; then - AC_MSG_ERROR([lcov testing requested but llvm-cov not found]) - fi - COV_TOOL="$LLVM_COV gcov" - ],[ - AC_MSG_RESULT([no]) - if test "$GCOV" = ""; then - AC_MSG_ERROR([lcov testing requested but gcov not found]) - fi - COV_TOOL="$GCOV" - ]) - AC_SUBST(COV_TOOL) - AC_SUBST(COV_TOOL_WRAPPER, "cov_tool_wrapper.sh") - LCOV="$LCOV --gcov-tool $(pwd)/$COV_TOOL_WRAPPER" - - AX_CHECK_LINK_FLAG([--coverage], [CORE_LDFLAGS="$CORE_LDFLAGS --coverage"], - [AC_MSG_ERROR([lcov testing requested but --coverage linker flag does not work])]) - AX_CHECK_COMPILE_FLAG([--coverage],[CORE_CXXFLAGS="$CORE_CXXFLAGS --coverage"], - [AC_MSG_ERROR([lcov testing requested but --coverage flag does not work])]) - CORE_CXXFLAGS="$CORE_CXXFLAGS -Og" - - AC_SUBST(LCOV_OPTS) -fi - -dnl Check for endianness -AC_C_BIGENDIAN - -dnl Check for pthread compile/link requirements -AX_PTHREAD - -dnl Check if -latomic is required for -CHECK_ATOMIC - -dnl The following macro will add the necessary defines to bitcoin-config.h, but -dnl they also need to be passed down to any subprojects. Pull the results out of -dnl the cache and add them to CPPFLAGS. -AC_SYS_LARGEFILE -dnl detect POSIX or GNU variant of strerror_r -AC_FUNC_STRERROR_R - -if test "$ac_cv_sys_file_offset_bits" != "" && - test "$ac_cv_sys_file_offset_bits" != "no" && - test "$ac_cv_sys_file_offset_bits" != "unknown"; then - CORE_CPPFLAGS="$CORE_CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits" -fi - -if test "$ac_cv_sys_large_files" != "" && - test "$ac_cv_sys_large_files" != "no" && - test "$ac_cv_sys_large_files" != "unknown"; then - CORE_CPPFLAGS="$CORE_CPPFLAGS -D_LARGE_FILES=$ac_cv_sys_large_files" -fi - -if test "$TARGET_OS" != "windows"; then - dnl All windows code is PIC, forcing it on just adds useless compile warnings - AX_CHECK_COMPILE_FLAG([-fPIC], [PIC_FLAGS="-fPIC"]) -fi - -if test "$use_hardening" != "no"; then - AX_CHECK_COMPILE_FLAG([-Wstack-protector], [HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -Wstack-protector"]) - AX_CHECK_COMPILE_FLAG([-fstack-protector-all], [HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-protector-all"]) - - AX_CHECK_COMPILE_FLAG([-fcf-protection=full], [HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fcf-protection=full"]) - - case $host in - *mingw*) - dnl stack-clash-protection is a no-op for Windows. - dnl See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90458 for more details. - ;; - *) - AX_CHECK_COMPILE_FLAG([-fstack-clash-protection], [HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-clash-protection"], [], [$CXXFLAG_WERROR]) - ;; - esac - - case $host in - *aarch64*) - AX_CHECK_COMPILE_FLAG([-mbranch-protection=bti], [HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -mbranch-protection=bti"]) - ;; - esac - - dnl _FORTIFY_SOURCE requires that there is some level of optimization, - dnl otherwise it does nothing and just creates a compiler warning. - dnl The probe sees the -O flags in compile-line order ($(AM_CXXFLAGS) before - dnl $(CXXFLAGS)), so a user-supplied -O2 still counts after --enable-debug's -O0. - AX_CHECK_PREPROC_FLAG([-D_FORTIFY_SOURCE=3],[ - AX_CHECK_PREPROC_FLAG([-U_FORTIFY_SOURCE],[ - HARDENED_CPPFLAGS="$HARDENED_CPPFLAGS -U_FORTIFY_SOURCE" - ]) - HARDENED_CPPFLAGS="$HARDENED_CPPFLAGS -D_FORTIFY_SOURCE=3" - ], [], [$CORE_CXXFLAGS $DEBUG_CXXFLAGS $CXXFLAGS], [AC_LANG_PROGRAM([[ - #if !defined __OPTIMIZE__ || __OPTIMIZE__ <= 0 - #error - #endif - ]])]) - - AX_CHECK_LINK_FLAG([-Wl,--enable-reloc-section], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--enable-reloc-section"], [], [$LDFLAG_WERROR]) - AX_CHECK_LINK_FLAG([-Wl,--dynamicbase], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--dynamicbase"], [], [$LDFLAG_WERROR]) - AX_CHECK_LINK_FLAG([-Wl,--nxcompat], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--nxcompat"], [], [$LDFLAG_WERROR]) - AX_CHECK_LINK_FLAG([-Wl,--high-entropy-va], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--high-entropy-va"], [], [$LDFLAG_WERROR]) - AX_CHECK_LINK_FLAG([-Wl,-z,relro], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,relro"], [], [$LDFLAG_WERROR]) - AX_CHECK_LINK_FLAG([-Wl,-z,now], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"], [], [$LDFLAG_WERROR]) - AX_CHECK_LINK_FLAG([-Wl,-z,separate-code], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,separate-code"], [], [$LDFLAG_WERROR]) - AX_CHECK_LINK_FLAG([-fPIE -pie], [PIE_FLAGS="-fPIE"; HARDENED_LDFLAGS="$HARDENED_LDFLAGS -pie"], [], [$CXXFLAG_WERROR]) -fi - -dnl Add build-id for perf and debug symbol matching (Linux only) -if test "$TARGET_OS" = "linux"; then - AX_CHECK_LINK_FLAG([-Wl,--build-id=sha1], [CORE_LDFLAGS="$CORE_LDFLAGS -Wl,--build-id=sha1"], [], [$LDFLAG_WERROR]) -fi - -dnl These flags are specific to ld64, and may cause issues with other linkers. -dnl For example: GNU ld will interpret -dead_strip as -de and then try and use -dnl "ad_strip" as the symbol for the entry point. -if test "$TARGET_OS" = "darwin"; then - AX_CHECK_LINK_FLAG([-Wl,-dead_strip], [CORE_LDFLAGS="$CORE_LDFLAGS -Wl,-dead_strip"], [], [$LDFLAG_WERROR]) - AX_CHECK_LINK_FLAG([-Wl,-dead_strip_dylibs], [CORE_LDFLAGS="$CORE_LDFLAGS -Wl,-dead_strip_dylibs"], [], [$LDFLAG_WERROR]) - AX_CHECK_LINK_FLAG([-Wl,-fixup_chains], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-fixup_chains"], [], [$LDFLAG_WERROR]) -fi - -AC_CHECK_HEADERS([sys/select.h sys/prctl.h vm/vm_param.h sys/vmmeter.h sys/resources.h]) - -AC_CHECK_DECLS([getifaddrs, freeifaddrs],[CHECK_SOCKET],, - [#include - #include ] -) - -dnl These are used for daemonization in dashd -AC_CHECK_DECLS([fork]) -AC_CHECK_DECLS([setsid]) - -AC_CHECK_DECLS([pipe2]) - -dnl Check for mallopt(M_ARENA_MAX) (to set glibc arenas) -AC_MSG_CHECKING([for mallopt M_ARENA_MAX]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], - [[ mallopt(M_ARENA_MAX, 1); ]])], - [ AC_MSG_RESULT([yes]); AC_DEFINE([HAVE_MALLOPT_ARENA_MAX], [1], [Define this symbol if you have mallopt with M_ARENA_MAX]) ], - [ AC_MSG_RESULT([no])] -) - -dnl Check for malloc_info (for memory statistics information in getmemoryinfo) -AC_MSG_CHECKING([for getmemoryinfo]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], - [[ int f = malloc_info(0, NULL); ]])], - [ AC_MSG_RESULT([yes]); AC_DEFINE([HAVE_MALLOC_INFO], [1], [Define this symbol if you have malloc_info]) ], - [ AC_MSG_RESULT([no])] -) - -dnl Check for posix_fallocate -AC_MSG_CHECKING([for posix_fallocate]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - // same as in src/util/fs_helpers.cpp - #ifdef __linux__ - #ifdef _POSIX_C_SOURCE - #undef _POSIX_C_SOURCE - #endif - #define _POSIX_C_SOURCE 200112L - #endif // __linux__ - #include ]], - [[ int f = posix_fallocate(0, 0, 0); ]])], - [ AC_MSG_RESULT([yes]); AC_DEFINE([HAVE_POSIX_FALLOCATE], [1], [Define this symbol if you have posix_fallocate]) ], - [ AC_MSG_RESULT([no])] -) - -AC_MSG_CHECKING([for default visibility attribute]) -AC_COMPILE_IFELSE([AC_LANG_SOURCE([ - int foo(void) __attribute__((visibility("default"))); - int main(){} - ])], - [ - AC_DEFINE([HAVE_DEFAULT_VISIBILITY_ATTRIBUTE], [1], [Define if the visibility attribute is supported.]) - AC_MSG_RESULT([yes]) - ], - [ - AC_MSG_RESULT([no]) - if test "$use_reduce_exports" = "yes"; then - AC_MSG_ERROR([Cannot find a working visibility attribute. Use --disable-reduce-exports.]) - fi - ] -) - -AC_MSG_CHECKING([for dllexport attribute]) -AC_COMPILE_IFELSE([AC_LANG_SOURCE([ - __declspec(dllexport) int foo(void); - int main(){} - ])], - [ - AC_DEFINE([HAVE_DLLEXPORT_ATTRIBUTE], [1], [Define if the dllexport attribute is supported.]) - AC_MSG_RESULT([yes]) - ], - [AC_MSG_RESULT([no])] -) - -BACKTRACE_FLAGS= -BACKTRACE_LDFLAGS= -BACKTRACE_LIBS= -if test "$enable_stacktraces" != "no"; then - AC_CHECK_HEADERS([backtrace.h], [ - if test "$TARGET_OS" = "windows"; then - BACKTRACE_LIBS="$BACKTRACE_LIBS -ldbghelp" - else - AC_CHECK_HEADERS([execinfo.h], [ - case $host in - *bsd*) - AC_SEARCH_LIBS([backtrace], [execinfo], [ - BACKTRACE_LIBS="$BACKTRACE_LIBS -lexecinfo" - ], [ - if test "$enable_stacktraces" = "yes"; then - AC_MSG_ERROR([--enable-stacktraces was specified but cannot locate libexecinfo]) - fi - AC_MSG_WARN([cannot locate libexecinfo, stacktraces will be disabled]) - enable_stacktraces=no - ]) - ;; - esac - AX_CHECK_LINK_FLAG([-Wl,-export-dynamic], [BACKTRACE_LDFLAGS="$BACKTRACE_LDFLAGS -Wl,-export-dynamic"], [ - AX_CHECK_LINK_FLAG([-rdynamic], [BACKTRACE_LDFLAGS="$BACKTRACE_LDFLAGS -rdynamic"], [ - if test "$enable_stacktraces" = "yes"; then - AC_MSG_ERROR([--enable-stacktraces was specified but cannot set requisite linker flags]) - fi - AC_MSG_WARN([cannot set requisite linker flags, stacktraces will be disabled]) - enable_stacktraces=no - ], [$LDFLAG_WERROR]) - ], [$LDFLAG_WERROR]) - ], [ - if test "$enable_stacktraces" = "yes"; then - AC_MSG_ERROR([--enable-stacktraces was specified but execinfo.h was not found]) - fi - AC_MSG_WARN([execinfo.h was not found, stacktraces will be disabled]) - enable_stacktraces=no - ]) - fi - BACKTRACE_LIBS="$BACKTRACE_LIBS -lbacktrace" - dnl The libbacktrace pinned in depends understands DWARF 5, so the - dnl compiler's default debug format is used as-is. A -gdwarf-4 pin - dnl previously lived here and, being a -g-family flag, also forced - dnl debug level 2 onto every build. - if test "$TARGET_OS" = "darwin"; then - AX_CHECK_COMPILE_FLAG([-fno-standalone-debug], [BACKTRACE_FLAGS="$BACKTRACE_FLAGS -fno-standalone-debug"], [ - if test "$enable_stacktraces" = "yes"; then - AC_MSG_ERROR([--enable-stacktraces was specified but cannot set -fno-standalone-debug]) - fi - AC_MSG_WARN([cannot set -fno-standalone-debug, stacktraces will be disabled]) - enable_stacktraces=no - ], [$CXXFLAG_WERROR]) - fi - ], [ - if test "$enable_stacktraces" = "yes"; then - AC_MSG_ERROR([--enable-stacktraces was specified but backtrace.h was not found]) - fi - AC_MSG_WARN([backtrace.h was not found, stacktraces will be disabled]) - enable_stacktraces=no - ]) -fi - -dnl If auto-detection succeeded (no sub-check disabled it), promote auto to yes -if test "$enable_stacktraces" = "auto"; then - enable_stacktraces=yes -fi - -AM_CONDITIONAL([ENABLE_STACKTRACES], [test "$enable_stacktraces" = "yes"]) -if test "$enable_stacktraces" = "yes"; then - AC_DEFINE(ENABLE_STACKTRACES, 1, [Define this symbol if stacktraces should be enabled]) -else - enable_crashhooks=no -fi - -AM_CONDITIONAL([ENABLE_CRASH_HOOKS], [test "$enable_crashhooks" = "yes"]) -if test "$enable_crashhooks" = "yes"; then - AC_DEFINE(ENABLE_CRASH_HOOKS, 1, [Define this symbol if crash hooks should be enabled]) -fi - -AX_CHECK_LINK_FLAG([-Wl,-wrap=__cxa_allocate_exception], [LINK_WRAP_SUPPORTED=yes],,,) -AM_CONDITIONAL([CRASH_HOOKS_WRAPPED_CXX_ABI],[test "$LINK_WRAP_SUPPORTED" = "yes"]) - -if test "$LINK_WRAP_SUPPORTED" = "yes"; then - AC_DEFINE(CRASH_HOOKS_WRAPPED_CXX_ABI, 1, [Define this symbol to use wrapped CXX ABIs for exception stacktraces]) -fi - -dnl Check for different ways of gathering OS randomness -AC_MSG_CHECKING([for Linux getrandom function]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include ]], - [[ getrandom(nullptr, 32, 0); ]])], - [ AC_MSG_RESULT([yes]); AC_DEFINE([HAVE_GETRANDOM], [1], [Define this symbol if the Linux getrandom function call is available]) ], - [ AC_MSG_RESULT([no])] -) - -AC_MSG_CHECKING([for getentropy via sys/random.h]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include ]], - [[ getentropy(nullptr, 32) ]])], - [ AC_MSG_RESULT([yes]); AC_DEFINE([HAVE_GETENTROPY_RAND], [1], [Define this symbol if the BSD getentropy system call is available with sys/random.h]) ], - [ AC_MSG_RESULT([no])] -) - -AC_MSG_CHECKING([for sysctl]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include - #include ]], - [[ #ifdef __linux__ - #error "Don't use sysctl on Linux, it's deprecated even when it works" - #endif - sysctl(nullptr, 2, nullptr, nullptr, nullptr, 0); ]])], - [ AC_MSG_RESULT([yes]); AC_DEFINE([HAVE_SYSCTL], [1], [Define this symbol if the BSD sysctl() is available]) ], - [ AC_MSG_RESULT([no])] -) - -AC_MSG_CHECKING([for sysctl KERN_ARND]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include - #include ]], - [[ #ifdef __linux__ - #error "Don't use sysctl on Linux, it's deprecated even when it works" - #endif - static int name[2] = {CTL_KERN, KERN_ARND}; - sysctl(name, 2, nullptr, nullptr, nullptr, 0); ]])], - [ AC_MSG_RESULT([yes]); AC_DEFINE([HAVE_SYSCTL_ARND], [1], [Define this symbol if the BSD sysctl(KERN_ARND) is available]) ], - [ AC_MSG_RESULT([no])] -) - -AC_MSG_CHECKING([for fdatasync]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], - [[ fdatasync(0); ]])], - [ AC_MSG_RESULT([yes]); HAVE_FDATASYNC=1 ], - [ AC_MSG_RESULT([no]); HAVE_FDATASYNC=0 ] -) -AC_DEFINE_UNQUOTED([HAVE_FDATASYNC], [$HAVE_FDATASYNC], [Define to 1 if fdatasync is available.]) - -AC_MSG_CHECKING([for F_FULLFSYNC]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], - [[ fcntl(0, F_FULLFSYNC, 0); ]])], - [ AC_MSG_RESULT([yes]); HAVE_FULLFSYNC=1 ], - [ AC_MSG_RESULT([no]); HAVE_FULLFSYNC=0 ] -) - -AC_MSG_CHECKING([for O_CLOEXEC]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], - [[ open("", O_CLOEXEC); ]])], - [ AC_MSG_RESULT([yes]); HAVE_O_CLOEXEC=1 ], - [ AC_MSG_RESULT([no]); HAVE_O_CLOEXEC=0 ] -) -AC_DEFINE_UNQUOTED([HAVE_O_CLOEXEC], [$HAVE_O_CLOEXEC], [Define to 1 if O_CLOEXEC flag is available.]) - -dnl crc32c platform checks -AC_MSG_CHECKING([for __builtin_prefetch]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ - char data = 0; - const char* address = &data; - __builtin_prefetch(address, 0, 0); - ]])], - [ AC_MSG_RESULT([yes]); HAVE_BUILTIN_PREFETCH=1 ], - [ AC_MSG_RESULT([no]); HAVE_BUILTIN_PREFETCH=0 ] -) - -AC_MSG_CHECKING([for _mm_prefetch]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ - char data = 0; - const char* address = &data; - _mm_prefetch(address, _MM_HINT_NTA); - ]])], - [ AC_MSG_RESULT([yes]); HAVE_MM_PREFETCH=1 ], - [ AC_MSG_RESULT([no]); HAVE_MM_PREFETCH=0 ] -) - -AC_MSG_CHECKING([for strong getauxval support in the system headers]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - ]], [[ - getauxval(AT_HWCAP); - ]])], - [ AC_MSG_RESULT([yes]); HAVE_STRONG_GETAUXVAL=1; AC_DEFINE([HAVE_STRONG_GETAUXVAL], [1], [Define this symbol to build code that uses getauxval]) ], - [ AC_MSG_RESULT([no]); HAVE_STRONG_GETAUXVAL=0 ] -) - -# Check for UNIX sockets -AC_MSG_CHECKING(for sockaddr_un) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #include - ]], [[ - struct sockaddr_un addr; - addr.sun_family = AF_UNIX; - ]])], - [ AC_MSG_RESULT([yes]); AC_DEFINE([HAVE_SOCKADDR_UN], [1], [Define this symbol if platform supports unix domain sockets]) ], - [ AC_MSG_RESULT([no]); ] -) - -have_any_system=no -AC_MSG_CHECKING([for std::system]) -AC_LINK_IFELSE( - [ AC_LANG_PROGRAM( - [[ #include ]], - [[ int nErr = std::system(""); ]] - )], - [ AC_MSG_RESULT([yes]); have_any_system=yes], - [ AC_MSG_RESULT([no]) ] -) - -AC_MSG_CHECKING([for ::_wsystem]) -AC_LINK_IFELSE( - [ AC_LANG_PROGRAM( - [[ #include ]], - [[ int nErr = ::_wsystem(NULL); ]] - )], - [ AC_MSG_RESULT([yes]); have_any_system=yes], - [ AC_MSG_RESULT([no]) ] -) - -if test "$have_any_system" != "no"; then - AC_DEFINE([HAVE_SYSTEM], [1], [Define to 1 if std::system or ::wsystem is available.]) -fi - -dnl SUPPRESSED_CPPFLAGS=SUPPRESS_WARNINGS([$SOME_CPPFLAGS]) -dnl Replace -I with -isystem in $SOME_CPPFLAGS to suppress warnings from -dnl headers from its include directories and return the result. -dnl See -isystem documentation: -dnl https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html -dnl https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-isystem-directory -dnl Do not change "-I/usr/include" to "-isystem /usr/include" because that -dnl is not necessary (/usr/include is already a system directory) and because -dnl it would break GCC's #include_next. -AC_DEFUN([SUPPRESS_WARNINGS], - [[$(echo $1 |${SED} -E -e 's/(^| )-I/\1-isystem /g' -e 's;-isystem /usr/include/*( |$);-I/usr/include\1;g')]]) - -dnl enable-fuzz should disable all other targets -if test "$enable_fuzz" = "yes"; then - AC_MSG_WARN([enable-fuzz will disable all other targets and force --enable-fuzz-binary=yes]) - build_bitcoin_utils=no - build_bitcoin_cli=no - build_bitcoin_tx=no - build_bitcoin_util=no - build_bitcoin_chainstate=no - build_bitcoin_wallet=no - build_bitcoind=no - build_bitcoin_libs=no - bitcoin_enable_qt=no - bitcoin_enable_qt_test=no - bitcoin_enable_qt_dbus=no - use_bench=no - use_tests=no - use_external_signer=no - use_upnp=no - use_natpmp=no - use_zmq=no - enable_fuzz_binary=yes - - AX_CHECK_PREPROC_FLAG([-DABORT_ON_FAILED_ASSUME], [DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DABORT_ON_FAILED_ASSUME"], [], [$CXXFLAG_WERROR]) -else - BITCOIN_QT_INIT - - dnl sets $bitcoin_enable_qt, $bitcoin_enable_qt_test, $bitcoin_enable_qt_dbus - BITCOIN_QT_CONFIGURE([5.15]) - - dnl Keep a copy of the original $QT_INCLUDES and use it when invoking qt's moc - QT_INCLUDES_UNSUPPRESSED=$QT_INCLUDES - if test "$suppress_external_warnings" != "no" ; then - QT_INCLUDES=SUPPRESS_WARNINGS($QT_INCLUDES) - QT_DBUS_INCLUDES=SUPPRESS_WARNINGS($QT_DBUS_INCLUDES) - QT_TEST_INCLUDES=SUPPRESS_WARNINGS($QT_TEST_INCLUDES) - fi -fi - -if test "$enable_fuzz_binary" = "yes"; then - AC_MSG_CHECKING([whether main function is needed for fuzz binary]) - AX_CHECK_LINK_FLAG( - [], - [AC_MSG_RESULT([no])], - [AC_MSG_RESULT([yes]); CORE_CPPFLAGS="$CORE_CPPFLAGS -DPROVIDE_FUZZ_MAIN_FUNCTION"], - [$SANITIZER_LDFLAGS], - [AC_LANG_PROGRAM([[ - #include - #include - extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { return 0; } - /* comment to remove the main function ... - ]],[[ - */ int not_main() { - ]])]) -fi - -if test "$enable_wallet" != "no"; then - dnl Check for libdb_cxx only if wallet enabled - if test "$use_bdb" != "no"; then - BITCOIN_FIND_BDB48 - if test "$suppress_external_warnings" != "no" ; then - BDB_CPPFLAGS=SUPPRESS_WARNINGS($BDB_CPPFLAGS) - fi - fi - - dnl Check for sqlite3 - if test "$use_sqlite" != "no"; then - PKG_CHECK_MODULES([SQLITE], [sqlite3 >= 3.7.17], [have_sqlite=yes], [have_sqlite=no]) - fi - AC_MSG_CHECKING([whether to build wallet with support for sqlite]) - if test "$use_sqlite" = "no"; then - use_sqlite=no - elif test "$have_sqlite" = "no"; then - if test "$use_sqlite" = "yes"; then - AC_MSG_ERROR([sqlite support requested but cannot be built. Use --without-sqlite]) - fi - use_sqlite=no - else - if test "$use_sqlite" != "no"; then - AC_DEFINE([USE_SQLITE],[1],[Define if sqlite support should be compiled in]) - use_sqlite=yes - fi - fi - AC_MSG_RESULT([$use_sqlite]) - - dnl Disable wallet if both --without-bdb and --without-sqlite - if test "$use_bdb$use_sqlite" = "nono"; then - if test "$enable_wallet" = "yes"; then - AC_MSG_ERROR([wallet functionality requested but no BDB or SQLite support available.]) - fi - enable_wallet=no - fi -fi - -if test "$use_usdt" != "no"; then - AC_MSG_CHECKING([whether Userspace, Statically Defined Tracing tracepoints are supported]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM( - [#include ], - [DTRACE_PROBE(context, event); - int a, b, c, d, e, f, g; - DTRACE_PROBE7(context, event, a, b, c, d, e, f, g);] - )], - [AC_MSG_RESULT([yes]); AC_DEFINE([ENABLE_TRACING], [1], [Define to 1 to enable tracepoints for Userspace, Statically Defined Tracing])], - [AC_MSG_RESULT([no]); use_usdt=no;] - ) -fi -AM_CONDITIONAL([ENABLE_USDT_TRACEPOINTS], [test "$use_usdt" = "yes"]) - -if test "$build_bitcoind$bitcoin_enable_qt$use_bench$use_tests" = "nononono"; then - use_upnp=no - use_natpmp=no - use_zmq=no -fi - -dnl Check for libminiupnpc (optional) -if test "$use_upnp" != "no"; then - TEMP_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $MINIUPNPC_CPPFLAGS" - AC_CHECK_HEADERS([miniupnpc/miniupnpc.h miniupnpc/upnpcommands.h miniupnpc/upnperrors.h], [], [have_miniupnpc=no]) - - if test "$have_miniupnpc" != "no"; then - AC_CHECK_LIB([miniupnpc], [upnpDiscover], [MINIUPNPC_LIBS="$MINIUPNPC_LIBS -lminiupnpc"], [have_miniupnpc=no], [$MINIUPNPC_LIBS]) - - dnl The minimum supported miniUPnPc API version is set to 17. This excludes - dnl versions with known vulnerabilities. - AC_MSG_CHECKING([whether miniUPnPc API version is supported]) - AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[ - @%:@include - ]], [[ - #if MINIUPNPC_API_VERSION >= 17 - // Everything is okay - #else - # error miniUPnPc API version is too old - #endif - ]])],[ - AC_MSG_RESULT([yes]) - ],[ - AC_MSG_RESULT([no]) - AC_MSG_WARN([miniUPnPc API version < 17 is unsupported, disabling UPnP support.]) - have_miniupnpc=no - ]) - fi - CPPFLAGS="$TEMP_CPPFLAGS" -fi - -dnl Check for libnatpmp (optional). -if test "$use_natpmp" != "no"; then - TEMP_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $NATPMP_CPPFLAGS" - AC_CHECK_HEADERS([natpmp.h], [], [have_natpmp=no]) - - if test "$have_natpmp" != "no"; then - AC_CHECK_LIB([natpmp], [initnatpmp], [NATPMP_LIBS="$NATPMP_LIBS -lnatpmp"], [have_natpmp=no], [$NATPMP_LIBS]) - fi - - CPPFLAGS="$TEMP_CPPFLAGS" -fi - -dnl Check for blst (required by src/dashbls) -TEMP_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS $BLST_CPPFLAGS" -AC_CHECK_HEADERS([blst.h], [], [AC_MSG_ERROR([blst headers missing])]) -AC_CHECK_LIB([blst], [blst_p1_compress], [BLST_LIBS="$BLST_LIBS -lblst"], [AC_MSG_ERROR([libblst missing])], [$BLST_LIBS]) -CPPFLAGS="$TEMP_CPPFLAGS" - -if test "$build_bitcoin_wallet$build_bitcoin_cli$build_bitcoin_tx$build_bitcoin_util$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench$enable_fuzz_binary" = "nonononononononono"; then - use_boost=no -else - use_boost=yes -fi - -if test "$use_boost" = "yes"; then - - dnl Check for Boost headers - AX_BOOST_BASE([1.73.0],[],[AC_MSG_ERROR([Boost is not available!])]) - if test "$want_boost" = "no"; then - AC_MSG_ERROR([[only libdashconsensus can be built without boost]]) - fi - - dnl we don't use multi_index serialization - BOOST_CPPFLAGS="$BOOST_CPPFLAGS -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION" - - dnl Prevent use of std::unary_function, which was removed in C++17, - dnl and will generate warnings with newer compilers for Boost - dnl older than 1.80. - dnl See: https://github.com/boostorg/config/pull/430. - AX_CHECK_PREPROC_FLAG([-DBOOST_NO_CXX98_FUNCTION_BASE], [BOOST_CPPFLAGS="$BOOST_CPPFLAGS -DBOOST_NO_CXX98_FUNCTION_BASE"], [], [$CXXFLAG_WERROR], - [AC_LANG_PROGRAM([[#include ]])]) - - if test "$suppress_external_warnings" != "no"; then - BOOST_CPPFLAGS=SUPPRESS_WARNINGS($BOOST_CPPFLAGS) - fi -fi - -case $host in - dnl Re-enable it after enabling Windows support in cpp-subprocess. - *mingw*) - use_external_signer="no" - ;; -esac -if test "$use_external_signer" = "yes"; then - AC_DEFINE([ENABLE_EXTERNAL_SIGNER], [1], [Define if external signer support is enabled]) -fi -AM_CONDITIONAL([ENABLE_EXTERNAL_SIGNER], [test "$use_external_signer" = "yes"]) - -dnl Check for reduced exports -if test "$use_reduce_exports" = "yes"; then - AX_CHECK_COMPILE_FLAG([-fvisibility=hidden], [CORE_CXXFLAGS="$CORE_CXXFLAGS -fvisibility=hidden"], - [AC_MSG_ERROR([Cannot set hidden symbol visibility. Use --disable-reduce-exports.])], [$CXXFLAG_WERROR]) - AX_CHECK_LINK_FLAG([-Wl,--exclude-libs,ALL], [RELDFLAGS="-Wl,--exclude-libs,ALL"], [], [$LDFLAG_WERROR]) - AX_CHECK_LINK_FLAG([-Wl,-no_exported_symbols], [LIBTOOL_APP_LDFLAGS="$LIBTOOL_APP_LDFLAGS -Wl,-no_exported_symbols"], [], [$LDFLAG_WERROR]) -fi - -if test "$use_tests" = "yes"; then - - if test "$HEXDUMP" = ""; then - AC_MSG_ERROR([hexdump is required for tests]) - fi -fi - -dnl libevent check - -use_libevent=no -if test "$build_bitcoin_cli$build_bitcoind$bitcoin_enable_qt$enable_fuzz_binary$use_tests$use_bench" != "nononononono"; then - PKG_CHECK_MODULES([EVENT], [libevent >= 2.1.8], [use_libevent=yes], [AC_MSG_ERROR([libevent version 2.1.8 or greater not found.])]) - if test "$TARGET_OS" != "windows"; then - PKG_CHECK_MODULES([EVENT_PTHREADS], [libevent_pthreads >= 2.1.8], [], [AC_MSG_ERROR([libevent_pthreads version 2.1.8 or greater not found.])]) - fi - - if test "$suppress_external_warnings" != "no"; then - EVENT_CFLAGS=SUPPRESS_WARNINGS($EVENT_CFLAGS) - fi -fi - -if test "$use_libevent" = "yes"; then - TEMP_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS $EVENT_CFLAGS" - AC_MSG_CHECKING([if evhttp_connection_get_peer expects const char**]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #include - ]], [[ - evhttp_connection *conn = (evhttp_connection *)1; - const char *host; - uint16_t port; - - evhttp_connection_get_peer(conn, &host, &port); - ]])], - [ AC_MSG_RESULT([yes]); AC_DEFINE([HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR], [1], [Define this symbol if evhttp_connection_get_peer expects const char**]) ], - [ AC_MSG_RESULT([no]) ] - ) - CXXFLAGS="$TEMP_CXXFLAGS" -fi - -dnl QR Code encoding library check - -if test "$use_qr" != "no"; then - BITCOIN_QT_CHECK([PKG_CHECK_MODULES([QR], [libqrencode], [have_qrencode=yes], [have_qrencode=no])]) -fi - -dnl ZMQ check - -if test "$use_zmq" = "yes"; then - PKG_CHECK_MODULES([ZMQ], [libzmq >= 4], - AC_DEFINE([ENABLE_ZMQ], [1], [Define this symbol to enable ZMQ functions]), - [AC_MSG_WARN([libzmq version 4.x or greater not found, disabling]) - use_zmq=no]) -fi - -if test "$use_zmq" = "yes"; then - dnl Assume libzmq was built for static linking - case $host in - *mingw*) - ZMQ_CFLAGS="$ZMQ_CFLAGS -DZMQ_STATIC" - ;; - esac -fi - -dnl zstd check -if test "$use_zstd" != "no"; then - PKG_CHECK_MODULES([ZSTD], [libzstd >= 1.4.0], - [AC_DEFINE([ENABLE_ZSTD], [1], [Define this symbol to enable zstd compression]) - use_zstd=yes], - [if test "$use_zstd" = "yes"; then - AC_MSG_ERROR([libzstd version 1.4.0 or greater not found.]) - fi - AC_MSG_WARN([libzstd version 1.4.0 or greater not found, disabling zstd compression]) - use_zstd=no]) -fi -if test "$use_zstd" = "yes" && test "$suppress_external_warnings" != "no"; then - ZSTD_CFLAGS=SUPPRESS_WARNINGS($ZSTD_CFLAGS) -fi - -AM_CONDITIONAL([ENABLE_ZMQ], [test "$use_zmq" = "yes"]) -AM_CONDITIONAL([ENABLE_ZSTD], [test "$use_zstd" = "yes"]) - -dnl libmultiprocess library check - -libmultiprocess_found=no -if test "$with_libmultiprocess" = "yes" || test "$with_libmultiprocess" = "auto"; then - PKG_CHECK_MODULES([LIBMULTIPROCESS], [libmultiprocess], [ - libmultiprocess_found=yes; - libmultiprocess_prefix=`$PKG_CONFIG --variable=prefix libmultiprocess`; - if test "$suppress_external_warnings" != "no" ; then - LIBMULTIPROCESS_CFLAGS=SUPPRESS_WARNINGS($LIBMULTIPROCESS_CFLAGS) - fi - ], [true]) -elif test "$with_libmultiprocess" != "no"; then - AC_MSG_ERROR([--with-libmultiprocess=$with_libmultiprocess value is not yes, auto, or no]) -fi - -dnl Enable multiprocess check - -if test "$enable_multiprocess" = "yes"; then - if test "$libmultiprocess_found" != "yes"; then - AC_MSG_ERROR([--enable-multiprocess=yes option specified but libmultiprocess library was not found. May need to install libmultiprocess library, or specify install path with PKG_CONFIG_PATH environment variable. Running 'pkg-config --debug libmultiprocess' may be helpful for debugging.]) - fi - build_multiprocess=yes -elif test "$enable_multiprocess" = "auto"; then - build_multiprocess=$libmultiprocess_found -else - build_multiprocess=no -fi - -AM_CONDITIONAL([BUILD_MULTIPROCESS], [test "$build_multiprocess" = "yes"]) -AM_CONDITIONAL([BUILD_BITCOIN_NODE], [test "$build_multiprocess" = "yes"]) -AM_CONDITIONAL([BUILD_BITCOIN_GUI], [test "$build_multiprocess" = "yes"]) - -dnl codegen tools check - -if test "$build_multiprocess" != "no"; then - if test "$with_mpgen" = "yes" || test "$with_mpgen" = "auto"; then - MPGEN_PREFIX="$libmultiprocess_prefix" - elif test "$with_mpgen" != "no"; then - MPGEN_PREFIX="$with_mpgen"; - fi - AC_SUBST(MPGEN_PREFIX) -fi - -AC_MSG_CHECKING([whether to build dashd]) -AM_CONDITIONAL([BUILD_BITCOIND], [test $build_bitcoind = "yes"]) -AC_MSG_RESULT($build_bitcoind) - -AC_MSG_CHECKING([whether to build dash-cli]) -AM_CONDITIONAL([BUILD_BITCOIN_CLI], [test $build_bitcoin_cli = "yes"]) -AC_MSG_RESULT($build_bitcoin_cli) - -AC_MSG_CHECKING([whether to build dash-tx]) -AM_CONDITIONAL([BUILD_BITCOIN_TX], [test $build_bitcoin_tx = "yes"]) -AC_MSG_RESULT($build_bitcoin_tx) - -AC_MSG_CHECKING([whether to build dash-wallet]) -AM_CONDITIONAL([BUILD_BITCOIN_WALLET], [test $build_bitcoin_wallet = "yes"]) -AC_MSG_RESULT($build_bitcoin_wallet) - -AC_MSG_CHECKING([whether to build dash-util]) -AM_CONDITIONAL([BUILD_BITCOIN_UTIL], [test $build_bitcoin_util = "yes"]) -AC_MSG_RESULT($build_bitcoin_util) - -AC_MSG_CHECKING([whether to build experimental dash-chainstate]) -if test "$build_bitcoin_chainstate" = "yes"; then - if test "$build_experimental_kernel_lib" = "no"; then - AC_MSG_ERROR([experimental dash-chainstate cannot be built without the experimental dashkernel library. Use --with-experimental-kernel-lib]); - fi -fi -AM_CONDITIONAL([BUILD_BITCOIN_CHAINSTATE], [test $build_bitcoin_chainstate = "yes"]) -AC_MSG_RESULT($build_bitcoin_chainstate) - -AC_MSG_CHECKING([whether to build libraries]) -AM_CONDITIONAL([BUILD_BITCOIN_LIBS], [test $build_bitcoin_libs = "yes"]) - -if test "$build_bitcoin_libs" = "yes"; then - AC_DEFINE([HAVE_CONSENSUS_LIB], [1], [Define this symbol if the consensus lib has been built]) - AC_CONFIG_FILES([libdashconsensus.pc:libdashconsensus.pc.in]) -fi - -AM_CONDITIONAL([BUILD_BITCOIN_KERNEL_LIB], [test "$build_experimental_kernel_lib" != "no" && ( test "$build_experimental_kernel_lib" = "yes" || test "$build_bitcoin_chainstate" = "yes" )]) - -AC_MSG_RESULT($build_bitcoin_libs) - -AC_LANG_POP - -if test "$use_ccache" != "no"; then - AC_MSG_CHECKING([if ccache should be used]) - if test "$CCACHE" = ""; then - if test "$use_ccache" = "yes"; then - AC_MSG_ERROR([ccache not found.]); - else - use_ccache=no - fi - else - use_ccache=yes - CC="$ac_cv_path_CCACHE $CC" - CXX="$ac_cv_path_CCACHE $CXX" - fi - AC_MSG_RESULT($use_ccache) - if test "$use_ccache" = "yes"; then - AX_CHECK_COMPILE_FLAG([-fdebug-prefix-map=A=B], [DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -fdebug-prefix-map=\$(abs_top_srcdir)=."], [], [$CXXFLAG_WERROR]) - AX_CHECK_PREPROC_FLAG([-fmacro-prefix-map=A=B], [DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -fmacro-prefix-map=\$(abs_top_srcdir)=."], [], [$CXXFLAG_WERROR]) - fi -fi - -dnl enable wallet -AC_MSG_CHECKING([if wallet should be enabled]) -if test "$enable_wallet" != "no"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED([ENABLE_WALLET],[1],[Define to 1 to enable wallet functions]) - enable_wallet=yes - -else - AC_MSG_RESULT([no]) -fi - -dnl enable upnp support -AC_MSG_CHECKING([whether to build with support for UPnP]) -if test "$have_miniupnpc" = "no"; then - if test "$use_upnp" = "yes"; then - AC_MSG_ERROR([UPnP requested but cannot be built. Use --without-miniupnpc]) - fi - AC_MSG_RESULT([no]) - use_upnp=no -else - if test "$use_upnp" != "no"; then - AC_MSG_RESULT([yes]) - use_upnp=yes - AC_DEFINE([USE_UPNP], [1], [Define to 1 if UPnP support should be compiled in.]) - if test "$TARGET_OS" = "windows"; then - MINIUPNPC_CPPFLAGS="$MINIUPNPC_CPPFLAGS -DMINIUPNP_STATICLIB" - fi - else - AC_MSG_RESULT([no]) - fi -fi - -dnl Enable NAT-PMP support. -AC_MSG_CHECKING([whether to build with support for NAT-PMP]) -if test "$have_natpmp" = "no"; then - if test "$use_natpmp" = "yes"; then - AC_MSG_ERROR([NAT-PMP requested but cannot be built. Use --without-natpmp]) - fi - AC_MSG_RESULT([no]) - use_natpmp=no -else - if test "$use_natpmp" != "no"; then - AC_MSG_RESULT([yes]) - use_natpmp=yes - AC_DEFINE([USE_NATPMP], [1], [Define to 1 if UPnP support should be compiled in.]) - if test "$TARGET_OS" = "windows"; then - NATPMP_CPPFLAGS="$NATPMP_CPPFLAGS -DSTATICLIB -DNATPMP_STATICLIB" - fi - else - AC_MSG_RESULT([no]) - fi -fi - -dnl these are only used when qt is enabled -BUILD_TEST_QT="" -if test "$bitcoin_enable_qt" != "no"; then - dnl enable dbus support - AC_MSG_CHECKING([whether to build GUI with support for D-Bus]) - if test "$bitcoin_enable_qt_dbus" != "no"; then - AC_DEFINE([USE_DBUS], [1], [Define if dbus support should be compiled in]) - fi - AC_MSG_RESULT([$bitcoin_enable_qt_dbus]) - - dnl enable qr support - AC_MSG_CHECKING([whether to build GUI with support for QR codes]) - if test "$have_qrencode" = "no"; then - if test "$use_qr" = "yes"; then - AC_MSG_ERROR([QR support requested but cannot be built. Use --without-qrencode]) - fi - use_qr=no - else - if test "$use_qr" != "no"; then - AC_DEFINE([USE_QRCODE], [1], [Define if QR support should be compiled in]) - use_qr=yes - fi - fi - AC_MSG_RESULT([$use_qr]) - - if test "$XGETTEXT" = ""; then - AC_MSG_WARN([xgettext is required to update qt translations]) - fi - - AC_MSG_CHECKING([whether to build test_dash-qt]) - if test "$use_gui_tests$bitcoin_enable_qt_test" = "yesyes"; then - AC_MSG_RESULT([yes]) - BUILD_TEST_QT="yes" - else - AC_MSG_RESULT([no]) - fi -fi - -AC_MSG_CHECKING([whether to build test_dash]) -if test "$use_tests" = "yes"; then - if test "$enable_fuzz" = "yes"; then - AC_MSG_RESULT([no, because fuzzing is enabled]) - else - AC_MSG_RESULT([yes]) - fi - BUILD_TEST="yes" -else - AC_MSG_RESULT([no]) - BUILD_TEST="" -fi - -AC_MSG_CHECKING([whether to reduce exports]) -if test "$use_reduce_exports" = "yes"; then - AC_MSG_RESULT([yes]) -else - AC_MSG_RESULT([no]) -fi - -# When compiled natively on MacOS, we need to specify -flat to avoid producing a dSYM bundle -# When cross-compiled on linux, we're using a different version of the tool that only supports flat symbol files -AC_MSG_CHECKING([whether dsymutil needs -flat]) -if test "$DSYMUTIL" != "" && ($DSYMUTIL --help | grep -q \\-flat); then -AC_MSG_RESULT([yes]) - DSYMUTIL_FLAT="$DSYMUTIL -flat" -else - AC_MSG_RESULT([no]) - DSYMUTIL_FLAT="$DSYMUTIL" -fi -AC_MSG_RESULT($dsymutil_needs_flat) - -if test "$build_bitcoin_wallet$build_bitcoin_cli$build_bitcoin_tx$build_bitcoin_util$build_bitcoind$bitcoin_enable_qt$enable_fuzz_binary$use_bench$use_tests" = "nonononononononono"; then - AC_MSG_ERROR([No targets! Please specify at least one of: --with-utils --with-libs --with-daemon --with-gui --enable-fuzz(-binary) --enable-bench or --enable-tests]) -fi - -dnl dash-sdk-cxx, the C++ binding of the Dash Platform SDK, is a Rust static -dnl library linked into dash-qt, test_dash and test_dash-qt only. depends -dnl installs dash_sdk_cxx.pc, whose Libs are the library and the vetted system -dnl libraries it needs; depends checks those against rustc's -dnl --print=native-static-libs. depends built with PLATFORM_GUI=1 sets "auto", -dnl which turns into "no" when the GUI or the wallet is off. -if test "$enable_platform_gui" = "auto"; then - if test "$bitcoin_enable_qt" = "yes" && test "$enable_wallet" = "yes"; then - enable_platform_gui=yes - else - AC_MSG_NOTICE([the GUI or the wallet is disabled, so Dash Platform support is not built]) - enable_platform_gui=no - fi -fi -if test "$enable_platform_gui" = "yes"; then - if test "$bitcoin_enable_qt" != "yes"; then - AC_MSG_ERROR([--enable-platform-gui requires the GUI]) - fi - if test "$enable_wallet" != "yes"; then - AC_MSG_ERROR([--enable-platform-gui requires the wallet]) - fi - PKG_CHECK_MODULES([PLATFORM_CXX], [dash_sdk_cxx], [], - [AC_MSG_ERROR([--enable-platform-gui requires dash-sdk-cxx (build depends with PLATFORM_GUI=1)])]) - TEMP_CPPFLAGS="$CPPFLAGS" - TEMP_LIBS="$LIBS" - CPPFLAGS="$CPPFLAGS $PLATFORM_CXX_CFLAGS" - LIBS="$PLATFORM_CXX_LIBS $LIBS" - AC_LANG_PUSH([C++]) - AC_MSG_CHECKING([whether a program using dash-sdk-cxx links]) - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ - #include - ]], [[ - rust::Box client{dash_sdk::new_platform_client(dash_sdk::Config{}, nullptr)}; - client->shutdown(); - ]])], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - AC_MSG_ERROR([a program using dash-sdk-cxx does not link; see config.log])]) - AC_LANG_POP([C++]) - CPPFLAGS="$TEMP_CPPFLAGS" - LIBS="$TEMP_LIBS" - AC_DEFINE([ENABLE_PLATFORM_GUI], [1], [Define this symbol to enable Dash Platform support in the GUI]) -fi -AM_CONDITIONAL([ENABLE_PLATFORM_GUI], [test "$enable_platform_gui" = "yes"]) - -AM_CONDITIONAL([TARGET_DARWIN], [test "$TARGET_OS" = "darwin"]) -AM_CONDITIONAL([BUILD_DARWIN], [test "$BUILD_OS" = "darwin"]) -AM_CONDITIONAL([TARGET_LINUX], [test "$TARGET_OS" = "linux"]) -AM_CONDITIONAL([TARGET_WINDOWS], [test "$TARGET_OS" = "windows"]) -AM_CONDITIONAL([ENABLE_WALLET], [test "$enable_wallet" = "yes"]) -AM_CONDITIONAL([USE_SQLITE], [test "$use_sqlite" = "yes"]) -AM_CONDITIONAL([USE_BDB], [test "$use_bdb" = "yes"]) -AM_CONDITIONAL([ENABLE_TESTS], [test "$BUILD_TEST" = "yes"]) -AM_CONDITIONAL([ENABLE_FUZZ], [test "$enable_fuzz" = "yes"]) -AM_CONDITIONAL([ENABLE_FUZZ_BINARY], [test "$enable_fuzz_binary" = "yes"]) -AM_CONDITIONAL([ENABLE_QT], [test "$bitcoin_enable_qt" = "yes"]) -AM_CONDITIONAL([ENABLE_QT_TESTS], [test "$BUILD_TEST_QT" = "yes"]) -AM_CONDITIONAL([ENABLE_BENCH], [test "$use_bench" = "yes"]) -AM_CONDITIONAL([USE_QRCODE], [test "$use_qr" = "yes"]) -AM_CONDITIONAL([USE_LCOV], [test "$use_lcov" = "yes"]) -AM_CONDITIONAL([HARDEN], [test "$use_hardening" = "yes"]) -AM_CONDITIONAL([ENABLE_SSSE3], [test "$enable_ssse3" = "yes"]) -AM_CONDITIONAL([ENABLE_SSE42], [test "$enable_sse42" = "yes"]) -AM_CONDITIONAL([ENABLE_SSE41], [test "$enable_sse41" = "yes"]) -AM_CONDITIONAL([ENABLE_AVX2], [test "$enable_avx2" = "yes"]) -AM_CONDITIONAL([ENABLE_X86_AESNI], [test "$enable_x86_aesni" = "yes"]) -AM_CONDITIONAL([ENABLE_X86_SHANI], [test "$enable_x86_shani" = "yes"]) -AM_CONDITIONAL([ENABLE_ARM_AES], [test "$enable_arm_aes" = "yes"]) -AM_CONDITIONAL([ENABLE_ARM_CRC], [test "$enable_arm_crc" = "yes"]) -AM_CONDITIONAL([ENABLE_ARM_NEON], [test "$enable_arm_neon" = "yes"]) -AM_CONDITIONAL([ENABLE_ARM_SHANI], [test "$enable_arm_shani" = "yes"]) -AM_CONDITIONAL([WORDS_BIGENDIAN], [test "$ac_cv_c_bigendian" = "yes"]) -AM_CONDITIONAL([USE_MIMALLOC], [test "$use_mimalloc" = "yes"]) -AM_CONDITIONAL([USE_NATPMP], [test "$use_natpmp" = "yes"]) -AM_CONDITIONAL([USE_UPNP], [test "$use_upnp" = "yes"]) - -dnl for minisketch -AM_CONDITIONAL([ENABLE_CLMUL], [test "$enable_clmul" = "yes"]) - -AC_DEFINE([CLIENT_VERSION_MAJOR], [_CLIENT_VERSION_MAJOR], [Major version]) -AC_DEFINE([CLIENT_VERSION_MINOR], [_CLIENT_VERSION_MINOR], [Minor version]) -AC_DEFINE([CLIENT_VERSION_BUILD], [_CLIENT_VERSION_BUILD], [Version Build]) -AC_DEFINE([CLIENT_VERSION_IS_RELEASE], [_CLIENT_VERSION_IS_RELEASE], [Version is release]) -AC_DEFINE([COPYRIGHT_YEAR], [_COPYRIGHT_YEAR], [Copyright year]) -AC_DEFINE([COPYRIGHT_HOLDERS], ["_COPYRIGHT_HOLDERS"], [Copyright holder(s) before %s replacement]) -AC_DEFINE([COPYRIGHT_HOLDERS_SUBSTITUTION], ["_COPYRIGHT_HOLDERS_SUBSTITUTION"], [Replacement for %s in copyright holders string]) -define(_COPYRIGHT_HOLDERS_FINAL, [patsubst(_COPYRIGHT_HOLDERS, [%s], [_COPYRIGHT_HOLDERS_SUBSTITUTION])]) -AC_DEFINE([COPYRIGHT_HOLDERS_FINAL], ["_COPYRIGHT_HOLDERS_FINAL"], [Copyright holder(s)]) -AC_SUBST(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR) -AC_SUBST(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR) -AC_SUBST(CLIENT_VERSION_BUILD, _CLIENT_VERSION_BUILD) -AC_SUBST(CLIENT_VERSION_IS_RELEASE, _CLIENT_VERSION_IS_RELEASE) -AC_SUBST(COPYRIGHT_YEAR, _COPYRIGHT_YEAR) -AC_SUBST(COPYRIGHT_HOLDERS, "_COPYRIGHT_HOLDERS") -AC_SUBST(COPYRIGHT_HOLDERS_SUBSTITUTION, "_COPYRIGHT_HOLDERS_SUBSTITUTION") -AC_SUBST(COPYRIGHT_HOLDERS_FINAL, "_COPYRIGHT_HOLDERS_FINAL") -AC_SUBST(BITCOIN_DAEMON_NAME) -AC_SUBST(BITCOIN_GUI_NAME) -AC_SUBST(BITCOIN_TEST_NAME) -AC_SUBST(BITCOIN_CLI_NAME) -AC_SUBST(BITCOIN_TX_NAME) -AC_SUBST(BITCOIN_UTIL_NAME) -AC_SUBST(BITCOIN_CHAINSTATE_NAME) -AC_SUBST(BITCOIN_WALLET_TOOL_NAME) -AC_SUBST(BITCOIN_MP_NODE_NAME) -AC_SUBST(BITCOIN_MP_GUI_NAME) - -AC_SUBST(RELDFLAGS) -AC_SUBST(CORE_LDFLAGS) -AC_SUBST(CORE_CPPFLAGS) -AC_SUBST(CORE_CXXFLAGS) -AC_SUBST(DEBUG_CFLAGS) -AC_SUBST(DEBUG_CPPFLAGS) -AC_SUBST(DEBUG_CXXFLAGS) -AC_SUBST(WARN_CXXFLAGS) -AC_SUBST(NOWARN_CXXFLAGS) -AC_SUBST(ERROR_CXXFLAGS) -AC_SUBST(HARDENED_CXXFLAGS) -AC_SUBST(HARDENED_CPPFLAGS) -AC_SUBST(HARDENED_LDFLAGS) -AC_SUBST(PIC_FLAGS) -AC_SUBST(PIE_FLAGS) -AC_SUBST(SANITIZER_CXXFLAGS) -AC_SUBST(SANITIZER_LDFLAGS) -AC_SUBST(SPHLIB_FLAGS) -AC_SUBST(SSSE3_CXXFLAGS) -AC_SUBST(SSE42_CXXFLAGS) -AC_SUBST(SSE41_CXXFLAGS) -AC_SUBST(CLMUL_CXXFLAGS) -AC_SUBST(AVX2_CXXFLAGS) -AC_SUBST(X86_AESNI_CXXFLAGS) -AC_SUBST(X86_SHANI_CXXFLAGS) -AC_SUBST(ARM_AES_CXXFLAGS) -AC_SUBST(ARM_CRC_CXXFLAGS) -AC_SUBST(ARM_NEON_CXXFLAGS) -AC_SUBST(ARM_SHANI_CXXFLAGS) -AC_SUBST(LIBTOOL_APP_LDFLAGS) -AC_SUBST(USE_SQLITE) -AC_SUBST(USE_BDB) -AC_SUBST(ENABLE_EXTERNAL_SIGNER) -AC_SUBST(USE_UPNP) -AC_SUBST(USE_QRCODE) -AC_SUBST(TESTDEFS) -AC_SUBST(MINIUPNPC_CPPFLAGS) -AC_SUBST(MINIUPNPC_LIBS) -AC_SUBST(BACKTRACE_FLAGS) -AC_SUBST(BACKTRACE_LDFLAGS) -AC_SUBST(BACKTRACE_LIBS) -AC_SUBST(BLST_CPPFLAGS) -AC_SUBST(BLST_LIBS) -AC_SUBST(NATPMP_CPPFLAGS) -AC_SUBST(NATPMP_LIBS) -AC_SUBST(DSYMUTIL_FLAT) -AC_SUBST(HAVE_FDATASYNC) -AC_SUBST(HAVE_FULLFSYNC) -AC_SUBST(HAVE_O_CLOEXEC) -AC_SUBST(HAVE_BUILTIN_PREFETCH) -AC_SUBST(HAVE_MM_PREFETCH) -AC_SUBST(HAVE_STRONG_GETAUXVAL) -AC_SUBST(HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR) -AC_CONFIG_FILES([Makefile src/Makefile doc/man/Makefile share/setup.nsi share/qt/Info.plist test/config.ini]) -AC_CONFIG_FILES([contrib/devtools/split-debug.sh],[chmod +x contrib/devtools/split-debug.sh]) -AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([doc/Doxyfile])]) -AC_CONFIG_LINKS([contrib/filter-lcov.py:contrib/filter-lcov.py]) -AC_CONFIG_LINKS([src/.bear-tidy-config:src/.bear-tidy-config]) -AC_CONFIG_LINKS([src/.clang-tidy:src/.clang-tidy]) -AC_CONFIG_LINKS([src/ipc/.clang-tidy:src/ipc/.clang-tidy]) -AC_CONFIG_LINKS([test/functional/test_runner.py:test/functional/test_runner.py]) -AC_CONFIG_LINKS([test/fuzz/test_runner.py:test/fuzz/test_runner.py]) -AC_CONFIG_LINKS([test/util/test_runner.py:test/util/test_runner.py]) -AC_CONFIG_LINKS([test/util/rpcauth-test.py:test/util/rpcauth-test.py]) -AC_CONFIG_LINKS([src/qt/Makefile:src/qt/Makefile]) -AC_CONFIG_LINKS([src/qt/test/Makefile:src/qt/test/Makefile]) -AC_CONFIG_LINKS([src/test/Makefile:src/test/Makefile]) - -dnl boost's m4 checks do something really nasty: they export these vars. As a -dnl result, they leak into secp256k1's configure and crazy things happen. -dnl Until this is fixed upstream and we've synced, we'll just un-export them. -CPPFLAGS_TEMP="$CPPFLAGS" -unset CPPFLAGS -CPPFLAGS="$CPPFLAGS_TEMP" - -dnl The ECDH module is required by the wallet's Platform key provider -dnl (DashPay contact request encryption, wallet/platformkeys.cpp). -ac_configure_args="${ac_configure_args} --disable-shared --with-pic --enable-benchmark=no --enable-module-recovery --enable-module-ecdh --disable-openssl-tests" -AC_CONFIG_SUBDIRS([src/secp256k1]) - -AC_OUTPUT - -dnl Replace the BUILDDIR path with the correct Windows path if compiling on Native Windows -case ${OS} in - *Windows*) - sed 's/BUILDDIR="\/\([[a-z]]\)/BUILDDIR="\1:/' test/config.ini > test/config-2.ini - mv test/config-2.ini test/config.ini - ;; -esac - -dnl An old hack similar to a98356fee to remove hard-coded -dnl bind_at_load flag from libtool -case $host in - *darwin*) - AC_MSG_RESULT([Removing -Wl,bind_at_load from libtool.]) - sed < libtool > libtool-2 '/bind_at_load/d' - mv libtool-2 libtool - chmod 755 libtool - ;; -esac - -echo -echo "Options used to compile and link:" -echo " external signer = $use_external_signer" -echo " multiprocess = $build_multiprocess" -echo " with libs = $build_bitcoin_libs" -echo " with wallet = $enable_wallet" -if test "$enable_wallet" != "no"; then - echo " with sqlite = $use_sqlite" - echo " with bdb = $use_bdb" -fi -echo " with gui / qt = $bitcoin_enable_qt" -if test $bitcoin_enable_qt != "no"; then - echo " with qr = $use_qr" -fi -echo " with zmq = $use_zmq" -echo " with zstd = $use_zstd" -if test $enable_fuzz = "no"; then - echo " with test = $use_tests" -else - echo " with test = not building test_dash because fuzzing is enabled" -fi -echo " with fuzz binary= $enable_fuzz_binary" -echo " with bench = $use_bench" -echo " with upnp = $use_upnp" -echo " with natpmp = $use_natpmp" -echo " USDT tracing = $use_usdt" -echo " sanitizers = $use_sanitizers" -echo " debug enabled = $enable_debug" -echo " stacktraces = $enable_stacktraces" -echo " crash hooks = $enable_crashhooks" -echo " miner enabled = $enable_miner" -echo " platform gui = $enable_platform_gui" -echo " werror = $enable_werror" -echo -echo " target os = $host_os" -echo " build os = $build_os" -echo -echo " CC = $CC" -echo " CFLAGS = $SANITIZER_CFLAGS $BACKTRACE_FLAGS $DEBUG_CFLAGS $PTHREAD_CFLAGS $CFLAGS" -echo " CPPFLAGS = $DEBUG_CPPFLAGS $HARDENED_CPPFLAGS $CORE_CPPFLAGS $CPPFLAGS" -echo " CXX = $CXX" -echo " CXXFLAGS = $CORE_CXXFLAGS $BACKTRACE_FLAGS $DEBUG_CXXFLAGS $HARDENED_CXXFLAGS $WARN_CXXFLAGS $NOWARN_CXXFLAGS $ERROR_CXXFLAGS $SANITIZER_CXXFLAGS $CXXFLAGS" -echo " LDFLAGS = $PTHREAD_LIBS $HARDENED_LDFLAGS $SANITIZER_LDFLAGS $CORE_LDFLAGS $BACKTRACE_LDFLAGS $LDFLAGS" -echo " AR = $AR" -echo " ARFLAGS = $ARFLAGS" -echo diff --git a/contrib/devtools/README.md b/contrib/devtools/README.md index 7211c5b91b01..6b2e658a7d4e 100644 --- a/contrib/devtools/README.md +++ b/contrib/devtools/README.md @@ -82,8 +82,8 @@ gen-manpages.py A small script to automatically create manpages in ../../doc/man by running the release binaries with the -help option. This requires help2man which can be found at: https://www.gnu.org/software/help2man/ -With in-tree builds this tool can be run from any directory within the -repository. To use this tool with out-of-tree builds set `BUILDDIR`. For +This tool can be run from any directory within the repository. It looks for +the binaries in `build/`; to use another build directory set `BUILDDIR`. For example: ```bash @@ -97,8 +97,8 @@ Generates a dash.conf file in `contrib/debian/examples/` by parsing the output f release process to include a dash.conf with the release binaries and can also be run by users to generate a file locally. When generating a file as part of the release process, make sure to commit the changes after running the script. -With in-tree builds this tool can be run from any directory within the -repository. To use this tool with out-of-tree builds set `BUILDDIR`. For +This tool can be run from any directory within the repository. It looks for +the binaries in `build/`; to use another build directory set `BUILDDIR`. For example: ```bash diff --git a/contrib/devtools/check-no-rust.py b/contrib/devtools/check-no-rust.py index f68b40761018..04e5cff70435 100755 --- a/contrib/devtools/check-no-rust.py +++ b/contrib/devtools/check-no-rust.py @@ -5,7 +5,7 @@ ''' Check that executables do not link Rust code. -dash-sdk-cxx, the Dash Platform SDK binding (--enable-platform-gui), is for +dash-sdk-cxx, the Dash Platform SDK binding (-DENABLE_PLATFORM_GUI=ON), is for dash-qt, test_dash and test_dash-qt only; dashd, the command-line tools, bench_dash and the fuzz binary must not contain any of it. A binary fails if its symbol table has cxx bridge, Rust runtime or Rust diff --git a/contrib/devtools/gen-dash-conf.sh b/contrib/devtools/gen-dash-conf.sh index 228f042b37a4..885de320149d 100755 --- a/contrib/devtools/gen-dash-conf.sh +++ b/contrib/devtools/gen-dash-conf.sh @@ -5,7 +5,7 @@ export LC_ALL=C TOPDIR=${TOPDIR:-$(git rev-parse --show-toplevel)} -BUILDDIR=${BUILDDIR:-$TOPDIR} +BUILDDIR=${BUILDDIR:-$TOPDIR/build} BINDIR=${BINDIR:-$BUILDDIR/src} DASHD=${DASHD:-$BINDIR/dashd} SHARE_EXAMPLES_DIR=${SHARE_EXAMPLES_DIR:-$TOPDIR/contrib/debian/examples/} diff --git a/contrib/devtools/gen-manpages.py b/contrib/devtools/gen-manpages.py index 7aded1f01918..382c8869bc97 100755 --- a/contrib/devtools/gen-manpages.py +++ b/contrib/devtools/gen-manpages.py @@ -27,7 +27,7 @@ topdir = r.stdout.rstrip() # Get input and output directories. -builddir = os.getenv('BUILDDIR', topdir) +builddir = os.getenv('BUILDDIR', os.path.join(topdir, 'build')) mandir = os.getenv('MANDIR', os.path.join(topdir, 'doc/man')) # Verify that all the required binaries are usable, and extract copyright diff --git a/contrib/devtools/test_deterministic_coverage.sh b/contrib/devtools/test_deterministic_coverage.sh index 246378cd0065..24f1e4a1c13b 100755 --- a/contrib/devtools/test_deterministic_coverage.sh +++ b/contrib/devtools/test_deterministic_coverage.sh @@ -82,7 +82,7 @@ if ! command -v gcovr > /dev/null; then fi if [[ ! -e ${TEST_BITCOIN_BINARY} ]]; then - echo "Error: Executable ${TEST_BITCOIN_BINARY} not found. Run \"./configure --enable-lcov\" and compile." + echo "Error: Executable ${TEST_BITCOIN_BINARY} not found. Configure the build with -DCMAKE_BUILD_TYPE=Coverage, compile, and run this script from the build directory." exit 1 fi @@ -91,7 +91,7 @@ get_file_suffix_count() { } if [[ $(get_file_suffix_count gcno) == 0 ]]; then - echo "Error: Could not find any *.gcno files. The *.gcno files are generated by the compiler. Run \"./configure --enable-lcov\" and re-compile." + echo "Error: Could not find any *.gcno files. The *.gcno files are generated by the compiler. Configure the build with -DCMAKE_BUILD_TYPE=Coverage and re-compile." exit 1 fi @@ -116,7 +116,7 @@ while [[ ${TEST_RUN_ID} -lt ${N_TEST_RUNS} ]]; do fi rm "${TEST_OUTPUT_TEMPFILE}" if [[ $(get_file_suffix_count gcda) == 0 ]]; then - echo "Error: Running the test suite did not create any *.gcda files. The gcda files are generated when the instrumented test programs are executed. Run \"./configure --enable-lcov\" and re-compile." + echo "Error: Running the test suite did not create any *.gcda files. The gcda files are generated when the instrumented test programs are executed. Configure the build with -DCMAKE_BUILD_TYPE=Coverage and re-compile." exit 1 fi GCOVR_TEMPFILE=$(mktemp) diff --git a/contrib/devtools/update-translations.py b/contrib/devtools/update-translations.py index a20945d3acbd..474b32b2f84a 100755 --- a/contrib/devtools/update-translations.py +++ b/contrib/devtools/update-translations.py @@ -292,12 +292,6 @@ def update_build_systems(): f.write(' \n') f.write('\n') - # update Makefile include - with open('src/Makefile.qt_locale.include', 'w', encoding='utf8') as f: - f.write('QT_TS = \\\n') - f.write(' \\\n'.join(f' qt/locale/{filename}' for (filename, basename, lang) in filename_lang)) - f.write('\n') # make sure last line doesn't end with a backslash - if __name__ == '__main__': check_at_repository_root() remove_current_translations() diff --git a/depends/.gitignore b/depends/.gitignore index d65d8931eaf2..c53f7f610e62 100644 --- a/depends/.gitignore +++ b/depends/.gitignore @@ -2,7 +2,6 @@ SDKs/ work/ built/ sources/ -config.site x86_64* amd64* i686* diff --git a/depends/Makefile b/depends/Makefile index 2716a4df0f74..c63277f091b9 100644 --- a/depends/Makefile +++ b/depends/Makefile @@ -203,7 +203,6 @@ meta_depends = Makefile config.guess config.sub funcs.mk builders/default.mk hos include funcs.mk -final_build_id_long+=$(shell $(build_SHA256SUM) config.site.in) final_build_id_long+=$(shell $(build_SHA256SUM) toolchain.cmake.in) final_build_id+=$(shell echo -n "$(final_build_id_long)" | $(build_SHA256SUM) | cut -c-$(HASH_LENGTH)) $(host_prefix)/.stamp_$(final_build_id): $(native_packages) $(packages) @@ -214,65 +213,6 @@ $(host_prefix)/.stamp_$(final_build_id): $(native_packages) $(packages) cd $(@D); $(foreach package,$^, $(build_TAR) xf $($(package)_cached); ) touch $@ -# $PATH is not preserved between ./configure and make by convention. Its -# modification and overriding at ./configure time is (as I understand it) -# supposed to be captured by the AC_{PROG_{,OBJ}CXX,PATH_{PROG,TOOL}} macros, -# which will expand the program names to their full absolute paths. The notable -# exception is command line overriding: ./configure CC=clang, which skips the -# program name expansion step, and works because the user implicitly indicates -# with CC=clang that clang will be available in $PATH at all times, and is most -# likely part of the user's system. -# -# Therefore, when we "seed the autoconf cache"/"override well-known program -# vars" by setting AR= in our config.site, either one of two things needs -# to be true for the build system to work correctly: -# -# 1. If we refer to the program by name (e.g. AR=riscv64-gnu-linux-ar), the -# tool needs to be available in $PATH at all times. -# -# 2. If the tool is _**not**_ expected to be available in $PATH at all times -# it needs to be referred to by its absolute path, such as would be output -# by the AC_PATH_{PROG,TOOL} macros. -# -# Minor note: it is also okay to refer to tools by their absolute path even if -# we expect them to be available in $PATH at all times, more specificity does -# not hurt. -$(host_prefix)/share/config.site : config.site.in $(host_prefix)/.stamp_$(final_build_id) - @mkdir -p $(@D) - sed -e 's|@HOST@|$(host)|' \ - -e 's|@CC@|$(host_CC)|' \ - -e 's|@CXX@|$(host_CXX)|' \ - -e 's|@AR@|$(host_AR)|' \ - -e 's|@RANLIB@|$(host_RANLIB)|' \ - -e 's|@NM@|$(host_NM)|' \ - -e 's|@STRIP@|$(host_STRIP)|' \ - -e 's|@OBJDUMP@|$(host_OBJDUMP)|' \ - -e 's|@DSYMUTIL@|$(host_DSYMUTIL)|' \ - -e 's|@WINDRES@|$(host_WINDRES)|' \ - -e 's|@build_os@|$(build_os)|' \ - -e 's|@host_os@|$(host_os)|' \ - -e 's|@CFLAGS@|$(strip $(host_CFLAGS) $(host_$(release_type)_CFLAGS))|' \ - -e 's|@CXXFLAGS@|$(strip $(host_CXXFLAGS) $(host_$(release_type)_CXXFLAGS))|' \ - -e 's|@CPPFLAGS@|$(strip $(host_CPPFLAGS) $(host_$(release_type)_CPPFLAGS))|' \ - -e 's|@LDFLAGS@|$(strip $(host_LDFLAGS) $(host_$(release_type)_LDFLAGS))|' \ - -e 's|@no_qt@|$(NO_QT)|' \ - -e 's|@no_qr@|$(NO_QR)|' \ - -e 's|@no_zmq@|$(NO_ZMQ)|' \ - -e 's|@no_zstd@|$(NO_ZSTD)|' \ - -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_usdt@|$(NO_USDT)|' \ - -e 's|@no_natpmp@|$(NO_NATPMP)|' \ - -e 's|@multiprocess@|$(MULTIPROCESS)|' \ - -e 's|@platform_gui@|$(PLATFORM_GUI)|' \ - -e 's|@lto@|$(LTO)|' \ - -e 's|@no_harden@|$(NO_HARDEN)|' \ - -e 's|@debug@|$(DEBUG)|' \ - $< > $@ - touch $@ - ifeq ($(host),$(build)) crosscompiling=FALSE else @@ -341,7 +281,6 @@ check-packages: check-sources: @$(foreach package,$(all_packages),$(call check_or_remove_sources,$(package));) -$(host_prefix)/share/config.site: check-packages $(host_prefix)/toolchain.cmake: check-packages check-packages: check-sources @@ -352,7 +291,7 @@ clean-all: clean clean: @rm -rf $(WORK_PATH) $(BASE_CACHE) $(BUILD) *.log -install: check-packages $(host_prefix)/share/config.site $(host_prefix)/toolchain.cmake +install: check-packages $(host_prefix)/toolchain.cmake download-one: check-sources $(all_sources) diff --git a/depends/config.site.in b/depends/config.site.in deleted file mode 100644 index a6536d7c11ac..000000000000 --- a/depends/config.site.in +++ /dev/null @@ -1,162 +0,0 @@ -# shellcheck shell=sh disable=SC2034 # Many variables set will be used in - # ./configure but shellcheck doesn't know - # that, hence: disable=SC2034 - -true # Dummy command because shellcheck treats all directives before first - # command as file-wide, and we only want to disable for one line. - # - # See: https://github.com/koalaman/shellcheck/wiki/Directive - -# shellcheck disable=SC2154 -depends_prefix="$(cd "$(dirname "$ac_site_file")/.." && pwd)" - -cross_compiling=maybe -host_alias="@HOST@" -ac_tool_prefix="${host_alias}-" - -if test -z "$with_boost"; then - with_boost="$depends_prefix" -fi -if test -z "$with_qt_plugindir"; then - with_qt_plugindir="${depends_prefix}/plugins" -fi -if test -z "$with_qt_translationdir"; then - with_qt_translationdir="${depends_prefix}/translations" -fi -if test -z "$with_qt_bindir" && test -z "@no_qt@"; then - with_qt_bindir="${depends_prefix}/native/bin" -fi -if test -z "$with_mpgen" && test -n "@multiprocess@"; then - with_mpgen="${depends_prefix}/native" -fi - -if test -z "$with_qrencode" && test -n "@no_qr@"; then - with_qrencode=no -fi - -if test -z "$enable_wallet" && test -n "@no_wallet@"; then - enable_wallet=no -fi - -if test -z "$with_bdb" && test -n "@no_bdb@"; then - with_bdb=no -fi - -if test -z "$with_sqlite" && test -n "@no_sqlite@"; then - with_sqlite=no -fi - -if test -z "$enable_multiprocess" && test -n "@multiprocess@"; then - enable_multiprocess=yes -fi - -if test -z "$enable_platform_gui" && test -n "@platform_gui@"; then - enable_platform_gui=auto -fi - -if test -z "$with_miniupnpc" && test -n "@no_upnp@"; then - with_miniupnpc=no -fi - -if test -z "$with_natpmp" && test -n "@no_natpmp@"; then - with_natpmp=no -fi - -if test -z "$with_gui" && test -n "@no_qt@"; then - with_gui=no -fi - -if test -n "@debug@" && test -z "@no_qt@" && test "$with_gui" != "no"; then - with_gui=qt5_debug -fi - -if test -z "$enable_zmq" && test -n "@no_zmq@"; then - enable_zmq=no -fi - -if test -z "$with_zstd" && test -n "@no_zstd@"; then - with_zstd=no -fi - -if test -z "$enable_usdt" && test -n "@no_usdt@"; then - enable_usdt=no -fi - -if test "@host_os@" = darwin; then - BREW=no -fi - -if test -z "$enable_hardening" && test -n "@no_harden@"; then - enable_hardening=no -fi - -PKG_CONFIG="$(which pkg-config) --static" - -PKG_CONFIG_PATH="${depends_prefix}/share/pkgconfig:${depends_prefix}/lib/pkgconfig" -PKG_CONFIG_LIBDIR="${depends_prefix}/lib/pkgconfig" - -CPPFLAGS="-I${depends_prefix}/include/ ${CPPFLAGS}" -LDFLAGS="-L${depends_prefix}/lib ${LDFLAGS}" - -if test -n "@CC@" -a -z "${CC}"; then - CC="@CC@" -fi -if test -n "@CXX@" -a -z "${CXX}"; then - CXX="@CXX@" -fi - -if test -n "@AR@"; then - AR="@AR@" - ac_cv_path_AR="${AR}" -fi - -if test -n "@RANLIB@"; then - RANLIB="@RANLIB@" - ac_cv_path_ac_pt_RANLIB="${RANLIB}" -fi - -if test -n "@NM@"; then - NM="@NM@" - ac_cv_path_ac_pt_NM="${NM}" -fi - -if test -n "@STRIP@"; then - STRIP="@STRIP@" - ac_cv_path_ac_pt_STRIP="${STRIP}" -fi - -if test "@host_os@" = darwin; then - if test -n "@OBJDUMP@"; then - OBJDUMP="@OBJDUMP@" - ac_cv_path_OBJDUMP="${OBJDUMP}" - fi - - if test -n "@DSYMUTIL@"; then - DSYMUTIL="@DSYMUTIL@" - ac_cv_path_DSYMUTIL="${DSYMUTIL}" - fi -fi - -if test "@host_os@" = mingw32; then - if test -n "@WINDRES@"; then - WINDRES="@WINDRES@" - ac_cv_path_WINDRES="${WINDRES}" - fi -fi - -if test -n "@debug@"; then - enable_reduce_exports=no -fi - -if test -n "@CFLAGS@"; then - CFLAGS="@CFLAGS@ ${CFLAGS}" -fi -if test -n "@CXXFLAGS@"; then - CXXFLAGS="@CXXFLAGS@ ${CXXFLAGS}" -fi -if test -n "@CPPFLAGS@"; then - CPPFLAGS="@CPPFLAGS@ ${CPPFLAGS}" -fi -if test -n "@LDFLAGS@"; then - LDFLAGS="@LDFLAGS@ ${LDFLAGS}" -fi diff --git a/doc/.gitignore b/doc/.gitignore deleted file mode 100644 index 38498103bb17..000000000000 --- a/doc/.gitignore +++ /dev/null @@ -1 +0,0 @@ -Doxyfile diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am deleted file mode 100644 index cd8f0189058e..000000000000 --- a/doc/man/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -dist_man1_MANS= - -if BUILD_BITCOIND - dist_man1_MANS+=dashd.1 -endif - -if ENABLE_QT - dist_man1_MANS+=dash-qt.1 -endif - -if BUILD_BITCOIN_CLI - dist_man1_MANS+=dash-cli.1 -endif - -if BUILD_BITCOIN_TX - dist_man1_MANS+=dash-tx.1 -endif - -if BUILD_BITCOIN_UTIL - dist_man1_MANS+=dash-util.1 -endif - -if ENABLE_WALLET -if BUILD_BITCOIN_WALLET - dist_man1_MANS+=dash-wallet.1 -endif -endif diff --git a/share/genbuild.sh b/share/genbuild.sh deleted file mode 100755 index d1e01f89d7ff..000000000000 --- a/share/genbuild.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh -# Copyright (c) 2012-2021 The Bitcoin Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. - -export LC_ALL=C -if [ $# -gt 1 ]; then - cd "$2" || exit 1 -fi -if [ $# -gt 0 ]; then - FILE="$1" - shift - if [ -f "$FILE" ]; then - INFO="$(head -n 1 "$FILE")" - fi -else - echo "Usage: $0 " - exit 1 -fi - -GIT_DESCRIPTION="" -if [ "${BITCOIN_GENBUILD_NO_GIT}" != "1" ] && [ -e "$(command -v git)" ] && [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]; then - # clean 'dirty' status of touched files that haven't been modified - git diff >/dev/null 2>/dev/null - - # override using the tag name from git, i.e. string like "v20.0.0-beta.8-5-g99786590df6f-dirty" - GIT_DESCRIPTION=$(git describe --abbrev=12 --dirty 2>/dev/null) -fi - -if [ -n "$GIT_DESCRIPTION" ]; then - NEWINFO="#define BUILD_GIT_DESCRIPTION \"$GIT_DESCRIPTION\"" -else - NEWINFO="// No build information available" -fi - -# only update build.h if necessary -if [ "$INFO" != "$NEWINFO" ]; then - echo "$NEWINFO" >"$FILE" -fi diff --git a/share/qt/extract_strings_qt.py b/share/qt/extract_strings_qt.py index 30bd870d92bb..452288f5e000 100755 --- a/share/qt/extract_strings_qt.py +++ b/share/qt/extract_strings_qt.py @@ -56,7 +56,7 @@ def parse_po(text): XGETTEXT=os.getenv('XGETTEXT', 'xgettext') if not XGETTEXT: print('Cannot extract strings: xgettext utility is not installed or not configured.',file=sys.stderr) - print('Please install package "gettext" and re-run \'./configure\'.',file=sys.stderr) + print('Please install package "gettext" and re-run \'cmake\'.',file=sys.stderr) sys.exit(1) child = Popen([XGETTEXT,'--output=-','--from-code=utf-8','-n','--keyword=_'] + files, stdout=PIPE) (out, err) = child.communicate() diff --git a/src/.bear-tidy-config b/src/.bear-tidy-config deleted file mode 100644 index b15cf07d9568..000000000000 --- a/src/.bear-tidy-config +++ /dev/null @@ -1,26 +0,0 @@ -{ - "output": { - "content": { - "include_only_existing_source": true, - "paths_to_include": [], - "paths_to_exclude": [ - "src/crc32c", - "src/crypto/ctaes", - "src/crypto/x11", - "src/dashbls", - "src/gsl", - "src/immer", - "src/leveldb", - "src/minisketch", - "src/univalue", - "src/bench/nanobench.cpp", - "src/bench/nanobench.h", - "src/secp256k1" - ] - }, - "format": { - "command_as_array": true, - "drop_output_field": false - } - } -} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b26d8edfa9ca..ce4aca735453 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -103,8 +103,7 @@ target_link_libraries(bitcoin_consensus # Dash still ships the public consensus library that upstream dropped in # bitcoin#29648, so build and install it here too. It gets its own compilation # of the consensus and crypto sources because the public library is built -# without the optimised SHA-256 backends; see libdashconsensus_la in -# src/Makefile.am. This has to stay below add_subdirectory(crypto), which is +# without the optimised SHA-256 backends. This has to stay below add_subdirectory(crypto), which is # what sets crypto_base_sources and crypto_sph_sources in this scope. if(BUILD_CONSENSUS_LIB) add_library(dashconsensus SHARED @@ -125,10 +124,9 @@ if(BUILD_CONSENSUS_LIB) dashbls secp256k1 ) - # libdashconsensus_la carries no -version-info, so libtool builds it as - # 0:0:0 and installs libdashconsensus.so.0.0.0 with an .so.0 soname. Match - # that here, otherwise consumers linked against an Autotools install cannot - # resolve DT_NEEDED against a CMake one. + # Releases built with Autotools installed libdashconsensus.so.0.0.0 with an + # .so.0 soname (libtool's 0:0:0). Keep that, otherwise consumers linked + # against an earlier release cannot resolve DT_NEEDED against this one. set_target_properties(dashconsensus PROPERTIES VERSION 0.0.0 SOVERSION 0) if(MINGW) # libtool includes the ABI version in the DLL name, but not its import library. diff --git a/src/Makefile.am b/src/Makefile.am deleted file mode 100644 index bcddb95fca27..000000000000 --- a/src/Makefile.am +++ /dev/null @@ -1,1580 +0,0 @@ -# Copyright (c) 2013-2016 The Bitcoin Core developers -# Copyright (c) 2014-2018 The Dash Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. - -# Pattern rule to print variables, e.g. make print-top_srcdir -print-%: FORCE - @echo '$*'='$($*)' - -DIST_SUBDIRS = secp256k1 - -AM_LDFLAGS = $(LIBTOOL_LDFLAGS) $(HARDENED_LDFLAGS) $(SANITIZER_LDFLAGS) $(CORE_LDFLAGS) $(BACKTRACE_LDFLAGS) -# BACKTRACE_FLAGS must precede the debug-level flags: -g-family members placed -# there (e.g. a -gdwarf-N version pin) imply -g2, so the intended level -# (DEBUG_*FLAGS' -g1 floor, --enable-debug's -g3, or the user's CXXFLAGS) must -# come later to take effect. -AM_CFLAGS = $(BACKTRACE_FLAGS) $(DEBUG_CFLAGS) -AM_CXXFLAGS = $(CORE_CXXFLAGS) $(BACKTRACE_FLAGS) $(DEBUG_CXXFLAGS) $(HARDENED_CXXFLAGS) $(WARN_CXXFLAGS) $(NOWARN_CXXFLAGS) $(ERROR_CXXFLAGS) $(SANITIZER_CXXFLAGS) -AM_OBJCXXFLAGS = $(AM_CXXFLAGS) -AM_CPPFLAGS = $(DEBUG_CPPFLAGS) $(HARDENED_CPPFLAGS) $(CORE_CPPFLAGS) -AM_LIBTOOLFLAGS = --preserve-dup-deps -PTHREAD_FLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) -EXTRA_LIBRARIES = - -lib_LTLIBRARIES = -noinst_LTLIBRARIES = - -bin_PROGRAMS = -noinst_PROGRAMS = -check_PROGRAMS = -TESTS = -BENCHMARKS = - -if ENABLE_STACKTRACES -if ENABLE_CRASH_HOOKS -if CRASH_HOOKS_WRAPPED_CXX_ABI -# Wrap internal C++ ABI's so that we can attach stacktraces to exceptions -LDFLAGS_WRAP_EXCEPTIONS = -Wl,-wrap,__cxa_allocate_exception -Wl,-wrap,__cxa_free_exception -if TARGET_WINDOWS -LDFLAGS_WRAP_EXCEPTIONS += -Wl,-wrap,_assert -Wl,-wrap,_wassert -else -LDFLAGS_WRAP_EXCEPTIONS += -Wl,-wrap,__assert_fail -endif # TARGET_WINDOWS -endif # CRASH_HOOKS_WRAPPED_CXX_ABI -endif # ENABLE_CRASH_HOOKS -endif # ENABLE_STACKTRACES - -BITCOIN_INCLUDES=-I$(builddir) -I$(srcdir)/$(MINISKETCH_INCLUDE_DIR_INT) -I$(srcdir)/secp256k1/include -I$(srcdir)/$(UNIVALUE_INCLUDE_DIR_INT) -BITCOIN_INCLUDES+=$(DASHBLS_CPPFLAGS) -BITCOIN_INCLUDES+=-isystem$(srcdir)/immer - -LIBBITCOIN_NODE=libbitcoin_node.a -LIBBITCOIN_COMMON=libbitcoin_common.a -LIBBITCOIN_CONSENSUS=libbitcoin_consensus.a -LIBBITCOIN_CLI=libbitcoin_cli.a -LIBBITCOIN_UTIL=libbitcoin_util.a -LIBBITCOIN_CRYPTO_BASE=crypto/libbitcoin_crypto_base.la -LIBBITCOINQT=qt/libbitcoinqt.a -LIBSECP256K1=secp256k1/libsecp256k1.la - -if ENABLE_ZMQ -LIBBITCOIN_ZMQ=libbitcoin_zmq.a -endif -if BUILD_BITCOIN_LIBS -LIBBITCOINCONSENSUS=libdashconsensus.la -endif -if BUILD_BITCOIN_KERNEL_LIB -LIBBITCOINKERNEL=libdashkernel.la -endif -if ENABLE_WALLET -LIBBITCOIN_WALLET=libbitcoin_wallet.a -LIBBITCOIN_WALLET_TOOL=libbitcoin_wallet_tool.a -endif - -LIBBITCOIN_CRYPTO = $(LIBBITCOIN_CRYPTO_BASE) -LIBBITCOIN_CRYPTO_SPH = crypto/libbitcoin_crypto_sph.la -LIBBITCOIN_CRYPTO += $(LIBBITCOIN_CRYPTO_SPH) -if ENABLE_SSSE3 -LIBBITCOIN_CRYPTO_SSSE3 = crypto/libbitcoin_crypto_ssse3.la -LIBBITCOIN_CRYPTO += $(LIBBITCOIN_CRYPTO_SSSE3) -endif -if ENABLE_SSE41 -LIBBITCOIN_CRYPTO_SSE41 = crypto/libbitcoin_crypto_sse41.la -LIBBITCOIN_CRYPTO += $(LIBBITCOIN_CRYPTO_SSE41) -if ENABLE_X86_AESNI -LIBBITCOIN_CRYPTO_X86_AESNI = crypto/libbitcoin_crypto_x86_aesni.la -LIBBITCOIN_CRYPTO += $(LIBBITCOIN_CRYPTO_X86_AESNI) -endif -if ENABLE_X86_SHANI -LIBBITCOIN_CRYPTO_X86_SHANI = crypto/libbitcoin_crypto_x86_shani.la -LIBBITCOIN_CRYPTO += $(LIBBITCOIN_CRYPTO_X86_SHANI) -endif -endif -if ENABLE_AVX2 -LIBBITCOIN_CRYPTO_AVX2 = crypto/libbitcoin_crypto_avx2.la -LIBBITCOIN_CRYPTO += $(LIBBITCOIN_CRYPTO_AVX2) -endif -if ENABLE_ARM_AES -LIBBITCOIN_CRYPTO_ARM_AES = crypto/libbitcoin_crypto_arm_aes.la -LIBBITCOIN_CRYPTO += $(LIBBITCOIN_CRYPTO_ARM_AES) -endif -if ENABLE_ARM_NEON -LIBBITCOIN_CRYPTO_ARM_NEON = crypto/libbitcoin_crypto_arm_neon.la -LIBBITCOIN_CRYPTO += $(LIBBITCOIN_CRYPTO_ARM_NEON) -endif -if ENABLE_ARM_SHANI -LIBBITCOIN_CRYPTO_ARM_SHANI = crypto/libbitcoin_crypto_arm_shani.la -LIBBITCOIN_CRYPTO += $(LIBBITCOIN_CRYPTO_ARM_SHANI) -endif -noinst_LTLIBRARIES += $(LIBBITCOIN_CRYPTO) - -$(LIBSECP256K1): $(wildcard secp256k1/src/*.h) $(wildcard secp256k1/src/*.c) $(wildcard secp256k1/include/*) - $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) - -# Make is not made aware of per-object dependencies to avoid limiting building parallelization -# But to build the less dependent modules first, we manually select their order here: -EXTRA_LIBRARIES += \ - $(LIBBITCOIN_UTIL) \ - $(LIBBITCOIN_COMMON) \ - $(LIBBITCOIN_CONSENSUS) \ - $(LIBBITCOIN_NODE) \ - $(LIBBITCOIN_CLI) \ - $(LIBBITCOIN_IPC) \ - $(LIBBITCOIN_WALLET) \ - $(LIBBITCOIN_WALLET_TOOL) \ - $(LIBBITCOIN_ZMQ) - -if BUILD_BITCOIND - bin_PROGRAMS += dashd -endif - -if BUILD_BITCOIN_NODE - bin_PROGRAMS += dash-node -endif - -if BUILD_BITCOIN_CLI - bin_PROGRAMS += dash-cli -endif - -if BUILD_BITCOIN_TX - bin_PROGRAMS += dash-tx -endif - -if ENABLE_WALLET -if BUILD_BITCOIN_WALLET - bin_PROGRAMS += dash-wallet -endif -endif - -if BUILD_BITCOIN_UTIL - bin_PROGRAMS += dash-util -endif - -if BUILD_BITCOIN_CHAINSTATE - bin_PROGRAMS += dash-chainstate -endif - -.PHONY: FORCE check-symbols check-security check-stdlib-paths -# dash core # -BITCOIN_CORE_H = \ - active/context.h \ - active/dkgsession.h \ - active/dkgsessionhandler.h \ - active/masternode.h \ - addrdb.h \ - addrman.h \ - addrman_impl.h \ - attributes.h \ - banman.h \ - base58.h \ - batchedlogger.h \ - bech32.h \ - bip324.h \ - blockencodings.h \ - blockfilter.h \ - cachemap.h \ - cachemultimap.h \ - chain.h \ - chainlock/chainlock.h \ - chainlock/clsig.h \ - chainlock/handler.h \ - chainlock/signing.h \ - chainparams.h \ - chainparamsbase.h \ - chainparamsseeds.h \ - checkqueue.h \ - clientversion.h \ - coinjoin/client.h \ - coinjoin/coinjoin.h \ - coinjoin/common.h \ - coinjoin/options.h \ - coinjoin/server.h \ - coinjoin/util.h \ - coinjoin/walletman.h \ - coins.h \ - common/args.h \ - common/bloom.h \ - common/init.h \ - common/run_command.h \ - common/url.h \ - compat/assumptions.h \ - compat/byteswap.h \ - compat/compat.h \ - compat/cpuid.h \ - compat/endian.h \ - common/settings.h \ - common/system.h \ - compressor.h \ - consensus/consensus.h \ - consensus/tx_check.h \ - consensus/tx_verify.h \ - context.h \ - core_io.h \ - core_memusage.h \ - ctpl_stl.h \ - cuckoocache.h \ - cxxtimer.hpp \ - dbwrapper.h \ - deploymentinfo.h \ - deploymentstatus.h \ - dsnotificationinterface.h \ - evo/assetlocktx.h \ - evo/cbtx.h \ - evo/creditpool.h \ - evo/deterministicmns.h \ - evo/dmn_types.h \ - evo/dmnstate.h \ - evo/evodb.h \ - evo/mnauth.h \ - evo/mnhftx.h \ - evo/netinfo.h \ - evo/providertx.h \ - evo/providertx_service.h \ - evo/sharedcollateral.h \ - evo/simplifiedmns.h \ - evo/smldiff.h \ - evo/snapshot.h \ - evo/specialtx.h \ - evo/specialtx_filter.h \ - evo/specialtxman.h \ - evo/types.h \ - external_signer.h \ - flat-database.h \ - flatfile.h \ - governance/collateral.h \ - governance/common.h \ - governance/governance.h \ - governance/net_governance.h \ - governance/object.h \ - governance/signing.h \ - governance/superblock.h \ - governance/vote.h \ - governance/votedb.h \ - gsl/assert.h \ - gsl/pointers.h \ - httprpc.h \ - httpserver.h \ - i2p.h \ - index/addressindex.h \ - index/addressindex_types.h \ - index/addressindex_util.h \ - index/base.h \ - index/blockfilterindex.h \ - index/coinstatsindex.h \ - index/disktxpos.h \ - index/govcollateralindex.h \ - index/spentindex.h \ - index/spentindex_types.h \ - index/timestampindex.h \ - index/timestampindex_types.h \ - index/txindex.h \ - indirectmap.h \ - init.h \ - init/common.h \ - instantsend/db.h \ - instantsend/instantsend.h \ - instantsend/lock.h \ - instantsend/net_instantsend.h \ - instantsend/signing.h \ - interfaces/chain.h \ - interfaces/coinjoin.h \ - interfaces/echo.h \ - interfaces/handler.h \ - interfaces/init.h \ - interfaces/ipc.h \ - interfaces/node.h \ - interfaces/providertx.h \ - interfaces/wallet.h \ - kernel/blockmanager_opts.h \ - kernel/chain.h \ - kernel/chainparams.h \ - kernel/chainstatemanager_opts.h \ - kernel/checks.h \ - kernel/coinstats.h \ - kernel/context.h \ - kernel/cs_main.h \ - kernel/disconnected_transactions.h \ - kernel/mempool_entry.h \ - kernel/mempool_limits.h \ - kernel/mempool_options.h \ - kernel/mempool_persist.h \ - kernel/mempool_removal_reason.h \ - kernel/notifications_interface.h \ - kernel/validation_cache_sizes.h \ - key.h \ - key_io.h \ - limitedmap.h \ - llmq/blockprocessor.h \ - llmq/cache.h \ - llmq/commitment.h \ - llmq/context.h \ - llmq/debug.h \ - llmq/dkgmessages.h \ - llmq/dkgsession.h \ - llmq/dkgsessionhandler.h \ - llmq/dkgsessionmgr.h \ - llmq/ehf_signals.h \ - llmq/net_dkg.h \ - llmq/net_quorum.h \ - llmq/net_signing.h \ - llmq/observer.h \ - llmq/options_args.h \ - llmq/params.h \ - llmq/quorumproofdata.h \ - llmq/quorumproofs.h \ - llmq/quorums.h \ - llmq/quorumsman.h \ - llmq/signhash.h \ - llmq/signing.h \ - llmq/signing_shares.h \ - llmq/snapshot.h \ - llmq/types.h \ - llmq/utils.h \ - logging.h \ - logging/timer.h \ - mapport.h \ - masternode/meta.h \ - masternode/payments.h \ - masternode/sync.h \ - masternode/utils.h \ - memusage.h \ - merkleblock.h \ - messagesigner.h \ - msg_result.h \ - net.h \ - net_permissions.h \ - net_processing.h \ - net_types.h \ - netaddress.h \ - netbase.h \ - netfulfilledman.h \ - netgroup.h \ - netmessagemaker.h \ - node/blockmanager_args.h \ - node/blockstorage.h \ - node/caches.h \ - node/chainstate.h \ - node/chainstatemanager_args.h \ - node/coin.h \ - node/coins_view_args.h \ - node/connection_types.h \ - node/context.h \ - node/database_args.h \ - node/eviction.h \ - node/interface_ui.h \ - node/kernel_notifications.h \ - node/mempool_args.h \ - node/mempool_persist_args.h \ - node/miner.h \ - node/minisketchwrapper.h \ - node/peerman_args.h \ - node/psbt.h \ - node/sync_manager.h \ - node/transaction.h \ - node/txreconciliation.h \ - node/utxo_snapshot.h \ - node/validation_cache_args.h \ - noui.h \ - outputtype.h \ - policy/feerate.h \ - policy/fees.h \ - policy/fees_args.h \ - policy/packages.h \ - policy/policy.h \ - policy/settings.h \ - pow.h \ - protocol.h \ - psbt.h \ - random.h \ - randomenv.h \ - rest.h \ - rpc/blockchain.h \ - rpc/client.h \ - rpc/json_help.h \ - rpc/mempool.h \ - rpc/mining.h \ - rpc/protocol.h \ - rpc/rawtransaction_util.h \ - rpc/register.h \ - rpc/request.h \ - rpc/server.h \ - rpc/server_util.h \ - rpc/util.h \ - saltedhasher.h \ - scheduler.h \ - script/descriptor.h \ - script/keyorigin.h \ - script/miniscript.h \ - script/sigcache.h \ - script/sign.h \ - script/signingprovider.h \ - script/standard.h \ - shutdown.h \ - source_location.h \ - spork.h \ - stacktraces.h \ - stats/client.h \ - stats/rawsender.h \ - streams.h \ - support/allocators/mt_pooled_secure.h \ - support/allocators/pool.h \ - support/allocators/pooled_secure.h \ - support/allocators/secure.h \ - support/allocators/zeroafterfree.h \ - support/cleanse.h \ - support/events.h \ - support/lockedpool.h \ - sync.h \ - threadsafety.h \ - timedata.h \ - torcontrol.h \ - txdb.h \ - txmempool.h \ - txorphanage.h \ - txrequest.h \ - undo.h \ - unordered_lru_cache.h \ - util/any.h \ - util/asmap.h \ - util/batchpriority.h \ - util/bip32.h \ - util/bitset.h \ - util/bytevectorhash.h \ - util/chaintype.h \ - util/check.h \ - util/edge.h \ - util/epochguard.h \ - util/error.h \ - util/exception.h \ - util/fastrange.h \ - util/fees.h \ - util/fs.h \ - util/fs_helpers.h \ - util/golombrice.h \ - util/hash_type.h \ - util/hasher.h \ - util/helpers.h \ - util/insert.h \ - util/macros.h \ - util/message.h \ - util/moneystr.h \ - util/overflow.h \ - util/overloaded.h \ - util/ranges_set.h \ - util/readwritefile.h \ - util/result.h \ - util/serfloat.h \ - util/sock.h \ - util/spanparsing.h \ - util/std23.h \ - util/string.h \ - util/subprocess.h \ - util/syserror.h \ - util/thread.h \ - util/threadinterrupt.h \ - util/threadnames.h \ - util/time.h \ - util/tokenpipe.h \ - util/trace.h \ - util/translation.h \ - util/types.h \ - util/ui_change_type.h \ - util/vecdeque.h \ - util/vector.h \ - util/wpipe.h \ - util/zstd.h \ - validation.h \ - validationinterface.h \ - versionbits.h \ - wallet/bdb.h \ - wallet/bip39.h \ - wallet/bip39_english.h \ - wallet/coincontrol.h \ - wallet/coinjoin.h \ - wallet/coinselection.h \ - wallet/context.h \ - wallet/crypter.h \ - wallet/db.h \ - wallet/dump.h \ - wallet/external_signer_scriptpubkeyman.h \ - wallet/fees.h \ - wallet/hdchain.h \ - wallet/load.h \ - wallet/platformkeys.h \ - wallet/platformtypes.h \ - wallet/receive.h \ - wallet/rpc/util.h \ - wallet/rpc/wallet.h \ - wallet/salvage.h \ - wallet/scriptpubkeyman.h \ - wallet/spend.h \ - wallet/sqlite.h \ - wallet/transaction.h \ - wallet/types.h \ - wallet/wallet.h \ - wallet/walletdb.h \ - wallet/wallettool.h \ - wallet/walletutil.h \ - walletinitinterface.h \ - warnings.h \ - zmq/zmqabstractnotifier.h \ - zmq/zmqnotificationinterface.h \ - zmq/zmqpublishnotifier.h \ - zmq/zmqrpc.h \ - zmq/zmqutil.h - - -obj/build.h: FORCE - @$(MKDIR_P) $(builddir)/obj - $(AM_V_GEN) $(top_srcdir)/share/genbuild.sh "$(abs_top_builddir)/src/obj/build.h" \ - "$(abs_top_srcdir)" -libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h - -# node # -libbitcoin_node_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(LEVELDB_CPPFLAGS) $(BOOST_CPPFLAGS) $(MINIUPNPC_CPPFLAGS) $(NATPMP_CPPFLAGS) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS) $(ZSTD_CFLAGS) -libbitcoin_node_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -libbitcoin_node_a_SOURCES = \ - active/context.cpp \ - active/dkgsession.cpp \ - active/dkgsessionhandler.cpp \ - active/masternode.cpp \ - addrdb.cpp \ - addrman.cpp \ - banman.cpp \ - batchedlogger.cpp \ - bip324.cpp \ - blockencodings.cpp \ - blockfilter.cpp \ - chain.cpp \ - chainlock/chainlock.cpp \ - chainlock/clsig.cpp \ - chainlock/handler.cpp \ - chainlock/signing.cpp \ - coinjoin/coinjoin.cpp \ - coinjoin/server.cpp \ - consensus/tx_verify.cpp \ - dbwrapper.cpp \ - deploymentstatus.cpp \ - dsnotificationinterface.cpp \ - evo/assetlocktx.cpp \ - evo/cbtx.cpp \ - evo/creditpool.cpp \ - evo/deterministicmns.cpp \ - evo/dmnstate.cpp \ - evo/evodb.cpp \ - evo/mnauth.cpp \ - evo/mnhftx.cpp \ - evo/providertx.cpp \ - evo/providertx_service.cpp \ - evo/simplifiedmns.cpp \ - evo/smldiff.cpp \ - evo/snapshot.cpp \ - evo/specialtx.cpp \ - evo/specialtx_filter.cpp \ - evo/specialtxman.cpp \ - flatfile.cpp \ - governance/collateral.cpp \ - governance/governance.cpp \ - governance/net_governance.cpp \ - governance/object.cpp \ - governance/signing.cpp \ - governance/superblock.cpp \ - governance/vote.cpp \ - governance/votedb.cpp \ - gsl/assert.cpp \ - httprpc.cpp \ - httpserver.cpp \ - i2p.cpp \ - index/addressindex.cpp \ - index/addressindex_util.cpp \ - index/base.cpp \ - index/blockfilterindex.cpp \ - index/coinstatsindex.cpp \ - index/govcollateralindex.cpp \ - index/spentindex.cpp \ - index/timestampindex.cpp \ - index/txindex.cpp \ - init.cpp \ - instantsend/db.cpp \ - instantsend/instantsend.cpp \ - instantsend/lock.cpp \ - instantsend/net_instantsend.cpp \ - instantsend/signing.cpp \ - kernel/chain.cpp \ - kernel/checks.cpp \ - kernel/coinstats.cpp \ - kernel/context.cpp \ - kernel/cs_main.cpp \ - kernel/disconnected_transactions.cpp \ - kernel/mempool_persist.cpp \ - kernel/mempool_removal_reason.cpp \ - llmq/blockprocessor.cpp \ - llmq/commitment.cpp \ - llmq/context.cpp \ - llmq/debug.cpp \ - llmq/dkgsession.cpp \ - llmq/dkgsessionhandler.cpp \ - llmq/dkgsessionmgr.cpp \ - llmq/ehf_signals.cpp \ - llmq/net_dkg.cpp \ - llmq/net_quorum.cpp \ - llmq/net_signing.cpp \ - llmq/observer.cpp \ - llmq/options_args.cpp \ - llmq/quorumproofs.cpp \ - llmq/quorums.cpp \ - llmq/quorumsman.cpp \ - llmq/signhash.cpp \ - llmq/signing.cpp \ - llmq/signing_shares.cpp \ - llmq/snapshot.cpp \ - llmq/utils.cpp \ - mapport.cpp \ - masternode/meta.cpp \ - masternode/payments.cpp \ - masternode/sync.cpp \ - masternode/utils.cpp \ - net.cpp \ - net_processing.cpp \ - netfulfilledman.cpp \ - netgroup.cpp \ - node/blockmanager_args.cpp \ - node/blockstorage.cpp \ - node/caches.cpp \ - node/chainstate.cpp \ - node/chainstatemanager_args.cpp \ - node/coin.cpp \ - node/coins_view_args.cpp \ - node/connection_types.cpp \ - node/context.cpp \ - node/database_args.cpp \ - node/eviction.cpp \ - node/interface_ui.cpp \ - node/interfaces.cpp \ - node/kernel_notifications.cpp \ - node/mempool_args.cpp \ - node/mempool_persist_args.cpp \ - node/miner.cpp \ - node/minisketchwrapper.cpp \ - node/peerman_args.cpp \ - node/psbt.cpp \ - node/sync_manager.cpp \ - node/transaction.cpp \ - node/txreconciliation.cpp \ - node/utxo_snapshot.cpp \ - node/validation_cache_args.cpp \ - noui.cpp \ - policy/fees.cpp \ - policy/fees_args.cpp \ - policy/packages.cpp \ - policy/policy.cpp \ - policy/settings.cpp \ - pow.cpp \ - rest.cpp \ - rpc/blockchain.cpp \ - rpc/coinjoin.cpp \ - rpc/evo.cpp \ - rpc/fees.cpp \ - rpc/governance.cpp \ - rpc/json_help.cpp \ - rpc/masternode.cpp \ - rpc/mempool.cpp \ - rpc/mining.cpp \ - rpc/net.cpp \ - rpc/node.cpp \ - rpc/output_script.cpp \ - rpc/quorums.cpp \ - rpc/rawtransaction.cpp \ - rpc/server.cpp \ - rpc/server_util.cpp \ - rpc/signmessage.cpp \ - rpc/txoutproof.cpp \ - script/sigcache.cpp \ - shutdown.cpp \ - spork.cpp \ - stats/client.cpp \ - stats/rawsender.cpp \ - timedata.cpp \ - torcontrol.cpp \ - txdb.cpp \ - txmempool.cpp \ - txorphanage.cpp \ - txrequest.cpp \ - validation.cpp \ - validationinterface.cpp \ - versionbits.cpp \ - $(BITCOIN_CORE_H) - -if ENABLE_WALLET -libbitcoin_node_a_SOURCES += wallet/init.cpp -libbitcoin_node_a_CPPFLAGS += $(BDB_CPPFLAGS) -endif -if !ENABLE_WALLET -libbitcoin_node_a_SOURCES += dummywallet.cpp -endif -# - -# zmq # -if ENABLE_ZMQ -libbitcoin_zmq_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BOOST_CPPFLAGS) $(ZMQ_CFLAGS) -libbitcoin_zmq_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -libbitcoin_zmq_a_SOURCES = \ - zmq/zmqabstractnotifier.cpp \ - zmq/zmqnotificationinterface.cpp \ - zmq/zmqpublishnotifier.cpp \ - zmq/zmqrpc.cpp \ - zmq/zmqutil.cpp -endif -# - -# wallet # -libbitcoin_wallet_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BOOST_CPPFLAGS) $(BDB_CPPFLAGS) $(SQLITE_CFLAGS) -libbitcoin_wallet_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -libbitcoin_wallet_a_SOURCES = \ - coinjoin/client.cpp \ - coinjoin/interfaces.cpp \ - coinjoin/util.cpp \ - coinjoin/walletman.cpp \ - wallet/bip39.cpp \ - wallet/coincontrol.cpp \ - wallet/coinjoin.cpp \ - wallet/coinselection.cpp \ - wallet/context.cpp \ - wallet/crypter.cpp \ - wallet/db.cpp \ - wallet/dump.cpp \ - wallet/external_signer_scriptpubkeyman.cpp \ - wallet/fees.cpp \ - wallet/hdchain.cpp \ - wallet/interfaces.cpp \ - wallet/load.cpp \ - wallet/platformkeys.cpp \ - wallet/receive.cpp \ - wallet/rpc/addresses.cpp \ - wallet/rpc/backup.cpp \ - wallet/rpc/coins.cpp \ - wallet/rpc/encrypt.cpp \ - wallet/rpc/signmessage.cpp \ - wallet/rpc/spend.cpp \ - wallet/rpc/transactions.cpp \ - wallet/rpc/util.cpp \ - wallet/rpc/wallet.cpp \ - wallet/scriptpubkeyman.cpp \ - wallet/spend.cpp \ - wallet/transaction.cpp \ - wallet/wallet.cpp \ - wallet/walletdb.cpp \ - wallet/walletutil.cpp \ - $(BITCOIN_CORE_H) - -if USE_SQLITE -libbitcoin_wallet_a_SOURCES += wallet/sqlite.cpp -endif -if USE_BDB -libbitcoin_wallet_a_SOURCES += wallet/bdb.cpp wallet/salvage.cpp -endif -# - -# wallet tool # -libbitcoin_wallet_tool_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BOOST_CPPFLAGS) -libbitcoin_wallet_tool_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -libbitcoin_wallet_tool_a_SOURCES = \ - wallet/wallettool.cpp \ - $(BITCOIN_CORE_H) -# - -# crypto # -crypto_libbitcoin_crypto_base_la_CPPFLAGS = $(AM_CPPFLAGS) $(PIC_FLAGS) - -# Specify -static in both CXXFLAGS and LDFLAGS so libtool will only build a -# static version of this library. We don't need a dynamic version, and a dynamic -# version can't be used on windows anyway because the library doesn't currently -# export DLL symbols. -crypto_libbitcoin_crypto_base_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) $(PIC_FLAGS) -static -crypto_libbitcoin_crypto_base_la_LDFLAGS = $(AM_LDFLAGS) -static - -crypto_libbitcoin_crypto_base_la_SOURCES = \ - crypto/aes.cpp \ - crypto/aes.h \ - crypto/chacha20.cpp \ - crypto/chacha20.h \ - crypto/chacha20poly1305.cpp \ - crypto/chacha20poly1305.h \ - crypto/common.h \ - crypto/hkdf_sha256_32.cpp \ - crypto/hkdf_sha256_32.h \ - crypto/hmac_sha256.cpp \ - crypto/hmac_sha256.h \ - crypto/hmac_sha512.cpp \ - crypto/hmac_sha512.h \ - crypto/muhash.cpp \ - crypto/muhash.h \ - crypto/pkcs5_pbkdf2_hmac_sha512.cpp \ - crypto/pkcs5_pbkdf2_hmac_sha512.h \ - crypto/poly1305.cpp \ - crypto/poly1305.h \ - crypto/ripemd160.cpp \ - crypto/ripemd160.h \ - crypto/sha1.cpp \ - crypto/sha1.h \ - crypto/sha256.cpp \ - crypto/sha256.h \ - crypto/sha256_sse4.cpp \ - crypto/sha3.cpp \ - crypto/sha3.h \ - crypto/sha512.cpp \ - crypto/sha512.h \ - crypto/siphash.cpp \ - crypto/siphash.h - -# See explanation for -static in crypto_libbitcoin_crypto_base_la's LDFLAGS and -# CXXFLAGS above -crypto_libbitcoin_crypto_sse41_la_LDFLAGS = $(AM_LDFLAGS) -static -crypto_libbitcoin_crypto_sse41_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -static -crypto_libbitcoin_crypto_sse41_la_CPPFLAGS = $(AM_CPPFLAGS) -crypto_libbitcoin_crypto_sse41_la_CXXFLAGS += $(SSE41_CXXFLAGS) -crypto_libbitcoin_crypto_sse41_la_CPPFLAGS += -DENABLE_SSE41 -crypto_libbitcoin_crypto_sse41_la_SOURCES = crypto/sha256_sse41.cpp - -# See explanation for -static in crypto_libbitcoin_crypto_base_la's LDFLAGS and -# CXXFLAGS above -crypto_libbitcoin_crypto_avx2_la_LDFLAGS = $(AM_LDFLAGS) -static -crypto_libbitcoin_crypto_avx2_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -static -crypto_libbitcoin_crypto_avx2_la_CPPFLAGS = $(AM_CPPFLAGS) -crypto_libbitcoin_crypto_avx2_la_CXXFLAGS += $(AVX2_CXXFLAGS) -crypto_libbitcoin_crypto_avx2_la_CPPFLAGS += -DENABLE_AVX2 -crypto_libbitcoin_crypto_avx2_la_SOURCES = crypto/sha256_avx2.cpp - -# See explanation for -static in crypto_libbitcoin_crypto_base_la's LDFLAGS and -# CXXFLAGS above -crypto_libbitcoin_crypto_sph_la_LDFLAGS = $(AM_LDFLAGS) -static -crypto_libbitcoin_crypto_sph_la_CXXFLAGS = $(AM_CXXFLAGS) $(SPHLIB_FLAGS) $(PIE_FLAGS) -static -crypto_libbitcoin_crypto_sph_la_CPPFLAGS = $(AM_CPPFLAGS) -crypto_libbitcoin_crypto_sph_la_CFLAGS = $(SPHLIB_FLAGS) -crypto_libbitcoin_crypto_sph_la_CPPFLAGS += \ - -DSPH_SMALL_FOOTPRINT_CUBEHASH=1 \ - -DSPH_SMALL_FOOTPRINT_JH=1 -crypto_libbitcoin_crypto_sph_la_SOURCES = \ - crypto/x11/aes.cpp \ - crypto/x11/aes.h \ - crypto/x11/blake.c \ - crypto/x11/bmw.c \ - crypto/x11/cubehash.c \ - crypto/x11/dispatch.cpp \ - crypto/x11/dispatch.h \ - crypto/x11/echo.cpp \ - crypto/x11/groestl.c \ - crypto/x11/jh.c \ - crypto/x11/keccak.c \ - crypto/x11/luffa.c \ - crypto/x11/shavite.cpp \ - crypto/x11/simd.c \ - crypto/x11/skein.c \ - crypto/x11/sph_blake.h \ - crypto/x11/sph_bmw.h \ - crypto/x11/sph_cubehash.h \ - crypto/x11/sph_echo.h \ - crypto/x11/sph_groestl.h \ - crypto/x11/sph_jh.h \ - crypto/x11/sph_keccak.h \ - crypto/x11/sph_luffa.h \ - crypto/x11/sph_shavite.h \ - crypto/x11/sph_simd.h \ - crypto/x11/sph_skein.h \ - crypto/x11/sph_types.h \ - crypto/x11/util/consts_aes.hpp \ - crypto/x11/util/util.hpp - -# See explanation for -static in crypto_libbitcoin_crypto_base_la's LDFLAGS and -# CXXFLAGS above -crypto_libbitcoin_crypto_arm_aes_la_LDFLAGS = $(AM_LDFLAGS) -static -crypto_libbitcoin_crypto_arm_aes_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -static -crypto_libbitcoin_crypto_arm_aes_la_CPPFLAGS = $(AM_CPPFLAGS) -crypto_libbitcoin_crypto_arm_aes_la_CXXFLAGS += $(ARM_AES_CXXFLAGS) -crypto_libbitcoin_crypto_arm_aes_la_CPPFLAGS += -DENABLE_ARM_AES -crypto_libbitcoin_crypto_arm_aes_la_SOURCES = \ - crypto/x11/arm_crypto/echo.cpp \ - crypto/x11/arm_crypto/shavite.cpp - -# See explanation for -static in crypto_libbitcoin_crypto_base_la's LDFLAGS and -# CXXFLAGS above -crypto_libbitcoin_crypto_arm_neon_la_LDFLAGS = $(AM_LDFLAGS) -static -crypto_libbitcoin_crypto_arm_neon_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -static -crypto_libbitcoin_crypto_arm_neon_la_CPPFLAGS = $(AM_CPPFLAGS) -crypto_libbitcoin_crypto_arm_neon_la_CXXFLAGS += $(ARM_NEON_CXXFLAGS) -crypto_libbitcoin_crypto_arm_neon_la_CPPFLAGS += -DENABLE_ARM_NEON -crypto_libbitcoin_crypto_arm_neon_la_SOURCES = \ - crypto/x11/arm_neon/echo.cpp - -# See explanation for -static in crypto_libbitcoin_crypto_base_la's LDFLAGS and -# CXXFLAGS above -crypto_libbitcoin_crypto_ssse3_la_LDFLAGS = $(AM_LDFLAGS) -static -crypto_libbitcoin_crypto_ssse3_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -static -crypto_libbitcoin_crypto_ssse3_la_CPPFLAGS = $(AM_CPPFLAGS) -crypto_libbitcoin_crypto_ssse3_la_CXXFLAGS += $(SSSE3_CXXFLAGS) -crypto_libbitcoin_crypto_ssse3_la_CPPFLAGS += -DENABLE_SSSE3 -crypto_libbitcoin_crypto_ssse3_la_SOURCES = \ - crypto/x11/ssse3/echo.cpp - -# See explanation for -static in crypto_libbitcoin_crypto_base_la's LDFLAGS and -# CXXFLAGS above -crypto_libbitcoin_crypto_x86_aesni_la_LDFLAGS = $(AM_LDFLAGS) -static -crypto_libbitcoin_crypto_x86_aesni_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -static -crypto_libbitcoin_crypto_x86_aesni_la_CPPFLAGS = $(AM_CPPFLAGS) -crypto_libbitcoin_crypto_x86_aesni_la_CXXFLAGS += $(X86_AESNI_CXXFLAGS) -crypto_libbitcoin_crypto_x86_aesni_la_CPPFLAGS += -DENABLE_SSE41 -DENABLE_X86_AESNI -crypto_libbitcoin_crypto_x86_aesni_la_SOURCES = \ - crypto/x11/x86_aesni/echo.cpp \ - crypto/x11/x86_aesni/shavite.cpp - -# See explanation for -static in crypto_libbitcoin_crypto_base_la's LDFLAGS and -# CXXFLAGS above -crypto_libbitcoin_crypto_x86_shani_la_LDFLAGS = $(AM_LDFLAGS) -static -crypto_libbitcoin_crypto_x86_shani_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -static -crypto_libbitcoin_crypto_x86_shani_la_CPPFLAGS = $(AM_CPPFLAGS) -crypto_libbitcoin_crypto_x86_shani_la_CXXFLAGS += $(X86_SHANI_CXXFLAGS) -crypto_libbitcoin_crypto_x86_shani_la_CPPFLAGS += -DENABLE_SSE41 -DENABLE_X86_SHANI -crypto_libbitcoin_crypto_x86_shani_la_SOURCES = crypto/sha256_x86_shani.cpp - -# See explanation for -static in crypto_libbitcoin_crypto_base_la's LDFLAGS and -# CXXFLAGS above -crypto_libbitcoin_crypto_arm_shani_la_LDFLAGS = $(AM_LDFLAGS) -static -crypto_libbitcoin_crypto_arm_shani_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -static -crypto_libbitcoin_crypto_arm_shani_la_CPPFLAGS = $(AM_CPPFLAGS) -crypto_libbitcoin_crypto_arm_shani_la_CXXFLAGS += $(ARM_SHANI_CXXFLAGS) -crypto_libbitcoin_crypto_arm_shani_la_CPPFLAGS += -DENABLE_ARM_SHANI -crypto_libbitcoin_crypto_arm_shani_la_SOURCES = crypto/sha256_arm_shani.cpp -# - -# consensus # -libbitcoin_consensus_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BOOST_CPPFLAGS) -libbitcoin_consensus_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -libbitcoin_consensus_a_SOURCES = \ - arith_uint256.cpp \ - arith_uint256.h \ - bls/bls.cpp \ - bls/bls.h \ - consensus/amount.h \ - consensus/merkle.cpp \ - consensus/merkle.h \ - consensus/params.h \ - consensus/tx_check.cpp \ - consensus/validation.h \ - hash.cpp \ - hash.h \ - hash_x11.h \ - prevector.h \ - primitives/block.cpp \ - primitives/block.h \ - primitives/transaction.cpp \ - primitives/transaction.h \ - pubkey.cpp \ - pubkey.h \ - script/bitcoinconsensus.cpp \ - script/interpreter.cpp \ - script/interpreter.h \ - script/script.cpp \ - script/script.h \ - script/script_error.cpp \ - script/script_error.h \ - serialize.h \ - span.h \ - streams.h \ - tinyformat.h \ - uint256.cpp \ - uint256.h \ - util/strencodings.cpp \ - util/strencodings.h \ - util/string.cpp \ - version.h -# - -# common # -libbitcoin_common_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BOOST_CPPFLAGS) -libbitcoin_common_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -libbitcoin_common_a_SOURCES = \ - base58.cpp \ - bech32.cpp \ - chainparams.cpp \ - coins.cpp \ - common/args.cpp \ - common/bloom.cpp \ - common/config.cpp \ - common/init.cpp \ - common/interfaces.cpp \ - common/run_command.cpp \ - common/settings.cpp \ - common/system.cpp \ - common/url.cpp \ - compressor.cpp \ - core_read.cpp \ - core_write.cpp \ - deploymentinfo.cpp \ - evo/core_write.cpp \ - evo/netinfo.cpp \ - evo/providertx_util.cpp \ - external_signer.cpp \ - governance/common.cpp \ - init/common.cpp \ - kernel/chainparams.cpp \ - key.cpp \ - key_io.cpp \ - llmq/core_write.cpp \ - merkleblock.cpp \ - net_permissions.cpp \ - net_types.cpp \ - netaddress.cpp \ - netbase.cpp \ - outputtype.cpp \ - policy/feerate.cpp \ - policy/policy.cpp \ - protocol.cpp \ - psbt.cpp \ - rpc/external_signer.cpp \ - rpc/rawtransaction_util.cpp \ - rpc/request.cpp \ - rpc/util.cpp \ - saltedhasher.cpp \ - scheduler.cpp \ - script/descriptor.cpp \ - script/miniscript.cpp \ - script/sign.cpp \ - script/signingprovider.cpp \ - script/standard.cpp \ - warnings.cpp \ - $(BITCOIN_CORE_H) -# - -# util # -libbitcoin_util_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(ZSTD_CFLAGS) -libbitcoin_util_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -libbitcoin_util_a_SOURCES = \ - bls/bls_batchverifier.h \ - bls/bls_ies.cpp \ - bls/bls_ies.h \ - bls/bls_worker.cpp \ - bls/bls_worker.h \ - chainparamsbase.cpp \ - clientversion.cpp \ - coinjoin/common.cpp \ - coinjoin/options.cpp \ - logging.cpp \ - messagesigner.cpp \ - random.cpp \ - randomenv.cpp \ - stacktraces.cpp \ - streams.cpp \ - support/cleanse.cpp \ - support/lockedpool.cpp \ - sync.cpp \ - util/asmap.cpp \ - util/batchpriority.cpp \ - util/bip32.cpp \ - util/bytevectorhash.cpp \ - util/chaintype.cpp \ - util/check.cpp \ - util/edge.cpp \ - util/error.cpp \ - util/exception.cpp \ - util/fees.cpp \ - util/fs.cpp \ - util/fs_helpers.cpp \ - util/hasher.cpp \ - util/message.cpp \ - util/moneystr.cpp \ - util/ranges_set.cpp \ - util/readwritefile.cpp \ - util/serfloat.cpp \ - util/sock.cpp \ - util/spanparsing.cpp \ - util/strencodings.cpp \ - util/string.cpp \ - util/syserror.cpp \ - util/thread.cpp \ - util/threadinterrupt.cpp \ - util/threadnames.cpp \ - util/time.cpp \ - util/tokenpipe.cpp \ - util/wpipe.cpp \ - util/zstd.cpp \ - $(BITCOIN_CORE_H) -# - -# cli # -libbitcoin_cli_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) -libbitcoin_cli_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -libbitcoin_cli_a_SOURCES = \ - compat/stdin.h \ - compat/stdin.cpp \ - rpc/client.cpp \ - $(BITCOIN_CORE_H) - -nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h -# - -# dashd & dash-node binaries # -bitcoin_daemon_sources = bitcoind.cpp -bitcoin_bin_cppflags = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) -bitcoin_bin_cxxflags = $(AM_CXXFLAGS) $(PIE_FLAGS) -bitcoin_bin_ldflags = $(LDFLAGS_WRAP_EXCEPTIONS) $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS) - -if TARGET_WINDOWS -bitcoin_daemon_sources += dashd-res.rc -endif - -bitcoin_bin_ldadd = \ - $(LIBBITCOIN_WALLET) \ - $(LIBBITCOIN_COMMON) \ - $(LIBBITCOIN_UTIL) \ - $(LIBUNIVALUE) \ - $(LIBBITCOIN_ZMQ) \ - $(LIBBITCOIN_CONSENSUS) \ - $(LIBBITCOIN_CRYPTO) \ - $(LIBDASHBLS) \ - $(LIBLEVELDB) \ - $(LIBMEMENV) \ - $(LIBSECP256K1) - -bitcoin_bin_ldadd += $(BACKTRACE_LIBS) $(BDB_LIBS) $(MINIUPNPC_LIBS) $(NATPMP_LIBS) $(SQLITE_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(ZMQ_LIBS) $(ZSTD_LIBS) - -dashd_SOURCES = $(bitcoin_daemon_sources) init/bitcoind.cpp -dashd_CPPFLAGS = $(bitcoin_bin_cppflags) -dashd_CXXFLAGS = $(bitcoin_bin_cxxflags) -dashd_LDFLAGS = $(bitcoin_bin_ldflags) -dashd_LDADD = $(LIBBITCOIN_NODE) $(bitcoin_bin_ldadd) - -dash_node_SOURCES = $(bitcoin_daemon_sources) init/bitcoin-node.cpp -dash_node_CPPFLAGS = $(bitcoin_bin_cppflags) -dash_node_CXXFLAGS = $(bitcoin_bin_cxxflags) -dash_node_LDFLAGS = $(bitcoin_bin_ldflags) -dash_node_LDADD = $(LIBBITCOIN_NODE) $(bitcoin_bin_ldadd) $(LIBBITCOIN_IPC) $(LIBMULTIPROCESS_LIBS) - -# dash-cli binary # -dash_cli_SOURCES = bitcoin-cli.cpp -dash_cli_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS) -dash_cli_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -dash_cli_LDFLAGS = $(LDFLAGS_WRAP_EXCEPTIONS) $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS) - -if TARGET_WINDOWS -dash_cli_SOURCES += dash-cli-res.rc -endif - -dash_cli_LDADD = \ - $(LIBBITCOIN_CLI) \ - $(LIBUNIVALUE) \ - $(LIBBITCOIN_COMMON) \ - $(LIBBITCOIN_UTIL) \ - $(LIBBITCOIN_CRYPTO) -dash_cli_LDADD += $(BACKTRACE_LIBS) $(EVENT_LIBS) -# - -# dash-tx binary # -dash_tx_SOURCES = bitcoin-tx.cpp -dash_tx_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) -dash_tx_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -dash_tx_LDFLAGS = $(LDFLAGS_WRAP_EXCEPTIONS) $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS) - -if TARGET_WINDOWS -dash_tx_SOURCES += dash-tx-res.rc -endif - -dash_tx_LDADD = \ - $(LIBUNIVALUE) \ - $(LIBBITCOIN_COMMON) \ - $(LIBBITCOIN_UTIL) \ - $(LIBBITCOIN_CONSENSUS) \ - $(LIBBITCOIN_CRYPTO) \ - $(LIBDASHBLS) \ - $(LIBSECP256K1) - -dash_tx_LDADD += $(BACKTRACE_LIBS) -# - -# dash-wallet binary # -dash_wallet_SOURCES = bitcoin-wallet.cpp -dash_wallet_SOURCES += init/bitcoin-wallet.cpp -dash_wallet_CPPFLAGS = $(bitcoin_bin_cppflags) -dash_wallet_CXXFLAGS = $(bitcoin_bin_cxxflags) -dash_wallet_LDFLAGS = $(bitcoin_bin_ldflags) -dash_wallet_LDADD = \ - $(LIBBITCOIN_WALLET_TOOL) \ - $(LIBBITCOIN_WALLET) \ - $(LIBBITCOIN_COMMON) \ - $(LIBBITCOIN_UTIL) \ - $(LIBUNIVALUE) \ - $(LIBBITCOIN_CONSENSUS) \ - $(LIBBITCOIN_CRYPTO) \ - $(LIBDASHBLS) \ - $(LIBSECP256K1) \ - $(BACKTRACE_LIBS) \ - $(BOOST_LIBS) \ - $(BDB_LIBS) \ - $(SQLITE_LIBS) - -if TARGET_WINDOWS -dash_wallet_SOURCES += dash-wallet-res.rc -endif -# - -# dash-util binary # -dash_util_SOURCES = bitcoin-util.cpp -dash_util_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) -dash_util_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -dash_util_LDFLAGS = $(LDFLAGS_WRAP_EXCEPTIONS) $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS) - -if TARGET_WINDOWS -dash_util_SOURCES += bitcoin-util-res.rc -endif - -dash_util_LDADD = \ - $(LIBBITCOIN_COMMON) \ - $(LIBBITCOIN_UTIL) \ - $(LIBUNIVALUE) \ - $(LIBBITCOIN_CONSENSUS) \ - $(LIBBITCOIN_CRYPTO) \ - $(LIBSECP256K1) \ - $(BACKTRACE_LIBS) - -dash_util_LDADD += $(BOOST_LIBS) - -# dash-chainstate binary # -dash_chainstate_SOURCES = bitcoin-chainstate.cpp -dash_chainstate_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BOOST_CPPFLAGS) -dash_chainstate_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) - -dash_chainstate_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(PTHREAD_FLAGS) $(LIBTOOL_APP_LDFLAGS) -static -dash_chainstate_LDADD = $(LIBBITCOINKERNEL) - -# libtool is unable to calculate this indirect dependency, presumably because it's a subproject. -# libsecp256k1 and libdashbls only need to be linked in when libdashkernel is static. -dash_chainstate_LDADD += $(LIBSECP256K1) $(LIBDASHBLS) -# - -# dashkernel library # -if BUILD_BITCOIN_KERNEL_LIB -lib_LTLIBRARIES += $(LIBBITCOINKERNEL) - -libdashkernel_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS) $(PTHREAD_FLAGS) -libdashkernel_la_LIBADD = $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) $(LIBMEMENV) $(LIBSECP256K1) $(LIBDASHBLS) $(ZSTD_LIBS) -libdashkernel_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL $(DASHBLS_CPPFLAGS) -isystem$(srcdir)/immer $(BOOST_CPPFLAGS) $(LEVELDB_CPPFLAGS) $(ZSTD_CFLAGS) -I$(srcdir)/$(UNIVALUE_INCLUDE_DIR_INT) - -# libdashkernel requires default symbol visibility, explicitly specify that -# here so that things still work even when user configures with -# --enable-reduce-exports -# -# Note this is a quick hack that will be removed as we incrementally define what -# to export from the library. -libdashkernel_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -fvisibility=default - -# TODO: libdashkernel is a work in progress consensus engine library, as more -# and more modules are decoupled from the consensus engine, this list will -# shrink to only those which are absolutely necessary. For example, things -# like index/*.cpp will be removed. -libdashkernel_la_SOURCES = \ - kernel/bitcoinkernel.cpp \ - arith_uint256.cpp \ - base58.cpp \ - batchedlogger.cpp \ - bech32.cpp \ - blockfilter.cpp \ - bls/bls.cpp \ - bls/bls_worker.cpp \ - chain.cpp \ - chainlock/chainlock.cpp \ - chainlock/clsig.cpp \ - chainparams.cpp \ - chainparamsbase.cpp \ - clientversion.cpp \ - coins.cpp \ - common/args.cpp \ - common/bloom.cpp \ - common/config.cpp \ - common/settings.cpp \ - compressor.cpp \ - consensus/merkle.cpp \ - consensus/tx_check.cpp \ - consensus/tx_verify.cpp \ - core_read.cpp \ - dbwrapper.cpp \ - deploymentinfo.cpp \ - deploymentstatus.cpp \ - evo/assetlocktx.cpp \ - evo/cbtx.cpp \ - evo/creditpool.cpp \ - evo/deterministicmns.cpp \ - evo/dmnstate.cpp \ - evo/evodb.cpp \ - evo/mnhftx.cpp \ - evo/netinfo.cpp \ - evo/providertx.cpp \ - evo/providertx_util.cpp \ - evo/simplifiedmns.cpp \ - evo/smldiff.cpp \ - evo/specialtx.cpp \ - evo/specialtx_filter.cpp \ - evo/specialtxman.cpp \ - flatfile.cpp \ - gsl/assert.cpp \ - hash.cpp \ - index/addressindex_util.cpp \ - instantsend/db.cpp \ - instantsend/instantsend.cpp \ - instantsend/lock.cpp \ - kernel/chain.cpp \ - kernel/checks.cpp \ - kernel/chainparams.cpp \ - kernel/coinstats.cpp \ - kernel/context.cpp \ - kernel/cs_main.cpp \ - kernel/disconnected_transactions.cpp \ - kernel/mempool_persist.cpp \ - kernel/mempool_removal_reason.cpp \ - key.cpp \ - key_io.cpp \ - llmq/blockprocessor.cpp \ - llmq/commitment.cpp \ - llmq/context.cpp \ - llmq/dkgsessionmgr.cpp \ - llmq/quorums.cpp \ - llmq/quorumsman.cpp \ - llmq/signhash.cpp \ - llmq/signing.cpp \ - llmq/snapshot.cpp \ - llmq/utils.cpp \ - logging.cpp \ - masternode/meta.cpp \ - masternode/payments.cpp \ - merkleblock.cpp \ - messagesigner.cpp \ - netaddress.cpp \ - netbase.cpp \ - node/blockstorage.cpp \ - node/chainstate.cpp \ - node/interface_ui.cpp \ - node/utxo_snapshot.cpp \ - policy/feerate.cpp \ - policy/fees.cpp \ - policy/packages.cpp \ - policy/policy.cpp \ - policy/settings.cpp \ - pow.cpp \ - primitives/block.cpp \ - primitives/transaction.cpp \ - protocol.cpp \ - pubkey.cpp \ - random.cpp \ - randomenv.cpp \ - saltedhasher.cpp \ - scheduler.cpp \ - script/interpreter.cpp \ - script/script.cpp \ - script/script_error.cpp \ - script/sigcache.cpp \ - script/standard.cpp \ - shutdown.cpp \ - spork.cpp \ - streams.cpp \ - support/cleanse.cpp \ - support/lockedpool.cpp \ - sync.cpp \ - timedata.cpp \ - txdb.cpp \ - txmempool.cpp \ - uint256.cpp \ - util/batchpriority.cpp \ - util/bytevectorhash.cpp \ - util/chaintype.cpp \ - util/check.cpp \ - util/exception.cpp \ - util/fs.cpp \ - util/fs_helpers.cpp \ - util/hasher.cpp \ - util/message.cpp \ - util/moneystr.cpp \ - util/ranges_set.cpp \ - util/serfloat.cpp \ - util/sock.cpp \ - util/strencodings.cpp \ - util/string.cpp \ - util/syserror.cpp \ - util/thread.cpp \ - util/threadinterrupt.cpp \ - util/threadnames.cpp \ - util/time.cpp \ - util/tokenpipe.cpp \ - util/zstd.cpp \ - validation.cpp \ - validationinterface.cpp \ - versionbits.cpp \ - warnings.cpp - -# Required for obj/build.h to be generated first. -# More details: https://www.gnu.org/software/automake/manual/html_node/Built-Sources-Example.html -libdashkernel_la-clientversion.l$(OBJEXT): obj/build.h -endif # BUILD_BITCOIN_KERNEL_LIB -# - -# dashconsensus library # -if BUILD_BITCOIN_LIBS -lib_LTLIBRARIES += $(LIBBITCOINCONSENSUS) - -include_HEADERS = script/bitcoinconsensus.h -libdashconsensus_la_SOURCES = support/cleanse.cpp $(crypto_libbitcoin_crypto_base_la_SOURCES) $(crypto_libbitcoin_crypto_sph_la_SOURCES) $(libbitcoin_consensus_a_SOURCES) - -libdashconsensus_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS) -libdashconsensus_la_LIBADD = $(LIBDASHBLS) $(LIBSECP256K1) -libdashconsensus_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL -DDISABLE_OPTIMIZED_SHA256 -libdashconsensus_la_CPPFLAGS += $(DASHBLS_CPPFLAGS) -libdashconsensus_la_CPPFLAGS += -isystem$(srcdir)/immer -libdashconsensus_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) - -endif -# - -CTAES_DIST = crypto/ctaes/bench.c -CTAES_DIST += crypto/ctaes/ctaes.c -CTAES_DIST += crypto/ctaes/ctaes.h -CTAES_DIST += crypto/ctaes/README.md -CTAES_DIST += crypto/ctaes/test.c - -CLEANFILES = $(EXTRA_LIBRARIES) - -CLEANFILES += *.gcda *.gcno -CLEANFILES += compat/*.gcda compat/*.gcno -CLEANFILES += consensus/*.gcda consensus/*.gcno -CLEANFILES += crc32c/src/*.gcda crc32c/src/*.gcno -CLEANFILES += crypto/*.gcda crypto/*.gcno -CLEANFILES += index/*.gcda index/*.gcno -CLEANFILES += interfaces/*.gcda interfaces/*.gcno -CLEANFILES += node/*.gcda node/*.gcno -CLEANFILES += policy/*.gcda policy/*.gcno -CLEANFILES += primitives/*.gcda primitives/*.gcno -CLEANFILES += rpc/*.gcda rpc/*.gcno -CLEANFILES += script/*.gcda script/*.gcno -CLEANFILES += support/*.gcda support/*.gcno -CLEANFILES += univalue/*.gcda univalue/*.gcno -CLEANFILES += util/*.gcda util/*.gcno -CLEANFILES += wallet/*.gcda wallet/*.gcno -CLEANFILES += wallet/test/*.gcda wallet/test/*.gcno -CLEANFILES += zmq/*.gcda zmq/*.gcno -CLEANFILES += dashbls/src/*.gcda dashbls/src/*.gcno dashbls/depends/mimalloc/src/*.gcda dashbls/depends/mimalloc/src/*.gcno -CLEANFILES += obj/build.h - -IMMER_DIST = immer/immer -LIBDASHBLS_DIST = dashbls - -EXTRA_DIST = \ - $(CTAES_DIST) \ - $(IMMER_DIST) \ - $(LIBDASHBLS_DIST) - -config/bitcoin-config.h: config/stamp-h1 - @$(MAKE) -C $(top_builddir) $(subdir)/$(@) -config/stamp-h1: $(top_srcdir)/$(subdir)/config/bitcoin-config.h.in $(top_builddir)/config.status - $(AM_V_at)$(MAKE) -C $(top_builddir) $(subdir)/$(@) -$(top_srcdir)/$(subdir)/config/bitcoin-config.h.in: $(am__configure_deps) - $(AM_V_at)$(MAKE) -C $(top_srcdir) $(subdir)/config/bitcoin-config.h.in - - -clean-local: - -$(MAKE) -C secp256k1 clean - -rm -f leveldb/*/*.gcda leveldb/*/*.gcno leveldb/helpers/memenv/*.gcda leveldb/helpers/memenv/*.gcno - -rm -f config.h - -rm -rf test/__pycache__ - -rm -rf *.dSYM test/*.dSYM bench/*.dSYM qt/*.dSYM qt/test/*.dSYM - -.rc.o: - @command -v $(WINDRES) || (echo "windres $(WINDRES) not found, but is required to compile windows resource files"; exit 1) - ## FIXME: How to get the appropriate modulename_CPPFLAGS in here? - $(AM_V_GEN) $(WINDRES) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) -DWINDRES_PREPROC -i $< -o $@ - -check-symbols: $(bin_PROGRAMS) - @echo "Running symbol and dynamic library checks..." - $(AM_V_at) $(PYTHON) $(top_srcdir)/contrib/guix/symbol-check.py $(bin_PROGRAMS) - -check-security: $(bin_PROGRAMS) -if HARDEN - @echo "Checking binary security..." - $(AM_V_at) $(PYTHON) $(top_srcdir)/contrib/guix/security-check.py $(bin_PROGRAMS) -endif - -check-stdlib-paths: $(bin_PROGRAMS) - @echo "Checking for embedded standard library header paths..." - $(AM_V_at) $(PYTHON) $(top_srcdir)/contrib/guix/stdlib-path-check.py $(bin_PROGRAMS) - - -osx_debug: $(bin_PROGRAMS) - for i in $(bin_PROGRAMS); do mkdir -p $$i.dSYM/Contents/Resources/DWARF && $(DSYMUTIL_FLAT) -o $$i.dSYM/Contents/Resources/DWARF/$$(basename $$i) $$i &> /dev/null ; done - -libbitcoin_ipc_mpgen_input = \ - ipc/capnp/echo.capnp \ - ipc/capnp/init.capnp -EXTRA_DIST += $(libbitcoin_ipc_mpgen_input) -%.capnp: - -# Explicitly list dependencies on generated headers as described in -# https://www.gnu.org/software/automake/manual/html_node/Built-Sources-Example.html#Recording-Dependencies-manually -ipc/capnp/libbitcoin_ipc_a-protocol.$(OBJEXT): $(libbitcoin_ipc_mpgen_input:=.h) - -if BUILD_MULTIPROCESS -LIBBITCOIN_IPC=libbitcoin_ipc.a -libbitcoin_ipc_a_SOURCES = \ - ipc/capnp/context.h \ - ipc/capnp/init-types.h \ - ipc/capnp/protocol.cpp \ - ipc/capnp/protocol.h \ - ipc/context.h \ - ipc/exception.h \ - ipc/interfaces.cpp \ - ipc/process.cpp \ - ipc/process.h \ - ipc/protocol.h -libbitcoin_ipc_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BOOST_CPPFLAGS) -libbitcoin_ipc_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) $(LIBMULTIPROCESS_CFLAGS) - -include $(MPGEN_PREFIX)/include/mpgen.mk -libbitcoin_ipc_mpgen_output = \ - $(libbitcoin_ipc_mpgen_input:=.c++) \ - $(libbitcoin_ipc_mpgen_input:=.h) \ - $(libbitcoin_ipc_mpgen_input:=.proxy-client.c++) \ - $(libbitcoin_ipc_mpgen_input:=.proxy-server.c++) \ - $(libbitcoin_ipc_mpgen_input:=.proxy-types.c++) \ - $(libbitcoin_ipc_mpgen_input:=.proxy-types.h) \ - $(libbitcoin_ipc_mpgen_input:=.proxy.h) -nodist_libbitcoin_ipc_a_SOURCES = $(libbitcoin_ipc_mpgen_output) -CLEANFILES += $(libbitcoin_ipc_mpgen_output) -endif - -%.raw.h: %.raw - @$(MKDIR_P) $(@D) - $(AM_V_GEN) { \ - echo "static unsigned const char $(*F)_raw[] = {" && \ - $(HEXDUMP) -v -e '8/1 "0x%02x, "' -e '"\n"' $< | $(SED) -e 's/0x ,//g' && \ - echo "};"; \ - } > "$@.new" && mv -f "$@.new" "$@" - -include Makefile.minisketch.include - -include Makefile.crc32c.include -include Makefile.leveldb.include -include Makefile.dashbls.include - -include Makefile.test_util.include -include Makefile.test_fuzz.include - -include Makefile.test.include - -if ENABLE_BENCH -include Makefile.bench.include -endif - -if ENABLE_QT -include Makefile.qt.include -endif - -if ENABLE_QT_TESTS -include Makefile.qttest.include -endif - -include Makefile.univalue.include diff --git a/src/Makefile.bench.include b/src/Makefile.bench.include deleted file mode 100644 index d76027a0f566..000000000000 --- a/src/Makefile.bench.include +++ /dev/null @@ -1,117 +0,0 @@ -# Copyright (c) 2015-2016 The Bitcoin Core developers -# Copyright (c) 2014-2018 The Dash Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. - -bin_PROGRAMS += bench/bench_dash -BENCH_SRCDIR = bench -BENCH_BINARY = bench/bench_dash$(EXEEXT) - -RAW_BENCH_FILES = \ - bench/data/block813851.raw -GENERATED_BENCH_FILES = $(RAW_BENCH_FILES:.raw=.raw.h) - -bench_bench_dash_SOURCES = \ - $(RAW_BENCH_FILES) \ - bench/addrman.cpp \ - bench/base58.cpp \ - bench/bech32.cpp \ - bench/bench.cpp \ - bench/bench.h \ - bench/bench_bitcoin.cpp \ - bench/bip324_ecdh.cpp \ - bench/block_assemble.cpp \ - bench/blockfilter_index.cpp \ - bench/bls.cpp \ - bench/bls_dkg.cpp \ - bench/bls_pubkey_agg.cpp \ - bench/ccoins_caching.cpp \ - bench/chacha20.cpp \ - bench/checkblock.cpp \ - bench/checkqueue.cpp \ - bench/crypto_hash.cpp \ - bench/data.cpp \ - bench/data.h \ - bench/descriptors.cpp \ - bench/disconnected_transactions.cpp \ - bench/duplicate_inputs.cpp \ - bench/ecdsa.cpp \ - bench/ellswift.cpp \ - bench/examples.cpp \ - bench/gcs_filter.cpp \ - bench/hashpadding.cpp \ - bench/logging.cpp \ - bench/load_external.cpp \ - bench/lockedpool.cpp \ - bench/mempool_eviction.cpp \ - bench/mempool_stress.cpp \ - bench/merkle_root.cpp \ - bench/nanobench.cpp \ - bench/nanobench.h \ - bench/net_processing.cpp \ - bench/peer_eviction.cpp \ - bench/poly1305.cpp \ - bench/pool.cpp \ - bench/pow_hash.cpp \ - bench/prevector.cpp \ - bench/rollingbloom.cpp \ - bench/rpc_blockchain.cpp \ - bench/rpc_mempool.cpp \ - bench/streams_findbyte.cpp \ - bench/strencodings.cpp \ - bench/string_cast.cpp \ - bench/util_time.cpp \ - bench/verify_script.cpp \ - bench/xor.cpp - -nodist_bench_bench_dash_SOURCES = $(GENERATED_BENCH_FILES) - -bench_bench_dash_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BOOST_CPPFLAGS) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS) -I$(builddir)/bench/ -bench_bench_dash_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -bench_bench_dash_LDFLAGS = $(LDFLAGS_WRAP_EXCEPTIONS) $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS) -bench_bench_dash_LDADD = \ - $(LIBTEST_UTIL) \ - $(LIBBITCOIN_NODE) \ - $(LIBBITCOIN_WALLET) \ - $(LIBBITCOIN_COMMON) \ - $(LIBBITCOIN_UTIL) \ - $(LIBBITCOIN_CONSENSUS) \ - $(LIBBITCOIN_CRYPTO) \ - $(LIBDASHBLS) \ - $(LIBLEVELDB) \ - $(LIBMEMENV) \ - $(LIBSECP256K1) \ - $(LIBUNIVALUE) \ - $(EVENT_PTHREADS_LIBS) \ - $(EVENT_LIBS) \ - $(MINIUPNPC_LIBS) \ - $(NATPMP_LIBS) \ - $(ZSTD_LIBS) \ - $(BACKTRACE_LIBS) - -if ENABLE_ZMQ -bench_bench_dash_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS) -endif - -if ENABLE_WALLET -bench_bench_dash_SOURCES += bench/coin_selection.cpp -bench_bench_dash_SOURCES += bench/wallet_balance.cpp -bench_bench_dash_SOURCES += bench/wallet_create.cpp -bench_bench_dash_SOURCES += bench/wallet_loading.cpp -bench_bench_dash_SOURCES += bench/wallet_create_tx.cpp -bench_bench_dash_LDADD += $(BDB_LIBS) $(SQLITE_LIBS) -endif - -CLEAN_BITCOIN_BENCH = bench/*.gcda bench/*.gcno $(GENERATED_BENCH_FILES) - -CLEANFILES += $(CLEAN_BITCOIN_BENCH) - -bench/data.cpp: bench/data/block813851.raw.h - -bitcoin_bench: $(BENCH_BINARY) - -bench: $(BENCH_BINARY) FORCE - $(BENCH_BINARY) - -bitcoin_bench_clean : FORCE - rm -f $(CLEAN_BITCOIN_BENCH) $(bench_bench_dash_OBJECTS) $(BENCH_BINARY) diff --git a/src/Makefile.crc32c.include b/src/Makefile.crc32c.include deleted file mode 100644 index c4dd84991d27..000000000000 --- a/src/Makefile.crc32c.include +++ /dev/null @@ -1,81 +0,0 @@ -# Copyright (c) 2019 The Bitcoin Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. - -LIBCRC32C_INT = crc32c/libcrc32c.la - -noinst_LTLIBRARIES += $(LIBCRC32C_INT) - -LIBCRC32C = $(LIBCRC32C_INT) - -CRC32C_CPPFLAGS_INT = -CRC32C_CPPFLAGS_INT += -I$(srcdir)/crc32c/include -CRC32C_CPPFLAGS_INT += -DHAVE_BUILTIN_PREFETCH=@HAVE_BUILTIN_PREFETCH@ -CRC32C_CPPFLAGS_INT += -DHAVE_MM_PREFETCH=@HAVE_MM_PREFETCH@ -CRC32C_CPPFLAGS_INT += -DHAVE_STRONG_GETAUXVAL=@HAVE_STRONG_GETAUXVAL@ -CRC32C_CPPFLAGS_INT += -DCRC32C_TESTS_BUILT_WITH_GLOG=0 - -if ENABLE_SSE42 -CRC32C_CPPFLAGS_INT += -DHAVE_SSE42=1 -else -CRC32C_CPPFLAGS_INT += -DHAVE_SSE42=0 -endif - -if ENABLE_ARM_CRC -CRC32C_CPPFLAGS_INT += -DHAVE_ARM64_CRC32C=1 -else -CRC32C_CPPFLAGS_INT += -DHAVE_ARM64_CRC32C=0 -endif - -if WORDS_BIGENDIAN -CRC32C_CPPFLAGS_INT += -DBYTE_ORDER_BIG_ENDIAN=1 -else -CRC32C_CPPFLAGS_INT += -DBYTE_ORDER_BIG_ENDIAN=0 -endif - -crc32c_libcrc32c_la_CPPFLAGS = $(AM_CPPFLAGS) $(CRC32C_CPPFLAGS_INT) $(CRC32C_CPPFLAGS) - -# Specify -static in both CXXFLAGS and LDFLAGS so libtool will only build a -# static version of this library. We don't need a dynamic version, and a dynamic -# version can't be used on windows anyway because the library doesn't currently -# export DLL symbols. -crc32c_libcrc32c_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -static -crc32c_libcrc32c_la_LDFLAGS = $(AM_LDFLAGS) -static - -crc32c_libcrc32c_la_SOURCES = -crc32c_libcrc32c_la_SOURCES += crc32c/include/crc32c/crc32c.h -crc32c_libcrc32c_la_SOURCES += crc32c/src/crc32c_arm64.h -crc32c_libcrc32c_la_SOURCES += crc32c/src/crc32c_arm64_check.h -crc32c_libcrc32c_la_SOURCES += crc32c/src/crc32c_internal.h -crc32c_libcrc32c_la_SOURCES += crc32c/src/crc32c_prefetch.h -crc32c_libcrc32c_la_SOURCES += crc32c/src/crc32c_read_le.h -crc32c_libcrc32c_la_SOURCES += crc32c/src/crc32c_round_up.h -crc32c_libcrc32c_la_SOURCES += crc32c/src/crc32c_sse42_check.h -crc32c_libcrc32c_la_SOURCES += crc32c/src/crc32c_sse42.h - -crc32c_libcrc32c_la_SOURCES += crc32c/src/crc32c.cc -crc32c_libcrc32c_la_SOURCES += crc32c/src/crc32c_portable.cc - -if ENABLE_SSE42 -LIBCRC32C_SSE42_INT = crc32c/libcrc32c_sse42.la -noinst_LTLIBRARIES += $(LIBCRC32C_SSE42_INT) -LIBCRC32C += $(LIBCRC32C_SSE42_INT) - -crc32c_libcrc32c_sse42_la_CPPFLAGS = $(crc32c_libcrc32c_la_CPPFLAGS) -crc32c_libcrc32c_sse42_la_CXXFLAGS = $(crc32c_libcrc32c_la_CXXFLAGS) $(SSE42_CXXFLAGS) -crc32c_libcrc32c_sse42_la_LDFLAGS = $(crc32c_libcrc32c_la_LDFLAGS) - -crc32c_libcrc32c_sse42_la_SOURCES = crc32c/src/crc32c_sse42.cc -endif - -if ENABLE_ARM_CRC -LIBCRC32C_ARM_CRC_INT = crc32c/libcrc32c_arm_crc.la -noinst_LTLIBRARIES += $(LIBCRC32C_ARM_CRC_INT) -LIBCRC32C += $(LIBCRC32C_ARM_CRC_INT) - -crc32c_libcrc32c_arm_crc_la_CPPFLAGS = $(crc32c_libcrc32c_la_CPPFLAGS) -crc32c_libcrc32c_arm_crc_la_CXXFLAGS = $(crc32c_libcrc32c_la_CXXFLAGS) $(ARM_CRC_CXXFLAGS) -crc32c_libcrc32c_arm_crc_la_LDFLAGS = $(crc32c_libcrc32c_la_LDFLAGS) - -crc32c_libcrc32c_arm_crc_la_SOURCES = crc32c/src/crc32c_arm64.cc -endif diff --git a/src/Makefile.dashbls.include b/src/Makefile.dashbls.include deleted file mode 100644 index b7188b1f8125..000000000000 --- a/src/Makefile.dashbls.include +++ /dev/null @@ -1,136 +0,0 @@ -# Copyright (c) 2026 The Dash Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. - -LIBDASHBLS_INT = dashbls/libdashbls.la - -noinst_LTLIBRARIES += $(LIBDASHBLS_INT) -if USE_MIMALLOC -LIBMIMALLOC_INT = dashbls/libmimalloc-secure.la -noinst_LTLIBRARIES += $(LIBMIMALLOC_INT) -endif - -# What consumers link, dependents first: dashbls -> mimalloc -> blst (from depends) -LIBDASHBLS = $(LIBDASHBLS_INT) $(LIBMIMALLOC_INT) $(BLST_LIBS) - -# Flags for consumers of the library -DASHBLS_CPPFLAGS = -isystem$(srcdir)/dashbls/include $(BLST_CPPFLAGS) - -# Flags used only when building the library itself. Its headers are treated -# as system headers, as they are for consumers, so that Dash's warning set -# (-Werror in CI) does not apply to the vendored code. -DASHBLS_CPPFLAGS_INT = $(BLST_CPPFLAGS) -DASHBLS_CPPFLAGS_INT += -isystem$(srcdir)/dashbls/include/dashbls -DASHBLS_CPPFLAGS_INT += -isystem$(srcdir)/dashbls/depends/mimalloc/include -if USE_MIMALLOC -DASHBLS_CPPFLAGS_INT += -DBLSALLOC_MIMALLOC=1 -endif - -MIMALLOC_CPPFLAGS_INT = -MIMALLOC_CPPFLAGS_INT += -I$(srcdir)/dashbls/depends/mimalloc/include -MIMALLOC_CPPFLAGS_INT += -I$(srcdir)/dashbls/depends/mimalloc/src -MIMALLOC_CPPFLAGS_INT += -DMI_SECURE=4 -MIMALLOC_CPPFLAGS_INT += -DNDEBUG - -DASHBLS_H = \ - dashbls/include/dashbls/bls.hpp \ - dashbls/include/dashbls/chaincode.hpp \ - dashbls/include/dashbls/elements.hpp \ - dashbls/include/dashbls/extendedprivatekey.hpp \ - dashbls/include/dashbls/extendedpublickey.hpp \ - dashbls/include/dashbls/hdkeys.hpp \ - dashbls/include/dashbls/hkdf.hpp \ - dashbls/include/dashbls/legacy.hpp \ - dashbls/include/dashbls/privatekey.hpp \ - dashbls/include/dashbls/schemes.hpp \ - dashbls/include/dashbls/test-utils.hpp \ - dashbls/include/dashbls/threshold.hpp \ - dashbls/include/dashbls/util.hpp - -dashbls_libdashbls_la_SOURCES = \ - $(DASHBLS_H) \ - dashbls/src/bls.cpp \ - dashbls/src/chaincode.cpp \ - dashbls/src/elements.cpp \ - dashbls/src/extendedprivatekey.cpp \ - dashbls/src/extendedpublickey.cpp \ - dashbls/src/hdkeys.cpp \ - dashbls/src/hkdf.cpp \ - dashbls/src/legacy.cpp \ - dashbls/src/privatekey.cpp \ - dashbls/src/schemes.cpp \ - dashbls/src/secure.cpp \ - dashbls/src/secure.h \ - dashbls/src/threshold.cpp \ - dashbls/src/util.cpp - -dashbls_libdashbls_la_CPPFLAGS = $(AM_CPPFLAGS) $(DASHBLS_CPPFLAGS_INT) - -# Specify -static in both CXXFLAGS and LDFLAGS so libtool will only build a -# static version of this library (same as crc32c and leveldb). -dashbls_libdashbls_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -static -dashbls_libdashbls_la_LDFLAGS = $(AM_LDFLAGS) -static - -MIMALLOC_H = \ - dashbls/depends/mimalloc/include/mimalloc-new-delete.h \ - dashbls/depends/mimalloc/include/mimalloc-override.h \ - dashbls/depends/mimalloc/include/mimalloc-stats.h \ - dashbls/depends/mimalloc/include/mimalloc.h \ - dashbls/depends/mimalloc/src/bitmap.h - -dashbls_libmimalloc_secure_la_SOURCES = \ - $(MIMALLOC_H) \ - dashbls/depends/mimalloc/src/alloc-aligned.c \ - dashbls/depends/mimalloc/src/alloc-posix.c \ - dashbls/depends/mimalloc/src/alloc.c \ - dashbls/depends/mimalloc/src/arena-meta.c \ - dashbls/depends/mimalloc/src/arena.c \ - dashbls/depends/mimalloc/src/bitmap.c \ - dashbls/depends/mimalloc/src/heap.c \ - dashbls/depends/mimalloc/src/init.c \ - dashbls/depends/mimalloc/src/libc.c \ - dashbls/depends/mimalloc/src/options.c \ - dashbls/depends/mimalloc/src/os.c \ - dashbls/depends/mimalloc/src/page-map.c \ - dashbls/depends/mimalloc/src/page.c \ - dashbls/depends/mimalloc/src/random.c \ - dashbls/depends/mimalloc/src/stats.c \ - dashbls/depends/mimalloc/src/prim/prim.c - -dashbls_libmimalloc_secure_la_CPPFLAGS = $(AM_CPPFLAGS) $(MIMALLOC_CPPFLAGS_INT) -dashbls_libmimalloc_secure_la_CFLAGS = $(AM_CFLAGS) $(PIE_FLAGS) -static -dashbls_libmimalloc_secure_la_LDFLAGS = $(AM_LDFLAGS) -static - -if ENABLE_TESTS -if !ENABLE_FUZZ -DASHBLS_RUNTEST = dashbls/runtest -TESTS += $(DASHBLS_RUNTEST) -check_PROGRAMS += $(DASHBLS_RUNTEST) - -dashbls_runtest_SOURCES = \ - dashbls/src/test.cpp \ - dashbls/src/test-vectors.hpp \ - dashbls/test/test_secure.cpp \ - dashbls/depends/catch2/include/catch2/catch.hpp -dashbls_runtest_CPPFLAGS = $(AM_CPPFLAGS) $(DASHBLS_CPPFLAGS_INT) -isystem$(srcdir)/dashbls/depends/catch2/include -dashbls_runtest_CPPFLAGS += -I$(srcdir)/dashbls/src -dashbls_runtest_CPPFLAGS += -DDASHBLS_REFERENCE_VECTORS=\"$(abs_srcdir)/dashbls/test-vectors/reference.txt\" -dashbls_runtest_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -dashbls_runtest_LDADD = $(LIBDASHBLS) -dashbls_runtest_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS) -static -endif -endif - -if ENABLE_BENCH -if !ENABLE_FUZZ -noinst_PROGRAMS += dashbls/runbench - -dashbls_runbench_SOURCES = \ - dashbls/src/test-bench.cpp \ - dashbls/include/dashbls/test-utils.hpp -dashbls_runbench_CPPFLAGS = $(AM_CPPFLAGS) $(DASHBLS_CPPFLAGS_INT) -dashbls_runbench_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -dashbls_runbench_LDADD = $(LIBDASHBLS) -dashbls_runbench_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS) -static -endif -endif diff --git a/src/Makefile.leveldb.include b/src/Makefile.leveldb.include deleted file mode 100644 index bf14fe206b92..000000000000 --- a/src/Makefile.leveldb.include +++ /dev/null @@ -1,153 +0,0 @@ -# Copyright (c) 2016 The Bitcoin Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. - -LIBLEVELDB_INT = leveldb/libleveldb.la -LIBMEMENV_INT = leveldb/libmemenv.la - -noinst_LTLIBRARIES += $(LIBLEVELDB_INT) -noinst_LTLIBRARIES += $(LIBMEMENV_INT) - -LIBLEVELDB = $(LIBLEVELDB_INT) $(LIBCRC32C) -LIBMEMENV = $(LIBMEMENV_INT) - -LEVELDB_CPPFLAGS = -LEVELDB_CPPFLAGS += -I$(srcdir)/leveldb/include - -LEVELDB_CPPFLAGS_INT = -LEVELDB_CPPFLAGS_INT += -I$(srcdir)/leveldb -LEVELDB_CPPFLAGS_INT += -I$(srcdir)/crc32c/include -LEVELDB_CPPFLAGS_INT += -D__STDC_LIMIT_MACROS -LEVELDB_CPPFLAGS_INT += -DHAVE_SNAPPY=0 -DHAVE_CRC32C=1 -LEVELDB_CPPFLAGS_INT += -DHAVE_FDATASYNC=@HAVE_FDATASYNC@ -LEVELDB_CPPFLAGS_INT += -DHAVE_FULLFSYNC=@HAVE_FULLFSYNC@ -LEVELDB_CPPFLAGS_INT += -DHAVE_O_CLOEXEC=@HAVE_O_CLOEXEC@ -LEVELDB_CPPFLAGS_INT += -DFALLTHROUGH_INTENDED=[[fallthrough]] - -if WORDS_BIGENDIAN -LEVELDB_CPPFLAGS_INT += -DLEVELDB_IS_BIG_ENDIAN=1 -else -LEVELDB_CPPFLAGS_INT += -DLEVELDB_IS_BIG_ENDIAN=0 -endif - -if TARGET_WINDOWS -LEVELDB_CPPFLAGS_INT += -DLEVELDB_PLATFORM_WINDOWS -D_UNICODE -DUNICODE -D__USE_MINGW_ANSI_STDIO=1 -else -LEVELDB_CPPFLAGS_INT += -DLEVELDB_PLATFORM_POSIX -endif - -leveldb_libleveldb_la_CPPFLAGS = $(AM_CPPFLAGS) $(LEVELDB_CPPFLAGS_INT) $(LEVELDB_CPPFLAGS) - -# Specify -static in both CXXFLAGS and LDFLAGS so libtool will only build a -# static version of this library. We don't need a dynamic version, and a dynamic -# version can't be used on windows anyway because the library doesn't currently -# export DLL symbols. -leveldb_libleveldb_la_CXXFLAGS = $(filter-out -Wconditional-uninitialized -Werror=conditional-uninitialized -Wsuggest-override -Werror=suggest-override, $(AM_CXXFLAGS)) $(PIE_FLAGS) -static -leveldb_libleveldb_la_LDFLAGS = $(AM_LDFLAGS) -static - -leveldb_libleveldb_la_SOURCES= -leveldb_libleveldb_la_SOURCES += leveldb/port/port_stdcxx.h -leveldb_libleveldb_la_SOURCES += leveldb/port/port.h -leveldb_libleveldb_la_SOURCES += leveldb/port/thread_annotations.h -leveldb_libleveldb_la_SOURCES += leveldb/include/leveldb/db.h -leveldb_libleveldb_la_SOURCES += leveldb/include/leveldb/options.h -leveldb_libleveldb_la_SOURCES += leveldb/include/leveldb/comparator.h -leveldb_libleveldb_la_SOURCES += leveldb/include/leveldb/filter_policy.h -leveldb_libleveldb_la_SOURCES += leveldb/include/leveldb/slice.h -leveldb_libleveldb_la_SOURCES += leveldb/include/leveldb/table_builder.h -leveldb_libleveldb_la_SOURCES += leveldb/include/leveldb/env.h -leveldb_libleveldb_la_SOURCES += leveldb/include/leveldb/export.h -leveldb_libleveldb_la_SOURCES += leveldb/include/leveldb/c.h -leveldb_libleveldb_la_SOURCES += leveldb/include/leveldb/iterator.h -leveldb_libleveldb_la_SOURCES += leveldb/include/leveldb/cache.h -leveldb_libleveldb_la_SOURCES += leveldb/include/leveldb/dumpfile.h -leveldb_libleveldb_la_SOURCES += leveldb/include/leveldb/table.h -leveldb_libleveldb_la_SOURCES += leveldb/include/leveldb/write_batch.h -leveldb_libleveldb_la_SOURCES += leveldb/include/leveldb/status.h -leveldb_libleveldb_la_SOURCES += leveldb/db/log_format.h -leveldb_libleveldb_la_SOURCES += leveldb/db/memtable.h -leveldb_libleveldb_la_SOURCES += leveldb/db/version_set.h -leveldb_libleveldb_la_SOURCES += leveldb/db/write_batch_internal.h -leveldb_libleveldb_la_SOURCES += leveldb/db/filename.h -leveldb_libleveldb_la_SOURCES += leveldb/db/version_edit.h -leveldb_libleveldb_la_SOURCES += leveldb/db/dbformat.h -leveldb_libleveldb_la_SOURCES += leveldb/db/builder.h -leveldb_libleveldb_la_SOURCES += leveldb/db/log_writer.h -leveldb_libleveldb_la_SOURCES += leveldb/db/db_iter.h -leveldb_libleveldb_la_SOURCES += leveldb/db/skiplist.h -leveldb_libleveldb_la_SOURCES += leveldb/db/db_impl.h -leveldb_libleveldb_la_SOURCES += leveldb/db/table_cache.h -leveldb_libleveldb_la_SOURCES += leveldb/db/snapshot.h -leveldb_libleveldb_la_SOURCES += leveldb/db/log_reader.h -leveldb_libleveldb_la_SOURCES += leveldb/table/filter_block.h -leveldb_libleveldb_la_SOURCES += leveldb/table/block_builder.h -leveldb_libleveldb_la_SOURCES += leveldb/table/block.h -leveldb_libleveldb_la_SOURCES += leveldb/table/two_level_iterator.h -leveldb_libleveldb_la_SOURCES += leveldb/table/merger.h -leveldb_libleveldb_la_SOURCES += leveldb/table/format.h -leveldb_libleveldb_la_SOURCES += leveldb/table/iterator_wrapper.h -leveldb_libleveldb_la_SOURCES += leveldb/util/crc32c.h -leveldb_libleveldb_la_SOURCES += leveldb/util/env_posix_test_helper.h -leveldb_libleveldb_la_SOURCES += leveldb/util/env_windows_test_helper.h -leveldb_libleveldb_la_SOURCES += leveldb/util/arena.h -leveldb_libleveldb_la_SOURCES += leveldb/util/random.h -leveldb_libleveldb_la_SOURCES += leveldb/util/posix_logger.h -leveldb_libleveldb_la_SOURCES += leveldb/util/hash.h -leveldb_libleveldb_la_SOURCES += leveldb/util/histogram.h -leveldb_libleveldb_la_SOURCES += leveldb/util/coding.h -leveldb_libleveldb_la_SOURCES += leveldb/util/testutil.h -leveldb_libleveldb_la_SOURCES += leveldb/util/mutexlock.h -leveldb_libleveldb_la_SOURCES += leveldb/util/logging.h -leveldb_libleveldb_la_SOURCES += leveldb/util/no_destructor.h -leveldb_libleveldb_la_SOURCES += leveldb/util/testharness.h -leveldb_libleveldb_la_SOURCES += leveldb/util/windows_logger.h - -leveldb_libleveldb_la_SOURCES += leveldb/db/builder.cc -leveldb_libleveldb_la_SOURCES += leveldb/db/c.cc -leveldb_libleveldb_la_SOURCES += leveldb/db/dbformat.cc -leveldb_libleveldb_la_SOURCES += leveldb/db/db_impl.cc -leveldb_libleveldb_la_SOURCES += leveldb/db/db_iter.cc -leveldb_libleveldb_la_SOURCES += leveldb/db/dumpfile.cc -leveldb_libleveldb_la_SOURCES += leveldb/db/filename.cc -leveldb_libleveldb_la_SOURCES += leveldb/db/log_reader.cc -leveldb_libleveldb_la_SOURCES += leveldb/db/log_writer.cc -leveldb_libleveldb_la_SOURCES += leveldb/db/memtable.cc -leveldb_libleveldb_la_SOURCES += leveldb/db/repair.cc -leveldb_libleveldb_la_SOURCES += leveldb/db/table_cache.cc -leveldb_libleveldb_la_SOURCES += leveldb/db/version_edit.cc -leveldb_libleveldb_la_SOURCES += leveldb/db/version_set.cc -leveldb_libleveldb_la_SOURCES += leveldb/db/write_batch.cc -leveldb_libleveldb_la_SOURCES += leveldb/table/block_builder.cc -leveldb_libleveldb_la_SOURCES += leveldb/table/block.cc -leveldb_libleveldb_la_SOURCES += leveldb/table/filter_block.cc -leveldb_libleveldb_la_SOURCES += leveldb/table/format.cc -leveldb_libleveldb_la_SOURCES += leveldb/table/iterator.cc -leveldb_libleveldb_la_SOURCES += leveldb/table/merger.cc -leveldb_libleveldb_la_SOURCES += leveldb/table/table_builder.cc -leveldb_libleveldb_la_SOURCES += leveldb/table/table.cc -leveldb_libleveldb_la_SOURCES += leveldb/table/two_level_iterator.cc -leveldb_libleveldb_la_SOURCES += leveldb/util/arena.cc -leveldb_libleveldb_la_SOURCES += leveldb/util/bloom.cc -leveldb_libleveldb_la_SOURCES += leveldb/util/cache.cc -leveldb_libleveldb_la_SOURCES += leveldb/util/coding.cc -leveldb_libleveldb_la_SOURCES += leveldb/util/comparator.cc -leveldb_libleveldb_la_SOURCES += leveldb/util/crc32c.cc -leveldb_libleveldb_la_SOURCES += leveldb/util/env.cc -leveldb_libleveldb_la_SOURCES += leveldb/util/filter_policy.cc -leveldb_libleveldb_la_SOURCES += leveldb/util/hash.cc -leveldb_libleveldb_la_SOURCES += leveldb/util/histogram.cc -leveldb_libleveldb_la_SOURCES += leveldb/util/logging.cc -leveldb_libleveldb_la_SOURCES += leveldb/util/options.cc -leveldb_libleveldb_la_SOURCES += leveldb/util/status.cc - -if TARGET_WINDOWS -leveldb_libleveldb_la_SOURCES += leveldb/util/env_windows.cc -else -leveldb_libleveldb_la_SOURCES += leveldb/util/env_posix.cc -endif - -leveldb_libmemenv_la_CPPFLAGS = $(leveldb_libleveldb_la_CPPFLAGS) -leveldb_libmemenv_la_CXXFLAGS = $(leveldb_libleveldb_la_CXXFLAGS) -leveldb_libmemenv_la_LDFLAGS = $(leveldb_libleveldb_la_LDFLAGS) -leveldb_libmemenv_la_SOURCES = leveldb/helpers/memenv/memenv.cc -leveldb_libmemenv_la_SOURCES += leveldb/helpers/memenv/memenv.h diff --git a/src/Makefile.minisketch.include b/src/Makefile.minisketch.include deleted file mode 100644 index c6f894f0ca01..000000000000 --- a/src/Makefile.minisketch.include +++ /dev/null @@ -1,39 +0,0 @@ -include minisketch/sources.mk - -LIBMINISKETCH_CPPFLAGS= -LIBMINISKETCH_CPPFLAGS += -DDISABLE_DEFAULT_FIELDS -DENABLE_FIELD_32 - -LIBMINISKETCH = minisketch/libminisketch.a -MINISKETCH_LIBS = $(LIBMINISKETCH) - -if ENABLE_CLMUL -LIBMINISKETCH_CLMUL = minisketch/libminisketch_clmul.a -LIBMINISKETCH_CPPFLAGS += -DHAVE_CLMUL -MINISKETCH_LIBS += $(LIBMINISKETCH_CLMUL) -endif - -EXTRA_LIBRARIES += $(MINISKETCH_LIBS) - -minisketch_libminisketch_clmul_a_SOURCES = $(MINISKETCH_FIELD_CLMUL_SOURCES_INT) $(MINISKETCH_FIELD_CLMUL_HEADERS_INT) -minisketch_libminisketch_clmul_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) $(CLMUL_CXXFLAGS) -minisketch_libminisketch_clmul_a_CPPFLAGS = $(AM_CPPFLAGS) $(LIBMINISKETCH_CPPFLAGS) - -minisketch_libminisketch_a_SOURCES = $(MINISKETCH_FIELD_GENERIC_SOURCES_INT) $(MINISKETCH_LIB_SOURCES_INT) -minisketch_libminisketch_a_SOURCES += $(MINISKETCH_FIELD_GENERIC_HEADERS_INT) $(MINISKETCH_LIB_HEADERS_INT) $(MINISKETCH_DIST_HEADERS_INT) -minisketch_libminisketch_a_CPPFLAGS = $(AM_CPPFLAGS) $(LIBMINISKETCH_CPPFLAGS) -minisketch_libminisketch_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) - -if ENABLE_TESTS -if !ENABLE_FUZZ -MINISKETCH_TEST = minisketch/test -TESTS += $(MINISKETCH_TEST) -check_PROGRAMS += $(MINISKETCH_TEST) - -minisketch_test_SOURCES = $(MINISKETCH_TEST_SOURCES_INT) -minisketch_test_CPPFLAGS = $(AM_CPPFLAGS) $(LIBMINISKETCH_CPPFLAGS) -minisketch_test_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -minisketch_test_LDADD = $(MINISKETCH_LIBS) -minisketch_test_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS) - -endif -endif diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include deleted file mode 100644 index 3f4e8d77ad3c..000000000000 --- a/src/Makefile.qt.include +++ /dev/null @@ -1,568 +0,0 @@ -# Copyright (c) 2013-2016 The Bitcoin Core developers -# Copyright (c) 2014-2018 The Dash Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. - -bin_PROGRAMS += qt/dash-qt - -if BUILD_BITCOIN_GUI - bin_PROGRAMS += dash-gui -endif - -EXTRA_LIBRARIES += qt/libbitcoinqt.a - -# dash qt core # -include Makefile.qt_locale.include - -QT_FORMS_UI = \ - qt/forms/addressbookpage.ui \ - qt/forms/appearancewidget.ui \ - qt/forms/askpassphrasedialog.ui \ - qt/forms/coincontroldialog.ui \ - qt/forms/createwalletdialog.ui \ - qt/forms/debugwindow.ui \ - qt/forms/descriptiondialog.ui \ - qt/forms/editaddressdialog.ui \ - qt/forms/helpmessagedialog.ui \ - qt/forms/informationwidget.ui \ - qt/forms/intro.ui \ - qt/forms/masternodelist.ui \ - qt/forms/mnemonicverificationdialog.ui \ - qt/forms/modaloverlay.ui \ - qt/forms/networkwidget.ui \ - qt/forms/openuridialog.ui \ - qt/forms/optionsdialog.ui \ - qt/forms/overviewpage.ui \ - qt/forms/proposalcreate.ui \ - qt/forms/proposalinfo.ui \ - qt/forms/proposallist.ui \ - qt/forms/proposalresume.ui \ - qt/forms/psbtoperationsdialog.ui \ - qt/forms/qrdialog.ui \ - qt/forms/receivecoinsdialog.ui \ - qt/forms/receiverequestdialog.ui \ - qt/forms/sendcoinsdialog.ui \ - qt/forms/sendcoinsentry.ui \ - qt/forms/signverifymessagedialog.ui - -QT_MOC_CPP = \ - qt/moc_addressbookpage.cpp \ - qt/moc_addresstablemodel.cpp \ - qt/moc_appearancewidget.cpp \ - qt/moc_askpassphrasedialog.cpp \ - qt/moc_bantablemodel.cpp \ - qt/moc_bitcoin.cpp \ - qt/moc_bitcoinaddressvalidator.cpp \ - qt/moc_bitcoinamountfield.cpp \ - qt/moc_bitcoingui.cpp \ - qt/moc_bitcoinunits.cpp \ - qt/moc_clientfeeds.cpp \ - qt/moc_clientmodel.cpp \ - qt/moc_coincontroldialog.cpp \ - qt/moc_coincontroltreewidget.cpp \ - qt/moc_createwalletdialog.cpp \ - qt/moc_csvmodelwriter.cpp \ - qt/moc_descriptiondialog.cpp \ - qt/moc_donutchart.cpp \ - qt/moc_editaddressdialog.cpp \ - qt/moc_guiutil.cpp \ - qt/moc_informationwidget.cpp \ - qt/moc_initexecutor.cpp \ - qt/moc_intro.cpp \ - qt/moc_macdockiconhandler.cpp \ - qt/moc_macnotificationhandler.cpp \ - qt/moc_masternodedialogs.cpp \ - qt/moc_masternodelist.cpp \ - qt/moc_masternodemodel.cpp \ - qt/moc_masternodeoperationrunner.cpp \ - qt/moc_masternodewidgets.cpp \ - qt/moc_masternodewizard.cpp \ - qt/moc_mnemonicverificationdialog.cpp \ - qt/moc_modaloverlay.cpp \ - qt/moc_networkwidget.cpp \ - qt/moc_notificator.cpp \ - qt/moc_openuridialog.cpp \ - qt/moc_optionsdialog.cpp \ - qt/moc_optionsmodel.cpp \ - qt/moc_overviewpage.cpp \ - qt/moc_paymentserver.cpp \ - qt/moc_peertablemodel.cpp \ - qt/moc_peertablesortproxy.cpp \ - qt/moc_proposalcreate.cpp \ - qt/moc_proposalinfo.cpp \ - qt/moc_proposallist.cpp \ - qt/moc_proposalmodel.cpp \ - qt/moc_proposalvotedialog.cpp \ - qt/moc_proposalresume.cpp \ - qt/moc_psbtoperationsdialog.cpp \ - qt/moc_qrdialog.cpp \ - qt/moc_qrimagewidget.cpp \ - qt/moc_qvalidatedlineedit.cpp \ - qt/moc_qvaluecombobox.cpp \ - qt/moc_receivecoinsdialog.cpp \ - qt/moc_receiverequestdialog.cpp \ - qt/moc_recentrequeststablemodel.cpp \ - qt/moc_rpcconsole.cpp \ - qt/moc_sendcoinsdialog.cpp \ - qt/moc_sharedmncreatedialog.cpp \ - qt/moc_sharedmndialogs.cpp \ - qt/moc_sharedmnwidgets.cpp \ - qt/moc_sendcoinsentry.cpp \ - qt/moc_signverifymessagedialog.cpp \ - qt/moc_splashscreen.cpp \ - qt/moc_trafficgraphwidget.cpp \ - qt/moc_transactiondesc.cpp \ - qt/moc_transactionfilterproxy.cpp \ - qt/moc_transactionoverviewwidget.cpp \ - qt/moc_transactiontablemodel.cpp \ - qt/moc_transactionview.cpp \ - qt/moc_utilitydialog.cpp \ - qt/moc_walletcontroller.cpp \ - qt/moc_walletframe.cpp \ - qt/moc_walletmodel.cpp \ - qt/moc_walletview.cpp - -BITCOIN_MM = \ - qt/macdockiconhandler.mm \ - qt/macnotificationhandler.mm \ - qt/macos_appnap.mm - -QT_MOC = \ - qt/bitcoinamountfield.moc \ - qt/intro.moc \ - qt/overviewpage.moc \ - qt/rpcconsole.moc - -QT_QRC_CPP = qt/qrc_bitcoin.cpp -QT_QRC = qt/dash.qrc -QT_QRC_LOCALE_CPP = qt/qrc_dash_locale.cpp -QT_QRC_LOCALE = qt/dash_locale.qrc - -BITCOIN_QT_H = \ - qt/addressbookpage.h \ - qt/addresstablemodel.h \ - qt/appearancewidget.h \ - qt/askpassphrasedialog.h \ - qt/bantablemodel.h \ - qt/bitcoin.h \ - qt/bitcoinaddressvalidator.h \ - qt/bitcoinamountfield.h \ - qt/bitcoingui.h \ - qt/bitcoinunits.h \ - qt/clientfeeds.h \ - qt/clientmodel.h \ - qt/coincontroldialog.h \ - qt/coincontroltreewidget.h \ - qt/createwalletdialog.h \ - qt/csvmodelwriter.h \ - qt/descriptiondialog.h \ - qt/donutchart.h \ - qt/editaddressdialog.h \ - qt/guiconstants.h \ - qt/guiutil.h \ - qt/informationwidget.h \ - qt/initexecutor.h \ - qt/intro.h \ - qt/macdockiconhandler.h \ - qt/macnotificationhandler.h \ - qt/macos_appnap.h \ - qt/masternodedialogs.h \ - qt/masternodelist.h \ - qt/masternodemodel.h \ - qt/masternodeoperationrunner.h \ - qt/masternodewidgets.h \ - qt/masternodewizard.h \ - qt/mnemonicverificationdialog.h \ - qt/mnsharesession.h \ - qt/modaloverlay.h \ - qt/networkstyle.h \ - qt/networkwidget.h \ - qt/notificator.h \ - qt/openuridialog.h \ - qt/optionsdialog.h \ - qt/optionsmodel.h \ - qt/overviewpage.h \ - qt/paymentserver.h \ - qt/peertablemodel.h \ - qt/peertablesortproxy.h \ - qt/proposalcreate.h \ - qt/proposalinfo.h \ - qt/proposallist.h \ - qt/proposalmodel.h \ - qt/proposalvotedialog.h \ - qt/proposalresume.h \ - qt/psbtoperationsdialog.h \ - qt/qrdialog.h \ - qt/qrimagewidget.h \ - qt/qvalidatedlineedit.h \ - qt/qvaluecombobox.h \ - qt/receivecoinsdialog.h \ - qt/receiverequestdialog.h \ - qt/recentrequeststablemodel.h \ - qt/rpcconsole.h \ - qt/sendcoinsdialog.h \ - qt/sendcoinsentry.h \ - qt/sendcoinsrecipient.h \ - qt/sharedmncreatedialog.h \ - qt/sharedmndialogs.h \ - qt/sharedmnwidgets.h \ - qt/signverifymessagedialog.h \ - qt/splashscreen.h \ - qt/trafficgraphdata.h \ - qt/trafficgraphwidget.h \ - qt/transactiondesc.h \ - qt/transactionfilterproxy.h \ - qt/transactionoverviewwidget.h \ - qt/transactionrecord.h \ - qt/transactiontablemodel.h \ - qt/transactionview.h \ - qt/utilitydialog.h \ - qt/walletcontroller.h \ - qt/walletframe.h \ - qt/walletmodel.h \ - qt/walletmodeltransaction.h \ - qt/walletview.h \ - qt/winshutdownmonitor.h - -QT_RES_ICONS = \ - qt/res/icons/address-book.png \ - qt/res/icons/connect1_16.png \ - qt/res/icons/connect2_16.png \ - qt/res/icons/connect3_16.png \ - qt/res/icons/connect4_16.png \ - qt/res/icons/dash.ico \ - qt/res/icons/dash.png \ - qt/res/icons/dash_macos_devnet.png \ - qt/res/icons/dash_macos_mainnet.png \ - qt/res/icons/dash_macos_regtest.png \ - qt/res/icons/dash_macos_testnet.png \ - qt/res/icons/dash_macos_tray.png \ - qt/res/icons/dash_macos_tray@2x.png \ - qt/res/icons/dash_testnet.ico \ - qt/res/icons/editcopy.png \ - qt/res/icons/editpaste.png \ - qt/res/icons/eye.png \ - qt/res/icons/eye_minus.png \ - qt/res/icons/eye_plus.png \ - qt/res/icons/fontbigger.png \ - qt/res/icons/fontsmaller.png \ - qt/res/icons/hd_enabled.png \ - qt/res/icons/lock_closed.png \ - qt/res/icons/lock_open.png \ - qt/res/icons/moon_0.png \ - qt/res/icons/moon_1.png \ - qt/res/icons/moon_2.png \ - qt/res/icons/moon_3.png \ - qt/res/icons/moon_4.png \ - qt/res/icons/moon_5.png \ - qt/res/icons/moon_6.png \ - qt/res/icons/moon_7.png \ - qt/res/icons/proxy.png \ - qt/res/icons/remove.png \ - qt/res/icons/synced.png \ - qt/res/icons/transaction0.png \ - qt/res/icons/transaction1.png \ - qt/res/icons/transaction2.png \ - qt/res/icons/transaction3.png \ - qt/res/icons/transaction4.png \ - qt/res/icons/transaction5.png \ - qt/res/icons/transaction6.png \ - qt/res/icons/transaction_abandoned.png \ - qt/res/icons/transaction_locked.png \ - qt/res/icons/voting.png \ - qt/res/icons/warning.png - -BITCOIN_QT_BASE_CPP = \ - qt/appearancewidget.cpp \ - qt/bantablemodel.cpp \ - qt/bitcoin.cpp \ - qt/bitcoinaddressvalidator.cpp \ - qt/bitcoinamountfield.cpp \ - qt/bitcoingui.cpp \ - qt/bitcoinunits.cpp \ - qt/clientfeeds.cpp \ - qt/clientmodel.cpp \ - qt/csvmodelwriter.cpp \ - qt/donutchart.cpp \ - qt/guiutil.cpp \ - qt/guiutil_font.cpp \ - qt/informationwidget.cpp \ - qt/initexecutor.cpp \ - qt/intro.cpp \ - qt/masternodemodel.cpp \ - qt/modaloverlay.cpp \ - qt/networkstyle.cpp \ - qt/networkwidget.cpp \ - qt/notificator.cpp \ - qt/optionsdialog.cpp \ - qt/optionsmodel.cpp \ - qt/peertablemodel.cpp \ - qt/peertablesortproxy.cpp \ - qt/proposalinfo.cpp \ - qt/proposalmodel.cpp \ - qt/proposalvotedialog.cpp \ - qt/qvalidatedlineedit.cpp \ - qt/qvaluecombobox.cpp \ - qt/rpcconsole.cpp \ - qt/splashscreen.cpp \ - qt/trafficgraphdata.cpp \ - qt/trafficgraphwidget.cpp \ - qt/utilitydialog.cpp - -BITCOIN_QT_WINDOWS_CPP = qt/winshutdownmonitor.cpp - -BITCOIN_QT_WALLET_CPP = \ - qt/addressbookpage.cpp \ - qt/addresstablemodel.cpp \ - qt/askpassphrasedialog.cpp \ - qt/coincontroldialog.cpp \ - qt/coincontroltreewidget.cpp \ - qt/createwalletdialog.cpp \ - qt/descriptiondialog.cpp \ - qt/editaddressdialog.cpp \ - qt/masternodedialogs.cpp \ - qt/masternodelist.cpp \ - qt/masternodeoperationrunner.cpp \ - qt/masternodewidgets.cpp \ - qt/masternodewizard.cpp \ - qt/mnemonicverificationdialog.cpp \ - qt/mnsharesession.cpp \ - qt/openuridialog.cpp \ - qt/overviewpage.cpp \ - qt/paymentserver.cpp \ - qt/proposalcreate.cpp \ - qt/proposallist.cpp \ - qt/proposalresume.cpp \ - qt/psbtoperationsdialog.cpp \ - qt/qrdialog.cpp \ - qt/qrimagewidget.cpp \ - qt/receivecoinsdialog.cpp \ - qt/receiverequestdialog.cpp \ - qt/recentrequeststablemodel.cpp \ - qt/sendcoinsdialog.cpp \ - qt/sendcoinsentry.cpp \ - qt/sharedmncreatedialog.cpp \ - qt/sharedmndialogs.cpp \ - qt/sharedmnwidgets.cpp \ - qt/signverifymessagedialog.cpp \ - qt/transactiondesc.cpp \ - qt/transactionfilterproxy.cpp \ - qt/transactionoverviewwidget.cpp \ - qt/transactionrecord.cpp \ - qt/transactiontablemodel.cpp \ - qt/transactionview.cpp \ - qt/walletcontroller.cpp \ - qt/walletframe.cpp \ - qt/walletmodel.cpp \ - qt/walletmodeltransaction.cpp \ - qt/walletview.cpp - -BITCOIN_QT_CPP = $(BITCOIN_QT_BASE_CPP) -if TARGET_WINDOWS -BITCOIN_QT_CPP += $(BITCOIN_QT_WINDOWS_CPP) -endif -if ENABLE_WALLET -BITCOIN_QT_CPP += $(BITCOIN_QT_WALLET_CPP) -endif # ENABLE_WALLET - -QT_RES_IMAGES = \ - qt/res/images/arrow_down_dark.png \ - qt/res/images/arrow_down_light.png \ - qt/res/images/arrow_left_dark.png \ - qt/res/images/arrow_left_light.png \ - qt/res/images/arrow_light_down_hover.png \ - qt/res/images/arrow_light_down_normal.png \ - qt/res/images/arrow_light_left_hover.png \ - qt/res/images/arrow_light_left_normal.png \ - qt/res/images/arrow_light_right_hover.png \ - qt/res/images/arrow_light_right_normal.png \ - qt/res/images/arrow_light_up_hover.png \ - qt/res/images/arrow_light_up_normal.png \ - qt/res/images/arrow_right_dark.png \ - qt/res/images/arrow_right_light.png \ - qt/res/images/arrow_up_dark.png \ - qt/res/images/arrow_up_light.png \ - qt/res/images/checkbox_checked_dark.png \ - qt/res/images/checkbox_checked_disabled_dark.png \ - qt/res/images/checkbox_checked_disabled_light.png \ - qt/res/images/checkbox_checked_hover_dark.png \ - qt/res/images/checkbox_checked_hover_light.png \ - qt/res/images/checkbox_checked_light.png \ - qt/res/images/checkbox_normal_dark.png \ - qt/res/images/checkbox_normal_disabled_dark.png \ - qt/res/images/checkbox_normal_disabled_light.png \ - qt/res/images/checkbox_normal_hover_dark.png \ - qt/res/images/checkbox_normal_hover_light.png \ - qt/res/images/checkbox_normal_light.png \ - qt/res/images/checkbox_partly_checked_dark.png \ - qt/res/images/checkbox_partly_checked_disabled_dark.png \ - qt/res/images/checkbox_partly_checked_disabled_light.png \ - qt/res/images/checkbox_partly_checked_hover_dark.png \ - qt/res/images/checkbox_partly_checked_hover_light.png \ - qt/res/images/checkbox_partly_checked_light.png \ - qt/res/images/dash_logo_toolbar.png \ - qt/res/images/dash_logo_toolbar_blue.png \ - qt/res/images/radio_checked_dark.png \ - qt/res/images/radio_checked_disabled_dark.png \ - qt/res/images/radio_checked_disabled_light.png \ - qt/res/images/radio_checked_hover_dark.png \ - qt/res/images/radio_checked_hover_light.png \ - qt/res/images/radio_checked_light.png \ - qt/res/images/radio_normal_dark.png \ - qt/res/images/radio_normal_disabled_dark.png \ - qt/res/images/radio_normal_disabled_light.png \ - qt/res/images/radio_normal_hover_dark.png \ - qt/res/images/radio_normal_hover_light.png \ - qt/res/images/radio_normal_light.png \ - qt/res/images/splash.png - -QT_RES_CSS = \ - qt/res/css/dark.css \ - qt/res/css/general.css \ - qt/res/css/light.css \ - qt/res/css/traditional.css - -QT_RES_FONTS = \ - qt/res/fonts/Montserrat/Montserrat-Black.otf \ - qt/res/fonts/Montserrat/Montserrat-BlackItalic.otf \ - qt/res/fonts/Montserrat/Montserrat-Bold.otf \ - qt/res/fonts/Montserrat/Montserrat-BoldItalic.otf \ - qt/res/fonts/Montserrat/Montserrat-ExtraBold.otf \ - qt/res/fonts/Montserrat/Montserrat-ExtraBoldItalic.otf \ - qt/res/fonts/Montserrat/Montserrat-ExtraLight.otf \ - qt/res/fonts/Montserrat/Montserrat-ExtraLightItalic.otf \ - qt/res/fonts/Montserrat/Montserrat-Italic.otf \ - qt/res/fonts/Montserrat/Montserrat-Light.otf \ - qt/res/fonts/Montserrat/Montserrat-LightItalic.otf \ - qt/res/fonts/Montserrat/Montserrat-Medium.otf \ - qt/res/fonts/Montserrat/Montserrat-MediumItalic.otf \ - qt/res/fonts/Montserrat/Montserrat-Regular.otf \ - qt/res/fonts/Montserrat/Montserrat-SemiBold.otf \ - qt/res/fonts/Montserrat/Montserrat-SemiBoldItalic.otf \ - qt/res/fonts/Montserrat/Montserrat-Thin.otf \ - qt/res/fonts/Montserrat/Montserrat-ThinItalic.otf \ - qt/res/fonts/RobotoMono-Bold.ttf - -QT_RES_ANIMATION = $(wildcard $(srcdir)/qt/res/animation/spinner-*.png) - -BITCOIN_QT_RC = qt/res/dash-qt-res.rc - -BITCOIN_QT_INCLUDES = -DQT_NO_KEYWORDS -DQT_USE_QSTRINGBUILDER - -qt_libbitcoinqt_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \ - $(QT_INCLUDES) $(QT_DBUS_INCLUDES) $(QR_CFLAGS) $(BOOST_CPPFLAGS) $(BDB_CPPFLAGS) -qt_libbitcoinqt_a_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS) -qt_libbitcoinqt_a_OBJCXXFLAGS = $(AM_OBJCXXFLAGS) $(QT_PIE_FLAGS) - -qt_libbitcoinqt_a_SOURCES = $(BITCOIN_QT_CPP) $(BITCOIN_QT_H) $(QT_FORMS_UI) \ - $(QT_QRC) $(QT_QRC_LOCALE) $(QT_TS) $(QT_RES_ICONS) $(QT_RES_IMAGES) $(QT_RES_CSS) $(QT_RES_FONTS) $(QT_RES_ANIMATION) -if TARGET_DARWIN - qt_libbitcoinqt_a_SOURCES += $(BITCOIN_MM) -endif - -nodist_qt_libbitcoinqt_a_SOURCES = $(QT_MOC_CPP) $(QT_MOC) \ - $(QT_QRC_CPP) $(QT_QRC_LOCALE_CPP) - -# forms/foo.h -> forms/ui_foo.h -QT_FORMS_H=$(join $(dir $(QT_FORMS_UI)),$(addprefix ui_, $(notdir $(QT_FORMS_UI:.ui=.h)))) - -# Most files will depend on the forms and moc files as includes. Generate them -# before anything else. -$(QT_MOC): $(QT_FORMS_H) -$(qt_libbitcoinqt_a_OBJECTS) $(qt_dash_qt_OBJECTS) $(dash_gui_OBJECTS): | $(QT_MOC) - -# dash-qt binary and dash-gui binaries # -bitcoin_qt_cppflags = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \ - $(QT_INCLUDES) $(QR_CFLAGS) -bitcoin_qt_cxxflags = $(AM_CXXFLAGS) $(QT_PIE_FLAGS) - -bitcoin_qt_sources = qt/main.cpp -if TARGET_WINDOWS - bitcoin_qt_sources += $(BITCOIN_QT_RC) -endif -bitcoin_qt_ldadd = qt/libbitcoinqt.a $(LIBBITCOIN_NODE) -if ENABLE_WALLET -bitcoin_qt_ldadd += $(LIBBITCOIN_UTIL) $(LIBBITCOIN_WALLET) -endif -if ENABLE_ZMQ -bitcoin_qt_ldadd += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS) -endif -if ENABLE_PLATFORM_GUI -bitcoin_qt_ldadd += $(PLATFORM_CXX_LIBS) -endif -bitcoin_qt_ldadd += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBDASHBLS) $(LIBUNIVALUE) $(LIBLEVELDB) $(LIBMEMENV) \ - $(BACKTRACE_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QR_LIBS) $(BDB_LIBS) $(MINIUPNPC_LIBS) $(NATPMP_LIBS) $(SQLITE_LIBS) $(LIBSECP256K1) \ - $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(ZSTD_LIBS) -bitcoin_qt_ldflags = $(LDFLAGS_WRAP_EXCEPTIONS) $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS) -bitcoin_qt_libtoolflags = $(AM_LIBTOOLFLAGS) --tag CXX - -qt_dash_qt_CPPFLAGS = $(bitcoin_qt_cppflags) -qt_dash_qt_CXXFLAGS = $(bitcoin_qt_cxxflags) -qt_dash_qt_SOURCES = $(bitcoin_qt_sources) init/bitcoin-qt.cpp -qt_dash_qt_LDADD = $(bitcoin_qt_ldadd) -qt_dash_qt_LDFLAGS = $(bitcoin_qt_ldflags) -qt_dash_qt_LIBTOOLFLAGS = $(bitcoin_qt_libtoolflags) - -dash_gui_CPPFLAGS = $(bitcoin_qt_cppflags) -dash_gui_CXXFLAGS = $(bitcoin_qt_cxxflags) -dash_gui_SOURCES = $(bitcoin_qt_sources) init/bitcoin-gui.cpp -dash_gui_LDADD = $(bitcoin_qt_ldadd) $(LIBBITCOIN_IPC) $(LIBBITCOIN_UTIL) $(LIBMULTIPROCESS_LIBS) -dash_gui_LDFLAGS = $(bitcoin_qt_ldflags) -dash_gui_LIBTOOLFLAGS = $(bitcoin_qt_libtoolflags) - -#locale/foo.ts -> locale/foo.qm -QT_QM=$(QT_TS:.ts=.qm) - -SECONDARY: $(QT_QM) - -$(srcdir)/qt/dashstrings.cpp: FORCE - @test -n $(XGETTEXT) || echo "xgettext is required for updating translations" - $(AM_V_GEN) cd $(srcdir); XGETTEXT=$(XGETTEXT) COPYRIGHT_HOLDERS="$(COPYRIGHT_HOLDERS)" $(PYTHON) ../share/qt/extract_strings_qt.py \ - $(libbitcoin_node_a_SOURCES) $(libbitcoin_wallet_a_SOURCES) $(libbitcoin_common_a_SOURCES) \ - $(libbitcoin_zmq_a_SOURCES) $(libbitcoin_consensus_a_SOURCES) $(libbitcoin_util_a_SOURCES) \ - $(BITCOIN_QT_BASE_CPP) $(BITCOIN_QT_WINDOWS_CPP) $(BITCOIN_QT_WALLET_CPP) $(BITCOIN_QT_H) $(BITCOIN_MM) - -# The resulted dash_en.xlf source file should follow Transifex requirements. -# See: https://docs.transifex.com/formats/xliff#how-to-distinguish-between-a-source-file-and-a-translation-file -translate: $(srcdir)/qt/dashstrings.cpp $(QT_FORMS_UI) $(QT_FORMS_UI) $(BITCOIN_QT_BASE_CPP) $(BITCOIN_QT_WINDOWS_CPP) $(BITCOIN_QT_WALLET_CPP) $(BITCOIN_QT_H) $(BITCOIN_MM) - @test -n $(LUPDATE) || echo "lupdate is required for updating translations" - $(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(LUPDATE) -no-obsolete -I $(srcdir) -locations relative $^ -ts $(srcdir)/qt/locale/dash_en.ts - @test -n $(LCONVERT) || echo "lconvert is required for updating translations" - $(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(LCONVERT) -drop-translations -o $(srcdir)/qt/locale/dash_en.xlf -i $(srcdir)/qt/locale/dash_en.ts - @$(SED) -i.old -e 's|source-language="en" target-language="en"|source-language="en"|' -e '/<\/target>/d' $(srcdir)/qt/locale/dash_en.xlf - @rm -f $(srcdir)/qt/locale/dash_en.xlf.old - -$(QT_QRC_LOCALE_CPP): $(QT_QRC_LOCALE) $(QT_QM) - @test -f $(RCC) || (echo "rcc $(RCC) not found, but is required for generating qrc cpp files"; exit 1) - @cp -f $< $(@D)/temp_$( $@ - @rm $(@D)/temp_$( $@ - -CLEAN_QT = $(nodist_qt_libbitcoinqt_a_SOURCES) $(QT_QM) $(QT_FORMS_H) qt/*.gcda qt/*.gcno qt/temp_dash_locale.qrc qt/res/css/colors/* - -CLEANFILES += $(CLEAN_QT) - -dash_qt_clean: FORCE - rm -f $(CLEAN_QT) $(qt_libbitcoinqt_a_OBJECTS) $(qt_dash_qt_OBJECTS) qt/dash-qt$(EXEEXT) $(LIBBITCOINQT) - -dash_qt : qt/dash-qt$(EXEEXT) - -ui_%.h: %.ui - @test -f $(UIC) || (echo "uic $(UIC) not found, but is required for generating ui headers"; exit 1) - @$(MKDIR_P) $(@D) - $(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(UIC) -o $@ $< || (echo "Error creating $@"; false) - -%.moc: %.cpp - $(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(MOC) $(DEFAULT_INCLUDES) $(QT_INCLUDES_UNSUPPRESSED) $(MOC_DEFS) $< > $@ - -moc_%.cpp: %.h - $(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(MOC) $(DEFAULT_INCLUDES) $(QT_INCLUDES_UNSUPPRESSED) $(MOC_DEFS) $< > $@ - -%.qm: %.ts - @test -f $(LRELEASE) || (echo "lrelease $(LRELEASE) not found, but is required for generating translations"; exit 1) - @$(MKDIR_P) $(@D) - $(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(LRELEASE) -silent $< -qm $@ diff --git a/src/Makefile.qt_locale.include b/src/Makefile.qt_locale.include deleted file mode 100644 index 5373f7fa85b7..000000000000 --- a/src/Makefile.qt_locale.include +++ /dev/null @@ -1,22 +0,0 @@ -QT_TS = \ - qt/locale/dash_ar.ts \ - qt/locale/dash_bg.ts \ - qt/locale/dash_de.ts \ - qt/locale/dash_en.ts \ - qt/locale/dash_es.ts \ - qt/locale/dash_fi.ts \ - qt/locale/dash_fr.ts \ - qt/locale/dash_it.ts \ - qt/locale/dash_ja.ts \ - qt/locale/dash_ko.ts \ - qt/locale/dash_nl.ts \ - qt/locale/dash_pl.ts \ - qt/locale/dash_pt.ts \ - qt/locale/dash_ro.ts \ - qt/locale/dash_ru.ts \ - qt/locale/dash_sk.ts \ - qt/locale/dash_th.ts \ - qt/locale/dash_tr.ts \ - qt/locale/dash_vi.ts \ - qt/locale/dash_zh_CN.ts \ - qt/locale/dash_zh_TW.ts diff --git a/src/Makefile.qttest.include b/src/Makefile.qttest.include deleted file mode 100644 index cf7756656e97..000000000000 --- a/src/Makefile.qttest.include +++ /dev/null @@ -1,110 +0,0 @@ -# Copyright (c) 2013-2016 The Bitcoin Core developers -# Copyright (c) 2014-2018 The Dash Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. - -bin_PROGRAMS += qt/test/test_dash-qt -TESTS += qt/test/test_dash-qt - -TEST_QT_MOC_CPP = \ - qt/test/moc_apptests.cpp \ - qt/test/moc_optiontests.cpp \ - qt/test/moc_proposalvotetests.cpp \ - qt/test/moc_rpcnestedtests.cpp \ - qt/test/moc_trafficgraphdatatests.cpp \ - qt/test/moc_uritests.cpp - -if ENABLE_WALLET -TEST_QT_MOC_CPP += \ - qt/test/moc_addressbooktests.cpp \ - qt/test/moc_coincontroltreewidgettests.cpp \ - qt/test/moc_mnsharesessiontests.cpp \ - qt/test/moc_sharedmnwalkthroughtests.cpp \ - qt/test/moc_providertransactiontests.cpp \ - qt/test/moc_masternodewidgettests.cpp \ - qt/test/moc_masternodemaintenancetests.cpp \ - qt/test/moc_sharedmnwidgettests.cpp \ - qt/test/moc_sharedmnwizardtests.cpp \ - qt/test/moc_wallettests.cpp -endif # ENABLE_WALLET - -TEST_QT_H = \ - qt/test/addressbooktests.h \ - qt/test/apptests.h \ - qt/test/coincontroltreewidgettests.h \ - qt/test/mnsharesessiontests.h \ - qt/test/masternodemaintenancetests.h \ - qt/test/masternodetestutil.h \ - qt/test/masternodewidgettests.h \ - qt/test/optiontests.h \ - qt/test/proposalvotetests.h \ - qt/test/providertransactiontests.h \ - qt/test/rpcnestedtests.h \ - qt/test/sharedmnwidgettests.h \ - qt/test/sharedmnwizardtests.h \ - qt/test/sharedmnwalkthroughtests.h \ - qt/test/uritests.h \ - qt/test/util.h \ - qt/test/trafficgraphdatatests.h \ - qt/test/wallettests.h - -qt_test_test_dash_qt_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \ - $(QT_INCLUDES) $(QT_TEST_INCLUDES) $(BOOST_CPPFLAGS) - -qt_test_test_dash_qt_SOURCES = \ - init/bitcoin-qt.cpp \ - qt/test/apptests.cpp \ - qt/test/optiontests.cpp \ - qt/test/proposalvotetests.cpp \ - qt/test/rpcnestedtests.cpp \ - qt/test/test_main.cpp \ - qt/test/trafficgraphdatatests.cpp \ - qt/test/uritests.cpp \ - qt/test/util.cpp \ - $(TEST_QT_H) -if ENABLE_WALLET -qt_test_test_dash_qt_SOURCES += \ - qt/test/addressbooktests.cpp \ - qt/test/coincontroltreewidgettests.cpp \ - qt/test/masternodetestutil.cpp \ - qt/test/mnsharesessiontests.cpp \ - qt/test/providertransactiontests.cpp \ - qt/test/sharedmnwalkthroughtests.cpp \ - qt/test/masternodewidgettests.cpp \ - qt/test/masternodemaintenancetests.cpp \ - qt/test/sharedmnwidgettests.cpp \ - qt/test/sharedmnwizardtests.cpp \ - qt/test/wallettests.cpp \ - wallet/test/wallet_test_fixture.cpp -endif # ENABLE_WALLET - -nodist_qt_test_test_dash_qt_SOURCES = $(TEST_QT_MOC_CPP) - -qt_test_test_dash_qt_LDADD = $(LIBBITCOINQT) $(LIBBITCOIN_NODE) $(LIBTEST_UTIL) -if ENABLE_WALLET -qt_test_test_dash_qt_LDADD += $(LIBBITCOIN_UTIL) $(LIBBITCOIN_WALLET) -endif -if ENABLE_ZMQ -qt_test_test_dash_qt_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS) -endif -if ENABLE_PLATFORM_GUI -qt_test_test_dash_qt_LDADD += $(PLATFORM_CXX_LIBS) -endif -qt_test_test_dash_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBDASHBLS) $(LIBUNIVALUE) $(LIBLEVELDB) \ - $(LIBMEMENV) $(BACKTRACE_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QT_TEST_LIBS) \ - $(QR_LIBS) $(BDB_LIBS) $(MINIUPNPC_LIBS) $(NATPMP_LIBS) $(SQLITE_LIBS) $(LIBSECP256K1) \ - $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(ZSTD_LIBS) -qt_test_test_dash_qt_LDFLAGS = $(LDFLAGS_WRAP_EXCEPTIONS) $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS) -qt_test_test_dash_qt_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS) - -CLEAN_BITCOIN_QT_TEST = $(TEST_QT_MOC_CPP) qt/test/*.gcda qt/test/*.gcno - -CLEANFILES += $(CLEAN_BITCOIN_QT_TEST) - -test_dash_qt : qt/test/test_dash-qt$(EXEEXT) - -test_dash_qt_check : qt/test/test_dash-qt$(EXEEXT) FORCE - $(MAKE) check-TESTS TESTS=$^ - -test_dash_qt_clean: FORCE - rm -f $(CLEAN_BITCOIN_QT_TEST) $(qt_test_test_dash_qt_OBJECTS) diff --git a/src/Makefile.test.include b/src/Makefile.test.include deleted file mode 100644 index efc856e152e4..000000000000 --- a/src/Makefile.test.include +++ /dev/null @@ -1,503 +0,0 @@ -# Copyright (c) 2013-2016 The Bitcoin Core developers -# Copyright (c) 2014-2018 The Dash Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. - -if ENABLE_FUZZ_BINARY -noinst_PROGRAMS += test/fuzz/fuzz -endif - -if ENABLE_TESTS -bin_PROGRAMS += test/test_dash -endif - -TEST_SRCDIR = test -TEST_BINARY=test/test_dash$(EXEEXT) -FUZZ_BINARY=test/fuzz/fuzz$(EXEEXT) - -JSON_TEST_FILES = \ - test/data/blockfilters.json \ - test/data/base58_encode_decode.json \ - test/data/bip39_vectors.json \ - test/data/key_io_valid.json \ - test/data/key_io_invalid.json \ - test/data/proposals_valid.json \ - test/data/proposals_invalid.json \ - test/data/script_tests.json \ - test/data/sighash.json \ - test/data/trivially_invalid.json \ - test/data/trivially_valid.json \ - test/data/tx_invalid.json \ - test/data/tx_valid.json - -RAW_TEST_FILES = \ - test/data/asmap.raw - -GENERATED_TEST_FILES = $(JSON_TEST_FILES:.json=.json.h) $(RAW_TEST_FILES:.raw=.raw.h) - -BITCOIN_TEST_SUITE = \ - test/main.cpp \ - $(TEST_UTIL_H) - -FUZZ_SUITE_LD_COMMON = \ - $(LIBTEST_FUZZ) \ - $(LIBTEST_UTIL) \ - $(LIBBITCOIN_NODE) \ - $(LIBBITCOIN_WALLET) \ - $(LIBBITCOIN_COMMON) \ - $(LIBBITCOIN_UTIL) \ - $(LIBBITCOIN_CONSENSUS) \ - $(LIBBITCOIN_CRYPTO) \ - $(LIBBITCOIN_CLI) \ - $(LIBDASHBLS) \ - $(BDB_LIBS) \ - $(SQLITE_LIBS) \ - $(LIBUNIVALUE) \ - $(LIBLEVELDB) \ - $(LIBMEMENV) \ - $(LIBSECP256K1) \ - $(MINISKETCH_LIBS) \ - $(EVENT_LIBS) \ - $(EVENT_PTHREADS_LIBS) \ - $(ZSTD_LIBS) \ - $(BACKTRACE_LIBS) - -if USE_UPNP -FUZZ_SUITE_LD_COMMON += $(MINIUPNPC_LIBS) -endif - -if USE_NATPMP -FUZZ_SUITE_LD_COMMON += $(NATPMP_LIBS) -endif - -# test_dash binary # -BITCOIN_TESTS =\ - test/argsman_tests.cpp \ - test/arith_uint256_tests.cpp \ - test/scriptnum10.h \ - test/addrman_tests.cpp \ - test/amount_tests.cpp \ - test/allocator_tests.cpp \ - test/banman_tests.cpp \ - test/base32_tests.cpp \ - test/base58_tests.cpp \ - test/base64_tests.cpp \ - test/baseindex_tests.cpp \ - test/bech32_tests.cpp \ - test/bip32_tests.cpp \ - test/bip324_tests.cpp \ - test/block_reward_reallocation_tests.cpp \ - test/blockchain_tests.cpp \ - test/blockencodings_tests.cpp \ - test/blockfilter_tests.cpp \ - test/blockfilter_index_tests.cpp \ - test/blockmanager_tests.cpp \ - test/bloom_tests.cpp \ - test/bls_tests.cpp \ - test/bswap_tests.cpp \ - test/checkdatasig_tests.cpp \ - test/checkqueue_tests.cpp \ - test/cachemap_tests.cpp \ - test/cachemultimap_tests.cpp \ - test/coins_tests.cpp \ - test/coinstatsindex_tests.cpp \ - test/common_url_tests.cpp \ - test/compilerbug_tests.cpp \ - test/compress_tests.cpp \ - test/crypto_tests.cpp \ - test/cuckoocache_tests.cpp \ - test/denialofservice_tests.cpp \ - test/dip0020opcodes_tests.cpp \ - test/dip14_tests.cpp \ - test/descriptor_tests.cpp \ - test/disconnected_transactions.cpp \ - test/dynamic_activation_thresholds_tests.cpp \ - test/evo_assetlocks_tests.cpp \ - test/evo_cbtx_tests.cpp \ - test/evo_db_tests.cpp \ - test/evo_deterministicmns_tests.cpp \ - test/evo_islock_tests.cpp \ - test/evo_mnauth_tests.cpp \ - test/evo_mnhf_tests.cpp \ - test/evo_netinfo_tests.cpp \ - test/evo_sharedmn_tests.cpp \ - test/evo_simplifiedmns_tests.cpp \ - test/evo_snapshot_tests.cpp \ - test/evo_trivialvalidation.cpp \ - test/evo_utils_tests.cpp \ - test/flatfile_tests.cpp \ - test/fs_tests.cpp \ - test/getarg_tests.cpp \ - test/governance_collateral_tests.cpp \ - test/governance_inv_tests.cpp \ - test/governance_superblock_tests.cpp \ - test/governance_validators_tests.cpp \ - test/governance_vote_processing_tests.cpp \ - test/governance_vote_sync_tests.cpp \ - test/governance_vote_wire_tests.cpp \ - test/coinjoin_inouts_tests.cpp \ - test/coinjoin_dstxmanager_tests.cpp \ - test/coinjoin_queue_tests.cpp \ - test/hash_tests.cpp \ - test/httpserver_tests.cpp \ - test/i2p_tests.cpp \ - test/index_migration_tests.cpp \ - test/interfaces_tests.cpp \ - test/key_io_tests.cpp \ - test/key_tests.cpp \ - test/lcg.h \ - test/limitedmap_tests.cpp \ - test/llmq_blockprocessor_tests.cpp \ - test/llmq_dkg_tests.cpp \ - test/llmq_chainlock_tests.cpp \ - test/llmq_commitment_tests.cpp \ - test/llmq_hash_tests.cpp \ - test/llmq_invalid_type_tests.cpp \ - test/llmq_params_tests.cpp \ - test/llmq_qgetdata_tests.cpp \ - test/llmq_snapshot_tests.cpp \ - test/llmq_utils_tests.cpp \ - test/logging_tests.cpp \ - test/quorum_proofs_tests.cpp \ - test/masternode_params_tests.cpp \ - test/masternode_payments_tests.cpp \ - test/dbwrapper_tests.cpp \ - test/validation_tests.cpp \ - test/mempool_tests.cpp \ - test/merkle_tests.cpp \ - test/merkleblock_tests.cpp \ - test/miniscript_tests.cpp \ - test/minisketch_tests.cpp \ - test/miner_tests.cpp \ - test/multisig_tests.cpp \ - test/net_peer_connection_tests.cpp \ - test/net_peer_eviction_tests.cpp \ - test/net_tests.cpp \ - test/netbase_tests.cpp \ - test/orphanage_tests.cpp \ - test/peerman_tests.cpp \ - test/pmt_tests.cpp \ - test/policyestimator_tests.cpp \ - test/pool_tests.cpp \ - test/pow_tests.cpp \ - test/prevector_tests.cpp \ - test/raii_event_tests.cpp \ - test/random_tests.cpp \ - test/ratecheck_tests.cpp \ - test/rest_tests.cpp \ - test/result_tests.cpp \ - test/reverselock_tests.cpp \ - test/rpc_tests.cpp \ - test/sanity_tests.cpp \ - test/scheduler_tests.cpp \ - test/script_p2sh_tests.cpp \ - test/script_p2pk_tests.cpp \ - test/script_p2pkh_tests.cpp \ - test/script_parse_tests.cpp \ - test/script_standard_tests.cpp \ - test/script_tests.cpp \ - test/scriptnum_tests.cpp \ - test/serfloat_tests.cpp \ - test/serialize_tests.cpp \ - test/settings_tests.cpp \ - test/sighash_tests.cpp \ - test/sigopcount_tests.cpp \ - test/skiplist_tests.cpp \ - test/sock_tests.cpp \ - test/span_tests.cpp \ - test/spork_tests.cpp \ - test/streams_tests.cpp \ - test/subsidy_tests.cpp \ - test/sync_tests.cpp \ - test/system_tests.cpp \ - test/util_threadnames_tests.cpp \ - test/timedata_tests.cpp \ - test/torcontrol_tests.cpp \ - test/transaction_tests.cpp \ - test/translation_tests.cpp \ - test/txindex_tests.cpp \ - test/txpackage_tests.cpp \ - test/txreconciliation_tests.cpp \ - test/txrequest_tests.cpp \ - test/txvalidation_tests.cpp \ - test/txvalidationcache_tests.cpp \ - test/uint256_tests.cpp \ - test/unordered_lru_cache_tests.cpp \ - test/util_tests.cpp \ - test/validation_block_tests.cpp \ - test/validation_chainstate_tests.cpp \ - test/validation_chainstatemanager_tests.cpp \ - test/validation_flush_tests.cpp \ - test/validationinterface_tests.cpp \ - test/versionbits_tests.cpp \ - test/xoroshiro128plusplus_tests.cpp - -if ENABLE_WALLET -BITCOIN_TESTS += \ - wallet/test/bip39_tests.cpp \ - wallet/test/coinjoin_tests.cpp \ - wallet/test/platformkeys_tests.cpp \ - wallet/test/psbt_wallet_tests.cpp \ - wallet/test/spend_tests.cpp \ - wallet/test/wallet_tests.cpp \ - wallet/test/walletdb_tests.cpp \ - wallet/test/wallet_crypto_tests.cpp \ - wallet/test/wallet_transaction_tests.cpp \ - wallet/test/coinselector_tests.cpp \ - wallet/test/init_tests.cpp \ - wallet/test/ismine_tests.cpp \ - wallet/test/rpc_util_tests.cpp \ - wallet/test/scriptpubkeyman_tests.cpp \ - wallet/test/walletload_tests.cpp \ - wallet/test/group_outputs_tests.cpp - -FUZZ_SUITE_LD_COMMON +=\ - $(SQLITE_LIBS) \ - $(BDB_LIBS) - -if USE_BDB -BITCOIN_TESTS += wallet/test/db_tests.cpp -endif - -FUZZ_WALLET_SRC = \ - wallet/test/fuzz/coincontrol.cpp \ - wallet/test/fuzz/coinselection.cpp \ - wallet/test/fuzz/fees.cpp \ - wallet/test/fuzz/parse_iso8601.cpp - -if USE_SQLITE -FUZZ_WALLET_SRC += \ - wallet/test/fuzz/notifications.cpp \ - wallet/test/fuzz/scriptpubkeyman.cpp -endif # USE_SQLITE - -BITCOIN_TEST_SUITE += \ - wallet/test/wallet_test_fixture.cpp \ - wallet/test/wallet_test_fixture.h \ - wallet/test/init_test_fixture.cpp \ - wallet/test/init_test_fixture.h -endif # ENABLE_WALLET - -test_test_dash_SOURCES = $(BITCOIN_TEST_SUITE) $(BITCOIN_TESTS) $(JSON_TEST_FILES) $(RAW_TEST_FILES) -test_test_dash_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(TESTDEFS) $(BOOST_CPPFLAGS) $(EVENT_CFLAGS) -test_test_dash_LDADD = $(LIBTEST_UTIL) -if ENABLE_WALLET -test_test_dash_LDADD += $(LIBBITCOIN_WALLET) -test_test_dash_CPPFLAGS += $(BDB_CPPFLAGS) -endif -if ENABLE_PLATFORM_GUI -test_test_dash_LDADD += $(PLATFORM_CXX_LIBS) -endif -test_test_dash_LDADD += $(LIBBITCOIN_NODE) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) \ - $(LIBDASHBLS) $(LIBLEVELDB) $(LIBMEMENV) $(BACKTRACE_LIBS) $(LIBSECP256K1) $(EVENT_LIBS) $(EVENT_PTHREADS_LIBS) $(MINISKETCH_LIBS) -test_test_dash_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) - -test_test_dash_LDADD += $(BDB_LIBS) $(MINIUPNPC_LIBS) $(SQLITE_LIBS) $(NATPMP_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(ZSTD_LIBS) -test_test_dash_LDFLAGS = $(LDFLAGS_WRAP_EXCEPTIONS) $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS) -static - -if ENABLE_ZMQ -test_test_dash_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS) -FUZZ_SUITE_LD_COMMON += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS) -endif - -if ENABLE_FUZZ_BINARY -test_fuzz_fuzz_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BOOST_CPPFLAGS) $(EVENT_CFLAGS) -test_fuzz_fuzz_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -test_fuzz_fuzz_LDADD = $(FUZZ_SUITE_LD_COMMON) -test_fuzz_fuzz_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(LDFLAGS_WRAP_EXCEPTIONS) $(PTHREAD_FLAGS) -test_fuzz_fuzz_SOURCES = \ - $(FUZZ_WALLET_SRC) \ - test/fuzz/addition_overflow.cpp \ - test/fuzz/addrman.cpp \ - test/fuzz/asmap.cpp \ - test/fuzz/asmap_direct.cpp \ - test/fuzz/autofile.cpp \ - test/fuzz/banman.cpp \ - test/fuzz/base_encode_decode.cpp \ - test/fuzz/bech32.cpp \ - test/fuzz/bip324.cpp \ - test/fuzz/bitset.cpp \ - test/fuzz/block.cpp \ - test/fuzz/block_header.cpp \ - test/fuzz/blockfilter.cpp \ - test/fuzz/bloom_filter.cpp \ - test/fuzz/buffered_file.cpp \ - test/fuzz/chain.cpp \ - test/fuzz/checkqueue.cpp \ - test/fuzz/coins_view.cpp \ - test/fuzz/coinscache_sim.cpp \ - test/fuzz/connman.cpp \ - test/fuzz/crypto.cpp \ - test/fuzz/crypto_aes256.cpp \ - test/fuzz/crypto_aes256cbc.cpp \ - test/fuzz/crypto_chacha20.cpp \ - test/fuzz/crypto_common.cpp \ - test/fuzz/crypto_diff_fuzz_chacha20.cpp \ - test/fuzz/crypto_hkdf_hmac_sha256_l32.cpp \ - test/fuzz/crypto_poly1305.cpp \ - test/fuzz/cuckoocache.cpp \ - test/fuzz/decode_tx.cpp \ - test/fuzz/descriptor_parse.cpp \ - test/fuzz/deserialize.cpp \ - test/fuzz/dkg_message_framing.cpp \ - test/fuzz/eval_script.cpp \ - test/fuzz/fee_rate.cpp \ - test/fuzz/fees.cpp \ - test/fuzz/flatfile.cpp \ - test/fuzz/float.cpp \ - test/fuzz/golomb_rice.cpp \ - test/fuzz/hex.cpp \ - test/fuzz/http_request.cpp \ - test/fuzz/integer.cpp \ - test/fuzz/key.cpp \ - test/fuzz/key_io.cpp \ - test/fuzz/kitchen_sink.cpp \ - test/fuzz/load_external_block_file.cpp \ - test/fuzz/locale.cpp \ - test/fuzz/merkleblock.cpp \ - test/fuzz/message.cpp \ - test/fuzz/miniscript.cpp \ - test/fuzz/minisketch.cpp \ - test/fuzz/muhash.cpp \ - test/fuzz/multiplication_overflow.cpp \ - test/fuzz/net.cpp \ - test/fuzz/net_permissions.cpp \ - test/fuzz/netaddress.cpp \ - test/fuzz/netbase_dns_lookup.cpp \ - test/fuzz/node_eviction.cpp \ - test/fuzz/p2p_transport_serialization.cpp \ - test/fuzz/package_eval.cpp \ - test/fuzz/parse_hd_keypath.cpp \ - test/fuzz/parse_numbers.cpp \ - test/fuzz/parse_script.cpp \ - test/fuzz/parse_univalue.cpp \ - test/fuzz/partially_downloaded_block.cpp \ - test/fuzz/policy_estimator.cpp \ - test/fuzz/policy_estimator_io.cpp \ - test/fuzz/poolresource.cpp \ - test/fuzz/pow.cpp \ - test/fuzz/prevector.cpp \ - test/fuzz/primitives_transaction.cpp \ - test/fuzz/process_message.cpp \ - test/fuzz/process_messages.cpp \ - test/fuzz/protocol.cpp \ - test/fuzz/psbt.cpp \ - test/fuzz/random.cpp \ - test/fuzz/rolling_bloom_filter.cpp \ - test/fuzz/rpc.cpp \ - test/fuzz/script.cpp \ - test/fuzz/script_bitcoin_consensus.cpp \ - test/fuzz/script_descriptor_cache.cpp \ - test/fuzz/script_flags.cpp \ - test/fuzz/script_format.cpp \ - test/fuzz/script_interpreter.cpp \ - test/fuzz/script_ops.cpp \ - test/fuzz/script_sigcache.cpp \ - test/fuzz/script_sign.cpp \ - test/fuzz/scriptnum_ops.cpp \ - test/fuzz/secp256k1_ec_seckey_import_export_der.cpp \ - test/fuzz/secp256k1_ecdsa_signature_parse_der_lax.cpp \ - test/fuzz/signature_checker.cpp \ - test/fuzz/socks5.cpp \ - test/fuzz/span.cpp \ - test/fuzz/spanparsing.cpp \ - test/fuzz/string.cpp \ - test/fuzz/strprintf.cpp \ - test/fuzz/system.cpp \ - test/fuzz/timedata.cpp \ - test/fuzz/torcontrol.cpp \ - test/fuzz/transaction.cpp \ - test/fuzz/tx_in.cpp \ - test/fuzz/tx_out.cpp \ - test/fuzz/tx_pool.cpp \ - test/fuzz/txorphan.cpp \ - test/fuzz/txrequest.cpp \ - test/fuzz/utxo_snapshot.cpp \ - test/fuzz/utxo_total_supply.cpp \ - test/fuzz/validation_load_mempool.cpp \ - test/fuzz/vecdeque.cpp \ - test/fuzz/versionbits.cpp -endif # ENABLE_FUZZ_BINARY - -nodist_test_test_dash_SOURCES = $(GENERATED_TEST_FILES) - -$(BITCOIN_TESTS): $(GENERATED_TEST_FILES) - -CLEAN_BITCOIN_TEST = test/*.gcda test/*.gcno test/fuzz/*.gcda test/fuzz/*.gcno test/util/*.gcda test/util/*.gcno $(GENERATED_TEST_FILES) $(addsuffix .log,$(basename $(BITCOIN_TESTS))) - -CLEANFILES += $(CLEAN_BITCOIN_TEST) - -if TARGET_WINDOWS -dash_test: $(TEST_BINARY) -else -if ENABLE_BENCH -dash_test: $(TEST_BINARY) $(BENCH_BINARY) -else -dash_test: $(TEST_BINARY) -endif -endif - -dash_test_check: $(TEST_BINARY) FORCE - $(MAKE) check-TESTS TESTS=$^ - -dash_test_clean : FORCE - rm -f $(CLEAN_BITCOIN_TEST) $(test_test_dash_OBJECTS) $(TEST_BINARY) - -check-unit: $(BITCOIN_TESTS:.cpp=.cpp.test) - -check-local: check-unit -if BUILD_BITCOIN_TX - @echo "Running test/util/test_runner.py..." - $(PYTHON) $(top_builddir)/test/util/test_runner.py -endif - @echo "Running test/util/rpcauth-test.py..." - $(PYTHON) $(top_builddir)/test/util/rpcauth-test.py -if TARGET_WINDOWS -else -if ENABLE_BENCH - @echo "Running bench/bench_dash (one iteration sanity check, only high priority)..." - $(BENCH_BINARY) -sanity-check -priority-level=high -endif -endif - $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C secp256k1 check - -if ENABLE_TESTS -UNIVALUE_TESTS = univalue/test/object univalue/test/unitester -noinst_PROGRAMS += $(UNIVALUE_TESTS) -TESTS += $(UNIVALUE_TESTS) - -univalue_test_unitester_SOURCES = $(UNIVALUE_TEST_UNITESTER_INT) -univalue_test_unitester_LDADD = $(LIBUNIVALUE) -univalue_test_unitester_CPPFLAGS = -I$(srcdir)/$(UNIVALUE_INCLUDE_DIR_INT) -DJSON_TEST_SRC=\"$(srcdir)/$(UNIVALUE_TEST_DATA_DIR_INT)\" -univalue_test_unitester_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS) - -univalue_test_object_SOURCES = $(UNIVALUE_TEST_OBJECT_INT) -univalue_test_object_LDADD = $(LIBUNIVALUE) -univalue_test_object_CPPFLAGS = -I$(srcdir)/$(UNIVALUE_INCLUDE_DIR_INT) -univalue_test_object_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS) -endif - -%.cpp.test: %.cpp - @echo Running tests: $$(\ - cat $< | \ - grep -E "(BOOST_FIXTURE_TEST_SUITE\\(|BOOST_AUTO_TEST_SUITE\\()" | \ - cut -d '(' -f 2 | cut -d ',' -f 1 | cut -d ')' -f 1\ - ) from $< - $(AM_V_at)export TEST_LOGFILE=$(abs_builddir)/$$(\ - echo $< | grep -E -o "(wallet/test/.*\.cpp|test/.*\.cpp)" | $(SED) -e s/\.cpp/.log/ \ - ) && \ - $(TEST_BINARY) --catch_system_errors=no -l test_suite -t "$$(\ - cat $< | \ - grep -E "(BOOST_FIXTURE_TEST_SUITE\\(|BOOST_AUTO_TEST_SUITE\\()" | \ - cut -d '(' -f 2 | cut -d ',' -f 1 | cut -d ')' -f 1\ - )" -- DEBUG_LOG_OUT > "$$TEST_LOGFILE" 2>&1 || (cat "$$TEST_LOGFILE" && false) - -%.json.h: %.json - @$(MKDIR_P) $(@D) - $(AM_V_GEN) { \ - echo "#include " && \ - echo "namespace json_tests{" && \ - echo "static const std::string $(*F){" && \ - $(HEXDUMP) -v -e '8/1 "char(0x%02x), "' -e '"\n"' $< | $(SED) -e 's/char(0x ),//g' && \ - echo "};};"; \ - } > "$@.new" && mv -f "$@.new" "$@" diff --git a/src/Makefile.test_fuzz.include b/src/Makefile.test_fuzz.include deleted file mode 100644 index b41475894e82..000000000000 --- a/src/Makefile.test_fuzz.include +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright (c) 2013-2020 The Bitcoin Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. - -LIBTEST_FUZZ=libtest_fuzz.a - -EXTRA_LIBRARIES += \ - $(LIBTEST_FUZZ) - -TEST_FUZZ_H = \ - test/fuzz/fuzz.h \ - test/fuzz/FuzzedDataProvider.h \ - test/fuzz/util.h \ - test/util/mining.h \ - test/fuzz/util/descriptor.h \ - test/fuzz/util/mempool.h \ - test/fuzz/util/net.h - -libtest_fuzz_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BOOST_CPPFLAGS) -libtest_fuzz_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -libtest_fuzz_a_SOURCES = \ - test/fuzz/fuzz.cpp \ - test/util/mining.cpp \ - test/fuzz/util.cpp \ - test/fuzz/util/descriptor.cpp \ - test/fuzz/util/mempool.cpp \ - test/fuzz/util/net.cpp \ - $(TEST_FUZZ_H) diff --git a/src/Makefile.test_util.include b/src/Makefile.test_util.include deleted file mode 100644 index 91a9ca2788dc..000000000000 --- a/src/Makefile.test_util.include +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright (c) 2013-2019 The Bitcoin Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. - -LIBTEST_UTIL=libtest_util.a - -EXTRA_LIBRARIES += \ - $(LIBTEST_UTIL) - -TEST_UTIL_H = \ - test/util/blockfilter.h \ - test/util/chainstate.h \ - test/util/coins.h \ - test/util/json.h \ - test/util/index.h \ - test/util/llmq_tests.h \ - test/util/logging.h \ - test/util/masternode.h \ - test/util/mining.h \ - test/util/net.h \ - test/util/poolresourcetester.h \ - test/util/random.h \ - test/util/script.h \ - test/util/setup_common.h \ - test/util/str.h \ - test/util/transaction_utils.h \ - test/util/txmempool.h \ - test/util/validation.h \ - test/util/xoroshiro128plusplus.h - -if ENABLE_WALLET -TEST_UTIL_H += wallet/test/util.h -endif # ENABLE_WALLET - -libtest_util_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BOOST_CPPFLAGS) -libtest_util_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -libtest_util_a_SOURCES = \ - test/util/blockfilter.cpp \ - test/util/index.cpp \ - test/util/coins.cpp \ - test/util/json.cpp \ - test/util/logging.cpp \ - test/util/masternode.cpp \ - test/util/mining.cpp \ - test/util/net.cpp \ - test/util/random.cpp \ - test/util/script.cpp \ - test/util/setup_common.cpp \ - test/util/str.cpp \ - test/util/transaction_utils.cpp \ - test/util/txmempool.cpp \ - test/util/validation.cpp - -if ENABLE_WALLET -libtest_util_a_SOURCES += wallet/test/util.cpp -endif # ENABLE_WALLET - -libtest_util_a_SOURCES += $(TEST_UTIL_H) diff --git a/src/Makefile.univalue.include b/src/Makefile.univalue.include deleted file mode 100644 index 3644e363688d..000000000000 --- a/src/Makefile.univalue.include +++ /dev/null @@ -1,6 +0,0 @@ -include univalue/sources.mk - -LIBUNIVALUE = libunivalue.la -noinst_LTLIBRARIES += $(LIBUNIVALUE) -libunivalue_la_SOURCES = $(UNIVALUE_LIB_SOURCES_INT) $(UNIVALUE_DIST_HEADERS_INT) $(UNIVALUE_LIB_HEADERS_INT) $(UNIVALUE_TEST_FILES_INT) -libunivalue_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/$(UNIVALUE_INCLUDE_DIR_INT) diff --git a/src/bench/.gitignore b/src/bench/.gitignore deleted file mode 100644 index d3f80df06ef5..000000000000 --- a/src/bench/.gitignore +++ /dev/null @@ -1 +0,0 @@ -bench_dash diff --git a/src/clientversion.cpp b/src/clientversion.cpp index 419efce2887f..4826ab143edd 100644 --- a/src/clientversion.cpp +++ b/src/clientversion.cpp @@ -25,7 +25,7 @@ const std::string CLIENT_NAME("Dash Core"); #ifdef HAVE_BUILD_INFO #include -// The , which is generated by the build environment (share/genbuild.sh), +// The , which is generated by the build environment (cmake/script/GenerateBuildInfo.cmake), // could contain only one line of the following: // - "#define BUILD_GIT_DESCRIPTION ...", if the top commit is not tagged // - "// No build information available", if proper git information is not available diff --git a/src/crypto/CMakeLists.txt b/src/crypto/CMakeLists.txt index 471553daed1b..a870d1c72853 100644 --- a/src/crypto/CMakeLists.txt +++ b/src/crypto/CMakeLists.txt @@ -68,9 +68,8 @@ if(HAVE_ARM_SHANI) target_link_libraries(bitcoin_crypto PRIVATE bitcoin_crypto_arm_shani) endif() -# The sphlib sources sit on the X11 proof-of-work path, so Autotools builds -# them as their own library with -O3 (SPHLIB_FLAGS in configure.ac). Mirror -# that here instead of letting them inherit the default optimisation level. +# The sphlib sources sit on the X11 proof-of-work path, so build them with -O3 +# instead of letting them inherit the default optimisation level. set(crypto_sph_sources x11/aes.cpp x11/blake.c diff --git a/src/ipc/capnp/.gitignore b/src/ipc/capnp/.gitignore deleted file mode 100644 index 036df1430c56..000000000000 --- a/src/ipc/capnp/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# capnp generated files -*.capnp.* diff --git a/src/kernel/CMakeLists.txt b/src/kernel/CMakeLists.txt index 7ab5e57fef2b..04ad20d008dc 100644 --- a/src/kernel/CMakeLists.txt +++ b/src/kernel/CMakeLists.txt @@ -2,8 +2,7 @@ # Distributed under the MIT software license, see the accompanying # file COPYING or https://opensource.org/license/mit/. -# Match libdashkernel_la_SOURCES in src/Makefile.am. The kernel supplies its -# own globals and helpers instead of pulling in the full node and RPC layers. +# The kernel supplies its own globals and helpers instead of pulling in the full node and RPC layers. add_library(bitcoinkernel STATIC EXCLUDE_FROM_ALL bitcoinkernel.cpp ../arith_uint256.cpp diff --git a/src/qt/Makefile b/src/qt/Makefile deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/src/qt/test/Makefile b/src/qt/test/Makefile deleted file mode 100644 index 09cd874b1157..000000000000 --- a/src/qt/test/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -all: - $(MAKE) -C ../../ test_dash_qt -clean: - $(MAKE) -C ../../ test_dash_qt_clean -check: - $(MAKE) -C ../../ test_dash_qt_check diff --git a/src/test/Makefile b/src/test/Makefile deleted file mode 100644 index a8fb61559b13..000000000000 --- a/src/test/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -all: - $(MAKE) -C .. dash_test -clean: - $(MAKE) -C .. dash_test_clean -check: - $(MAKE) -C .. dash_test_check diff --git a/src/test/bls_tests.cpp b/src/test/bls_tests.cpp index 6c5d35c3e9e5..86d08842afec 100644 --- a/src/test/bls_tests.cpp +++ b/src/test/bls_tests.cpp @@ -595,7 +595,7 @@ BOOST_AUTO_TEST_CASE(bls_verify_contribution_shares_empty_vvecs_tests) // contributions are accepted. Accepting an invalid share would corrupt the // recovered quorum key; rejecting an honest one would stall DKG. This property // was previously only covered by src/bench/bls_dkg.cpp, which does not run under -// `make check`. +// ctest. // // QUORUM_SIZE exceeds CONTRIBUTION_VERIFY_BATCH_SIZE so the aggregated path // builds more than one batch. Corrupting a share in the first batch must then diff --git a/src/univalue/.gitignore b/src/univalue/.gitignore deleted file mode 100644 index 19e42f814a5d..000000000000 --- a/src/univalue/.gitignore +++ /dev/null @@ -1,32 +0,0 @@ -.deps/ -INSTALL -Makefile -Makefile.in -aclocal.m4 -autom4te.cache/ -compile -config.log -config.status -config.guess -config.sub -configure -depcomp -install-sh -missing -stamp-h1 -univalue-config.h* -test-driver -libtool -ltmain.sh -test-suite.log - -*.a -*.la -*.lo -*.logs -*.o -*.pc -*.trs - -.dirstamp -.libs diff --git a/src/univalue/lib/.gitignore b/src/univalue/lib/.gitignore deleted file mode 100644 index ee7fc2851cd5..000000000000 --- a/src/univalue/lib/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -gen -.libs diff --git a/src/univalue/sources.mk b/src/univalue/sources.mk deleted file mode 100644 index 5e4d9c383199..000000000000 --- a/src/univalue/sources.mk +++ /dev/null @@ -1,86 +0,0 @@ -# - All Variables ending in _HEADERS or _SOURCES confuse automake, so the -# _INT postfix is applied. -# - Convenience variables, for example a UNIVALUE_TEST_DIR should not be used -# as they interfere with automatic dependency generation -# - The %reldir% is the relative path from the Makefile.am. - -UNIVALUE_INCLUDE_DIR_INT = %reldir%/include - -UNIVALUE_DIST_HEADERS_INT = -UNIVALUE_DIST_HEADERS_INT += %reldir%/include/univalue.h -UNIVALUE_DIST_HEADERS_INT += %reldir%/include/univalue_utffilter.h -UNIVALUE_DIST_HEADERS_INT += %reldir%/include/univalue_escapes.h - -UNIVALUE_LIB_SOURCES_INT = -UNIVALUE_LIB_SOURCES_INT += %reldir%/lib/univalue.cpp -UNIVALUE_LIB_SOURCES_INT += %reldir%/lib/univalue_get.cpp -UNIVALUE_LIB_SOURCES_INT += %reldir%/lib/univalue_read.cpp -UNIVALUE_LIB_SOURCES_INT += %reldir%/lib/univalue_write.cpp - -UNIVALUE_TEST_DATA_DIR_INT = %reldir%/test - -UNIVALUE_TEST_UNITESTER_INT = -UNIVALUE_TEST_UNITESTER_INT += %reldir%/test/unitester.cpp - -UNIVALUE_TEST_JSON_INT = -UNIVALUE_TEST_JSON_INT += %reldir%/test/test_json.cpp - -UNIVALUE_TEST_OBJECT_INT = -UNIVALUE_TEST_OBJECT_INT += %reldir%/test/object.cpp - -UNIVALUE_TEST_FILES_INT = -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail1.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail2.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail3.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail4.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail5.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail6.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail7.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail8.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail9.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail10.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail11.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail12.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail13.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail14.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail15.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail16.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail17.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail18.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail19.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail20.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail21.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail22.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail23.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail24.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail25.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail26.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail27.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail28.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail29.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail30.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail31.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail32.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail33.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail34.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail35.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail36.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail37.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail38.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail39.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail40.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail41.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail42.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail44.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/fail45.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/pass1.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/pass2.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/pass3.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/pass4.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/round1.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/round2.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/round3.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/round4.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/round5.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/round6.json -UNIVALUE_TEST_FILES_INT += %reldir%/test/round7.json diff --git a/src/univalue/test/.gitignore b/src/univalue/test/.gitignore deleted file mode 100644 index 5812c96b1434..000000000000 --- a/src/univalue/test/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ - -object -unitester -test_json - -*.trs -*.log diff --git a/src/util/fs_helpers.cpp b/src/util/fs_helpers.cpp index 9197195b03e7..924fdbdc3faf 100644 --- a/src/util/fs_helpers.cpp +++ b/src/util/fs_helpers.cpp @@ -26,7 +26,7 @@ #include #ifndef WIN32 -// for posix_fallocate, in configure.ac we check if it is present after this +// for posix_fallocate, in cmake/introspection.cmake we check if it is present after this #ifdef __linux__ #ifdef _POSIX_C_SOURCE diff --git a/test/functional/.gitignore b/test/functional/.gitignore index cb41d94423e4..0d20b6487c61 100644 --- a/test/functional/.gitignore +++ b/test/functional/.gitignore @@ -1,2 +1 @@ *.pyc -cache diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py index c77f8e39dff8..0a48f447b1c4 100755 --- a/test/functional/test_runner.py +++ b/test/functional/test_runner.py @@ -535,7 +535,7 @@ def main(): if not enable_bitcoind: print("No functional tests to run.") - print("Rerun ./configure with --with-daemon and then make") + print("Rerun cmake with -DBUILD_DAEMON=ON and then build") sys.exit(1) # Build list of tests diff --git a/test/lint/lint-spelling.py b/test/lint/lint-spelling.py index 3fd047b45e5b..1134a566e923 100755 --- a/test/lint/lint-spelling.py +++ b/test/lint/lint-spelling.py @@ -14,7 +14,7 @@ from lint_ignore_dirs import SHARED_EXCLUDED_SUBTREES IGNORE_WORDS_FILE = 'test/lint/spelling.ignore-words.txt' -FILES_ARGS = ['git', 'ls-files', '--', ":(exclude)build-aux/m4/", ":(exclude)contrib/seeds/*.txt", ":(exclude)depends/", ":(exclude)doc/release-notes/", ":(exclude)src/dashbls/", ":(exclude)src/crypto/", ":(exclude)src/ctpl_stl.h", ":(exclude)src/cxxtimer.hpp", ":(exclude)src/immer/", ":(exclude)src/qt/locale/", ":(exclude)src/qt/*.qrc", ":(exclude)contrib/guix/patches", ":(exclude)src/wallet/bip39_english.h"] +FILES_ARGS = ['git', 'ls-files', '--', ":(exclude)contrib/seeds/*.txt", ":(exclude)depends/", ":(exclude)doc/release-notes/", ":(exclude)src/dashbls/", ":(exclude)src/crypto/", ":(exclude)src/ctpl_stl.h", ":(exclude)src/cxxtimer.hpp", ":(exclude)src/immer/", ":(exclude)src/qt/locale/", ":(exclude)src/qt/*.qrc", ":(exclude)contrib/guix/patches", ":(exclude)src/wallet/bip39_english.h"] FILES_ARGS += [f":(exclude){dir}" for dir in SHARED_EXCLUDED_SUBTREES] diff --git a/test/util/test_runner.py b/test/util/test_runner.py index bc3739978b76..db5d65b3c0b0 100755 --- a/test/util/test_runner.py +++ b/test/util/test_runner.py @@ -5,7 +5,7 @@ # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test framework for bitcoin utils. -Runs automatically during `make check`. +Runs automatically during `ctest --test-dir build/`. Can also be run manually."""