git: 579b9452fc0c - main - databases/rocksdb-jni: New port: Java (JNI) interface to RocksDB

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Fri, 04 Oct 2024 19:39:16 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=579b9452fc0c1c8797b09ada180b95f6c7220463

commit 579b9452fc0c1c8797b09ada180b95f6c7220463
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2024-10-04 19:23:49 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2024-10-04 19:39:13 +0000

    databases/rocksdb-jni: New port: Java (JNI) interface to RocksDB
---
 databases/Makefile                               |  1 +
 databases/rocksdb-jni/Makefile                   | 69 ++++++++++++++++++++++++
 databases/rocksdb-jni/distinfo                   | 13 +++++
 databases/rocksdb-jni/files/patch-CMakeLists.txt | 52 ++++++++++++++++++
 databases/rocksdb-jni/pkg-descr                  |  7 +++
 5 files changed, 142 insertions(+)

diff --git a/databases/Makefile b/databases/Makefile
index 23af500fe149..c889c4c13d97 100644
--- a/databases/Makefile
+++ b/databases/Makefile
@@ -893,6 +893,7 @@
     SUBDIR += replibyte
     SUBDIR += retcl
     SUBDIR += rocksdb
+    SUBDIR += rocksdb-jni
     SUBDIR += rqlite
     SUBDIR += rrdman
     SUBDIR += rrdmerge
diff --git a/databases/rocksdb-jni/Makefile b/databases/rocksdb-jni/Makefile
new file mode 100644
index 000000000000..7ca22cffada1
--- /dev/null
+++ b/databases/rocksdb-jni/Makefile
@@ -0,0 +1,69 @@
+PORTNAME=	rocksdb-jni
+DISTVERSIONPREFIX=	v
+DISTVERSION=	9.6.1
+CATEGORIES=	databases java
+MASTER_SITES=	https://rocksdb-deps.s3-us-west-2.amazonaws.com/jars/:deps
+DISTFILES=	assertj-core-2.9.0.jar:deps \
+		cglib-3.3.0.jar:deps \
+		hamcrest-2.2.jar:deps \
+		junit-4.13.1.jar:deps \
+		mockito-all-1.10.19.jar:deps
+EXTRACT_ONLY=	${GH_ACCOUNT}-${GH_PROJECT}-${DISTVERSIONFULL}_GH0${EXTRACT_SUFX}
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Java (JNI) interface to RocksDB
+WWW=		https://rocksdb.org/
+
+LICENSE=	APACHE20 GPLv2
+LICENSE_COMB=	dual
+LICENSE_FILE_APACHE20=	${WRKSRC}/../LICENSE.Apache
+LICENSE_FILE_GPLv2=	${WRKSRC}/../COPYING
+
+BUILD_DEPENDS=	rocksdb>0:databases/rocksdb \
+		googletest>0:devel/googletest
+
+USES=		cmake compiler:c++17-lang localbase
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	facebook
+GH_PROJECT=	rocksdb
+
+USE_JAVA=	yes
+JAVA_BUILD=	yes
+JAVA_RUN=	yes
+JAVA_VERSION=	21
+
+WRKSRC_SUBDIR=	java
+
+CMAKE_ARGS=	-DCMAKE_PROJECT_VERSION=${DISTVERSION} \
+		-DJAVA_INCLUDE_PATH=${JAVA_HOME}/include
+
+CXXFLAGS+=	-I${WRKSRC}/.. \
+		-DOS_FREEBSD \
+		-DROCKSDB_PLATFORM_POSIX
+
+#MAKE_ENV+=	JAVA_HOME=${JAVA_HOME}
+BINARY_ALIAS=	java=${JAVA_HOME}/bin/java
+
+PLIST_FILES=	${JAVAJARDIR}/rocksdb-${PORTVERSION}.jar \
+		${JAVAJARDIR}/rocksdbjni-${PORTVERSION}-javadoc.jar \
+		${JAVAJARDIR}/rocksdbjni-${PORTVERSION}-sources.jar \
+		${JAVAJARDIR}/rocksdbjni_classes.jar \
+		${JAVAJARDIR}/rocksdbjni_test_classes.jar
+
+post-extract:
+	@${MKDIR} ${WRKSRC}/test-libs && \
+		${RLN} ${DISTDIR}/assertj-core-2.9.0.jar ${WRKSRC}/test-libs && \
+		${RLN} ${DISTDIR}/cglib-3.3.0.jar ${WRKSRC}/test-libs && \
+		${RLN} ${DISTDIR}/hamcrest-2.2.jar ${WRKSRC}/test-libs && \
+		${RLN} ${DISTDIR}/junit-4.13.1.jar ${WRKSRC}/test-libs && \
+		${RLN} ${DISTDIR}/mockito-all-1.10.19.jar ${WRKSRC}/test-libs
+
+do-install:
+	${INSTALL_DATA} ${BUILD_WRKSRC}/rocksdb-${PORTVERSION}.jar ${STAGEDIR}${JAVAJARDIR}
+	${INSTALL_DATA} ${BUILD_WRKSRC}/rocksdbjni-${PORTVERSION}-sources.jar ${STAGEDIR}${JAVAJARDIR}
+	${INSTALL_DATA} ${BUILD_WRKSRC}/rocksdbjni-${PORTVERSION}-javadoc.jar ${STAGEDIR}${JAVAJARDIR}
+	${INSTALL_DATA} ${BUILD_WRKSRC}/rocksdbjni_classes.jar ${STAGEDIR}${JAVAJARDIR}
+	${INSTALL_DATA} ${BUILD_WRKSRC}/rocksdbjni_test_classes.jar ${STAGEDIR}${JAVAJARDIR}
+
+.include <bsd.port.mk>
diff --git a/databases/rocksdb-jni/distinfo b/databases/rocksdb-jni/distinfo
new file mode 100644
index 000000000000..ce27ed5e0b02
--- /dev/null
+++ b/databases/rocksdb-jni/distinfo
@@ -0,0 +1,13 @@
+TIMESTAMP = 1728066229
+SHA256 (assertj-core-2.9.0.jar) = 5e88ea3ecbe3c48aa1346fec76c84979fa9c8d22499f11479011691230e8babf
+SIZE (assertj-core-2.9.0.jar) = 1096630
+SHA256 (cglib-3.3.0.jar) = 9fe0c26d7464140ccdfe019ac687be1fb906122b508ab54beb810db0f09a9212
+SIZE (cglib-3.3.0.jar) = 306864
+SHA256 (hamcrest-2.2.jar) = 5e62846a89f05cd78cd9c1a553f340d002458380c320455dd1f8fc5497a8a1c1
+SIZE (hamcrest-2.2.jar) = 123360
+SHA256 (junit-4.13.1.jar) = c30719db974d6452793fe191b3638a5777005485bae145924044530ffa5f6122
+SIZE (junit-4.13.1.jar) = 382708
+SHA256 (mockito-all-1.10.19.jar) = d1a7a7ef14b3db5c0fc3e0a63a81b374b510afe85add9f7984b97911f4c70605
+SIZE (mockito-all-1.10.19.jar) = 1234599
+SHA256 (facebook-rocksdb-v9.6.1_GH0.tar.gz) = 98cf497c1d6d0a927142d2002a0b6b4816a0998c74fda9ae7b1bdaf6b784e895
+SIZE (facebook-rocksdb-v9.6.1_GH0.tar.gz) = 13589860
diff --git a/databases/rocksdb-jni/files/patch-CMakeLists.txt b/databases/rocksdb-jni/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..c75e2ddd194a
--- /dev/null
+++ b/databases/rocksdb-jni/files/patch-CMakeLists.txt
@@ -0,0 +1,52 @@
+--- CMakeLists.txt.orig	2024-08-27 20:39:35 UTC
++++ CMakeLists.txt
+@@ -542,9 +542,9 @@ include_directories(${JNI_INCLUDE_DIRS})
+ find_package(JNI)
+ 
+ include_directories(${JNI_INCLUDE_DIRS})
+-include_directories(${PROJECT_SOURCE_DIR}/java)
++include_directories(${PROJECT_SOURCE_DIR})
+ 
+-set(JAVA_TEST_LIBDIR ${PROJECT_SOURCE_DIR}/java/test-libs)
++set(JAVA_TEST_LIBDIR ${PROJECT_SOURCE_DIR}/test-libs)
+ set(JAVA_TMP_JAR ${JAVA_TEST_LIBDIR}/tmp.jar)
+ set(JAVA_JUNIT_JAR ${JAVA_TEST_LIBDIR}/junit-${JAVA_JUNIT_VERSION}.jar)
+ set(JAVA_HAMCR_JAR ${JAVA_TEST_LIBDIR}/hamcrest-${JAVA_HAMCR_VERSION}.jar)
+@@ -561,7 +561,7 @@ endif()
+   set(JAVA_RUN_TESTCLASSPATH ${JAVA_JUNIT_JAR}:${JAVA_HAMCR_JAR}:${JAVA_MOCKITO_JAR}:${JAVA_CGLIB_JAR}:${JAVA_ASSERTJ_JAR})
+ endif()
+ 
+-set(JNI_OUTPUT_DIR ${PROJECT_SOURCE_DIR}/java/include)
++set(JNI_OUTPUT_DIR ${PROJECT_SOURCE_DIR}/include)
+ file(MAKE_DIRECTORY ${JNI_OUTPUT_DIR})
+ 
+ if(${Java_VERSION_MINOR} VERSION_LESS_EQUAL "7" AND ${Java_VERSION_MAJOR} STREQUAL "1")
+@@ -602,8 +602,8 @@ add_jar(
+     GENERATE_NATIVE_HEADERS rocksdbjni_test_headers DESTINATION ${JNI_OUTPUT_DIR}
+ )
+ 
+-if(NOT EXISTS ${PROJECT_SOURCE_DIR}/java/classes)
+-  file(MAKE_DIRECTORY ${PROJECT_SOURCE_DIR}/java/classes)
++if(NOT EXISTS ${PROJECT_SOURCE_DIR}/classes)
++  file(MAKE_DIRECTORY ${PROJECT_SOURCE_DIR}/classes)
+ endif()
+ 
+ if(NOT EXISTS ${JAVA_TEST_LIBDIR})
+@@ -817,7 +817,7 @@ create_javadoc(rocksdb
+ set(ROCKSDB_JAVADOC_JAR rocksdbjni-${CMAKE_PROJECT_VERSION}-javadoc.jar)
+ create_javadoc(rocksdb
+         PACKAGES org.rocksdb org.rocksdb.util
+-        SOURCEPATH "${PROJECT_SOURCE_DIR}/java/src/main/java"
++        SOURCEPATH "${PROJECT_SOURCE_DIR}/src/main/java"
+         WINDOWTITLE "RocksDB Java API JavaDoc"
+         AUTHOR FALSE
+         USE FALSE
+@@ -833,7 +833,7 @@ add_custom_target(rocksdb_sources_jar ALL
+ # Sources Jar
+ set(ROCKSDB_SOURCES_JAR rocksdbjni-${CMAKE_PROJECT_VERSION}-sources.jar)
+ add_custom_target(rocksdb_sources_jar ALL
+-        ${Java_JAR_EXECUTABLE} cvf ${CMAKE_CURRENT_BINARY_DIR}/${ROCKSDB_SOURCES_JAR} -C ${PROJECT_SOURCE_DIR}/java/src/main/java/ .
++        ${Java_JAR_EXECUTABLE} cvf ${CMAKE_CURRENT_BINARY_DIR}/${ROCKSDB_SOURCES_JAR} -C ${PROJECT_SOURCE_DIR}/src/main/java/ .
+         BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/${ROCKSDB_SOURCES_JAR}
+         WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ )
diff --git a/databases/rocksdb-jni/pkg-descr b/databases/rocksdb-jni/pkg-descr
new file mode 100644
index 000000000000..81849ad193c7
--- /dev/null
+++ b/databases/rocksdb-jni/pkg-descr
@@ -0,0 +1,7 @@
+RocksDB is an embeddable persistent key-value store for fast storage. RocksDB
+can also be the foundation for a client-server database but our current focus is
+on embedded workloads.
+
+RocksDB builds on LevelDB to be scalable to run on servers with many CPU cores,
+to efficiently use fast storage, to support IO-bound, in-memory and write-once
+workloads, and to be flexible to allow for innovation.