File native-platform.spec of Package native-platform

#
# spec file for package native-platform
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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/
#

%define lname libnative-platform0

Name:           native-platform
Version:        0.13
Release:        0
Summary:        Java bindings for various native APIs
License:        Apache-2.0
Group:          Development/Libraries/Java
Url:            https://github.com/adammurdoch/native-platform
Source0:        %{name}-%{version}.tar.gz
Patch1:         %{name}-%{version}.patch
ExclusiveArch:  x86_64
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  gradle4
BuildRequires:  %{name}-kit == %{version}
BuildRequires:  java-devel < 10
BuildRequires:  gcc-c++
BuildRequires:  ncurses-devel
Requires:       libjnidispatch

%description
A collection of cross-platform Java APIs for various native APIs. Currently supports OS X, Linux, Windows and FreeBSD on Intel architectures.

These APIs support Java 5 and later. Some of these APIs overlap with APIs available in later Java versions.

%package -n %lname
Summary:        Java bindings for various native APIs
Group:          System/Libraries

%description -n %lname
A collection of cross-platform Java APIs for various native APIs. Currently supports OS X, Linux, Windows and FreeBSD on Intel architectures.

These APIs support Java 5 and later. Some of these APIs overlap with APIs available in later Java versions.


%prep
%setup -q
%patch1 -p1
rm -rf ../kit
cp -Rf %{_datadir}/tetra ../kit
cd ../kit
rm -rf ~/.gradle
ln -s `pwd`/gradle ~/.gradle
sed -i 's|sourceCompatibility = 1.5|sourceCompatibility = 1.7|g' ../%{name}-%{version}/build.gradle
sed -i 's|targetCompatibility = 1.5|targetCompatibility = 1.7|g' ../%{name}-%{version}/build.gradle

%build

gradle \
  -Prelease \
  -PartifactoryUserName=nobody \
  -PartifactoryPassword=password \
  -x :testApp:compileJava \
  -x :testApp:startScripts \
  -x :testApp:distZip \
  --offline \
  --no-daemon \
  assemble

%install

%{__install} -m 755 -d %{buildroot}%{_libdir}/jni
%{__install} -m 644 build/libs/nativePlatform/shared/linux_amd64/*so %{buildroot}%{_libdir}/jni
%{__install} -m 644 build/libs/nativePlatformCurses/shared/linux_amd64_ncurses*/*so %{buildroot}%{_libdir}/jni

%{__install} -m 755 -d %{buildroot}%{_datadir}/java
%{__install} -m 644 build/libs/native-platform-0.13.jar %{buildroot}%{_datadir}/java
ln -s native-platform-0.13.jar %{buildroot}%{_datadir}/java/%{name}.jar

%post -n %lname -p /sbin/ldconfig
%postun -n %lname -p /sbin/ldconfig

%files -n %lname
%defattr(-,root,root)
%doc  LICENSE  readme.md
%dir %{_libdir}/jni
%{_libdir}/jni/*.so
%{_datadir}/java/*.jar

%changelog
openSUSE Build Service is sponsored by