git: 592a706ae9a8 - main - databases/rocksdb-jni: Link with librocksdb.so at run-time; Add librocksdbjni-freebsd64.so symlink

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Sat, 05 Oct 2024 03:09:32 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=592a706ae9a83b7aee91f0867a4ba70fa9575515

commit 592a706ae9a83b7aee91f0867a4ba70fa9575515
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2024-10-05 00:12:51 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2024-10-05 03:09:25 +0000

    databases/rocksdb-jni: Link with librocksdb.so at run-time; Add librocksdbjni-freebsd64.so symlink
    
    librocksdbjni-freebsd64.so is expected by at least Apache Pulse.
---
 databases/rocksdb-jni/Makefile                   |  8 +++++---
 databases/rocksdb-jni/files/patch-CMakeLists.txt | 15 +++++++++++++++
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/databases/rocksdb-jni/Makefile b/databases/rocksdb-jni/Makefile
index 7ca22cffada1..53f7cc7f0bd9 100644
--- a/databases/rocksdb-jni/Makefile
+++ b/databases/rocksdb-jni/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	rocksdb-jni
 DISTVERSIONPREFIX=	v
 DISTVERSION=	9.6.1
+PORTREVISION=	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 \
@@ -19,10 +20,10 @@ LICENSE_COMB=	dual
 LICENSE_FILE_APACHE20=	${WRKSRC}/../LICENSE.Apache
 LICENSE_FILE_GPLv2=	${WRKSRC}/../COPYING
 
-BUILD_DEPENDS=	rocksdb>0:databases/rocksdb \
-		googletest>0:devel/googletest
+BUILD_DEPENDS=	googletest>0:devel/googletest
+LIB_DEPENDS=	librocksdb.so:databases/rocksdb # librocksdbjni.so in the rocksdb.jar file is linked to librocksdb.so
 
-USES=		cmake compiler:c++17-lang localbase
+USES=		cmake compiler:c++17-lang localbase:ldflags
 
 USE_GITHUB=	yes
 GH_ACCOUNT=	facebook
@@ -41,6 +42,7 @@ CMAKE_ARGS=	-DCMAKE_PROJECT_VERSION=${DISTVERSION} \
 CXXFLAGS+=	-I${WRKSRC}/.. \
 		-DOS_FREEBSD \
 		-DROCKSDB_PLATFORM_POSIX
+LDFLAGS+=	-lrocksdb
 
 #MAKE_ENV+=	JAVA_HOME=${JAVA_HOME}
 BINARY_ALIAS=	java=${JAVA_HOME}/bin/java
diff --git a/databases/rocksdb-jni/files/patch-CMakeLists.txt b/databases/rocksdb-jni/files/patch-CMakeLists.txt
index c75e2ddd194a..d75b2084b004 100644
--- a/databases/rocksdb-jni/files/patch-CMakeLists.txt
+++ b/databases/rocksdb-jni/files/patch-CMakeLists.txt
@@ -1,3 +1,7 @@
+- this patch performs 2 functions:
+- 1. remove java/ from the PROJECT_SOURCE_DIR path
+- 2. add librocksdbjni-freebsd64.so symlink needed to run some dependencies
+
 --- CMakeLists.txt.orig	2024-08-27 20:39:35 UTC
 +++ CMakeLists.txt
 @@ -542,9 +542,9 @@ include_directories(${JNI_INCLUDE_DIRS})
@@ -50,3 +54,14 @@
          BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/${ROCKSDB_SOURCES_JAR}
          WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
  )
+@@ -877,8 +877,10 @@ add_custom_target(rocksdbjava ALL
+ 
+ add_custom_target(rocksdbjava ALL
+         COMMAND ${CMAKE_COMMAND} -E copy ${ROCKS_JAR_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${ROCKSDB_JAR}
++	COMMAND ln -s librocksdbjni.so librocksdbjni-freebsd64.so
+         COMMAND ${Java_JAR_EXECUTABLE} -uf ${CMAKE_CURRENT_BINARY_DIR}/${ROCKSDB_JAR} -C $<TARGET_FILE_DIR:${ROCKSDBJNI_STATIC_LIB}> $<TARGET_FILE_NAME:${ROCKSDBJNI_STATIC_LIB}>
+         COMMAND ${Java_JAR_EXECUTABLE} -uf ${CMAKE_CURRENT_BINARY_DIR}/${ROCKSDB_JAR} -C ${CMAKE_CURRENT_SOURCE_DIR} HISTORY-JAVA.md
++        COMMAND ${Java_JAR_EXECUTABLE} -uf ${CMAKE_CURRENT_BINARY_DIR}/${ROCKSDB_JAR} -C $<TARGET_FILE_DIR:${ROCKSDBJNI_STATIC_LIB}> librocksdbjni-freebsd64.so
+         DEPENDS ${ROCKSDBJNI_STATIC_LIB} rocksdbjni_classes
+         BYPRODUCTS ${ROCKSDB_JAR}
+         WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}