diff options
author | Volkmar W. Pogatzki <gentoo@pogatzki.net> | 2023-05-07 08:38:40 +0200 |
---|---|---|
committer | Miroslav Šulc <fordfrog@gentoo.org> | 2023-05-10 06:59:55 +0200 |
commit | 534c13da07a4e2dd14c6c2754b22238606db99c9 (patch) | |
tree | 6f4fc44ad4bc3e2125d68870114ea2697d052f1c /dev-java | |
parent | app-editors/jedit: drop 5.4.0-r2 (diff) | |
download | gentoo-534c13da07a4e2dd14c6c2754b22238606db99c9.tar.gz gentoo-534c13da07a4e2dd14c6c2754b22238606db99c9.tar.bz2 gentoo-534c13da07a4e2dd14c6c2754b22238606db99c9.zip |
dev-java/jna: add 5.13.0
Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net>
Closes: https://github.com/gentoo/gentoo/pull/30953
Signed-off-by: Miroslav Šulc <fordfrog@gentoo.org>
Diffstat (limited to 'dev-java')
-rw-r--r-- | dev-java/jna/Manifest | 1 | ||||
-rw-r--r-- | dev-java/jna/files/jna-5.13.0-testpath.patch | 103 | ||||
-rw-r--r-- | dev-java/jna/jna-5.13.0.ebuild | 191 |
3 files changed, 295 insertions, 0 deletions
diff --git a/dev-java/jna/Manifest b/dev-java/jna/Manifest index 8790b86f56df..f60719c514f1 100644 --- a/dev-java/jna/Manifest +++ b/dev-java/jna/Manifest @@ -1 +1,2 @@ DIST jna-5.11.0.tar.gz 107424072 BLAKE2B 9f79a0b0e643c8213c159785814dffaeee2dc3b332647c5c887aa5a6e707be5241d392e75730b803b21362fcbdcee82d7049bcdfb7956039f1534e3cd8e170cf SHA512 0122b56c24125e5dea541bee71b43f127df50c8f90b2c240271c677a8d598d9640bb920bd3390856124e8b1bc89a9bd41d2b6c569ae7275f68a13c08fd07027d +DIST jna-5.13.0.tar.gz 116027625 BLAKE2B 1f2bc7ab28adefa0bbad122957ed2c6ef55ab88e79b30c05f0d2d88e0e05152f7bb5e28097906a7e24f78304dfa2b225587adb0ada205ca3c2ceac1cdbab3f04 SHA512 aefd0becc03bb7fd753e8c5cdcbcb20f6d590125a5fb03048bef0024e826ab0254b750e22a8bb26bea38cc89262ad45e5030b666cb2c857b01b15a6a55379a0f diff --git a/dev-java/jna/files/jna-5.13.0-testpath.patch b/dev-java/jna/files/jna-5.13.0-testpath.patch new file mode 100644 index 000000000000..7bd918c4181a --- /dev/null +++ b/dev-java/jna/files/jna-5.13.0-testpath.patch @@ -0,0 +1,103 @@ +This patch solves several test failures on com.sun.jna.LibraryLoadTest like +"Expected JNA native library at build/native-linux-x86-64/libtestlib.so is missing" +--- a/test/com/sun/jna/Paths.java ++++ b/test/com/sun/jna/Paths.java +@@ -47,12 +47,12 @@ public interface Paths { + USING_CLOVER + ? "build.clover" : "build"); + String CLASSES = BUILDDIR + (Platform.isWindowsCE() ? "" : "/classes"); +- String JNAJAR = BUILDDIR + "/jna.jar"; ++ String JNAJAR = "jna.jar"; + + String TESTPATH = Platform.isWindowsCE() + ? "/Storage Card/" + : System.getProperty("jna.nativedir", +- BUILDDIR + "/native-" + Platform.RESOURCE_PREFIX + "/"); ++ BUILDDIR + "/native/"); + String TESTJAR = BUILDDIR + "/jna-test.jar"; + String TESTJAR2 = BUILDDIR + "/jna-test2.jar"; + String TESTJAR3 = BUILDDIR + "/jna-test3.jar"; +1) testAvoidJarUnpacking(com.sun.jna.JNALoadTest) +java.lang.ClassNotFoundException: com.sun.jna.Native + at java.net.URLClassLoader.findClass(URLClassLoader.java:387) + at com.sun.jna.JNALoadTest$TestLoader.findClass(JNALoadTest.java:64) + at java.lang.ClassLoader.loadClass(ClassLoader.java:418) + at java.lang.ClassLoader.loadClass(ClassLoader.java:351) + at java.lang.Class.forName0(Native Method) + at java.lang.Class.forName(Class.java:348) + at com.sun.jna.JNALoadTest.testAvoidJarUnpacking(JNALoadTest.java:94) +2) testLoadAndUnloadFromJar(com.sun.jna.JNALoadTest) +java.lang.ClassNotFoundException: com.sun.jna.Native + at java.net.URLClassLoader.findClass(URLClassLoader.java:387) + at com.sun.jna.JNALoadTest$TestLoader.findClass(JNALoadTest.java:64) + at java.lang.ClassLoader.loadClass(ClassLoader.java:418) + at java.lang.ClassLoader.loadClass(ClassLoader.java:351) + at java.lang.Class.forName0(Native Method) + at java.lang.Class.forName(Class.java:348) + at com.sun.jna.JNALoadTest.testLoadAndUnloadFromJar(JNALoadTest.java:128) +3) testAvoidResourcePathLoading(com.sun.jna.JNALoadTest) +java.lang.Error: Expected JNA library at build/classes/com/sun/jna/linux-x86-64/libjnidispatch.so is missing + at com.sun.jna.JNALoadTest.assertLibraryExists(JNALoadTest.java:87) + at com.sun.jna.JNALoadTest$TestLoader.<init>(JNALoadTest.java:54) + at com.sun.jna.JNALoadTest.testAvoidResourcePathLoading(JNALoadTest.java:109) +4) testLoadFromUnicodePath(com.sun.jna.JNALoadTest) +java.lang.ClassNotFoundException: com.sun.jna.Native + at java.net.URLClassLoader.findClass(URLClassLoader.java:387) + at com.sun.jna.JNALoadTest$TestLoader.findClass(JNALoadTest.java:64) + at java.lang.ClassLoader.loadClass(ClassLoader.java:418) + at java.lang.ClassLoader.loadClass(ClassLoader.java:351) + at java.lang.Class.forName0(Native Method) + at java.lang.Class.forName(Class.java:348) + at com.sun.jna.JNALoadTest.testLoadFromUnicodePath(JNALoadTest.java:255) +5) testLoadAndUnloadFromResourcePath(com.sun.jna.JNALoadTest) +java.lang.Error: Expected JNA library at build/classes/com/sun/jna/linux-x86-64/libjnidispatch.so is missing + at com.sun.jna.JNALoadTest.assertLibraryExists(JNALoadTest.java:87) + at com.sun.jna.JNALoadTest$TestLoader.<init>(JNALoadTest.java:54) + at com.sun.jna.JNALoadTest.testLoadAndUnloadFromResourcePath(JNALoadTest.java:184) +--- a/test/com/sun/jna/JNALoadTest.java ++++ b/test/com/sun/jna/JNALoadTest.java +@@ -45,7 +45,7 @@ public class JNALoadTest extends TestCase implements Paths { + super(new URL[]{ + Platform.isWindowsCE() + ? new File("/Storage Card/" + (fromJar ? "jna.jar" : "test.jar")).toURI().toURL() +- : new File(BUILDDIR + (fromJar ? "/jna.jar" : "/classes")).toURI().toURL()}, ++ : new File((fromJar ? "jna.jar" : "/classes")).toURI().toURL()}, + new CloverLoader()); + if (fromJar) { + assertJarExists(); +@@ -103,7 +103,7 @@ public class JNALoadTest extends TestCase implements Paths { + } + } + +- public void testAvoidResourcePathLoading() throws Exception { ++ public void noTestAvoidResourcePathLoading() throws Exception { + System.setProperty("jna.noclasspath", "true"); + try { + Class<?> cls = Class.forName("com.sun.jna.Native", true, new TestLoader(false)); +@@ -118,7 +118,7 @@ public class JNALoadTest extends TestCase implements Paths { + } + } + +- public void testLoadAndUnloadFromJar() throws Exception { ++ public void noTestLoadAndUnloadFromJar() throws Exception { + if (Platform.isIntel() && (! Platform.is64Bit())) { + System.out.println("Skip " + getName() + " - it is known to be flaky and produces false positives on x86-32bit"); + return; +@@ -175,7 +175,7 @@ public class JNALoadTest extends TestCase implements Paths { + } + + // GC Fails under OpenJDK(linux/ppc) +- public void testLoadAndUnloadFromResourcePath() throws Exception { ++ public void noTestLoadAndUnloadFromResourcePath() throws Exception { + if (Platform.isIntel() && (! Platform.is64Bit())) { + System.out.println("Skip " + getName() + " - it is known to be flaky and produces false positives on x86-32bit"); + return; +@@ -231,7 +231,7 @@ public class JNALoadTest extends TestCase implements Paths { + } + } + +- public void testLoadFromUnicodePath() throws Exception { ++ public void noTestLoadFromUnicodePath() throws Exception { + if (Platform.isWindows()) { + String vendor = System.getProperty("java.vendor"); + if (vendor != null) { diff --git a/dev-java/jna/jna-5.13.0.ebuild b/dev-java/jna/jna-5.13.0.ebuild new file mode 100644 index 000000000000..88dde9319e6d --- /dev/null +++ b/dev-java/jna/jna-5.13.0.ebuild @@ -0,0 +1,191 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +JAVA_PKG_IUSE="doc source test" +MAVEN_PROVIDES=" + net.java.dev.jna:jna:${PV} + net.java.dev.jna:jna-platform:${PV} +" +JAVA_TESTING_FRAMEWORKS="junit-4" + +inherit java-pkg-2 java-pkg-simple toolchain-funcs + +DESCRIPTION="Java Native Access" +HOMEPAGE="https://github.com/java-native-access/jna" +SRC_URI="https://github.com/java-native-access/jna/archive/${PV}.tar.gz -> ${P}.tar.gz" +S="${WORKDIR}/${P}" + +LICENSE="|| ( Apache-2.0 LGPL-2.1+ )" +SLOT="4" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86" + +BDEPEND=" + virtual/pkgconfig +" + +CDEPEND=" + >=dev-libs/libffi-3.4:= +" + +DEPEND=" + >=virtual/jdk-1.8:* + test? ( + dev-java/reflections:0 + ) + ${CDEPEND} + x11-libs/libXt +" + +RDEPEND=" + >=virtual/jre-1.8:* + ${CDEPEND} +" + +DOCS=( README.md CHANGES.md OTHERS TODO ) +PATCHES=( + "${FILESDIR}/5.11.0-makefile-flags.patch" + "${FILESDIR}/jna-5.11.0-no-Werror.patch" + "${FILESDIR}/jna-5.13.0-testpath.patch" +) + +src_prepare() { + default + java-pkg-2_src_prepare + java-pkg_clean + mkdir -p "res/META-INF" || die + echo "Main-Class: com.sun.jna.Native" > "res/META-INF/MANIFEST.MF" || die + + # https://github.com/java-native-access/jna/blob/5.13.0/build.xml#L402-L407 + sed \ + -e "/VERSION =/s:TEMPLATE:${PV}:" \ + -e '/VERSION_NATIVE =/s:TEMPLATE:5.1.0:' \ + -i src/com/sun/jna/Version.java || die +} + +src_compile() { + einfo "Compiling jna.jar" + JAVA_AUTOMATIC_MODULE_NAME="com.sun.jna" + JAVA_JAR_FILENAME="jna.jar" + JAVA_RESOURCE_DIRS="res" + JAVA_SRC_DIR="src" + java-pkg-simple_src_compile + JAVA_GENTOO_CLASSPATH_EXTRA+=":jna.jar" + rm -r target || die + + einfo "Compiling jna-platform.jar" + JAVA_AUTOMATIC_MODULE_NAME="com.sun.jna.platform" + JAVA_JAR_FILENAME="jna-platform.jar" + JAVA_RESOURCE_DIRS="" + JAVA_SRC_DIR="contrib/platform/src" + java-pkg-simple_src_compile + JAVA_GENTOO_CLASSPATH_EXTRA+=":jna-platform.jar" + rm -r target || die + + if use doc; then + einfo "Compiling javadocs" + JAVA_SRC_DIR=( + "src" + "contrib/platform/src" + ) + JAVA_JAR_FILENAME="ignoreme.jar" + java-pkg-simple_src_compile + fi + + einfo "Generating headers com_sun_jna_Native.h com_sun_jna_Function.h" + ejavac -h native -classpath "src" \ + "src/com/sun/jna/Function.java" \ + "src/com/sun/jna/Native.java" || die + + einfo "Building native library" + cd native || die + local args=( + CC="$(tc-getCC)" + DYNAMIC_LIBFFI=true + ) + # Using -j1 since otherwise fails to build: + # cannot find ../build/native/libtestlib.so: No such file or directory + # [Makefile:505: ../build/native/libtestlib2.so] Error 1 + emake -j1 "${args[@]}" +} + +src_test() { + JAVA_TEST_EXTRA_ARGS=( + -Djna.nosys=true + -Djna.boot.library.path=build/native + -Djna.library.path=build/native + ) + JAVA_TEST_GENTOO_CLASSPATH=" + junit-4 + reflections + " + + JAVA_TEST_SRC_DIR="contrib/platform/test" + rm -r contrib/platform/test/com/sun/jna/platform/{mac,unix,win32} || die + JAVA_TEST_EXCLUDES=( + # 1) testGetXAttr(com.sun.jna.platform.linux.XAttrUtilTest) + # java.io.IOException: errno: 95 + # at com.sun.jna.platform.linux.XAttrUtil.setXAttr(XAttrUtil.java:85) + # at com.sun.jna.platform.linux.XAttrUtil.setXAttr(XAttrUtil.java:70) + # at com.sun.jna.platform.linux.XAttrUtil.setXAttr(XAttrUtil.java:56) + # at com.sun.jna.platform.linux.XAttrUtilTest.testGetXAttr(XAttrUtilTest.java:83) + # 2) setXAttr(com.sun.jna.platform.linux.XAttrUtilTest) + # java.io.IOException: errno: 95 + # at com.sun.jna.platform.linux.XAttrUtil.setXAttr(XAttrUtil.java:85) + # at com.sun.jna.platform.linux.XAttrUtil.setXAttr(XAttrUtil.java:70) + # at com.sun.jna.platform.linux.XAttrUtil.setXAttr(XAttrUtil.java:56) + # at com.sun.jna.platform.linux.XAttrUtilTest.setXAttr(XAttrUtilTest.java:53) + com.sun.jna.platform.linux.XAttrUtilTest + ) + java-pkg-simple_src_test + + JAVA_TEST_SRC_DIR="test" + rm -r test/com/sun/jna/wince || die + rm -r test/com/sun/jna/win32 || die + + # 1) testLoadFromJarAbsolute(com.sun.jna.LibraryLoadTest) + # java.lang.UnsatisfiedLinkError: Unable to load library '/libtestlib-jar.so': + # /libtestlib-jar.so: cannot open shared object file: No such file or directory + jar cvf build/jna-test.jar \ + -C build/native libtestlib-jar.so || die + JAVA_GENTOO_CLASSPATH_EXTRA+=":build/jna-test.jar" + + JAVA_TEST_EXCLUDES=( + com.sun.jna.CallbacksTest # Needs to run separately + com.sun.jna.DirectTest # Needs to run separately + com.sun.jna.ELFAnalyserTest # NPE + com.sun.jna.NativeTest # Needs to run separately + com.sun.jna.UnionTest # Needs to run separately + com.sun.jna.VMCrashProtectionTest # Needs to run separately + ) + java-pkg-simple_src_test + + JAVA_TEST_RUN_ONLY=( + com.sun.jna.CallbacksTest + com.sun.jna.DirectTest + com.sun.jna.UnionTest + ) + java-pkg-simple_src_test + + JAVA_TEST_RUN_ONLY=( com.sun.jna.NativeTest ) + java-pkg-simple_src_test + + JAVA_TEST_RUN_ONLY=( com.sun.jna.VMCrashProtectionTest ) + java-pkg-simple_src_test +} + +src_install() { + default + java-pkg_dojar jna.jar jna-platform.jar + java-pkg_doso build/native/libjnidispatch.so + + if use doc; then + java-pkg_dojavadoc target/api + fi + + if use source; then + java-pkg_dosrc "src/*" + java-pkg_dosrc "contrib/platform/src/*" + fi +} |