File libjnidispatch.spec of Package libjnidispatch
#
# spec file for package libjnidispatch
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2000-2009, JPackage Project
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: libjnidispatch
Version: 4.5.0
Release: 0
Summary: Java Native Access (shared library)
License: LGPL-2.1+ OR Apache-2.0
Group: Development/Libraries/Java
Url: https://github.com/twall/jna
Source0: https://github.com/twall/jna/archive/%{version}.tar.gz
Source1: jna-4.5.0.pom
Source2: libjnidispatch-rpmlintrc
Patch0: jna-build.patch
Patch1: jna-getpeer.patch
Patch2: jna-4.5.0-nojavah.patch
BuildRequires: ant
BuildRequires: ant-junit
BuildRequires: dos2unix
BuildRequires: fdupes
BuildRequires: java-devel >= 1.8
BuildRequires: javapackages-local
BuildRequires: javapackages-tools
BuildRequires: junit
BuildRequires: libffi-devel
BuildRequires: xorg-x11-libX11-devel
BuildRequires: xorg-x11-libXt-devel
Requires: java >= 1.6
Provides: jna-native = %{version}-%{release}
Obsoletes: jna-native < %{version}-%{release}
%description
Native library stub to dynamically invoke native code used by Java Native
Access library.
%package -n jna
Summary: Java Native Access
Group: Development/Libraries/Java
Requires: libjnidispatch = %{version}
BuildArch: noarch
%description -n jna
JNA provides Java programs easy access to native shared libraries without
writing anything but Java code. No JNI or native code is required. This
functionality is comparable to Windows' Platform/Invoke and Python's ctypes.
Access is dynamic at runtime without code generation. JNA's design aims to
provide native access in a natural way with a minimum of effort. No boilerplate
or generated code is required. While some attention is paid to performance,
correctness and ease of use take priority.
The JNA library uses a small native library (%{name}) stub to dynamically
invoke native code. The developer uses a Java interface to describe functions
and structures in the target native library. This makes it quite easy to take
advantage of native platform features without incurring the high overhead of
configuring and building JNI code for multiple platforms.
%package -n jna-javadoc
Summary: Javadoc for Java Native Access
Group: Documentation/HTML
BuildArch: noarch
%description -n jna-javadoc
Javadoc reference for the Java Native Access library.
%prep
%setup -q -n jna-%{version}
# Cleanup the dist tarball
find . -name '*jar' | xargs rm
rm -rf dist
dos2unix OTHERS
# Then apply patch
%patch0 -p1 -b .orig
%patch1 -p1
%patch2 -p1
#FIXME: DirectTest fails
#rm test/com/sun/jna/DirectTest.java test/com/sun/jna/PerformanceTest.java
sed -i 's|soname,\$@|soname,%{name}.so|' native/Makefile
%build
build-jar-repository -s -p lib ant
ant \
jar \
native \
platform-jar \
-Dcflags_extra.native="%{optflags}" \
-Dbuild-native=true \
-Dcompatibility=1.6 \
-Ddynlink.native=true \
javadoc
%install
if [ -d build-d64 ]; then
suffix="-d64"
fi
install -d -m 755 %{buildroot}%{_libdir}
install -p -m 644 build${suffix}/native-*/libjnidispatch.so %{buildroot}%{_libdir}/libjnidispatch.so
install -d -m 755 %{buildroot}%{_javadir}
install -p -m 644 build${suffix}/jna.jar %{buildroot}%{_javadir}/jna.jar
install -p -m 644 ./contrib/platform/dist/jna-platform.jar %{buildroot}%{_javadir}/jna-platform.jar
install -d -m 755 %{buildroot}%{_mavenpomdir}
# let's name maven fragment jna as expected
install -p -m 644 %{SOURCE1} %{buildroot}/%{_mavenpomdir}/JPP-jna.pom
%add_maven_depmap JPP-jna.pom jna.jar
mv %{buildroot}%{_datadir}/maven-metadata/libjnidispatch.xml %{buildroot}%{_datadir}/maven-metadata/jna.xml
install -d -m 755 %{buildroot}%{_javadocdir}/jna
cp -pr doc/javadoc/* %{buildroot}%{_javadocdir}/jna
%fdupes -s %{buildroot}%{_javadocdir}/jna
%files
%doc LICENSE
%attr(0755,root,root) %{_libdir}/libjnidispatch.so
%files -n jna
%doc CHANGES.md LICENSE OTHERS README.md TODO
%{_javadir}/jna.jar
%{_javadir}/jna-platform.jar
%{_mavenpomdir}/JPP-jna.pom
%{_datadir}/maven-metadata/jna.xml
%files -n jna-javadoc
%{_javadocdir}/jna
%changelog