diff options
author | Ahmed Kamal <email.ahmedkamal@googlemail.com> | 2022-05-07 15:42:51 +0200 |
---|---|---|
committer | Ahmed Kamal <email.ahmedkamal@googlemail.com> | 2022-05-07 15:42:51 +0200 |
commit | 2032969f0a8b63b3d80596c4ea69856027305709 (patch) | |
tree | dff2cbf009ecaf74152e933075c1b8c21b1bb9c7 /pkgs/applications/blockchains | |
parent | 5f8cb210112fd2f4414fd4fbba045bdbc18cddf0 (diff) |
Initial port of haven-cli
Diffstat (limited to 'pkgs/applications/blockchains')
-rw-r--r-- | pkgs/applications/blockchains/haven-cli/default.nix | 63 | ||||
-rw-r--r-- | pkgs/applications/blockchains/haven-cli/use-system-libraries.patch | 79 |
2 files changed, 142 insertions, 0 deletions
diff --git a/pkgs/applications/blockchains/haven-cli/default.nix b/pkgs/applications/blockchains/haven-cli/default.nix new file mode 100644 index 0000000000000..93cca5a7f991d --- /dev/null +++ b/pkgs/applications/blockchains/haven-cli/default.nix @@ -0,0 +1,63 @@ +{ lib, stdenv, fetchFromGitHub, fetchpatch +, cmake, pkg-config +, boost, miniupnpc, openssl, unbound +, zeromq, pcsclite, readline, libsodium, hidapi +, randomx, rapidjson +, easyloggingpp +, CoreData, IOKit, PCSC +, trezorSupport ? true, libusb1, protobuf, python3 +}: + +stdenv.mkDerivation rec { + pname = "haven-cli"; + version = "2.2.3"; + + src = fetchFromGitHub { + owner = "haven-protocol-org"; + repo = "haven-main"; + rev = "v${version}"; + sha256 = "sha256-nBVLNT0jWIewr6MPDGwDqXoVtyFLyls1IEQraVoWDQ4="; + fetchSubmodules = true; + }; + + patches = [ + ./use-system-libraries.patch + ]; + + postPatch = '' + # remove vendored libraries + rm -r external/{miniupnp,randomx,rapidjson,unbound} + # export patched source for haven-gui + cp -r . $source + ''; + + nativeBuildInputs = [ cmake pkg-config ]; + + buildInputs = [ + boost miniupnpc openssl unbound + zeromq pcsclite readline + libsodium hidapi randomx rapidjson + protobuf + readline easyloggingpp + ] + ++ lib.optionals trezorSupport [ libusb1 protobuf python3 ]; + + cmakeFlags = [ + "-DCMAKE_BUILD_TYPE=Release" + "-DUSE_DEVICE_TREZOR=ON" + "-DBUILD_GUI_DEPS=ON" + "-DReadline_ROOT_DIR=${readline.dev}" + "-DReadline_INCLUDE_DIR=${readline.dev}/include/readline" + "-DRandomX_ROOT_DIR=${randomx}" + ] ++ lib.optional stdenv.isDarwin "-DBoost_USE_MULTITHREADED=OFF"; + + outputs = [ "out" "source" ]; + + meta = with lib; { + description = "Haven Protocol is the world's only network of private stable asset"; + homepage = "https://havenprotocol.org/"; + license = licenses.bsd3; + platforms = platforms.all; + maintainers = with maintainers; [ kim0 ]; + }; +} diff --git a/pkgs/applications/blockchains/haven-cli/use-system-libraries.patch b/pkgs/applications/blockchains/haven-cli/use-system-libraries.patch new file mode 100644 index 0000000000000..6d485b578f605 --- /dev/null +++ b/pkgs/applications/blockchains/haven-cli/use-system-libraries.patch @@ -0,0 +1,79 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index fb71d2d..3a710a4 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -200,11 +200,11 @@ if(NOT MANUAL_SUBMODULES) + endfunction () + + message(STATUS "Checking submodules") +- check_submodule(external/miniupnp) +- check_submodule(external/unbound) +- check_submodule(external/rapidjson) ++ # check_submodule(external/miniupnp) ++ # check_submodule(external/unbound) ++ # check_submodule(external/rapidjson) + check_submodule(external/trezor-common) +- check_submodule(external/randomx) ++ # check_submodule(external/randomx) + endif() + endif() + +@@ -300,7 +300,8 @@ endif() + # elseif(CMAKE_SYSTEM_NAME MATCHES ".*BSDI.*") + # set(BSDI TRUE) + +-include_directories(external/rapidjson/include external/easylogging++ src contrib/epee/include external) ++include_directories(external/easylogging++ src contrib/epee/include external) ++#include_directories(external/rapidjson/include external/easylogging++ src contrib/epee/include external) + + if(APPLE) + include_directories(SYSTEM /usr/include/malloc) +diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt +index 71b165f..10189ce 100644 +--- a/external/CMakeLists.txt ++++ b/external/CMakeLists.txt +@@ -37,19 +37,9 @@ + + find_package(Miniupnpc REQUIRED) + +-message(STATUS "Using in-tree miniupnpc") +-add_subdirectory(miniupnp/miniupnpc) +-set_property(TARGET libminiupnpc-static PROPERTY FOLDER "external") +-if(MSVC) +- set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -wd4244 -wd4267") +-elseif(NOT MSVC) +- set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value") +-endif() +-if(CMAKE_SYSTEM_NAME MATCHES "NetBSD") +- set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -D_NETBSD_SOURCE") +-endif() +- +-set(UPNP_LIBRARIES "libminiupnpc-static" PARENT_SCOPE) ++set(UPNP_STATIC false PARENT_SCOPE) ++set(UPNP_INCLUDE ${MINIUPNP_INCLUDE_DIR} PARENT_SCOPE) ++set(UPNP_LIBRARIES ${MINIUPNP_LIBRARY} PARENT_SCOPE) + + find_package(Unbound) + +@@ -80,4 +70,3 @@ endif() + + add_subdirectory(db_drivers) + add_subdirectory(easylogging++) +-add_subdirectory(randomx EXCLUDE_FROM_ALL) +diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl +index c626e22..be570ed 100644 +--- a/src/p2p/net_node.inl ++++ b/src/p2p/net_node.inl +@@ -60,9 +60,9 @@ + #include "cryptonote_core/cryptonote_core.h" + #include "net/parse.h" + +-#include <miniupnp/miniupnpc/miniupnpc.h> +-#include <miniupnp/miniupnpc/upnpcommands.h> +-#include <miniupnp/miniupnpc/upnperrors.h> ++#include <miniupnpc/miniupnpc.h> ++#include <miniupnpc/upnpcommands.h> ++#include <miniupnpc/upnperrors.h> + + #undef MONERO_DEFAULT_LOG_CATEGORY + #define MONERO_DEFAULT_LOG_CATEGORY "net.p2p" |