From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1521551-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 5359C15806E
	for <garchives@archives.gentoo.org>; Fri, 26 May 2023 08:36:30 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 393B4E0845;
	Fri, 26 May 2023 08:36:29 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 1ADF0E0845
	for <gentoo-commits@lists.gentoo.org>; Fri, 26 May 2023 08:36:29 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id E509133BDF0
	for <gentoo-commits@lists.gentoo.org>; Fri, 26 May 2023 08:36:27 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 45F73A6C
	for <gentoo-commits@lists.gentoo.org>; Fri, 26 May 2023 08:36:26 +0000 (UTC)
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" <sam@gentoo.org>
Message-ID: <1685089686.cf214682cf6f27a30d12877ecb98c8e9e4255ff0.sam@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-libs/gdal/
X-VCS-Repository: repo/gentoo
X-VCS-Files: sci-libs/gdal/gdal-3.7.0.ebuild
X-VCS-Directories: sci-libs/gdal/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: cf214682cf6f27a30d12877ecb98c8e9e4255ff0
X-VCS-Branch: master
Date: Fri, 26 May 2023 08:36:26 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 472e5937-985d-4478-a83b-7d5381c8cf38
X-Archives-Hash: 254220f317f0eb1be6ec43275e555f67

commit:     cf214682cf6f27a30d12877ecb98c8e9e4255ff0
Author:     Bryan Gardiner <bog <AT> khumba <DOT> net>
AuthorDate: Fri May 26 04:47:39 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri May 26 08:28:06 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cf214682

sci-libs/gdal: fix the build of the Java bindings

GDAL uses FindJNI.cmake which is unable to find a Java VM on its own.
This change passes in the system VM symlink explicitly, and also
installs the JNI shared library in the proper location for Gentoo via
'java-pkg_doso', rather than in the same directory as the JAR.

Bug: https://bugs.gentoo.org/857816
Signed-off-by: Bryan Gardiner <bog <AT> khumba.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sci-libs/gdal/gdal-3.7.0.ebuild | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/sci-libs/gdal/gdal-3.7.0.ebuild b/sci-libs/gdal/gdal-3.7.0.ebuild
index 7015e10d415d..81842eb4e7bf 100644
--- a/sci-libs/gdal/gdal-3.7.0.ebuild
+++ b/sci-libs/gdal/gdal-3.7.0.ebuild
@@ -212,6 +212,9 @@ src_configure() {
 		# Bindings
 		-DBUILD_PYTHON_BINDINGS=$(usex python)
 		-DBUILD_JAVA_BINDINGS=$(usex java)
+		$(usex java -DJAVA_AWT_LIBRARY=/etc/java-config-2/current-system-vm/lib '')
+		$(usex java -DJAVA_JVM_LIBRARY=/etc/java-config-2/current-system-vm/lib '')
+		$(usex java -DJAVA_INCLUDE_PATH=/etc/java-config-2/current-system-vm/include '')
 		# bug #845369
 		-DBUILD_CSHARP_BINDINGS=OFF
 
@@ -260,10 +263,25 @@ src_test() {
 src_install() {
 	cmake_src_install
 	use python && python_optimize
+
+	if use java; then
+		# Move the native library into the proper place for Gentoo.  The
+		# library in ${D} has already had its RPATH fixed, so we use it
+		# rather than ${BUILD_DIR}/swig/java/libgdalalljni.so.
+		java-pkg_doso "${D}/usr/share/java/libgdalalljni.so"
+		rm "${D}/usr/share/java/libgdalalljni.so" || die
+	fi
+
 	# TODO: install docs?
 }
 
 pkg_postinst() {
 	elog "Check available image and data formats after building with"
 	elog "gdalinfo and ogrinfo (using the --formats switch)."
+
+	if use java; then
+		elog
+		elog "To use the Java bindings, you need to pass the following to java:"
+		elog "    -Djava.library.path=$(java-config -i gdal)"
+	fi
 }