File dune-grid.spec of Package dune-grid

#
# spec file for package dune-grid
#
# 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.9
Name:           dune-grid
Version:        2.9.1
Release:        0
Summary:        Grid management module for DUNE
License:        GPL-2.0-only
Group:          Development/Libraries/C and C++
URL:            https://www.dune-project.org/
Source0:        https://www.dune-project.org/download/%{version}/%{name}-%{version}.tar.gz
BuildRequires:  Mesa-devel
BuildRequires:  Vc-devel
BuildRequires:  Vc-devel-static
BuildRequires:  cmake >= 3.13
BuildRequires:  dune-common-devel = %{version}
BuildRequires:  dune-common-openmpi-devel = %{version}
BuildRequires:  dune-geometry-devel = %{version}
BuildRequires:  dune-geometry-openmpi-devel = %{version}
BuildRequires:  dune-uggrid-devel = %{version}
BuildRequires:  dune-uggrid-openmpi-devel = %{version}
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  gcc-fortran
BuildRequires:  pkgconfig
BuildRequires:  tbb-devel
Requires:       dune-common = %{version}
Requires:       dune-geometry = %{version}
Requires:       dune-uggrid = %{version}
Requires:       libdunegrid = %{version}

%description
dune-grid defines nonconforming, hierarchically nested, multi-element-type,
parallel grids in arbitrary space dimensions. Graphical output with several
packages is available, e.g. file output to IBM data explorer and VTK (parallel
XML format for unstructured grids). The graphics package Grape has been integrated
in interactive mode. This module also provides some grid implementations and
further grid managers can be added through seprate modules.

%package -n libdunegrid
Summary:        Grid management module for DUNE
Group:          System/Libraries

%description -n libdunegrid
dune-grid defines nonconforming, hierarchically nested, multi-element-type,
parallel grids in arbitrary space dimensions. Graphical output with several
packages is available, e.g. file output to IBM data explorer and VTK (parallel
XML format for unstructured grids). The graphics package Grape has been integrated
in interactive mode. This module also provides some grid implementations and
further grid managers can be added through separate modules.

%package devel
Summary:        Development and header files for %{name}
Group:          Development/Libraries/C and C++
BuildRequires:  dune-geometry-openmpi-devel
BuildRequires:  dune-uggrid-openmpi-devel
Requires:       %{name} = %{version}
Requires:       Mesa-devel
Requires:       dune-common-devel = %{version}
Requires:       dune-geometry-devel = %{version}
Requires:       dune-uggrid-devel = %{version}
Requires:       libdunegrid = %{version}

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

%package openmpi
Summary:        Grid management module for DUNE
Group:          Development/Libraries/C and C++
Requires:       dune-common-openmpi = %{version}
Requires:       dune-geometry-openmpi = %{version}
Requires:       dune-uggrid-openmpi = %{version}
Requires:       libdunegrid-openmpi = %{version}

%description openmpi
dune-grid defines nonconformi-openmping, hierarchically nested, multi-element-type,
parallel grids in arbitrary space dimensions. Graphical output with several
packages is available, e.g. file output to IBM data explorer and VTK (parallel
XML format for unstructured grids). The graphics package Grape has been integrated
in interactive mode. This module also provides some grid implementations and
further grid managers can be added through separate modules.

%package -n libdunegrid-openmpi
Summary:        Grid management module for DUNE
Group:          System/Libraries

%description -n libdunegrid-openmpi
dune-grid defines nonconformi-openmping, hierarchically nested, multi-element-type,
parallel grids in arbitrary space dimensions. Graphical output with several
packages is available, e.g. file output to IBM data explorer and VTK (parallel
XML format for unstructured grids). The graphics package Grape has been integrated
in interactive mode. This module also provides some grid implementations and
further grid managers can be added through separate modules.

%package openmpi-devel
Summary:        Development and header files for %{name}
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}
Requires:       %{name}-openmpi = %{version}
Requires:       Mesa-devel
Requires:       dune-common-openmpi-devel = %{version}
Requires:       dune-geometry-openmpi-devel = %{version}
Requires:       dune-uggrid-openmpi-devel = %{version}
Requires:       libdunegrid-openmpi = %{version}

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

%prep
%setup -q

mkdir serial openmpi

%build
cd serial
# FIXME: you should use the %%cmake macros
cmake \
    -DCMAKE_DISABLE_FIND_PACKAGE_MPI=TRUE \
    -DBUILD_SHARED_LIBS=ON \
    -DCMAKE_INSTALL_PREFIX=%{_prefix} \
    ..
%make_build
cd ..

cd openmpi
# FIXME: you should use the %%cmake macros
cmake \
    -DBUILD_SHARED_LIBS=ON \
    -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

%fdupes -s %{buildroot}%{_includedir}
%fdupes -s %{buildroot}%{_libdir}/mpi/gcc/openmpi4/include

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

%files
%license COPYING
%doc README.md
%{_prefix}/lib/dunecontrol/%{name}
%{_datadir}/doc/%{name}

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

%files devel
%{_includedir}/dune/*
%dir %{_datadir}/dune
%{_datadir}/dune/cmake/
%{_datadir}/%{name}/
%{_libdir}/cmake/
%{_libdir}/pkgconfig/*.pc

%files openmpi
%license COPYING
%doc README.md
%{_libdir}/mpi/gcc/openmpi4/share/doc/%{name}
%dir %{_libdir}/mpi/gcc/openmpi4/lib/dunecontrol/%{name}
%{_libdir}/mpi/gcc/openmpi4/lib/dunecontrol/%{name}/dune.module

%files -n libdunegrid-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/
%{_libdir}/mpi/gcc/openmpi4/share/%{name}/
%dir %{_libdir}/mpi/gcc/openmpi4/lib
%{_libdir}/mpi/gcc/openmpi4/%{_lib}/cmake
%dir %{_libdir}/mpi/gcc/openmpi4/%{_lib}/pkgconfig
%{_libdir}/mpi/gcc/openmpi4/%{_lib}/pkgconfig/*.pc

%changelog
openSUSE Build Service is sponsored by