-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathboost-patch.patch
280 lines (272 loc) · 10.4 KB
/
boost-patch.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
From fe0568321e4e72940fc2062f37bfca63ab21773d Mon Sep 17 00:00:00 2001
From: cassandras-lies <203535133+cassandras-lies@users.noreply.github.com>
Date: Sun, 27 Apr 2025 13:39:07 +0000
Subject: [PATCH] Fix compilation with CMake 4 and LLVM 17
---
CMakeLists.txt | 44 +++++++++++++++--
cmake/Modules/StandaloneBuild.cmake | 2 +-
patch/1.63.0/context_0001_arm64_cpu.patch | 47 -------------------
...context_0002_macOS_execution_context.patch | 23 ---------
patches/integral_wrapper.patch | 19 ++++++++
patches/that_future.patch | 19 ++++++++
repack.sh | 44 -----------------
7 files changed, 80 insertions(+), 118 deletions(-)
delete mode 100644 patch/1.63.0/context_0001_arm64_cpu.patch
delete mode 100644 patch/1.63.0/context_0002_macOS_execution_context.patch
create mode 100644 patches/integral_wrapper.patch
create mode 100644 patches/that_future.patch
delete mode 100755 repack.sh
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 16d48dc..52fd3d9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,9 +1,11 @@
-cmake_minimum_required(VERSION 3.12)
+cmake_minimum_required(VERSION 3.10)
project(Boost-CMake)
-option(BOOST_DISABLE_TESTS "Do not build test targets, even if building standalone" OFF)
+add_compile_definitions(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION)
-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")
+option(BOOST_DISABLE_TESTS "Do not build test targets, even if building standalone" ON)
+
+set(BOOST_URL "https://archives.boost.io/release/1.71.0/source/boost_1_71_0.tar.bz2" CACHE STRING "Boost download URL")
set(BOOST_URL_SHA256 "d73a8da01e8bf8c7eda40b4c84915071a8c8a0df4a6734537ddde4a8580524ee" CACHE STRING "Boost download URL SHA256 checksum")
include(FetchContent)
@@ -21,6 +23,42 @@ if(NOT Boost_POPULATED)
set(BOOST_SOURCE ${boost_SOURCE_DIR})
endif()
+set(SOURCE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/../thread_data.hpp")
+set(DESTINATION_DIR "${BOOST_SOURCE}/boost/thread/pthread")
+set(DESTINATION_FILE "${BOOST_SOURCE}/boost/thread/pthread/thread_data.hpp")
+if(EXISTS "${DESTINATION_FILE}")
+ message(STATUS "Removing: ${DESTINATION_FILE}")
+ file(REMOVE "${DESTINATION_FILE}")
+endif()
+message(STATUS "Copying: ${SOURCE_FILE} to ${DESTINATION_DIR}")
+file(COPY ${SOURCE_FILE} DESTINATION ${DESTINATION_DIR})
+
+# Define your patch directory and source root
+set(PATCH_DIR "${CMAKE_CURRENT_SOURCE_DIR}/patches")
+set(SOURCE_ROOT "${BOOST_SOURCE}")
+
+# Get all patch files
+file(GLOB PATCH_FILES "${PATCH_DIR}/*.patch")
+
+# Build a list of commands to apply each patch
+set(PATCH_COMMANDS "")
+foreach(PATCH_FILE ${PATCH_FILES})
+ list(APPEND PATCH_COMMANDS
+ COMMAND ${CMAKE_COMMAND} -E echo "Applying patch: ${PATCH_FILE}"
+ COMMAND ${CMAKE_COMMAND} -E chdir ${SOURCE_ROOT} patch -F -p0 < "${PATCH_FILE}"
+ )
+endforeach()
+
+# Add a marker file to avoid reapplying patches
+add_custom_command(
+ OUTPUT "${SOURCE_ROOT}/.patched"
+ ${PATCH_COMMANDS}
+ COMMAND ${CMAKE_COMMAND} -E touch "${SOURCE_ROOT}/.patched"
+ COMMENT "Applying all patches in ${PATCH_DIR}"
+)
+
+add_custom_target(apply_patches ALL DEPENDS "${SOURCE_ROOT}/.patched")
+
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
include(CheckBoostVersion)
diff --git a/cmake/Modules/StandaloneBuild.cmake b/cmake/Modules/StandaloneBuild.cmake
index 22083ce..a945102 100644
--- a/cmake/Modules/StandaloneBuild.cmake
+++ b/cmake/Modules/StandaloneBuild.cmake
@@ -1,7 +1,7 @@
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL "${CMAKE_SOURCE_DIR}")
message(STATUS "Standalone mode detected")
set(BOOST_STANDALONE ON)
- set(CMAKE_CXX_STANDARD 11)
+ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
enable_testing()
diff --git a/patch/1.63.0/context_0001_arm64_cpu.patch b/patch/1.63.0/context_0001_arm64_cpu.patch
deleted file mode 100644
index 977eba4..0000000
--- a/patch/1.63.0/context_0001_arm64_cpu.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From 26b61a67cf1d384796e5ae2f207c5b6fa56015e5 Mon Sep 17 00:00:00 2001
-From: Oliver Kowalke <oliver.kowalke@gmail.com>
-Date: Thu, 5 Jan 2017 10:38:47 -0800
-Subject: [PATCH] remove directive '.cpu' for ARM64/AAPCS/ELF
-
----
- src/asm/jump_arm64_aapcs_elf_gas.S | 1 -
- src/asm/make_arm64_aapcs_elf_gas.S | 1 -
- src/asm/ontop_arm64_aapcs_elf_gas.S | 1 -
- 3 files changed, 3 deletions(-)
-
-diff --git a/libs/context/src/asm/jump_arm64_aapcs_elf_gas.S b/libs/context/src/asm/jump_arm64_aapcs_elf_gas.S
-index 7c0c2fa..1b8ce9e 100644
---- a/libs/context/src/asm/jump_arm64_aapcs_elf_gas.S
-+++ b/libs/context/src/asm/jump_arm64_aapcs_elf_gas.S
-@@ -51,7 +51,6 @@
- * *
- *******************************************************/
-
--.cpu generic+fp+simd
- .text
- .align 2
- .global jump_fcontext
-diff --git a/libs/context/src/asm/make_arm64_aapcs_elf_gas.S b/libs/context/src/asm/make_arm64_aapcs_elf_gas.S
-index e71a91c..c1fa843 100644
---- a/libs/context/src/asm/make_arm64_aapcs_elf_gas.S
-+++ b/libs/context/src/asm/make_arm64_aapcs_elf_gas.S
-@@ -51,7 +51,6 @@
- * *
- *******************************************************/
-
--.cpu generic+fp+simd
- .text
- .align 2
- .global make_fcontext
-diff --git a/libs/context/src/asm/ontop_arm64_aapcs_elf_gas.S b/libs/context/src/asm/ontop_arm64_aapcs_elf_gas.S
-index 7e3b047..02a3b07 100644
---- a/libs/context/src/asm/ontop_arm64_aapcs_elf_gas.S
-+++ b/libs/context/src/asm/ontop_arm64_aapcs_elf_gas.S
-@@ -51,7 +51,6 @@
- * *
- *******************************************************/
-
--.cpu generic+fp+simd
- .text
- .align 2
- .global ontop_fcontext
diff --git a/patch/1.63.0/context_0002_macOS_execution_context.patch b/patch/1.63.0/context_0002_macOS_execution_context.patch
deleted file mode 100644
index e3fb420..0000000
--- a/patch/1.63.0/context_0002_macOS_execution_context.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-From 3167d4dfb82aa74fcf41c755d6c9bc7a3401bfea Mon Sep 17 00:00:00 2001
-From: Timo Sandmann <mail@timosandmann.de>
-Date: Sun, 8 Jan 2017 18:24:20 +0100
-Subject: [PATCH] Fixes #38
-
-Use correct type cast and tuple extracting for pointer to transfered data tuples
----
- include/boost/context/execution_context_v2.hpp | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/boost/context/execution_context_v2.hpp b/boost/context/execution_context_v2.hpp
-index 33b9bda..bbd4eb1 100644
---- a/boost/context/execution_context_v2.hpp
-+++ b/boost/context/execution_context_v2.hpp
-@@ -103,7 +103,7 @@ class record {
-
- transfer_t run( transfer_t t) {
- Ctx from{ t.fctx };
-- typename Ctx::args_tpl_t args = std::move( * static_cast< typename Ctx::args_tpl_t * >( t.data) );
-+ 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) ) );
- auto tpl = std::tuple_cat(
- params_,
- std::forward_as_tuple( std::move( from) ),
diff --git a/patches/integral_wrapper.patch b/patches/integral_wrapper.patch
new file mode 100644
index 0000000..277ba34
--- /dev/null
+++ b/patches/integral_wrapper.patch
@@ -0,0 +1,19 @@
+*** boost/mpl/aux_/integral_wrapper.hpp Thu Apr 10 15:16:33 2025
+--- boost/mpl/aux_/integral_wrapper.hpp Thu Apr 10 15:19:07 2025
+***************
+*** 56,62 ****
+ // have to #ifdef here: some compilers don't like the 'N + 1' form (MSVC),
+ // while some other don't like 'value + 1' (Borland), and some don't like
+ // either
+! #if BOOST_WORKAROUND(__EDG_VERSION__, <= 243)
+ private:
+ BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, next_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N + 1)));
+ BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, prior_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1)));
+--- 56,62 ----
+ // have to #ifdef here: some compilers don't like the 'N + 1' form (MSVC),
+ // while some other don't like 'value + 1' (Borland), and some don't like
+ // either
+! #if BOOST_WORKAROUND(__EDG_VERSION__, <= 243) || __cplusplus >= 201703L
+ private:
+ BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, next_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N + 1)));
+ BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, prior_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1)));
diff --git a/patches/that_future.patch b/patches/that_future.patch
new file mode 100644
index 0000000..22253c0
--- /dev/null
+++ b/patches/that_future.patch
@@ -0,0 +1,19 @@
+*** boost/thread/future.hpp Thu Apr 10 21:24:34 2025
+--- boost/thread/future.hpp Thu Apr 10 21:25:04 2025
+***************
+*** 4669,4675 ****
+ }
+ run_it& operator=(BOOST_THREAD_RV_REF(run_it) x) BOOST_NOEXCEPT {
+ if (this != &x) {
+! that_=x.that;
+ x.that_.reset();
+ }
+ return *this;
+--- 4669,4675 ----
+ }
+ run_it& operator=(BOOST_THREAD_RV_REF(run_it) x) BOOST_NOEXCEPT {
+ if (this != &x) {
+! that_=x.that_;
+ x.that_.reset();
+ }
+ return *this;
diff --git a/repack.sh b/repack.sh
deleted file mode 100755
index adea206..0000000
--- a/repack.sh
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/usr/bin/env bash
-
-set -e
-
-BOOST_VERSION=1.67.0
-
-function finish {
- rm -rf ${tmp_dir}
-}
-trap finish EXIT
-
-out_dir=$(pwd)
-patch_dir=$(pwd)/patch/${BOOST_VERSION}
-tmp_dir=$(mktemp -d)
-
-echo "Downloading Boost ${BOOST_VERSION}..."
-curl -L "https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION//\./_}.tar.bz2" > ${tmp_dir}/boost_${BOOST_VERSION}.tar.bz2
-
-mkdir -p ${tmp_dir}/extract
-cd ${tmp_dir}/extract
-echo "Extracting archive..."
-tar xf ${tmp_dir}/boost_${BOOST_VERSION}.tar.bz2
-
-cd boost_*
-
-if [ -d "${patch_dir}" ]; then
- mkdir patch
- for f in ${patch_dir}/*.patch; do
- echo "Applying patch ${f}..."
- git apply --verbose $f
- cp $f patch/
- done
-fi
-
-echo "Removing extra files..."
-find . -name "doc" -print0 | xargs -0 -- rm -rf
-find . -name "*.htm*" -delete
-find . -name "*.png" -delete
-find . -name "*.bmp" -delete
-find . -name "*.jpg" -delete
-
-cd ..
-echo "Recompressing archive..."
-tar cfJ ${out_dir}/boost_${BOOST_VERSION//./_}.tar.xz boost_*
--
2.39.5 (Apple Git-154)