File sundials.spec of Package sundials

#
# spec file for package sundials
#
# Copyright (c) 2019 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 https://bugs.opensuse.org/
#

%define shlib_main libsundials2
%define shlib_arkode libsundials_arkode3
%define shlib_cvode libsundials_cvode4
%define shlib_cvodes libsundials_cvodes4
%define shlib_ida libsundials_ida4
%define shlib_idas libsundials_idas3
%define shlib_kinsol libsundials_kinsol4
%define shlib_nvecserial libsundials_nvecserial4

Name:           sundials
Version:        4.1.0
Release:        0
Summary:        Suite of nonlinear solvers
License:        BSD-3-Clause
Group:          System/Libraries
# SUNDIALS is licensed under BSD with some additional (but unrestrictive) clauses.
# Check the file 'LICENSE' for details.
URL:            https://computation.llnl.gov/projects/sundials/
Source0:        https://computation.llnl.gov/projects/sundials/download/%{name}-%{version}.tar.gz
BuildRequires:  cmake
BuildRequires:  fdupes
BuildRequires:  gcc-fortran
BuildRequires:  blas-devel
BuildRequires:  lapack-devel

%description
SUNDIALS is a SUite of Non-linear DIfferential/ALgebraic equation Solvers
for use in writing mathematical software.

SUNDIALS was implemented with the goal of providing robust time integrators
and nonlinear solvers that can easily be incorporated into existing simulation
codes. The primary design goals were to require minimal information from the
user, allow users to easily supply their own data structures underneath the
solvers, and allow for easy incorporation of user-supplied linear solvers and
preconditioners.

%package devel
Summary:        Suite of nonlinear solvers (developer files)
Group:          Development/Libraries/C and C++
Requires:       %{shlib_main} = %{version}
Requires:       %{shlib_arkode} = %{version}
Requires:       %{shlib_cvode} = %{version}
Requires:       %{shlib_cvodes} = %{version}
Requires:       %{shlib_ida} = %{version}
Requires:       %{shlib_idas} = %{version}
Requires:       %{shlib_kinsol} = %{version}
Requires:       %{shlib_nvecserial} = %{version}

%description devel
SUNDIALS is a SUite of Non-linear DIfferential/ALgebraic equation Solvers
for use in writing mathematical software.

This package contains the developer files (.so file, header files)

%package doc
Summary:        Suite of nonlinear solvers (documentation)
Group:          Documentation/Other

%description doc
SUNDIALS is a SUite of Non-linear DIfferential/ALgebraic equation Solvers
for use in writing mathematical software.

This package contains the documentation files

%package -n %{shlib_main}
Summary:        Suite of nonlinear solvers - main shared libraries
Group: Productivity/Scientific/Math

%description -n %{shlib_main}
SUNDIALS is a SUite of Non-linear DIfferential/ALgebraic equation Solvers
for use in writing mathematical software.

This package provides the main shared libraries for SUNDIALS.

%package -n %{shlib_arkode}
Summary:        Suite of nonlinear solvers - arkode shared libraries
Group: Productivity/Scientific/Math

%description -n %{shlib_arkode}
SUNDIALS is a SUite of Non-linear DIfferential/ALgebraic equation Solvers
for use in writing mathematical software.

This package provides the shared libraries for SUNDIALS' arkode solver.

%package -n %{shlib_cvode}
Summary:        Suite of nonlinear solvers - cvode shared libraries
Group: Productivity/Scientific/Math

%description -n %{shlib_cvode}
SUNDIALS is a SUite of Non-linear DIfferential/ALgebraic equation Solvers
for use in writing mathematical software.

This package provides the shared libraries for SUNDIALS' cvode solver.

%package -n %{shlib_cvodes}
Summary:        Suite of nonlinear solvers - cvodes shared libraries
Group: Productivity/Scientific/Math

%description -n %{shlib_cvodes}
SUNDIALS is a SUite of Non-linear DIfferential/ALgebraic equation Solvers
for use in writing mathematical software.

This package provides the shared libraries for SUNDIALS' cvodes solver.

%package -n %{shlib_ida}
Summary:        Suite of nonlinear solvers - ida shared libraries
Group: Productivity/Scientific/Math

%description -n %{shlib_ida}
SUNDIALS is a SUite of Non-linear DIfferential/ALgebraic equation Solvers
for use in writing mathematical software.

This package provides the shared libraries for SUNDIALS' ida solver.

%package -n %{shlib_idas}
Summary:        Suite of nonlinear solvers - idas shared libraries
Group: Productivity/Scientific/Math

%description -n %{shlib_idas}
SUNDIALS is a SUite of Non-linear DIfferential/ALgebraic equation Solvers
for use in writing mathematical software.

This package provides the shared libraries for SUNDIALS' idas solver.

%package -n %{shlib_kinsol}
Summary:        Suite of nonlinear solvers - kinsol shared libraries
Group: Productivity/Scientific/Math

%description -n %{shlib_kinsol}
SUNDIALS is a SUite of Non-linear DIfferential/ALgebraic equation Solvers
for use in writing mathematical software.

This package provides the shared libraries for SUNDIALS' kinsol solver.

%package -n %{shlib_nvecserial}
Summary:        Suite of nonlinear solvers - nvecserial shared libraries
Group: Productivity/Scientific/Math

%description -n %{shlib_nvecserial}
SUNDIALS is a SUite of Non-linear DIfferential/ALgebraic equation Solvers
for use in writing mathematical software.

This package provides the shared libraries for SUNDIALS' nvecserial solver.

%prep
%setup -q

%build
%cmake -DBLAS_ENABLE=ON \
       -DLAPACK_ENABLE=ON \
       -DPTHREAD_ENABLE=ON \
       -DEXAMPLES_INSTALL_PATH=%{_docdir}/%{name}/examples

%cmake_build

%install
# SUNDIALS does not support the 'DESTDIR' method, hence:
%cmake_install

rm %{buildroot}%{_includedir}/sundials/{NOTICE,LICENSE}

%fdupes %{buildroot}

%post -n %{shlib_main} -p /sbin/ldconfig
%postun -n %{shlib_main} -p /sbin/ldconfig

%post -n %{shlib_arkode} -p /sbin/ldconfig
%postun -n %{shlib_arkode} -p /sbin/ldconfig

%post -n %{shlib_cvode} -p /sbin/ldconfig
%postun -n %{shlib_cvode} -p /sbin/ldconfig

%post -n %{shlib_cvodes} -p /sbin/ldconfig
%postun -n %{shlib_cvodes} -p /sbin/ldconfig

%post -n %{shlib_ida} -p /sbin/ldconfig
%postun -n %{shlib_ida} -p /sbin/ldconfig

%post -n %{shlib_idas} -p /sbin/ldconfig
%postun -n %{shlib_idas} -p /sbin/ldconfig

%post -n %{shlib_kinsol} -p /sbin/ldconfig
%postun -n %{shlib_kinsol} -p /sbin/ldconfig

%post -n %{shlib_nvecserial} -p /sbin/ldconfig
%postun -n %{shlib_nvecserial} -p /sbin/ldconfig

%files doc
%doc doc/cvode/cv_examples.pdf
%doc doc/cvode/cv_guide.pdf
%doc doc/kinsol/kin_examples.pdf
%doc doc/kinsol/kin_guide.pdf
%doc doc/cvodes/cvs_examples.pdf
%doc doc/cvodes/cvs_guide.pdf
%doc doc/ida/ida_examples.pdf
%doc doc/ida/ida_guide.pdf
%{_docdir}/%{name}/

%files devel
%license LICENSE
%doc README.md CONTRIBUTING.md NOTICE
%{_libdir}/*.so
%{_includedir}/*

%files -n %{shlib_main}
%{_libdir}/libsundials_sun*.so.*

%files -n %{shlib_arkode}
%{_libdir}/libsundials_arkode.so.*

%files -n %{shlib_cvode}
%{_libdir}/libsundials_cvode.so.*

%files -n %{shlib_cvodes}
%{_libdir}/libsundials_cvodes.so.*

%files -n %{shlib_ida}
%{_libdir}/libsundials_ida.so.*

%files -n %{shlib_idas}
%{_libdir}/libsundials_idas.so.*

%files -n %{shlib_kinsol}
%{_libdir}/libsundials_kinsol.so.*

%files -n %{shlib_nvecserial}
%{_libdir}/libsundials_nvecserial.so.*

%changelog