Group: System/Libraries
# BEGIN SourceDeps(oneline):
BuildRequires(pre): rpm-macros-java
BuildRequires: gcc-c++ texinfo unzip
# END SourceDeps(oneline)
BuildRequires: /proc rpm-build-java
BuildRequires: jpackage-default
# see https://bugzilla.altlinux.org/show_bug.cgi?id=10382
%define _localstatedir %{_var}
%global cluster jnr
%global sover 1.2
Name: jffi
Version: 1.3.4
Release: alt1_1jpp11
Summary: Java Foreign Function Interface
License: LGPLv3+ or ASL 2.0
URL: http://github.com/jnr/jffi
Source0: https://github.com/%{cluster}/%{name}/archive/%{name}-%{version}.tar.gz
Source3: p2.inf
# Fix references to junit/hamcrest to match what is generated by `build-jar-repository`
Patch0: 0001-Fix-dependencies-on-junit-hamcrest.patch
# Fix compilation flags and binary stripping
Patch1: 0002-Fix-compilation-flags.patch
# Fix usage of antrun plugin, sent upstream: https://github.com/jnr/jffi/pull/111
Patch2: 0003-Update-to-latest-maven-ant-plugin.patch
BuildRequires: gcc
BuildRequires: maven-local
BuildRequires: mvn(junit:junit)
BuildRequires: mvn(org.apache.felix:maven-bundle-plugin)
BuildRequires: mvn(org.apache.maven.plugins:maven-antrun-plugin)
BuildRequires: mvn(org.apache.maven.plugins:maven-assembly-plugin)
BuildRequires: mvn(org.codehaus.mojo:build-helper-maven-plugin)
BuildRequires: libffi-devel
BuildRequires: ant
BuildRequires: ant-junit
Source44: import.info
%description
An optimized Java interface to libffi.
%package native
Group: System/Libraries
Summary: %{name} JAR with native bits
%description native
This package contains %{name} JAR with native bits.
%package javadoc
Group: System/Libraries
Summary: Javadoc for %{name}
BuildArch: noarch
%description javadoc
This package contains the API documentation for %{name}.
%prep
%setup -q -n %{name}-%{name}-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
# Remove pointless parent pom
%pom_remove_parent
# Don't attempt to override arch configuration from RPM flags
sed -i -e '/i586/d' jni/GNUmakefile
# remove uneccessary directories
rm -r archive/* jni/libffi/ lib/junit*
# Remove any pre-build bytecode
find ./ -name '*.jar' -exec rm -f '{}' \;
find ./ -name '*.class' -exec rm -f '{}' \;
# Test dependencies for ant tests
build-jar-repository -s -p lib/ junit hamcrest/core
# A couple of tests fail on armv7 for some reason
sed -i -e 's/haltonfailure="true"/haltonfailure="no"/' build.xml
# Ensure debug symbols in the native java
sed -i -e 's/<javac/<javac debug="true"/' build.xml
%mvn_package 'com.github.jnr:jffi::native:' native
%mvn_file ':{*}' %{name}/@1 @1
%build
# ant will produce JAR with native bits
ant jar build-native -Duse.system.libffi=1
# maven will look for JAR with native bits in archive/
cp -p dist/jffi-*-Linux.jar archive/
%mvn_build
# Ensure jar with correct manifest is the one that is installed
cp target/jffi-%{version}-complete.jar target/jffi-%{version}.jar
%install
%mvn_install
mkdir -p META-INF/
cp %{SOURCE3} META-INF/
jar uf %{buildroot}%{_jnidir}/%{name}/%{name}.jar META-INF/p2.inf
# install *.so
install -dm 755 %{buildroot}%{_libdir}/%{name}
unzip dist/jffi-*-Linux.jar
mv jni/*-Linux %{buildroot}%{_libdir}/%{name}/
# create version-less symlink for .so file
pushd %{buildroot}%{_libdir}/%{name}/*
chmod +x lib%{name}-%{sover}.so
ln -s lib%{name}-%{sover}.so lib%{name}.so
popd
%check
# don't fail on unused parameters... (TODO: send patch upstream)
sed -i 's|-Werror||' libtest/GNUmakefile
ant -Duse.system.libffi=1 -Drun.jvm.model=-Xmx128m test
%files -f .mfiles
%doc --no-dereference COPYING.GPL COPYING.LESSER LICENSE
%files native -f .mfiles-native
%{_libdir}/%{name}
%doc --no-dereference COPYING.GPL COPYING.LESSER LICENSE
%files javadoc -f .mfiles-javadoc
%doc --no-dereference COPYING.GPL COPYING.LESSER LICENSE
%changelog
* Mon Jun 13 2022 Igor Vlasenko <viy@altlinux.org> 1.3.4-alt1_1jpp11
- java11 build
* Fri Jun 10 2022 Igor Vlasenko <viy@altlinux.org> 1.3.4-alt1_1jpp8
- new version
* Wed Jun 08 2022 Igor Vlasenko <viy@altlinux.org> 1.2.23-alt1_6jpp11
- Port to maven-antrun-plugin 3.0.0
* Sun Jun 13 2021 Igor Vlasenko <viy@altlinux.org> 1.2.23-alt1_5jpp11
- new version
* Thu Jun 03 2021 Igor Vlasenko <viy@altlinux.org> 1.2.23-alt1_2jpp8
- new version, use jvm8
* Sat Jul 20 2019 Igor Vlasenko <viy@altlinux.ru> 1.2.19-alt1_0jpp8
- new version
* Sat Jul 20 2019 Igor Vlasenko <viy@altlinux.ru> 1.2.12-alt2_11jpp8
- aarch64 support & java 8 build
* Sat May 25 2019 Igor Vlasenko <viy@altlinux.ru> 1.2.12-alt1_11jpp8
- new version
* Tue Feb 05 2019 Igor Vlasenko <viy@altlinux.ru> 1.2.12-alt1_10jpp8
- fc29 update
* Sun Apr 15 2018 Igor Vlasenko <viy@altlinux.ru> 1.2.12-alt1_9jpp8
- java update
* Thu Nov 09 2017 Igor Vlasenko <viy@altlinux.ru> 1.2.12-alt1_8jpp8
- fc27 update
* Sun Oct 22 2017 Igor Vlasenko <viy@altlinux.ru> 1.2.12-alt1_5jpp8
- new jpp release
* Fri Dec 16 2016 Igor Vlasenko <viy@altlinux.ru> 1.2.12-alt1_3jpp8
- new version
* Fri Nov 25 2016 Igor Vlasenko <viy@altlinux.ru> 1.2.10-alt1_1jpp8
- new version
* Thu Feb 11 2016 Igor Vlasenko <viy@altlinux.ru> 1.2.9-alt2_8jpp8
- %%_jnidir set to /usr/lib/java
* Sun Feb 07 2016 Igor Vlasenko <viy@altlinux.ru> 1.2.9-alt1_8jpp8
- java 8 mass update
* Mon Sep 08 2014 Igor Vlasenko <viy@altlinux.ru> 1.2.6-alt2_3jpp7
- new release
* Tue Aug 05 2014 Igor Vlasenko <viy@altlinux.ru> 1.2.6-alt2_1jpp7
- added symlink in javadir
* Tue Aug 05 2014 Igor Vlasenko <viy@altlinux.ru> 1.2.6-alt1_1jpp7
- new version
* Tue Jun 03 2014 Igor Vlasenko <viy@altlinux.ru> 1.0.10-alt3_1jpp7
- fixed build
* Tue Oct 02 2012 Igor Vlasenko <viy@altlinux.ru> 1.0.10-alt2_1jpp7
- gcc47 build
* Sat Apr 07 2012 Igor Vlasenko <viy@altlinux.ru> 1.0.10-alt1_1jpp7
- new version