File mshr.spec of Package mshr

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

# Bindings have been changed to pybind11, recheck
%bcond_with python

%define lib_name  libmshr2019_1

Name:           mshr
Version:        2019.1.0
Release:        0
Summary:        The mesh generation component of FEniCS
License:        GPL-3.0-or-later
Group:          Development/Libraries/C and C++
URL:            https://bitbucket.org/fenics-project/mshr
Source:         https://bitbucket.org/fenics-project/%{name}/downloads/%{name}-%{version}.tar.gz
# PATCH-FIX-UPSTREAM -- https://bitbucket.org/fenics-project/mshr/issues/92/mshr-build-fails-against-external-cgal-414
Patch0:         0001-fix-build-against-CGAL-4.14.patch
# PATCH-FIX-UPSTREAM -- https://bitbucket.org/fenics-project/mshr/issues/98/mshr-build-fails-against-external-cgal-413
Patch1:         0002-Fix-build-with-CGAL-4.13-and-later.patch
# PATCH-FIX-UPSTREAM -- https://bitbucket.org/fenics-project/mshr/issues/99/mshrable-should-always-call-dolfin
Patch2:         0001-Always-call-dolfin-SubSystemsManager-init_mpi.patch
BuildRequires:  libboost_chrono-devel
BuildRequires:  libboost_filesystem-devel
BuildRequires:  libboost_program_options-devel
BuildRequires:  libboost_system-devel
BuildRequires:  libboost_timer-devel
BuildRequires:  cgal-devel >= 4.12
#!BuildConflicts:  cgal-devel >= 5
BuildRequires:  cmake
BuildRequires:  dolfin-devel = %{version}
BuildRequires:  eigen3-devel >= 3.1.0
BuildRequires:  gcc-c++
BuildRequires:  gmp-devel
BuildRequires:  hdf5-devel
BuildRequires:  libstdc++-devel
BuildRequires:  mpfr-devel
BuildRequires:  tetgen-devel
BuildRequires:  ufc-devel
%if %{with python}
BuildRequires:  python3-dolfin = %{version}
BuildRequires:  python3-numpy
BuildRequires:  python3-pybind11
%endif

%description
mshr is the mesh generation component of FEniCS. It generates simplicial
DOLFIN meshes in 2D and 3D from geometries described by Constructive Solid
Geometry (CSG) or from surface files, utilizing CGAL and Tetgen as mesh
generation backends.

%package devel
Summary:        Development and header files for %{name}
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}
Requires:       dolfin-devel = %{version}
Requires:       gmp-devel
Requires:       mpfr-devel

%description devel
The %{name}-devel package contains header files for developing
applications that use %{name}.


%package -n python3-mshr
Summary:        Python bindings for %{name} to generate meshes for FEniCS
Group:          Development/Libraries/Python
Requires:       python3-dolfin = %{version}
Requires:       python3-numpy
Provides:       python3-mshr = %{version}
Obsoletes:      python3-mshr < %{version}

%description -n python3-mshr
The python bindings for the mshr package that generates simplical meshes
for DOLFIN in 2D and 3D from geometries described by Constructive Solid
Geometry (CSG) or from surface files, utilizing CGAL and Tetgen as mesh
generation backends.

%package -n %{lib_name}
Summary:        The mesh generation component of FEniCS
Group:          System/Libraries

%description -n %{lib_name}
mshr is the mesh generation component of FEniCS. It generates simplicial
DOLFIN meshes in 2D and 3D from geometries described by Constructive Solid
Geometry (CSG) or from surface files, utilizing CGAL and Tetgen as mesh
generation backends.

%package demos
Summary:        Demo programs for the mshr mesh generator in FEniCS
Group:          Documentation/Other

%description demos
Examples and demo programs for mshr

mshr generates simplicial DOLFIN meshes in 2D and 3D from geometries
described by Constructive Solid Geometry (CSG) or from surface files,
utilizing CGAL and Tetgen as mesh generation backends.

%prep
%setup -q -n %{name}-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
rm -Rf 3rdparty/*/*
sed -i 's/\r//g' README.rst

%build
%cmake \
       -DINSTALL_LIB_DIR:PATH=%{_libdir} \
       -DINSTALL_CMAKE_DIR:PATH=%{_libdir}/cmake \
       -DUSE_SYSTEM_CGAL:BOOL=ON \
       -DUSE_SYSTEM_TETGEN:BOOL=ON \
       -DENABLE_MSHRABLE:BOOL=ON \
       ..
%cmake_build

%install
%cmake_install

mkdir -p %{buildroot}/%{_datadir}/%{name}
cp -a demo %{buildroot}/%{_datadir}/%{name}/

# Fixup cmake install dir
mkdir -p %{buildroot}%{_libdir}/cmake/
mv %{buildroot}%{_prefix}/share/mshr/cmake %{buildroot}%{_libdir}/cmake/mshr

%post -n %{lib_name} -p /sbin/ldconfig

%postun -n %{lib_name} -p /sbin/ldconfig

%files -n %{lib_name}
%license COPYING
%doc ChangeLog.rst README.rst
%{_libdir}/*.so.*

%files devel
%{_libdir}/*.so
%{_includedir}/mshr
%{_includedir}/mshr.h
%dir %{_libdir}/cmake
%{_libdir}/cmake/*

%files
%{_bindir}/mshrable

%if %{with python}
%files -n python3-mshr
%{python3_sitearch}/mshr.py
%{python3_sitearch}/_mshr.so
%endif

%files demos
%dir %{_datadir}/mshr
%{_datadir}/mshr/demo

%changelog
openSUSE Build Service is sponsored by