%global uname jigawatts
%global uversion c15dd4c19e81cbcefe419a99ebaa3af7c5c60c5e
%global dversion %(echo %{uversion} | sed s/-/_/)
%global aarch64 aarch64 arm64 armv8
Name: %{uname}
Version: 0
Release: 0.0.pre.2.%{uversion}%{?dist}
Summary: Java CRIU helper
License: GPLv2 with exceptions
URL: https://github.com/chflood/%{uname}
Source0: https://github.com/chflood/jigawatts/archive/%{uname}-%{uversion}.zip
# Pathces to move library out of the jar. This must be usptreamed in one or another way
Patch0: output_loc.patch
Patch1: load_library.patch
BuildRequires: java-devel
BuildRequires: criu-devel
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: maven-local
BuildRequires: maven-surefire-provider-junit
BuildRequires: maven-surefire-provider-junit5
BuildRequires: maven-surefire
BuildRequires: maven-surefire-plugin
BuildRequires: maven-clean-plugin
BuildRequires: exec-maven-plugin
BuildRequires: maven-shade-plugin
BuildRequires: mvn(org.apache.commons:commons-lang3)
Requires: java-headless
Requires: criu-libs
# criu is only available on these architectures
# https://bugzilla.redhat.com/show_bug.cgi?id=902875
ExclusiveArch: x86_64 %{arm} ppc64le aarch64 s390x
%description
CRIU is a Linux utility that allows the checkpointing and restoring of processes. You can read more about CRIU at criu.org. CRIU for Java is a package which makes it more convenient to use CRIU from Java.
# https://docs.google.com/document/d/1G71_Kwd5CTfx6IKCuO64s3VztXMWHecERl3D4mpmyWc/edit
%package javadoc
Summary: Javadoc for %{name}
%description javadoc
Javadoc for %{name}
#todo binding subpackage (waiting for http://mailman-int.corp.redhat.com/archives/java-project/2021-April/msg00000.html)
%prep
%setup -q -n %{uname}-%{uversion}
%patch0 -p1
%patch1 -p1
%pom_add_dep org.apache.commons:commons-lang3:3.12.0:test
%pom_xpath_inject "pom:build/pom:plugins/pom:plugin[pom:artifactId='exec-maven-plugin']/pom:executions/pom:execution/pom:configuration/pom:arguments" '-g'
# Work-around for RHBZ#1977671, /usr/lib64 missing on default java.library.path on aarch64
%ifarch %{aarch64}
%pom_xpath_inject "pom:build/pom:plugins/pom:plugin[pom:artifactId='maven-surefire-plugin']/pom:configuration" '1
/usr/lib64:${project.build.directory}
'
%else
%pom_xpath_inject "pom:build/pom:plugins/pom:plugin[pom:artifactId='maven-surefire-plugin']/pom:configuration" '1
${project.build.directory}
'
%endif
%build
%mvn_build --xmvn-javadoc
%install
%mvn_install
mkdir -p %{buildroot}/%{_libdir}
cp ./target/libJigawatts.so %{buildroot}/%{_libdir}/
%files -f .mfiles
%doc README.md
%license LICENSE.md
%{_libdir}/libJigawatts.so
%files javadoc -f .mfiles-javadoc
%changelog
* Thu Jul 11 2021 Jiri Vanek - 0-0.0.pre.2.
- criu-devel moved to BR
- now requires criu-libs
- enabled debuginfo generation
- excluded i686 build as criu is 64b only
- .so file moved out of jar. Required teo patches:
- added and applied patch0 output_loc.patch
- added and applied patch1 load_library.patch
- on aarch64 workarounded missing lib64 on /usr/LD_LIBRARY_PATH
* Wed Apr 14 2021 Jiri Vanek - 0-0.0.pre.1
- initial build
- added requires of criu-devel