diff --git a/generate-tarball-rhel.sh b/generate-tarball-rhel.sh
new file mode 100755
index 0000000..18d3aef
--- /dev/null
+++ b/generate-tarball-rhel.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+set -e
+
+version=`grep Version: *spec | sed -e 's/Version:\s*\(.*\)/\1/'`
+
+
+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}
+# 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
+# that final jar can be built. They can be empty and then have no
+# effect on resulting jar. One jar (depending on architecture) will
+# be replaced with full content (containing libjnidispatch.so)
+for njar in jna-${version}/lib/native/*.jar; do
+ rm -v $njar
+ touch empty
+ jar cf $njar empty
+ rm -f empty
+done
+
+find jna-${version} -iname '*jar' ! -iname 'reflections*.jar' -size +1b -delete
+find jna-${version} -name '*.class' -delete
+
+tar cf jna-${version}-clean.tar jna-${version}
+xz -9 jna-${version}-clean.tar
diff --git a/jna-4.1.0-junit.patch b/jna-4.1.0-junit.patch
deleted file mode 100644
index adeae5c..0000000
--- a/jna-4.1.0-junit.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-diff -up ./build.xml.junit ./build.xml
---- ./build.xml.junit 2014-03-07 12:52:05.899899902 +0100
-+++ ./build.xml 2014-03-07 12:58:14.956255306 +0100
-@@ -290,7 +290,7 @@
-
-
-
--
-+
-
-
-
-@@ -486,7 +486,7 @@ osname=macosx;processor=x86;processor=x8
-
-
-
--
-+
-
-
-
-@@ -509,7 +509,7 @@ osname=macosx;processor=x86;processor=x8
-
-
-
--
-+
-
-
-
-@@ -822,7 +822,7 @@ osname=macosx;processor=x86;processor=x8
-
-
-
--
-+
-
-
-
-@@ -933,7 +933,7 @@ osname=macosx;processor=x86;processor=x8
-
-
-
--
-+
-
-
-
diff --git a/jna.spec b/jna.spec
index 965f5ee..3725079 100644
--- a/jna.spec
+++ b/jna.spec
@@ -1,6 +1,6 @@
Name: jna
Version: 4.2.0
-Release: 1%{?dist}
+Release: 2%{?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,
@@ -10,7 +10,11 @@ URL: https://github.com/java-native-access/jna/
# ./generate-tarball.sh
Source0: %{name}-%{version}-clean.tar.xz
Source1: package-list
+%if 0%{?fedora}
Source2: generate-tarball.sh
+%else
+Source2: generate-tarball-rhel.sh
+%endif
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
@@ -20,8 +24,6 @@ Patch1: jna-4.2.0-loadlibrary.patch
# and using a complex API like X11 through JNA just increases the potential
# for problems.
Patch2: jna-4.0.0-tests-headless.patch
-# junit cames from rpm
-Patch4: jna-4.1.0-junit.patch
# We manually require libffi because find-requires doesn't work
# inside jars.
@@ -32,6 +34,7 @@ BuildRequires: libX11-devel, libXt-devel
%if 0%{?fedora}
BuildRequires: reflections
%endif
+# no
%if 0%{?rhel} && 0%{?rhel} < 7
BuildRequires: ant-nodeps, ant-trax
%endif
@@ -87,7 +90,7 @@ sed -i 's/\r//' LICENSE
chmod -c 0644 LICENSE OTHERS CHANGES.md
%if 0%{?rhel}
-%patch4 -p1 -b .junit
+sed s,',&,' -i build.xml
build-jar-repository -s -p lib junit
%else
sed s,',&,' -i build.xml
@@ -116,18 +119,14 @@ find contrib -name '*.jar' -exec cp {} %{buildroot}%{_javadir}/%{name}/ \;
install -d -m 755 %{buildroot}%{_libdir}/%{name}
install -m 755 build/native*/libjnidispatch*.so %{buildroot}%{_libdir}/%{name}/
+%if 0%{?fedora}
# install maven pom file
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
@@ -135,7 +134,7 @@ install -p -d -m 755 %{buildroot}%{_javadocdir}/%{name}
cp -a doc/javadoc/* %{buildroot}%{_javadocdir}/%{name}
-#if 0%{?rhel} >= 6 || 0%{?fedora} >= 9
+#if 0%{?rhel} >= 6 || 0%{?fedora}
#ifnarch ppc s390 s390x
#check
#ant -Dcflags_extra.native="%{optflags}" -Ddynlink.native=true -Dnomixedjar.native=true test
@@ -143,22 +142,42 @@ cp -a doc/javadoc/* %{buildroot}%{_javadocdir}/%{name}
#endif
+%if 0%{?fedora}
%files -f .mfiles
+%else
+%files
+%{_javadir}/%{name}.jar
+%endif
%doc OTHERS README.md CHANGES.md TODO
+%if 0%{?fedora}
%license LICENSE LGPL2.1 ASL2.0
+%else
+%doc LICENSE LGPL2.1 ASL2.0
+%endif
%{_libdir}/%{name}
%files javadoc
+%if 0%{?fedora}
%license LICENSE LGPL2.1 ASL2.0
+%else
+%doc LICENSE LGPL2.1 ASL2.0
+%endif
%{_javadocdir}/%{name}
+%if 0%{?fedora}
%files contrib -f .mfiles-platform
+%else
+%files contrib
+%endif
%{_javadir}/%{name}
%changelog
+* Thu Sep 17 2015 Levente Farkas - 4.2.0-1
+- Update to 4.2.0
+
* Wed Jun 17 2015 Fedora Release Engineering - 4.1.0-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild