File sparselizard.spec of Package sparselizard

#
# spec file for package sparselizard
#
# Copyright (c) 2023 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/
#


%define petsc_version %(rpm -q --queryformat="%%{version}" petsc-openmpi4-devel)
%define petsc_path %{openmpi_prefix}/%{_lib}/petsc/%{petsc_version}/linux-gnu-c-opt

%define slepc_version %(rpm -q --queryformat="%%{version}" slepc-openmpi4-devel)
%define slepc_path %{openmpi_prefix}/%{_lib}/slepc/%{slepc_version}/linux-gnu-c-opt

%define mumps_path %{openmpi_prefix}

%define soname %(echo "libsparselizard-%{version}" | tr . _)

Name:           sparselizard
Version:        2022.05
Release:        0
Summary:        C++ finite element method (FEM) library
License:        GPL-2.0-or-later
URL:            http://www.sparselizard.org
Source:         sparselizard-%{version}.tar.xz
Source1:        https://github.com/halbux/sparselizard/releases/download/v.%{version}/DOCUMENTATION.pdf
# PATCH-FEATURE-UPSTREAM 0001-Improve-cMake-and-docker-builds.patch gh#halbux/sparselizard#66
Patch0:         0001-Improve-cMake-and-docker-builds.patch
# PATCH-FEATURE-UPSTREAM 0001-Find-MUMPS-before-linking.patch gh#nimish/sparselizard#1
Patch1:         0001-Find-MUMPS-before-linking.patch
BuildRequires:  cblas-devel
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  gmsh-devel
BuildRequires:  make
BuildRequires:  mumps-openmpi4-devel
BuildRequires:  openmpi-macros-devel
BuildRequires:  openmpi4-devel
BuildRequires:  patchelf
BuildRequires:  petsc-openmpi4-devel
BuildRequires:  slepc-openmpi4-devel

%description
A high-performance, multiphysics, hp-adaptive, open source C++ finite element
library running on Linux, Mac and Windows. It is carefully validated against
analytical solutions, third party software and lab measurements. General
high-performance domain decomposition methods are available for large-scale
simulations on computing clusters.

%package -n %{soname}
Summary:        C++ finite element method (FEM) library

%description -n %{soname}
A high-performance, multiphysics, hp-adaptive, open source C++ finite element
library running on Linux, Mac and Windows. It is carefully validated against
analytical solutions, third party software and lab measurements. General
high-performance domain decomposition methods are available for large-scale
simulations on computing clusters.

%package devel
Summary:        Development libraries and header files for sparselizard
Requires:       %{soname} = %{version}

%description devel
This package contains the header files and libraries for building programs
using the sparselizard library.

%package tools
Summary:        Tools for sparselizard

%description tools
This package contains tools for the sparselizard library.

%prep
%autosetup -p1
cp %{SOURCE1} .

%build
%cmake -DPETSC_ROOT="%{petsc_path}" -DSLEPC_ROOT="%{slepc_path}" -DMUMPS_ROOT="%{mumps_path}"
%cmake_build

%install
%cmake_install

mv %{buildroot}%{_libdir}/libsparselizard.so %{buildroot}%{_libdir}/%{soname}.so
patchelf --set-soname %{soname}.so %{buildroot}%{_libdir}/%{soname}.so
ln -s %{soname}.so %{buildroot}%{_libdir}/libsparselizard.so

mkdir -p %{buildroot}%{_datarootdir}/sparselizard
mv %{buildroot}%{_bindir}/disk.geo %{buildroot}%{_datarootdir}/sparselizard
mv %{buildroot}%{_bindir}/disk.msh %{buildroot}%{_datarootdir}/sparselizard

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

%files -n %{soname}
%{_libdir}/%{soname}.so

%files devel
%license COPYRIGHT LICENSE
%doc README.md DOCUMENTATION.pdf CITEME CREDITS
%{_includedir}/sparselizard
%{_libdir}/libsparselizard.so

%files tools
%license COPYRIGHT LICENSE
%{_bindir}/default
%{_datarootdir}/sparselizard

%changelog
openSUSE Build Service is sponsored by