Skip to content

Commit c17c082

Browse files
committedApr 11, 2025
Fix build with newer CMake and LLVM versions.
1 parent e8c5026 commit c17c082

File tree

5 files changed

+300
-11
lines changed

5 files changed

+300
-11
lines changed
 

‎scripts/prebuild.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ cd src\deps\sparkmobile
1616
git apply ..\patches\windows\windows_patch.patch
1717
cd ..\boost-cmake
1818
git apply ..\patches\boost-patch.patch
19+
cd ..\openssl-cmake
20+
git apply ..\patches\openssl-cmake-patch.patch
1921

2022
:: Navigate back to scripts.
2123
cd ..\..\..\scripts

‎scripts/prebuild.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@ cp src/deps/CMakeLists/secp256k1/CMakeLists.txt src/deps/sparkmobile/secp2
1111

1212
pushd src/deps/boost-cmake
1313
git apply ../patches/boost-patch.patch || true
14-
popd
14+
popd
15+
16+
pushd src/deps/openssl-cmake
17+
git apply ../patches/openssl-cmake-patch.patch || true
18+
popd

‎src/deps/CMakeLists/secp256k1/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Copyright (c) 2017 The Bitcoin developers
22

3-
cmake_minimum_required(VERSION 3.1)
3+
cmake_minimum_required(VERSION 3.5)
44
project(secp256k1_spark)
55

66
SET(ENABLE_MODULE_ECDH 1)

‎src/deps/patches/boost-patch.patch

Lines changed: 267 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,43 @@
1-
Subject: [PATCH] boost-patch
1+
From 05e09523d6644b8e27a21db41c2e86386b84d149 Mon Sep 17 00:00:00 2001
2+
From: cassandras-lies <203535133+cassandras-lies@users.noreply.github.com>
3+
Date: Thu, 10 Apr 2025 14:14:10 +0000
4+
Subject: [PATCH] Fix compilation with new LLVM and CMake.
5+
26
---
3-
Index: CMakeLists.txt
4-
IDEA additional info:
5-
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
6-
<+>UTF-8
7-
===================================================================
7+
CMakeLists.txt | 45 ++++++++++++++++--
8+
cmake/Modules/StandaloneBuild.cmake | 2 +-
9+
patch/1.63.0/context_0001_arm64_cpu.patch | 47 -------------------
10+
...context_0002_macOS_execution_context.patch | 23 ---------
11+
patches/integral_wrapper.patch | 19 ++++++++
12+
patches/that_future.patch | 19 ++++++++
13+
repack.sh | 44 -----------------
14+
7 files changed, 81 insertions(+), 118 deletions(-)
15+
delete mode 100644 patch/1.63.0/context_0001_arm64_cpu.patch
16+
delete mode 100644 patch/1.63.0/context_0002_macOS_execution_context.patch
17+
create mode 100644 patches/integral_wrapper.patch
18+
create mode 100644 patches/that_future.patch
19+
delete mode 100755 repack.sh
20+
821
diff --git a/CMakeLists.txt b/CMakeLists.txt
9-
--- a/CMakeLists.txt (revision 40cb41d86eab0d7fdc18af4b04b733f8cc852d2a)
10-
+++ b/CMakeLists.txt (date 1732142456631)
11-
@@ -21,6 +21,16 @@
22+
index 16d48dc..86edb38 100644
23+
--- a/CMakeLists.txt
24+
+++ b/CMakeLists.txt
25+
@@ -1,9 +1,11 @@
26+
-cmake_minimum_required(VERSION 3.12)
27+
+cmake_minimum_required(VERSION 3.10)
28+
project(Boost-CMake)
29+
30+
-option(BOOST_DISABLE_TESTS "Do not build test targets, even if building standalone" OFF)
31+
+add_compile_definitions(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION)
32+
33+
-set(BOOST_URL "https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/boost_1_71_0.tar.bz2" CACHE STRING "Boost download URL")
34+
+option(BOOST_DISABLE_TESTS "Do not build test targets, even if building standalone" ON)
35+
+
36+
+set(BOOST_URL "https://archives.boost.io/release/1.71.0/source/boost_1_71_0.tar.bz2" CACHE STRING "Boost download URL")
37+
set(BOOST_URL_SHA256 "d73a8da01e8bf8c7eda40b4c84915071a8c8a0df4a6734537ddde4a8580524ee" CACHE STRING "Boost download URL SHA256 checksum")
38+
39+
include(FetchContent)
40+
@@ -21,6 +23,42 @@ if(NOT Boost_POPULATED)
1241
set(BOOST_SOURCE ${boost_SOURCE_DIR})
1342
endif()
1443

@@ -21,7 +50,236 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt
2150
+endif()
2251
+message(STATUS "Copying: ${SOURCE_FILE} to ${DESTINATION_DIR}")
2352
+file(COPY ${SOURCE_FILE} DESTINATION ${DESTINATION_DIR})
53+
+
54+
+# Define your patch directory and source root
55+
+set(PATCH_DIR "${CMAKE_CURRENT_SOURCE_DIR}/patches")
56+
+set(SOURCE_ROOT "${BOOST_SOURCE}")
57+
+
58+
+# Get all patch files
59+
+file(GLOB PATCH_FILES "${PATCH_DIR}/*.patch")
60+
+
61+
+# Build a list of commands to apply each patch
62+
+set(PATCH_COMMANDS "")
63+
+foreach(PATCH_FILE ${PATCH_FILES})
64+
+ list(APPEND PATCH_COMMANDS
65+
+ COMMAND ${CMAKE_COMMAND} -E echo "Applying patch: ${PATCH_FILE}"
66+
+ COMMAND ${CMAKE_COMMAND} -E chdir ${SOURCE_ROOT} patch -p0 < "${PATCH_FILE}"
67+
+ )
68+
+endforeach()
69+
+
70+
+# Add a marker file to avoid reapplying patches
71+
+add_custom_command(
72+
+ OUTPUT "${SOURCE_ROOT}/.patched"
73+
+ ${PATCH_COMMANDS}
74+
+ COMMAND ${CMAKE_COMMAND} -E touch "${SOURCE_ROOT}/.patched"
75+
+ COMMENT "Applying all patches in ${PATCH_DIR}"
76+
+)
77+
+
78+
+add_custom_target(apply_patches ALL DEPENDS "${SOURCE_ROOT}/.patched")
2479
+
2580
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
2681
include(CheckBoostVersion)
2782

83+
@@ -102,3 +140,4 @@ if(USE_ANDROID)
84+
# Android doesn't support thread local storage through compiler intrinsics
85+
target_compile_definitions(Boost::boost INTERFACE BOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION)
86+
endif()
87+
+
88+
diff --git a/cmake/Modules/StandaloneBuild.cmake b/cmake/Modules/StandaloneBuild.cmake
89+
index 22083ce..a945102 100644
90+
--- a/cmake/Modules/StandaloneBuild.cmake
91+
+++ b/cmake/Modules/StandaloneBuild.cmake
92+
@@ -1,7 +1,7 @@
93+
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL "${CMAKE_SOURCE_DIR}")
94+
message(STATUS "Standalone mode detected")
95+
set(BOOST_STANDALONE ON)
96+
- set(CMAKE_CXX_STANDARD 11)
97+
+ set(CMAKE_CXX_STANDARD 17)
98+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
99+
set(CMAKE_CXX_EXTENSIONS OFF)
100+
enable_testing()
101+
diff --git a/patch/1.63.0/context_0001_arm64_cpu.patch b/patch/1.63.0/context_0001_arm64_cpu.patch
102+
deleted file mode 100644
103+
index 977eba4..0000000
104+
--- a/patch/1.63.0/context_0001_arm64_cpu.patch
105+
+++ /dev/null
106+
@@ -1,47 +0,0 @@
107+
-From 26b61a67cf1d384796e5ae2f207c5b6fa56015e5 Mon Sep 17 00:00:00 2001
108+
-From: Oliver Kowalke <oliver.kowalke@gmail.com>
109+
-Date: Thu, 5 Jan 2017 10:38:47 -0800
110+
-Subject: [PATCH] remove directive '.cpu' for ARM64/AAPCS/ELF
111+
-
112+
----
113+
- src/asm/jump_arm64_aapcs_elf_gas.S | 1 -
114+
- src/asm/make_arm64_aapcs_elf_gas.S | 1 -
115+
- src/asm/ontop_arm64_aapcs_elf_gas.S | 1 -
116+
- 3 files changed, 3 deletions(-)
117+
-
118+
-diff --git a/libs/context/src/asm/jump_arm64_aapcs_elf_gas.S b/libs/context/src/asm/jump_arm64_aapcs_elf_gas.S
119+
-index 7c0c2fa..1b8ce9e 100644
120+
---- a/libs/context/src/asm/jump_arm64_aapcs_elf_gas.S
121+
-+++ b/libs/context/src/asm/jump_arm64_aapcs_elf_gas.S
122+
-@@ -51,7 +51,6 @@
123+
- * *
124+
- *******************************************************/
125+
-
126+
--.cpu generic+fp+simd
127+
- .text
128+
- .align 2
129+
- .global jump_fcontext
130+
-diff --git a/libs/context/src/asm/make_arm64_aapcs_elf_gas.S b/libs/context/src/asm/make_arm64_aapcs_elf_gas.S
131+
-index e71a91c..c1fa843 100644
132+
---- a/libs/context/src/asm/make_arm64_aapcs_elf_gas.S
133+
-+++ b/libs/context/src/asm/make_arm64_aapcs_elf_gas.S
134+
-@@ -51,7 +51,6 @@
135+
- * *
136+
- *******************************************************/
137+
-
138+
--.cpu generic+fp+simd
139+
- .text
140+
- .align 2
141+
- .global make_fcontext
142+
-diff --git a/libs/context/src/asm/ontop_arm64_aapcs_elf_gas.S b/libs/context/src/asm/ontop_arm64_aapcs_elf_gas.S
143+
-index 7e3b047..02a3b07 100644
144+
---- a/libs/context/src/asm/ontop_arm64_aapcs_elf_gas.S
145+
-+++ b/libs/context/src/asm/ontop_arm64_aapcs_elf_gas.S
146+
-@@ -51,7 +51,6 @@
147+
- * *
148+
- *******************************************************/
149+
-
150+
--.cpu generic+fp+simd
151+
- .text
152+
- .align 2
153+
- .global ontop_fcontext
154+
diff --git a/patch/1.63.0/context_0002_macOS_execution_context.patch b/patch/1.63.0/context_0002_macOS_execution_context.patch
155+
deleted file mode 100644
156+
index e3fb420..0000000
157+
--- a/patch/1.63.0/context_0002_macOS_execution_context.patch
158+
+++ /dev/null
159+
@@ -1,23 +0,0 @@
160+
-From 3167d4dfb82aa74fcf41c755d6c9bc7a3401bfea Mon Sep 17 00:00:00 2001
161+
-From: Timo Sandmann <mail@timosandmann.de>
162+
-Date: Sun, 8 Jan 2017 18:24:20 +0100
163+
-Subject: [PATCH] Fixes #38
164+
-
165+
-Use correct type cast and tuple extracting for pointer to transfered data tuples
166+
----
167+
- include/boost/context/execution_context_v2.hpp | 2 +-
168+
- 1 file changed, 1 insertion(+), 1 deletion(-)
169+
-
170+
-diff --git a/boost/context/execution_context_v2.hpp b/boost/context/execution_context_v2.hpp
171+
-index 33b9bda..bbd4eb1 100644
172+
---- a/boost/context/execution_context_v2.hpp
173+
-+++ b/boost/context/execution_context_v2.hpp
174+
-@@ -103,7 +103,7 @@ class record {
175+
-
176+
- transfer_t run( transfer_t t) {
177+
- Ctx from{ t.fctx };
178+
-- typename Ctx::args_tpl_t args = std::move( * static_cast< typename Ctx::args_tpl_t * >( t.data) );
179+
-+ typename Ctx::args_tpl_t args = std::move( std::get<1>( * static_cast< std::tuple< std::exception_ptr, typename Ctx::args_tpl_t > * >( t.data) ) );
180+
- auto tpl = std::tuple_cat(
181+
- params_,
182+
- std::forward_as_tuple( std::move( from) ),
183+
diff --git a/patches/integral_wrapper.patch b/patches/integral_wrapper.patch
184+
new file mode 100644
185+
index 0000000..277ba34
186+
--- /dev/null
187+
+++ b/patches/integral_wrapper.patch
188+
@@ -0,0 +1,19 @@
189+
+*** boost/mpl/aux_/integral_wrapper.hpp Thu Apr 10 15:16:33 2025
190+
+--- boost/mpl/aux_/integral_wrapper.hpp Thu Apr 10 15:19:07 2025
191+
+***************
192+
+*** 56,62 ****
193+
+ // have to #ifdef here: some compilers don't like the 'N + 1' form (MSVC),
194+
+ // while some other don't like 'value + 1' (Borland), and some don't like
195+
+ // either
196+
+! #if BOOST_WORKAROUND(__EDG_VERSION__, <= 243)
197+
+ private:
198+
+ BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, next_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N + 1)));
199+
+ BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, prior_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1)));
200+
+--- 56,62 ----
201+
+ // have to #ifdef here: some compilers don't like the 'N + 1' form (MSVC),
202+
+ // while some other don't like 'value + 1' (Borland), and some don't like
203+
+ // either
204+
+! #if BOOST_WORKAROUND(__EDG_VERSION__, <= 243) || __cplusplus >= 201703L
205+
+ private:
206+
+ BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, next_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N + 1)));
207+
+ BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, prior_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1)));
208+
diff --git a/patches/that_future.patch b/patches/that_future.patch
209+
new file mode 100644
210+
index 0000000..22253c0
211+
--- /dev/null
212+
+++ b/patches/that_future.patch
213+
@@ -0,0 +1,19 @@
214+
+*** boost/thread/future.hpp Thu Apr 10 21:24:34 2025
215+
+--- boost/thread/future.hpp Thu Apr 10 21:25:04 2025
216+
+***************
217+
+*** 4669,4675 ****
218+
+ }
219+
+ run_it& operator=(BOOST_THREAD_RV_REF(run_it) x) BOOST_NOEXCEPT {
220+
+ if (this != &x) {
221+
+! that_=x.that;
222+
+ x.that_.reset();
223+
+ }
224+
+ return *this;
225+
+--- 4669,4675 ----
226+
+ }
227+
+ run_it& operator=(BOOST_THREAD_RV_REF(run_it) x) BOOST_NOEXCEPT {
228+
+ if (this != &x) {
229+
+! that_=x.that_;
230+
+ x.that_.reset();
231+
+ }
232+
+ return *this;
233+
diff --git a/repack.sh b/repack.sh
234+
deleted file mode 100755
235+
index adea206..0000000
236+
--- a/repack.sh
237+
+++ /dev/null
238+
@@ -1,44 +0,0 @@
239+
-#!/usr/bin/env bash
240+
-
241+
-set -e
242+
-
243+
-BOOST_VERSION=1.67.0
244+
-
245+
-function finish {
246+
- rm -rf ${tmp_dir}
247+
-}
248+
-trap finish EXIT
249+
-
250+
-out_dir=$(pwd)
251+
-patch_dir=$(pwd)/patch/${BOOST_VERSION}
252+
-tmp_dir=$(mktemp -d)
253+
-
254+
-echo "Downloading Boost ${BOOST_VERSION}..."
255+
-curl -L "https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION//\./_}.tar.bz2" > ${tmp_dir}/boost_${BOOST_VERSION}.tar.bz2
256+
-
257+
-mkdir -p ${tmp_dir}/extract
258+
-cd ${tmp_dir}/extract
259+
-echo "Extracting archive..."
260+
-tar xf ${tmp_dir}/boost_${BOOST_VERSION}.tar.bz2
261+
-
262+
-cd boost_*
263+
-
264+
-if [ -d "${patch_dir}" ]; then
265+
- mkdir patch
266+
- for f in ${patch_dir}/*.patch; do
267+
- echo "Applying patch ${f}..."
268+
- git apply --verbose $f
269+
- cp $f patch/
270+
- done
271+
-fi
272+
-
273+
-echo "Removing extra files..."
274+
-find . -name "doc" -print0 | xargs -0 -- rm -rf
275+
-find . -name "*.htm*" -delete
276+
-find . -name "*.png" -delete
277+
-find . -name "*.bmp" -delete
278+
-find . -name "*.jpg" -delete
279+
-
280+
-cd ..
281+
-echo "Recompressing archive..."
282+
-tar cfJ ${out_dir}/boost_${BOOST_VERSION//./_}.tar.xz boost_*
283+
--
284+
2.39.5 (Apple Git-154)
285+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
From bfff81c09a34a64c8d8adf97e963793054584773 Mon Sep 17 00:00:00 2001
2+
From: cassandras-lies <203535133+cassandras-lies@users.noreply.github.com>
3+
Date: Mon, 7 Apr 2025 09:27:36 +0000
4+
Subject: [PATCH] Bump cmake_required_version for compatibility with new
5+
CMakes.
6+
7+
---
8+
CMakeLists.txt | 2 +-
9+
1 file changed, 1 insertion(+), 1 deletion(-)
10+
11+
diff --git a/CMakeLists.txt b/CMakeLists.txt
12+
index e93be8f..66c7605 100644
13+
--- a/CMakeLists.txt
14+
+++ b/CMakeLists.txt
15+
@@ -23,7 +23,7 @@
16+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18+
# SOFTWARE.
19+
-cmake_minimum_required( VERSION 3.1.0 )
20+
+cmake_minimum_required( VERSION 3.5.0 )
21+
set( CMAKE_LEGACY_CYGWIN_WIN32 0 )
22+
project( openssl )
23+
24+
--
25+

0 commit comments

Comments
 (0)