mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-01-09 00:10:21 +03:00
See: https://github.com/bitcoin/bitcoin/releases/tag/v29.0rc2 Signed-off-by: Matt Whitlock <gentoo@mattwhitlock.name> Closes: https://github.com/gentoo/gentoo/pull/41047 Signed-off-by: Sam James <sam@gentoo.org>
82 lines
3.0 KiB
Diff
82 lines
3.0 KiB
Diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index 3ad29249e9..4d775fbb89 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.")
|
|
@@ -163,6 +163,9 @@ if(WITH_MULTIPROCESS)
|
|
)
|
|
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 41577b2ad6..01d601729f 100644
|
|
--- a/src/CMakeLists.txt
|
|
+++ b/src/CMakeLists.txt
|
|
@@ -19,6 +19,44 @@ include(../cmake/crc32c.cmake)
|
|
include(../cmake/leveldb.cmake)
|
|
include(../cmake/minisketch.cmake)
|
|
add_subdirectory(univalue)
|
|
+
|
|
+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(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
|
|
+
|
|
#=============================
|
|
# secp256k1 subtree
|
|
#=============================
|
|
@@ -68,6 +106,8 @@ set_target_properties(secp256k1 PROPERTIES
|
|
)
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
+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)
|