aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches/fulcrum-1.9.1-unbundled-libraries.patch
blob: 327846b7aae911362df60ce36d4e240a552d5248 (about) (plain)
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
SPDX-FileCopyrightText: © 2023 Foundation Devices, Inc. <hello@foundationdevices.com>
SPDX-License-Identifier: GPL-3.0-or-later

These patch series allow to compile Fulcrum without using any bundled
libraries.

From 141d590b4189908a88ca07ad8e3880e4933e6427 Mon Sep 17 00:00:00 2001
From: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
Date: Thu, 6 Jul 2023 14:56:53 +0200
Subject: [PATCH 1/4] Add config to build without secp256k1

Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
---
 Fulcrum.pro | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Fulcrum.pro b/Fulcrum.pro
index e7fdfde..2dad355 100644
--- a/Fulcrum.pro
+++ b/Fulcrum.pro
@@ -480,7 +480,7 @@ HEADERS += \
 # Enable secp256k1 compilation on x86_64 only -- we don't actually use this lib
 # yet in Fulcrum, so on platforms that aren't x86_64 it's ok to exclude it; it
 # was included in case we wish to someday verify signatures in Fulcrum, etc.
-contains(QT_ARCH, x86_64):!win32-msvc {
+contains(QT_ARCH, x86_64):!contains(CONFIG, config_without_bundled_secp256k1):!win32-msvc {
     message("Including embedded secp256k1")
 
     SOURCES += bitcoin/secp256k1/secp256k1.c
-- 
2.34.1


From 093a43d02dd14039ae8aed992223e5167f3fb866 Mon Sep 17 00:00:00 2001
From: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
Date: Thu, 6 Jul 2023 15:49:01 +0200
Subject: [PATCH 2/4] Allow using system simdjson

Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
---
 Fulcrum.pro              | 7 +++++++
 src/Json/Json_Parser.cpp | 5 ++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/Fulcrum.pro b/Fulcrum.pro
index 2dad355..c478af6 100644
--- a/Fulcrum.pro
+++ b/Fulcrum.pro
@@ -149,6 +149,13 @@ contains(CONFIG, config_endian_big) {
 }
 # /GIT_COMMIT=
 
+# simdjson
+contains(LIBS, -lsimdjson) {
+    message("simdjson: Using CLI override")
+    DEFINES += SYSTEM_SIMDJSON
+}
+# /simdjson
+
 # ZMQ
 !contains(LIBS, -lzmq) {
     # Test for ZMQ, and if found, add pkg-config which we will rely upon to find libs
diff --git a/src/Json/Json_Parser.cpp b/src/Json/Json_Parser.cpp
index c24fe94..eb42eec 100644
--- a/src/Json/Json_Parser.cpp
+++ b/src/Json/Json_Parser.cpp
@@ -56,7 +56,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 // embed simdjson here, if we are on a known 64-bit platform and the header & sources are available
 #if defined(__x86_64__) || defined(_M_AMD64) || defined(__aarch64__) || defined(_M_ARM64)
-#if __has_include("simdjson/simdjson.h") && __has_include("simdjson/simdjson.cpp")
+#if defined(SYSTEM_SIMDJSON)
+#include <simdjson.h>
+#define HAVE_SIMDJSON 1
+#elif __has_include("simdjson/simdjson.h") && __has_include("simdjson/simdjson.cpp")
 #include "simdjson/simdjson.h"
 #include "simdjson/simdjson.cpp"
 #define HAVE_SIMDJSON 1
-- 
2.34.1


From 4c609cb1467478cb669b5ca2290606128543a48c Mon Sep 17 00:00:00 2001
From: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
Date: Thu, 6 Jul 2023 15:56:01 +0200
Subject: [PATCH 3/4] Allow using system robin-hood-hashing

Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
---
 Fulcrum.pro        | 13 ++++++++++---
 src/Controller.cpp |  2 +-
 src/Storage.cpp    |  4 ++--
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/Fulcrum.pro b/Fulcrum.pro
index c478af6..99c7659 100644
--- a/Fulcrum.pro
+++ b/Fulcrum.pro
@@ -149,6 +149,16 @@ contains(CONFIG, config_endian_big) {
 }
 # /GIT_COMMIT=
 
+# robin-hood-hashing
+!contains(CONFIG, config_without_bundled_robin_hood) {
+    # Robin Hood unordered_flat_map implememntation (single header and MUCH more efficient than unordered_map!)
+    HEADERS += robin_hood/robin_hood.h
+    INCLUDEPATH += src/robin_hood/
+} else {
+    message("robin-hood-hashing: Using CLI override")
+}
+# /robin-hood-hashing
+
 # simdjson
 contains(LIBS, -lsimdjson) {
     message("simdjson: Using CLI override")
@@ -402,9 +412,6 @@ HEADERS += \
     WebSocket.h \
     ZmqSubNotifier.h
 
-# Robin Hood unordered_flat_map implememntation (single header and MUCH more efficient than unordered_map!)
-HEADERS += robin_hood/robin_hood.h
-
 RESOURCES += \
     resources.qrc
 
diff --git a/src/Controller.cpp b/src/Controller.cpp
index 918c1f2..d0cab56 100644
--- a/src/Controller.cpp
+++ b/src/Controller.cpp
@@ -33,7 +33,7 @@
 #include "bitcoin/crypto/common.h"  // ReadLE32
 #include "bitcoin/rpc/protocol.h" // for RPC_INVALID_ADDRESS_OR_KEY
 #include "bitcoin/transaction.h"
-#include "robin_hood/robin_hood.h"
+#include <robin_hood.h>
 
 #include <algorithm>
 #include <cassert>
diff --git a/src/Storage.cpp b/src/Storage.cpp
index e74278c..0f0b91e 100644
--- a/src/Storage.cpp
+++ b/src/Storage.cpp
@@ -31,7 +31,7 @@
 
 #include "bitcoin/hash.h"
 
-#include "robin_hood/robin_hood.h"
+#include <robin_hood.h>
 
 #if __has_include(<rocksdb/advanced_cache.h>)
 // Newer rocksdb 8.1 defines the `Cache` class in this header. :/
@@ -4537,7 +4537,7 @@ namespace {
 } // end anon namespace
 
 #ifdef ENABLE_TESTS
-#include "robin_hood/robin_hood.h"
+#include <robin_hood.h>
 namespace {
 
     template<size_t NB>
-- 
2.34.1


From 0e3888b12f62553b032a56b71d2c1545add080b6 Mon Sep 17 00:00:00 2001
From: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
Date: Thu, 6 Jul 2023 16:04:57 +0200
Subject: [PATCH 4/4] Allow using system cppzmq

Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
---
 Fulcrum.pro            | 8 ++++++++
 src/ZmqSubNotifier.cpp | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/Fulcrum.pro b/Fulcrum.pro
index 99c7659..0948834 100644
--- a/Fulcrum.pro
+++ b/Fulcrum.pro
@@ -186,6 +186,14 @@ contains(LIBS, -lsimdjson) {
 }
 # /ZMQ
 
+# cppzmq
+!contains(CONFIG, config_without_bundled_cppzmq) {
+    INCLUDEPATH += src/zmq
+} else {
+    message("cppzmq: Using CLI override")
+}
+# /cppzmq
+
 # - Try and detect rocksdb and if not, fall back to the staticlib.
 # - User can suppress this behavior by specifying a "LIBS+=-lrocksdb..." on the
 #   CLI when they invoked qmake. In that case, they must set-up the LIBS+= and
diff --git a/src/ZmqSubNotifier.cpp b/src/ZmqSubNotifier.cpp
index 6b03784..48a41be 100644
--- a/src/ZmqSubNotifier.cpp
+++ b/src/ZmqSubNotifier.cpp
@@ -23,7 +23,7 @@
 #if defined(ENABLE_ZMQ)
 // real implementation
 #define ZMQ_CPP11
-#include "zmq/zmq.hpp"
+#include <zmq.hpp>
 
 #include <QRandomGenerator>
 
-- 
2.34.1