git: 4d3be3c0d914 - main - misc/randomx: New port: Proof of work algorithm based on random code execution

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Mon, 04 Sep 2023 17:40:52 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=4d3be3c0d914e2fbc5f155c74a5915af2ea37b54

commit 4d3be3c0d914e2fbc5f155c74a5915af2ea37b54
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2023-09-04 17:40:20 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2023-09-04 17:40:50 +0000

    misc/randomx: New port: Proof of work algorithm based on random code execution
---
 misc/Makefile                           |  1 +
 misc/randomx/Makefile                   | 30 ++++++++++++++++++++++++++++++
 misc/randomx/distinfo                   |  3 +++
 misc/randomx/files/patch-CMakeLists.txt | 17 +++++++++++++++++
 misc/randomx/pkg-descr                  |  4 ++++
 5 files changed, 55 insertions(+)

diff --git a/misc/Makefile b/misc/Makefile
index 107fc608f44d..31a5c25df116 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -502,6 +502,7 @@
     SUBDIR += qt6-examples
     SUBDIR += qt6ct
     SUBDIR += quantum++
+    SUBDIR += randomx
     SUBDIR += raspberrypi-gpioshutdown
     SUBDIR += raspberrypi-userland
     SUBDIR += raspbsd-led
diff --git a/misc/randomx/Makefile b/misc/randomx/Makefile
new file mode 100644
index 000000000000..cacf47371c9e
--- /dev/null
+++ b/misc/randomx/Makefile
@@ -0,0 +1,30 @@
+PORTNAME=	randomx
+DISTVERSIONPREFIX=	v
+DISTVERSION=	1.1.10-28
+DISTVERSIONSUFFIX=	-g67ea010
+CATEGORIES=	misc
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Proof of work algorithm based on random code execution
+WWW=		https://github.com/tevador/RandomX
+
+LICENSE=	BSD3CLAUSE
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+USES=		cmake:testing compiler:c++11-lang
+USE_LDCONFIG=	yes
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	tevador
+GH_PROJECT=	RandomX
+
+CMAKE_ON=	BUILD_SHARED_LIBS
+CMAKE_TESTING_TARGET=
+
+PLIST_FILES=	include/randomx.h \
+		lib/librandomx.so
+
+post-test: # run tests
+	@cd ${BUILD_WRKSRC} && ./randomx-tests
+
+.include <bsd.port.mk>
diff --git a/misc/randomx/distinfo b/misc/randomx/distinfo
new file mode 100644
index 000000000000..7ff79618688a
--- /dev/null
+++ b/misc/randomx/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1693848545
+SHA256 (tevador-RandomX-v1.1.10-28-g67ea010_GH0.tar.gz) = 4ee0eda587b91b7812ab638a9d8d68b637f105145945dab7ddbcfc126e52c8d5
+SIZE (tevador-RandomX-v1.1.10-28-g67ea010_GH0.tar.gz) = 165919
diff --git a/misc/randomx/files/patch-CMakeLists.txt b/misc/randomx/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..956b88a592d2
--- /dev/null
+++ b/misc/randomx/files/patch-CMakeLists.txt
@@ -0,0 +1,17 @@
+--- CMakeLists.txt.orig	2023-09-04 17:31:42 UTC
++++ CMakeLists.txt
+@@ -192,6 +192,8 @@ install(TARGETS randomx
+   ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+   PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+ 
++if (${BUILD_TESTING})
++
+ add_executable(randomx-tests
+   src/tests/tests.cpp)
+ target_link_libraries(randomx-tests
+@@ -234,3 +236,5 @@ if(NOT HAVE_CXX_ATOMICS)
+ endif()
+ set_property(TARGET randomx-benchmark PROPERTY POSITION_INDEPENDENT_CODE ON)
+ set_property(TARGET randomx-benchmark PROPERTY CXX_STANDARD 11)
++
++endif()
diff --git a/misc/randomx/pkg-descr b/misc/randomx/pkg-descr
new file mode 100644
index 000000000000..253a3ba3dda5
--- /dev/null
+++ b/misc/randomx/pkg-descr
@@ -0,0 +1,4 @@
+RandomX is a proof-of-work (PoW) algorithm that is optimized for general-purpose
+CPUs. RandomX uses random code execution (hence the name) together with several
+memory-hard techniques to minimize the efficiency advantage of specialized
+hardware.