%global uname jigawatts
%global uversion 6c78499af1a1d536368267e5ab5449232b05f878
%global dversion %(echo %{uversion} | sed s/-/_/)
%global aarch64 aarch64 arm64 armv8
%global shortcommit %(c=%{uversion}; echo ${c:0:7})
%global commitdate 20210827
Name: %{uname}
Version: 0.2
Release: 0.8.%{commitdate}%{shortcommit}%{?dist}
Summary: Java CRIU helper
License: GPLv2 with exceptions
URL: https://github.com/chflood/%{uname}
Source0: https://github.com/chflood/jigawatts/archive/%{uversion}.tar.gz
# Pathces to move library out of the jar. This must be usptreamed in one or another way
Patch0: output_loc.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 the depndence shhould be generated by rpmbuild
# 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.
%package javadoc
Summary: Javadoc for %{name}
%description javadoc
Javadoc for %{name}
%prep
%setup -q -n %{uname}-%{uversion}
%patch0 -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
#skipping tests, new tests can pass only if run as root
%mvn_build --xmvn-javadoc -f
%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 Jan 19 2023 Fedora Release Engineering - 0.2-0.8.202108276c78499
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Thu Jul 21 2022 Fedora Release Engineering - 0.2-0.7.202108276c78499
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Sat Feb 05 2022 Jiri Vanek - 0.2-0.6.202108276c78499
- Rebuilt for java-17-openjdk as system jdk
* Thu Jan 20 2022 Fedora Release Engineering - 0.2-0.5.202108276c78499
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Thu Aug 19 2021 Jiri Vanek - 0.2-0.4.202108276c78499
- bumped to latst commit
- includes system library patch and variables to control library
* Thu Aug 19 2021 Jiri Vanek - 0.2-0.3.2021081722e8e87
- bumped to latst commit
- includes renaming jigawat.jar -> jigawatts.jar and chnage of package to com.redhat.jigawatts
* Thu Jul 22 2021 Fedora Release Engineering - 0.2-0.2.20210701c15dd4c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Thu Jul 01 2021 Jiri Vanek - 0.2-0.1.20210701c15dd4c
- 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.2-0.1.20210701c15dd4c
- initial build
- added requires of criu-devel