# # spec file for package libmesh # # 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/ # %global flavor @BUILD_FLAVOR@%{nil} %if !0%{?is_opensuse} && 0%{?sle_version:1} && 0%{?sle_version} < 150200 %define DisOMPI3 ExclusiveArch: do_not_build %endif %if !0%{?is_opensuse} && 0%{?sle_version:1} && 0%{?sle_version} < 150600 %define DisOMPI4 ExclusiveArch: do_not_build %endif %define sover_mesh 0 %define sover_timpi 5 %define sover_metaphysicl 8 %define mesh_version 1.7.6 %define timpi_version 1.2.1 %define metaphysicl_version 1.1.0 %define method opt %bcond_with petsc %bcond_without check %if "%{flavor}" == "" ExclusiveArch: do_not_build %endif %if "%{flavor}" == "serial" %bcond_with hpc %endif # this is a non-HPC build %if "%{flavor}" == "openmpi4" %{?DisOMPI4} %global mpi_flavor openmpi %define mpi_ver 4 %bcond_with hpc %endif %if "%{flavor}" == "openmpi5" %{?DisOMPI5} %global mpi_flavor openmpi %define mpi_ver 5 %bcond_with hpc %endif %{?mpi_flavor:%{bcond_without mpi}}%{!?mpi_flavor:%{bcond_with mpi}} %define mpi_ext %{?mpi_ver} %if %{with mpi} %global my_suffix -%{mpi_flavor}%{?mpi_ext} %define my_prefix %{_libdir}/mpi/gcc/%{mpi_flavor}%{?mpi_ext} %define my_bindir %{my_prefix}/bin %define my_datadir %{my_prefix}/share %define my_incdir %{my_prefix}/include %define my_libdir %{my_prefix}/%{_lib} %define my_sysconfdir %{my_prefix}/etc %else %define my_prefix %{_prefix} %define my_bindir %{_bindir} %define my_datadir %{_datadir} %define my_libdir %{_libdir} %define my_incdir %{_includedir} %define my_sysconfdir %{_sysconfdir} %endif %define libname(n:m:s:) lib%{-n*}%{-m:_%{-m*}}%{-s*}%{?my_suffix} Name: libmesh%{?my_suffix} Version: %{mesh_version} Release: 0 Summary: A framework for the numerical simulation of partial differential equations License: LGPL-2.1-only Group: Development/Libraries/C and C++ URL: https://libmesh.github.io/ Source0: https://github.com/libMesh/libmesh/releases/download/v%{mesh_version}/libmesh-%{mesh_version}.tar.xz Patch0: use_system_netcdf.patch BuildRequires: automake BuildRequires: blas-devel BuildRequires: libboost_headers-devel >= 1.57 BuildRequires: eigen3-devel BuildRequires: gcc-c++ BuildRequires: gcc-fortran BuildRequires: glpk-devel BuildRequires: hdf5%{?my_suffix}-devel BuildRequires: hwloc-devel BuildRequires: lapack-devel BuildRequires: libtool BuildRequires: nlopt-devel %if %{with mpi} BuildRequires: %{mpi_flavor}%{?mpi_ext}-devel BuildRequires: pastix%{my_suffix}-devel # libmesh insists on a MPI enabled VTK version, even when configured without MPI BuildRequires: vtk%{my_suffix}-devel %endif %if %{with petsc} BuildRequires: petsc%{?my_suffix}-devel %endif BuildRequires: pkgconfig BuildRequires: tbb-devel BuildRequires: libtirpc-devel BuildRequires: xz BuildRequires: zlib-devel BuildRequires: pkgconfig(netcdf) %description The libMesh library provides a framework for the numerical simulation of partial differential equations using arbitrary unstructured discretizations on serial and parallel platforms. A major goal of the library is to provide support for adaptive mesh refinement (AMR) computations in parallel while allowing a research scientist to focus on the physics they are modeling. %package -n %{libname -n mesh -m %{method} -s %{sover_mesh}} Summary: A framework for the numerical simulation of partial differential equations Group: System/Libraries %description -n %{libname -n mesh -m %{method} -s %{sover_mesh}} The libMesh library provides a framework for the numerical simulation of partial differential equations. %package -n %{libname -n timpi -m %{method} -s %{sover_timpi}} Summary: Templated Interface to MPI Group: System/Libraries Version: %{timpi_version} %description -n %{libname -n timpi -m %{method} -s %{sover_timpi}} The libMesh library provides a framework for the numerical simulation of partial differential equations. This package contains the TIMPI shared library. # TODO: libmesh allows external libmetaphysicl, split %package -n %{libname -n metaphysicl -s %{sover_metaphysicl}} Summary: Metaprogramming for numerical simulations Group: System/Libraries Version: %{metaphysicl_version} %description -n %{libname -n metaphysicl -s %{sover_metaphysicl}} The libMesh library provides a framework for the numerical simulation of partial differential equations. This package contains the metaphysicl shared library. %package devel Summary: Development files for %{name} Group: Development/Libraries/C and C++ Requires: %{libname -n mesh -m %{method} -s %{sover_mesh}} = %{mesh_version} Requires: %{libname -n timpi -m %{method} -s %{sover_timpi}} = %{timpi_version} Requires: %{libname -n metaphysicl -s %{sover_metaphysicl}} = %{metaphysicl_version} %description devel The %{name}-devel package contains libraries and header files for developing applications that use %{name}. %prep %setup -q -n libmesh-%{mesh_version} for d in boost eigen laspack triangle tetgen metis netcdf; do rm -R contrib/$d sed -i -e "s:AC_CONFIG_FILES.*contrib/$d.*::" m4/libmesh_optional_packages.m4 sed -i -e "s:SUBDIRS.*\s$d.*::" contrib/Makefile.am done %patch -P 0 -p1 sed -i -e "s:AC_CONFIG_FILES.*contrib/netcdf.*::" m4/netcdf.m4 %build autoreconf --install # Find all configure scripts and use something reproducible for the hostname/date # ac_hostname comes from system autoconf/general.m4 find . -iname \*configure -ls -exec sed -i \ -e '/uname -n/ s/hostname || uname -n/echo OBS/ ' \ -e "/date +/ s/date +/date -d@$SOURCE_DATE_EPOCH +/ " \ '{}' \; %if %{with petsc} export PETSC_DIR="$(echo %{my_libdir}/petsc/3.*/linux-gnu-c-opt)" %endif # clean up shipped *_config.h files - https://github.com/libMesh/libmesh/issues/3153 find . -iname \*_config.h -not -iname \*exodus_config.h -ls -delete mkdir build; pushd build %global _configure ../configure %configure \ USER=abuild \ --enable-strict-lgpl \ --disable-examples \ %{?with_petsc:--enable-petsc-required} \ %{?with_mpi:--enable-mpi} \ --prefix=%{my_prefix} \ --bindir=%{my_bindir} \ --libdir=%{my_libdir} \ --sysconfdir=%{my_sysconfdir} \ --disable-metis \ --enable-netcdf=system \ --disable-qhull \ --disable-parmetis \ --enable-hdf5 \ --with-hdf5=%{my_prefix} \ --with-methods="%{method}" \ --with-thread-model=auto %make_build # Build tests without running them %make_build check TESTS= %install pushd build make DESTDIR=%{buildroot} install # cleanup rm %{buildroot}/%{my_libdir}/pkgconfig/Make.common rm %{buildroot}/%{my_prefix}/Make.common rm -Rf %{buildroot}/%{my_prefix}/contrib rm -Rf %{buildroot}/%{_datadir}/reference_elements rm %{buildroot}/%{_includedir}/gzstream.h rm %{buildroot}/%{my_libdir}/*{.la,.a} rm -Rf %{buildroot}/%{my_sysconfdir}/libmesh %if "%{_bindir}" != "%{my_bindir}" mv %{buildroot}%{_bindir}/* %{buildroot}%{my_bindir} %endif find %{buildroot}/%{my_bindir} -type f -not \( -iname \*-config -o -iname \*_version\* \) -ls -delete # fix up *-config scripts and pkgconfig find %{buildroot}/%{my_bindir} -type f -iname \*-config -ls -exec \ sed -i -e 's@-Wl,-rpath,[^ ]* @@g' \ -e '/^builddir=/ d' \ '{}' \; \ -exec grep rpath '{}' \; find %{buildroot}/%{my_libdir}/pkgconfig -type f -iname \*.pc -ls -exec \ sed -i -e 's@-Wl,-rpath,[^ ]* @@g' \ '{}' \; \ -exec grep rpath '{}' \; %check %if %{with check} pushd build make %{?_smp_mflags} check %endif %post -n %{libname -n mesh -m %{method} -s %{sover_mesh}} -p /sbin/ldconfig %postun -n %{libname -n mesh -m %{method} -s %{sover_mesh}} -p /sbin/ldconfig %post -n %{libname -n timpi -m %{method} -s %{sover_timpi}} -p /sbin/ldconfig %postun -n %{libname -n timpi -m %{method} -s %{sover_timpi}} -p /sbin/ldconfig %post -n %{libname -n metaphysicl -s %{sover_metaphysicl}} -p /sbin/ldconfig %postun -n %{libname -n metaphysicl -s %{sover_metaphysicl}} -p /sbin/ldconfig %files -n %{libname -n mesh -m %{method} -s %{sover_mesh}} %{my_libdir}/libmesh*.so.* %files -n %{libname -n timpi -m %{method} -s %{sover_timpi}} %{my_libdir}/libtimpi*.so.* %files -n %{libname -n metaphysicl -s %{sover_metaphysicl}} %{my_libdir}/libmetaphysicl*.so.* %files devel %{my_bindir}/*-config %{my_bindir}/*_version{,-opt} %{my_incdir}/libmesh %{my_incdir}/timpi %{my_incdir}/metaphysicl %dir %{my_datadir}/aclocal %{my_datadir}/aclocal/* %{my_libdir}/*.so %{my_libdir}/pkgconfig/*.pc %changelog