diff --git a/.gitignore b/.gitignore
index c9ef048..483e7a6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,4 @@ jna-3.2.7.tar.bz2
/jna-4.0.0.tar.gz
/jna-4.1.0.tar.gz
/jna-4.1.0-clean.tar.xz
+/jna-4.2.0-clean.tar.xz
diff --git a/generate-tarball.sh b/generate-tarball.sh
index 45cbffd..511bc4d 100755
--- a/generate-tarball.sh
+++ b/generate-tarball.sh
@@ -4,10 +4,10 @@ set -e
version=`grep Version: *spec | sed -e 's/Version:\s*\(.*\)/\1/'`
-wget https://github.com/twall/jna/tarball/${version} -O jna-${version}.tar.gz
+wget https://github.com/java-native-access/jna/archive/${version}.tar.gz -O jna-${version}.tar.gz
rm -rf jna-${version}
tar xf jna-${version}.tar.gz
-mv twall-jna-* jna-${version}
+#mv twall-jna-* jna-${version}
# remove bundled things with unknown licensing
rm -rvf jna-${version}/{dist/*,www,native/libffi}
# jars in lib/native subdir need to be present in tarball so
diff --git a/jna-4.0.0-ffi.patch b/jna-4.0.0-ffi.patch
deleted file mode 100644
index 05457f0..0000000
--- a/jna-4.0.0-ffi.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -up ./native/callback.c.ffi ./native/callback.c
---- ./native/callback.c.ffi 2013-07-15 14:41:13.643452439 +0200
-+++ ./native/callback.c 2013-07-15 14:47:23.254830318 +0200
-@@ -253,7 +253,7 @@ create_callback(JNIEnv* env, jobject obj
- case 'D': cb->fptr_offset = OFFSETOF(env, CallDoubleMethod); break;
- default: cb->fptr_offset = OFFSETOF(env, CallObjectMethod); break;
- }
-- status = ffi_prep_cif_var(&cb->java_cif, java_abi, 2, argc+3, java_ffi_rtype, cb->java_arg_types);
-+ status = ffi_prep_cif(&cb->java_cif, java_abi, argc+3, java_ffi_rtype, cb->java_arg_types);
- if (!ffi_error(env, "callback setup (2)", status)) {
- ffi_prep_closure_loc(cb->closure, &cb->cif, callback_dispatch, cb,
- cb->x_closure);
diff --git a/jna-4.0.0-fix-native-test.patch b/jna-4.0.0-fix-native-test.patch
deleted file mode 100644
index bf639a2..0000000
--- a/jna-4.0.0-fix-native-test.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/test/com/sun/jna/NativeTest.java b/test/com/sun/jna/NativeTest.java
-index a946ca8..b71c9ec 100644
---- a/test/com/sun/jna/NativeTest.java
-+++ b/test/com/sun/jna/NativeTest.java
-@@ -410,7 +410,7 @@ public class NativeTest extends TestCase {
- for (int i=0;i < args.length;i++) {
- System.out.println("Running tests on class " + args[i]);
- try {
-- junit.textui.TestRunner.run(Class.forName(args[i]));
-+ junit.textui.TestRunner.run((Class) Class.forName(args[i]));
- }
- catch(Throwable e) {
- e.printStackTrace();
diff --git a/jna-4.0.0-loadlibrary.patch b/jna-4.2.0-loadlibrary.patch
similarity index 74%
rename from jna-4.0.0-loadlibrary.patch
rename to jna-4.2.0-loadlibrary.patch
index 540adf0..b9ac93a 100644
--- a/jna-4.0.0-loadlibrary.patch
+++ b/jna-4.2.0-loadlibrary.patch
@@ -1,6 +1,7 @@
---- jna-4.1.0/src/com/sun/jna/Native.java.loadlib 2014-03-06 17:06:40.000000000 +0100
-+++ jna-4.1.0/src/com/sun/jna/Native.java 2015-06-11 09:38:51.017572762 +0200
-@@ -642,102 +642,12 @@
+diff -up jna-4.2.0/src/com/sun/jna/Native.java.loadlib jna-4.2.0/src/com/sun/jna/Native.java
+--- jna-4.2.0/src/com/sun/jna/Native.java.loadlib 2015-09-15 00:31:20.000000000 +0200
++++ jna-4.2.0/src/com/sun/jna/Native.java 2015-09-15 14:25:23.631580142 +0200
+@@ -732,102 +732,12 @@ public final class Native implements Ver
/**
* Loads the JNA stub library.
@@ -29,20 +30,20 @@
- String dir = dirs.nextToken();
- File file = new File(new File(dir), System.mapLibraryName(libName).replace(".dylib", ".jnilib"));
- String path = file.getAbsolutePath();
-- if (DEBUG_JNA_LOAD) {
-- System.out.println("Looking in " + path);
-- }
+- if (DEBUG_JNA_LOAD) {
+- System.out.println("Looking in " + path);
+- }
- if (file.exists()) {
- try {
-- if (DEBUG_JNA_LOAD) {
-- System.out.println("Trying " + path);
-- }
+- if (DEBUG_JNA_LOAD) {
+- System.out.println("Trying " + path);
+- }
- System.setProperty("jnidispatch.path", path);
- System.load(path);
- jnidispatchPath = path;
-- if (DEBUG_JNA_LOAD) {
-- System.out.println("Found jnidispatch at " + path);
-- }
+- if (DEBUG_JNA_LOAD) {
+- System.out.println("Found jnidispatch at " + path);
+- }
- return;
- } catch (UnsatisfiedLinkError ex) {
- // Not a problem if already loaded in anoteher class loader
@@ -60,14 +61,14 @@
- ext = "dylib";
- }
- path = path.substring(0, path.lastIndexOf(orig)) + ext;
-- if (DEBUG_JNA_LOAD) {
-- System.out.println("Looking in " + path);
-- }
+- if (DEBUG_JNA_LOAD) {
+- System.out.println("Looking in " + path);
+- }
- if (new File(path).exists()) {
- try {
-- if (DEBUG_JNA_LOAD) {
-- System.out.println("Trying " + path);
-- }
+- if (DEBUG_JNA_LOAD) {
+- System.out.println("Trying " + path);
+- }
- System.setProperty("jnidispatch.path", path);
- System.load(path);
- jnidispatchPath = path;
@@ -84,9 +85,9 @@
- }
- if (!Boolean.getBoolean("jna.nosys")) {
- try {
-- if (DEBUG_JNA_LOAD) {
-- System.out.println("Trying (via loadLibrary) " + libName);
-- }
+- if (DEBUG_JNA_LOAD) {
+- System.out.println("Trying (via loadLibrary) " + libName);
+- }
- System.loadLibrary(libName);
- if (DEBUG_JNA_LOAD) {
- System.out.println("Found jnidispatch on system path");
@@ -102,8 +103,8 @@
- else {
- throw new UnsatisfiedLinkError("Unable to locate JNA native support library");
- }
-+ jnidispatchPath = "@LIBDIR@/" + System.mapLibraryName("jnidispatch");
-+ System.load(jnidispatchPath);
++ jnidispatchPath = "@LIBDIR@/" + System.mapLibraryName("jnidispatch");
++ System.load(jnidispatchPath);
}
static final String JNA_TMPLIB_PREFIX = "jna";
diff --git a/jna.spec b/jna.spec
index 1af0050..ab049c5 100644
--- a/jna.spec
+++ b/jna.spec
@@ -1,12 +1,12 @@
Name: jna
-Version: 4.1.0
-Release: 9%{?dist}
+Version: 4.2.0
+Release: 1%{?dist}
Summary: Pure Java access to native libraries
# Most of code is dual-licensed under either LGPL 2.1 only or Apache
# License 2.0. WeakIdentityHashMap.java was taken from Apache CXF,
# which is pure Apache License 2.0.
License: (LGPLv2 or ASL 2.0) and ASL 2.0
-URL: https://github.com/twall/jna
+URL: https://github.com/java-native-access/jna/
# ./generate-tarball.sh
Source0: %{name}-%{version}-clean.tar.xz
Source1: package-list
@@ -14,21 +14,26 @@ Source2: generate-tarball.sh
Patch0: jna-3.5.0-build.patch
# This patch is Fedora-specific for now until we get the huge
# JNI library location mess sorted upstream
-Patch1: jna-4.0.0-loadlibrary.patch
+Patch1: jna-4.2.0-loadlibrary.patch
# The X11 tests currently segfault; overall I think the X11 JNA stuff is just a
# Really Bad Idea, for relying on AWT internals, using the X11 API at all,
# and using a complex API like X11 through JNA just increases the potential
# for problems.
Patch2: jna-4.0.0-tests-headless.patch
-Patch6: jna-4.0.0-ffi.patch
-Patch7: jna-4.0.0-fix-native-test.patch
+# junit cames from rpm
+Patch4: jna-4.1.0-junit.patch
# We manually require libffi because find-requires doesn't work
# inside jars.
Requires: java, jpackage-utils, libffi
BuildRequires: java-devel, jpackage-utils, libffi-devel
-BuildRequires: ant, ant-junit, junit, reflections
-BuildRequires: libX11-devel, libXt-devel
+BuildRequires: ant, ant-junit, junit
+%if 0%{?fedora}
+BuildRequires: reflections
+%endif
+%if 0%{?rhel} && 0%{?rhel} < 7
+BuildRequires: ant-nodeps, ant-trax
+%endif
%description
@@ -42,7 +47,10 @@ of use take priority.
%package javadoc
Summary: Javadocs for %{name}
+Group: Documentation
+%if 0%{?fedora} || 0%{?rhel} > 5
BuildArch: noarch
+%endif
%description javadoc
@@ -52,8 +60,10 @@ This package contains the javadocs for %{name}.
%package contrib
Summary: Contrib for %{name}
License: LGPLv2 or ASL 2.0
-BuildArch: noarch
Requires: %{name} = %{version}-%{release}
+%if 0%{?fedora} || 0%{?rhel} > 5
+BuildArch: noarch
+%endif
%description contrib
@@ -66,8 +76,6 @@ cp %{SOURCE1} .
%patch0 -p1 -b .build
%patch1 -p1 -b .loadlib
%patch2 -p1 -b .tests-headless
-%patch6 -p1 -b .ffi
-%patch7 -p1
chmod -Rf a+rX,u+w,g-w,o-w .
sed -i 's|@LIBDIR@|%{_libdir}/%{name}|' src/com/sun/jna/Native.java
@@ -77,11 +85,17 @@ sed -i 's/\r//' LICENSE
chmod -c 0644 LICENSE OTHERS CHANGES.md
+%if 0%{?rhel}
+%patch4 -p1 -b .junit
+build-jar-repository -s -p lib junit
+%else
sed s,',&,' -i build.xml
-
build-jar-repository -s -p lib junit reflections
+%endif
+
cp lib/native/aix-ppc64.jar lib/clover.jar
+
%build
# We pass -Ddynlink.native which comes from our patch because
# upstream doesn't want to default to dynamic linking.
@@ -106,16 +120,26 @@ install -Dm 644 pom-%{name}.xml %{buildroot}%{_mavenpomdir}/JPP-%{name}.pom
install -Dm 644 pom-%{name}-platform.xml %{buildroot}%{_mavenpomdir}/JPP.%{name}-%{name}-platform.pom
# ... and maven depmap
+%if 0%{?fedora} >= 9 || 0%{?rhel} > 6
%add_maven_depmap JPP-%{name}.pom %{name}.jar
%add_maven_depmap JPP.%{name}-%{name}-platform.pom -f platform %{name}/%{name}-platform.jar -a "net.java.dev.jna:platform"
+%else
+%add_to_maven_depmap net.java.dev.jna jna-platform %{version} JPP jna-platform
+mv %{buildroot}%{_mavendepmapfragdir}/%{name} %{buildroot}%{_mavendepmapfragdir}/%{name}-platform
+%add_to_maven_depmap net.java.dev.jna %{name} %{version} JPP %{name}
+%endif
# javadocs
install -p -d -m 755 %{buildroot}%{_javadocdir}/%{name}
cp -a doc/javadoc/* %{buildroot}%{_javadocdir}/%{name}
-#%check
+#if 0%{?rhel} >= 6 || 0%{?fedora} >= 9
+#ifnarch ppc s390 s390x
+#check
#ant -Dcflags_extra.native="%{optflags}" -Ddynlink.native=true -Dnomixedjar.native=true test
+#endif
+#endif
%files -f .mfiles
diff --git a/sources b/sources
index 5ebcd67..59148f4 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-a2a3f08c2fc34ca05a1f55480ce0a9bd jna-4.1.0-clean.tar.xz
+a8fe8994ec974b63faa08f1211b25b42 jna-4.2.0-clean.tar.xz