summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/fulcrum-1.9.1-unbundled-libraries.patch
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/patches/fulcrum-1.9.1-unbundled-libraries.patch')
-rw-r--r--gnu/packages/patches/fulcrum-1.9.1-unbundled-libraries.patch210
1 files changed, 210 insertions, 0 deletions
diff --git a/gnu/packages/patches/fulcrum-1.9.1-unbundled-libraries.patch b/gnu/packages/patches/fulcrum-1.9.1-unbundled-libraries.patch
new file mode 100644
index 0000000000..327846b7aa
--- /dev/null
+++ b/gnu/packages/patches/fulcrum-1.9.1-unbundled-libraries.patch
@@ -0,0 +1,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
+