gentoo-ebuilds/net-p2p/bitcoin-core/files/30.0-cmake-syslibs.patch
Matt Whitlock 2abfc2dd75
net-p2p/bitcoin-core: bump to 30.0
Note: This release drops IUSE="berkdb" and replaces IUSE="sqlite" with
IUSE="wallet" since the BDB wallet format is no longer supported. An
automated detection is added in pkg_setup() to alert users if they have
any auto-loaded wallets still in the obsolete format. Even if they miss
seeing the warning, the worst that will happen is that their system
service or manually executed BitcoinD will fail to start, and they will
need to edit their settings.json to remove the offending wallets and
then call the migratewallet RPC to migrate their old wallets to the new
format. Bitcoin Core 30.0 introduces a minimal Berkeley DB reader (with
no dependency on any Berkeley DB library) so that the wallet migration
command remains usable.

Note: This release drops the automated data directory migration that has
been offered since 380aad5fc6 (Oct 2023).
Users who still have /var/lib/bitcoin/.bitcoin as a symlink to
/var/lib/bitcoind will lose that symlink upon upgrading to this release.

See: https://github.com/bitcoin/bitcoin/releases/tag/v30.0
Signed-off-by: Matt Whitlock <gentoo@mattwhitlock.name>
Part-of: https://github.com/gentoo/gentoo/pull/44118
Closes: https://github.com/gentoo/gentoo/pull/44118
Signed-off-by: Florian Schmaus <flow@gentoo.org>
2025-10-30 20:28:19 +01:00

78 lines
3 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d6368096e5..cff9157f70 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,7 +7,7 @@
#
# Centos Stream 9, https://www.centos.org/cl-vs-cs/#end-of-life, 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)
+cmake_minimum_required(VERSION 3.25)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
message(FATAL_ERROR "In-source builds are not allowed.")
@@ -150,6 +150,9 @@ if(ENABLE_IPC AND WITH_EXTERNAL_LIBMULTIPROCESS)
)
endif()
+option(WITH_SYSTEM_LIBSECP256K1 "Link with system-installed libsecp256k1." OFF)
+mark_as_advanced(WITH_SYSTEM_LIBSECP256K1)
+
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)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a6fb12c009..810d793ae6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -23,9 +23,50 @@ if (ENABLE_IPC AND NOT WITH_EXTERNAL_LIBMULTIPROCESS)
include(../cmake/libmultiprocess.cmake)
add_libmultiprocess(ipc/libmultiprocess)
endif()
+
+if(WITH_SYSTEM_LIBSECP256K1)
+
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(libsecp256k1 REQUIRED IMPORTED_TARGET libsecp256k1)
+add_library(secp256k1 ALIAS PkgConfig::libsecp256k1)
+block()
+ string(APPEND CMAKE_REQUIRED_FLAGS " ${libsecp256k1_CFLAGS_OTHER}")
+ list(APPEND CMAKE_REQUIRED_INCLUDES ${libsecp256k1_INCLUDE_DIRS})
+ list(APPEND CMAKE_REQUIRED_LINK_OPTIONS ${libsecp256k1_LDFLAGS})
+ list(APPEND CMAKE_REQUIRED_LIBRARIES ${libsecp256k1_LIBRARIES})
+ unset(missing_modules)
+ include(CheckSymbolExists)
+ macro(check_secp256k1_module module symbol)
+ string(TOUPPER "${symbol}" VAR)
+ set(VAR "libsecp256k1_HAS_${VAR}")
+ unset(${VAR})
+ check_symbol_exists("${symbol}" "secp256k1_${module}.h" ${VAR})
+ if(NOT ${VAR})
+ list(APPEND missing_modules "${module}")
+ endif()
+ endmacro()
+ message(CHECK_START "Checking for required libsecp256k1 modules")
+ list(APPEND CMAKE_MESSAGE_INDENT " ")
+ check_secp256k1_module(ellswift secp256k1_ellswift_create)
+ check_secp256k1_module(extrakeys secp256k1_xonly_pubkey_parse)
+ check_secp256k1_module(musig secp256k1_musig_pubnonce_parse)
+ check_secp256k1_module(recovery secp256k1_ecdsa_recover)
+ check_secp256k1_module(schnorrsig secp256k1_schnorrsig_verify)
+ list(POP_BACK CMAKE_MESSAGE_INDENT)
+ if(missing_modules)
+ list(JOIN missing_modules ", " missing_modules)
+ message(FATAL_ERROR "System-installed libsecp256k1 lacks these required modules: ${missing_modules}.")
+ endif()
+ message(CHECK_PASS "all were found")
+endblock()
+
+else() # !WITH_SYSTEM_LIBSECP256K1
+
include(../cmake/secp256k1.cmake)
add_secp256k1(secp256k1)
+endif() # !WITH_SYSTEM_LIBSECP256K1
+
# Set top-level target output locations.
if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)