File moab.spec of Package moab
#
# spec file for package moab
#
# Copyright (c) 2022 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 sover 5
# BitBucket unfortunately creates a versioned tarball with a SHA based dir name
%define git_hash e6a23a793c5f
%global flavor @BUILD_FLAVOR@%{nil}
%if "%flavor" == ""
ExclusiveArch: do_not_build
%endif
%if "%flavor" == "openmpi4"
%{?DisOMPI4}
%define mpi_family openmpi
%define mpi_ver 4
%endif
%if "%flavor" == "openmpi5"
%{?DisOMPI5}
%define mpi_family openmpi
%define mpi_ver 5
%endif
%if 0%{?mpi_family:1}
%{bcond_without mpi}
%else
%{bcond_with mpi}
%endif
%if %{with mpi}
%define my_prefix %{_libdir}/mpi/gcc/%{mpi_family}%{?mpi_ver}
%define my_bindir %{my_prefix}/bin
%define my_libdir %{my_prefix}/%{_lib}
%define my_includedir %{my_prefix}/include
%define my_datadir %{my_prefix}/share
%define my_docdir %{my_datadir}/doc/packages
%define my_mandir %{my_datadir}/man
%define libname libMOAB%{sover}-%{mpi_family}%{?mpi_ver}
%else
%define my_prefix %{_prefix}
%define my_bindir %{_bindir}
%define my_libdir %{_libdir}
%define my_includedir %{_includedir}
%define my_datadir %{_datadir}
%define my_docdir %{_docdir}
%define my_mandir %{_mandir}
%define libname libMOAB%{sover}
%endif
Name: moab%{?mpi_family:-%{mpi_family}%{?mpi_ver}}
Version: 5.4.0
Release: 0
Summary: A Mesh-Oriented datABase
License: LGPL-2.1
Group: Development/Libraries/C and C++
URL: https://sigma.mcs.anl.gov/moab-library/
Source0: https://bitbucket.org/fathomteam/moab/get/%{version}.tar.bz2#/moab-%{version}.tar.bz2
# PATCH-FIX-UPSTREAM
Patch0: 0001-Generate-moab.make-at-build-time-fix-location.patch
# PATCH-FIX-UPSTREAM https://bitbucket.org/fathomteam/moab/issues/161/libmoabso540-varies-from-build-machine-cpu
Patch1: reproducible.patch
BuildRequires: cmake
BuildRequires: eigen3-devel >= 3.2.0
BuildRequires: gcc-c++
BuildRequires: gcc-fortran
BuildRequires: openblas-devel
BuildRequires: zlib-devel
%if %{with mpi}
BuildRequires: %{mpi_family}%{?mpi_ver}-devel
BuildRequires: hdf5-%{mpi_family}%{?mpi_ver}-devel
%else
BuildRequires: hdf5-devel
BuildRequires: netcdf-devel
%endif
%description
MOAB is a component for representing and evaluating mesh data. MOAB can
store structured and unstructured mesh, consisting of elements in the
finite element "zoo" plus polygons and polyhedra. The functional interface
to MOAB is simple yet powerful, allowing the representation of many types
of metadata commonly found on the mesh. MOAB is optimized for efficiency
in space and time, based on access to mesh in chunks rather than through
individual entities, while also versatile enough to support individual
entity access.
%package -n %libname
Summary: A Mesh-Oriented datABase
Group: System/Libraries
%description -n %libname
MOAB is a component for representing and evaluating mesh data. MOAB can
store structured and unstructured mesh, consisting of elements in the
finite element "zoo" plus polygons and polyhedra. The functional interface
to MOAB is simple yet powerful, allowing the representation of many types
of metadata commonly found on the mesh. MOAB is optimized for efficiency
in space and time, based on access to mesh in chunks rather than through
individual entities, while also versatile enough to support individual
entity access.
%package devel
Summary: Development and header files for %{name}
Group: Development/Libraries/C and C++
Requires: %libname = %{version}
%description devel
This package contains the development and header files for %{name}.
%package examples
Summary: Code examples for %{name}
Group: Development/Libraries/C and C++
Requires: %{name}-devel = %{version}
BuildArch: noarch
%description examples
This package contains example code for %{name}.
%prep
%autosetup -n fathomteam-moab-%{git_hash} -p1
sed -i -e "s@DESTINATION lib/pkgconfig@DESTINATION %{_lib}/pkgconfig@" CMakeLists.txt
%build
%cmake \
-DCMAKE_INSTALL_PREFIX=%{my_prefix}
%cmake_build
%install
%cmake_install
# Contains not much useful info (not available from CMake or
# pkgconfig, but references the build directory
rm %{buildroot}/%{my_libdir}/moab.make
rm %{buildroot}/%{my_libdir}/iMesh-Defs.inc
mkdir -p %{buildroot}%{my_docdir}/
mv %{buildroot}%{my_datadir}/doc/moab %{buildroot}%{my_docdir}/%{name}
%if %{without mpi}
mkdir -p %{buildroot}%{_datadir}/%{name}/
mv %{buildroot}%{_datadir}/examples %{buildroot}%{_datadir}/%{name}/
%else
rm -Rf %{buildroot}%{my_datadir}/examples
%endif
%post -n %libname -p /sbin/ldconfig
%postun -n %libname -p /sbin/ldconfig
%files
%if %{with mpi}
%dir %{my_mandir}/man1
%endif
%{my_bindir}/*
%{my_mandir}/man1/*
%files -n %libname
%{my_libdir}/*.so.*
%files devel
%if %{with mpi}
%dir %{my_libdir}/cmake
%dir %{my_datadir}/doc
%dir %{my_docdir}
%endif
%{my_docdir}/%{name}
%{my_includedir}/*
%{my_libdir}/*.so
%{my_libdir}/cmake/MOAB
%{my_libdir}/pkgconfig/*.pc
%if %{without mpi}
%files examples
%{_datadir}/%{name}
%endif
%changelog