File dune-common.spec of Package dune-common

#
# spec file for package dune-common
#
# 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/
#


%define shortversion 2.10
Name:           dune-common
Version:        2.10.0
Release:        0
Summary:        Distributed and Unified Numerics Environment
License:        GPL-2.0-only
Group:          Development/Libraries/C and C++
URL:            https://www.dune-project.org/
Source0:        http://www.dune-project.org/download/%{version}/%{name}-%{version}.tar.gz
#PATCH-FIX-OPENSUSE: change shebangs in python and bash scripts to not use env
Patch0:         fix_script_shebangs.patch
BuildRequires:  blas-devel
#BuildArch:      noarch
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  gcc-fortran
BuildRequires:  gmp-devel
BuildRequires:  lapack-devel
BuildRequires:  openmpi4-devel
BuildRequires:  pkgconfig
BuildRequires:  python3-devel
BuildRequires:  tbb-devel
Requires:       libdunecommon = %{version}
#Vc packages are not available on SLE
%if 0%{?is_opensuse:1} > 0
BuildRequires:  Vc-devel
BuildRequires:  Vc-devel-static
%endif

%description
DUNE, the Distributed and Unified Numerics Environment is a modular toolbox
for solving partial differential equations (PDEs) with grid-based methods.
It supports the easy implementation of methods like Finite Elements (FE),
Finite Volumes (FV), and also Finite Differences (FD).

%package -n libdunecommon
Summary:        Distributed and Unified Numerics Environment
Group:          System/Libraries

%description -n libdunecommon
DUNE, the Distributed and Unified Numerics Environment is a modular toolbox
for solving partial differential equations (PDEs) with grid-based methods.
It supports the easy implementation of methods like Finite Elements (FE),
Finite Volumes (FV), and also Finite Differences (FD).

%package devel
Summary:        Development and header files for %{name}
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}
Requires:       blas-devel
Requires:       lapack-devel
Requires:       libdunecommon = %{version}
Recommends:     gcc-c++
Recommends:     gcc-fortran

%description devel
This package contains the development and header files for %{name}

%package openmpi
Summary:        Distributed and Unified Numerics Environment
Group:          Development/Libraries/C and C++
Requires:       libdunecommon-openmpi = %{version}

%description openmpi
DUNE, the Distributed and Unified Numerics Environment is a modular toolbox
for solving partial differential equations (PDEs) with grid-based methods.
It supports the easy implementation of methods like Finite Elements (FE),
Finite Volumes (FV), and also Finite Differences (FD).

%package -n libdunecommon-openmpi
Summary:        Distributed and Unified Numerics Environment
Group:          System/Libraries
Requires:       openmpi4

%description -n libdunecommon-openmpi
DUNE, the Distributed and Unified Numerics Environment is a modular toolbox
for solving partial differential equations (PDEs) with grid-based methods.
It supports the easy implementation of methods like Finite Elements (FE),
Finite Volumes (FV), and also Finite Differences (FD).

%package openmpi-devel
Summary:        Development and header files for %{name}
Group:          Development/Libraries/C and C++
Requires:       %{name}-openmpi = %{version}
Requires:       blas-devel
Requires:       lapack-devel
Requires:       libdunecommon-openmpi = %{version}
Requires:       openmpi4-devel

%description openmpi-devel
This pckage contains the development and header files for %{name}

%package doc
Summary:        Docs for %{name}
Group:          Development/Libraries/C and C++

%description doc
This package contains the docs files for %{name}

%prep
%setup -q

mkdir serial openmpi
%patch 0 -p1

%build
cd serial
cmake \
    -DCMAKE_DISABLE_FIND_PACKAGE_MPI=TRUE \
    -DCMAKE_DISABLE_FIND_PACKAGE_QuadMath=TRUE \
    -DBUILD_SHARED_LIBS=ON \
    -DCMAKE_INSTALL_PREFIX=%{_prefix} \
    ..
%make_build
cd ..
cd openmpi
cmake \
    -DBUILD_SHARED_LIBS=ON \
    -DCMAKE_DISABLE_FIND_PACKAGE_QuadMath=TRUE \
    -DMPI_C_COMPILER=%{_libdir}/mpi/gcc/openmpi4/bin/mpicc \
    -DCMAKE_INSTALL_PREFIX=%{_libdir}/mpi/gcc/openmpi4 \
    ..
%make_build
cd ..

%install
for build_dir in serial openmpi; do
  cd $build_dir
%make_install
  cd ..
done
find %{buildroot} -type f -name "*.la" -delete -print

%post -n libdunecommon -p /sbin/ldconfig
%postun -n libdunecommon -p /sbin/ldconfig
%post -n libdunecommon-openmpi -p /sbin/ldconfig
%postun -n libdunecommon-openmpi -p /sbin/ldconfig

%files
%license COPYING
%{_bindir}/*

%{_datadir}/dune-common
%{_mandir}/man1/*

%files -n libdunecommon
%{_libdir}/*.so

%files devel
%{_includedir}/*
%dir %{_datadir}/dune
%{_datadir}/dune/cmake/
%{_libdir}/cmake/
%{_libdir}/pkgconfig/*.pc
%{_prefix}/lib/dunecontrol
%{_prefix}/lib/dunemodules.lib
%{_datadir}/bash-completion/*
%dir %{_datadir}/bash-completion

%files openmpi
%license COPYING
%{_libdir}/mpi/gcc/openmpi4/bin/*
%{_libdir}/mpi/gcc/openmpi4/share/dune-common
%dir %{_libdir}/mpi/gcc/openmpi4/share/doc
%{_libdir}/mpi/gcc/openmpi4/share/bash-completion/*
%{_libdir}/mpi/gcc/openmpi4/share/doc/dune-common
%{_libdir}/mpi/gcc/openmpi4/share/man/man1
%{_libdir}/mpi/gcc/openmpi4/share/man/man1/*

%files -n libdunecommon-openmpi
%{_libdir}/mpi/gcc/openmpi4/%{_lib}/*.so

%files openmpi-devel
%{_libdir}/mpi/gcc/openmpi4/include/
%dir %{_libdir}/mpi/gcc/openmpi4/share/dune
%{_libdir}/mpi/gcc/openmpi4/share/dune/cmake/
%dir %{_libdir}/mpi/gcc/openmpi4/%{_lib}/
%{_libdir}/mpi/gcc/openmpi4/%{_lib}/cmake/
%dir %{_libdir}/mpi/gcc/openmpi4/%{_lib}/pkgconfig
%dir %{_libdir}/mpi/gcc/openmpi4/share/bash-completion
%{_libdir}/mpi/gcc/openmpi4/%{_lib}/pkgconfig/*.pc
%dir %{_libdir}/mpi/gcc/openmpi4/lib
%{_libdir}/mpi/gcc/openmpi4/lib/dunecontrol
%{_libdir}/mpi/gcc/openmpi4/lib/dunemodules.lib

%files doc
%license COPYING
%{_datadir}/doc/dune-common

%changelog
openSUSE Build Service is sponsored by