Files
aparapi/aparapi.spec

163 lines
4.8 KiB
RPMSpec

#
# spec file for package aparapi
#
# Copyright (c) 2024 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#
%global ver 3.0.0
%global jni_ver 1.4.3
%global native_ver 1.4.2
Name: aparapi
Version: %{ver}
Release: 0
Summary: A framework for executing native Java and Scala code on the GPU
License: Apache-2.0
Group: Development/Libraries/Java
URL: https://git.qoto.org/aparapi/%{name}
Source0: %{url}/-/archive/v%{ver}/%{name}-v%{ver}.tar.bz2
Source1: %{url}-jni/-/archive/v%{jni_ver}/%{name}-jni-v%{jni_ver}.tar.bz2
Source2: %{url}-native/-/archive/v%{native_ver}/%{name}-native-v%{native_ver}.tar.bz2
Patch0: no-javah.patch
BuildRequires: autoconf
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: libtool
BuildRequires: maven-local
BuildRequires: mvn(org.apache.bcel:bcel) >= 6
BuildRequires: mvn(org.apache.maven.plugins:maven-install-plugin)
BuildRequires: ocl-icd-devel
BuildRequires: opencl-headers mvn(junit:junit)
BuildRequires: pkgconfig
BuildRequires: pkgconfig(OpenCL)
Requires: libOpenCL1
%description
The New Official Aparapi: a framework for executing native Java and Scala code
on the GPU.
%package javadoc
Summary: API documentation for %{name}
Group: Documentation/HTML
BuildArch: noarch
%description javadoc
API documentation for %{name}.
%package jni
Version: %{jni_ver}
Summary: Loads the Aparapi Native library at runtime
%description jni
This project simply loads the Aparapi Native library at runtime. This prevents
the need for the user to install it manually.
There is usually no need for a user to call this library directly as it is
called internally by Aparapi. However it may be useful if creating your own
custom agent.
%package jni-javadoc
Version: %{jni_ver}
Summary: API documentation for %{name}-jni
Group: Documentation/HTML
BuildArch: noarch
%description jni-javadoc
API documentation for %{name}-jni.
%prep
%setup -q -n %{name}-v%{ver}
%patch -P 0 -p1
%pom_remove_parent
%pom_remove_dep org.scala-lang:scala-library
%pom_remove_plugin net.alchim31.maven:scala-maven-plugin
%pom_remove_plugin :maven-surefire-plugin
%pom_remove_plugin org.sonatype.plugins:nexus-staging-maven-plugin
%pom_add_dep org.apache.maven.plugins:maven-surefire-plugin
tar -xf %{SOURCE1}
pushd %{name}-jni-v%{jni_ver}
rm src/main/resources/{linux/*.so,osx/*.dylib,win/*.dll}
%pom_remove_parent
%pom_remove_plugin org.sonatype.plugins:nexus-staging-maven-plugin
popd
tar -xf %{SOURCE2}
%build
pushd %{name}-jni-v%{jni_ver}
%{mvn_build} -f -- -Dmaven.compiler.release=8 install
popd
mkdir -p include
%{mvn_build} -f -- -Dmaven.compiler.release=8
pushd %{name}-native-v%{native_ver}
libtoolize
aclocal
autoconf
automake --add-missing
export CXXFLAGS='-I%{_jvmdir}/java/include -I%{_jvmdir}/java/include/linux -I../include -L%{_libdir}/ocl-icd'
%configure
%make_build -j1
popd
mkdir linux
%ifarch %ix86
cp %{name}-native-v%{native_ver}/.libs/libaparapi.so linux/libaparapi_x86.so
%else
cp %{name}-native-v%{native_ver}/.libs/libaparapi.so linux/libaparapi_%{_arch}.so
%endif
jar \
%if %{?pkg_vcmp:%pkg_vcmp java-devel >= 17}%{!?pkg_vcmp:0}
--date="$(date -u -d @${SOURCE_DATE_EPOCH:-$(date +%%s)} +%%Y-%%m-%%dT%%H:%%M:%%SZ)" \
%endif
--update \
--verbose \
--file %{name}-jni-v%{jni_ver}/target/%{name}-jni-%{jni_ver}.jar linux/
%install
# This convoluted way is to assure the javadoc installation works with javadoc
# generated either by xmvn-mojo:javadoc and javadoc:aggregate alike
pushd aparapi-jni-v%{jni_ver}
%{mvn_package} :%{name}-jni __noinstall
%mvn_install
mv %{buildroot}%{_javadocdir}/%{name} %{buildroot}%{_javadocdir}/%{name}-jni
%fdupes %{buildroot}%{_javadocdir}/%{name}-jni
sed -i 's#%{_javadocdir}/%{name}#%{_javadocdir}/%{name}-jni#g' .mfiles-javadoc
popd
%{mvn_package} :%{name}
%{mvn_package} :%{name}-jni jni
%{mvn_artifact} %{name}-jni-v%{jni_ver}/pom.xml %{name}-jni-v%{jni_ver}/target/%{name}-jni-%{jni_ver}.jar
%mvn_install
%fdupes %{buildroot}%{_javadocdir}/%{name}
%files -f .mfiles
%license NOTICE LICENSE
%doc {CHANGELOG,README,ATTRIBUTIONS,CONTRIBUTORS}.md
%files javadoc -f .mfiles-javadoc
%license NOTICE LICENSE
%files jni -f .mfiles-jni
%files jni-javadoc -f aparapi-jni-v%{jni_ver}/.mfiles-javadoc
%changelog