File libjnidispatch.spec of Package libjnidispatch
#
# spec file for package libjnidispatch
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2000-2009, JPackage Project
# All rights reserved.
#
# 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
Url: https://github.com/twall/jna
Version: 3.4.0
Release: 0
Summary: Java Native Access (shared library)
License: LGPL-2.1+
Group: Development/Libraries/Java
#wget https://github.com/twall/jna/tarball/3.4.0
#tar -xf twall-jna-3.4.0-0-ge9da3c6.tar.bz2
#find twall-jna-3e5b84f/ -name '*jar' | xargs rm
#rm -rf twall-jna-3e5b84f/dist/
#tar -cjf jna-3.4.0-suse.tar.bz2 twall-jna-3e5b84f/
Source0: jna-%{version}-suse.tar.bz2
Source1: jna-%{version}.pom
Patch0: jna-%{version}-build.patch
Patch1: libffi-aarch64.patch
%if 0%{?mdkversion} < 201100
BuildArch: i586 x86_64 ppc ppc64 aarch64
%endif
Requires(post): javapackages-tools
Requires(postun): javapackages-tools
Requires: java >= 1.5.0
BuildRequires: ant
BuildRequires: ant-junit
BuildRequires: ant-nodeps
BuildRequires: ant-trax
BuildRequires: java-devel >= 1.5.0
BuildRequires: javapackages-tools
# ant variable
%if ! 0%{?suse_version}
%define ant JAVA_HOME=/usr/lib/jvm/java ant
%endif
# libx differences
%if 0%{?centos_version} || 0%{?fedora}
BuildRequires: libX11-devel
BuildRequires: libXt-devel
%endif
%if 0%{?centos_version} > 505 || 0%{?fedora}
BuildRequires: java-devel >= 1.6.0
%endif
%if 0%{?centos_version} > 505
BuildRequires: saxon
%endif
%if 0%{?mandriva_version}
%ifarch x86_64
%define _lib lib64
%else
%define _lib lib
%endif
%if 0%{?mdkversion} > 201010
BuildRequires: %{_lib}x11-devel
%else
BuildRequires: %{_lib}x11_6-devel
%endif
%if 0%{?mdkversion} >= 201010
BuildRequires: %{_lib}xt-devel
%else
BuildRequires: %{_lib}xt6-devel
%endif
%endif
%if 0%{?suse_version}
BuildRequires: xorg-x11-libX11-devel
BuildRequires: xorg-x11-libXt-devel
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Provides: jna-native = %{version}-%{release}
Obsoletes: jna-native < %{version}-%{release}
# centos does not know recommends
%if ! 0%{?centos_version} && ! 0%{?fedora}
Recommends: jna
%endif
%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
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
%{summary}.
%prep
%setup -q -n twall-jna-3e5b84f
%patch0 -p1 -b .orig
%patch1 -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
%{ant} \
jar \
native \
platform-jar \
-Dcflags_extra.native="%{optflags}" \
javadoc
# compile-tests \
# test \
# with correct soname one test fails, TODO
%install
if [ -d build-d64 ]; then
suffix="-d64"
fi
install -d -m 755 $RPM_BUILD_ROOT%{_libdir}
install -p -m 644 build${suffix}/native/libjnidispatch.so $RPM_BUILD_ROOT%{_libdir}/libjnidispatch.so
install -d -m 755 $RPM_BUILD_ROOT%{_javadir}
install -p -m 644 build${suffix}/jna.jar $RPM_BUILD_ROOT%{_javadir}/jna.jar
install -p -m 644 ./contrib/platform/dist/platform.jar $RPM_BUILD_ROOT%{_javadir}/platform.jar
install -d -m 755 $RPM_BUILD_ROOT%{_mavenpomdir}
# let's name maven fragment jna as expected
install -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT/%{_mavenpomdir}/JPP-jna.pom
%add_maven_depmap JPP-jna.pom jna.jar
mv $RPM_BUILD_ROOT/%{_mavendepmapfragdir}/%{name} $RPM_BUILD_ROOT/%{_mavendepmapfragdir}/jna
install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/jna
cp -pr doc/javadoc/* $RPM_BUILD_ROOT%{_javadocdir}/jna
%files
%defattr(0644,root,root,0755)
%doc LICENSE
%attr(0755,root,root) %{_libdir}/libjnidispatch.so
%files -n jna
%defattr(0644,root,root,0755)
%doc CHANGES.md LICENSE OTHERS README.md TODO
%{_javadir}/jna.jar
%{_javadir}/platform.jar
%{_mavenpomdir}/JPP-jna.pom
%{_mavendepmapfragdir}/jna
%files -n jna-javadoc
%defattr(0644,root,root,0755)
%{_javadocdir}/jna
%changelog