# Copyright (c) 2014 Dave Love, University of Liverpool
# Licence as for the package itself
# fixme:
# * make desktop file, per Debian
# * Use petsc
# * freesteam? -- being packaged
# Also coolprop?
# * What's CALCIUM that configure warns about missing?
# * configure against salome, syrthes (see Debian), when they're available
# * unbundle ple library?
# * package which avoids graphics requirements for use on compute node
# * Support python2/3. Packaging guide not clear on how to do it with
# the below
%if 0%{?rhel} && 0%{?rhel} <= 6
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%endif
# cgnslib in EPEL6 isn't recent enough
%if 0%{?el6}
%bcond_with cgns
%else
%bcond_without cgns
%endif
%bcond_without mpich
%global _performance_build 1
Name: code_saturne
Version: 5.0.10
Release: 1%{?dist}
Summary: General purpose Computational Fluid Dynamics (CFD) software
License: GPLv2+
Url: http://code-saturne.org
Source0: http://code-saturne.org/cms/sites/default/files/releases/%{name}-%{version}.tar.gz
# from http://sources.debian.net/data/main/c/code-saturne/3.2.2-1/debian/ple-config.1
Source1: ple-config.1
# for desktop file
Source2: %{name}.png
BuildRequires: PyQt4-devel openblas-devel
BuildRequires: gcc-gfortran chrpath hdf5-devel
BuildRequires: med-devel >= 3.0 libxml2-devel zlib-devel sip-devel bzip2-devel
%if %{with cgns}
BuildRequires: cgnslib-devel >= 3.1
%endif
# requires salome? fails to find SALOME_Component.idl, SALOMEDS.idl anyhow
#BuildRequires: omniORB-devel
# Awaiting packaging
#BuildRequires: syrthes
%if %{with cgns}
%global withcgns --with-cgns
%else
%global withcgns %nil
%endif
%global desc \
Code_Saturne solves the Navier-Stokes equations for 2D,\
2D-axisymmetric and 3D flows, steady or unsteady, laminar or\
turbulent, incompressible or weakly dilatable, isothermal or not, with\
scalars transport if required.\
\
Several turbulence models are available, from Reynolds-Averaged models\
to Large-Eddy Simulation models. In addition, a number of specific\
physical models are also available as "modules": gas, coal and\
heavy-fuel oil combustion, semi-transparent radiative transfer,\
particle-tracking with Lagrangian modeling, Joule effect, electrics\
arcs, weakly compressible flows, atmospheric flows, rotor/stator\
interaction for hydraulic machines.
%description
%desc
%package openmpi
Summary: General purpose Computational Fluid Dynamics (CFD) software - openmpi version
BuildRequires: openmpi-devel ptscotch-openmpi-devel
Requires: openmpi%{?_isa} %{name}-common = %{version}-%{release}
%description openmpi
%desc
This package uses openmpi.
%package openmpi-devel
Summary: Development files for %{name}
Requires: %{name}-openmpi%{?_isa} = %{version}-%{release}
%description openmpi-devel
This package contains the development files for %{name}.
%if %{with mpich}
%package mpich
Summary: General purpose Computational Fluid Dynamics (CFD) software - mpich version
BuildRequires: mpich-devel ptscotch-mpich-devel
Requires: mpich%{?_isa} %{name}-common = %{version}-%{release}
%description mpich
%desc
This package uses mpich.
%package mpich-devel
Summary: Development files for %{name}
Requires: %{name}-mpich%{?_isa} = %{version}-%{release}
%description mpich-devel
This package contains the development files for %{name}.
%endif
%package common
Summary: Development files for %{name}
BuildArch: noarch
Requires: PyQt4
%description common
This package contains the common files for %{name}.
%package doc
Summary: Documentation files for %{name}
BuildArch: noarch
%description doc
This package contains the documentation files for %{name}.
%prep
%setup -q
%build
%global _configure ../configure
# It needs all the options spelt out. Has warning about strict
# aliasing for ecs_pre_ens.c, which probably doesn't need
# -fno-strict-aliasing.
# -lbz2 needed for scotch
%global do_build \
%configure --with-scotch --with-ptscotch --bindir=$MPI_BIN \\\
--includedir=$MPI_INCLUDE --libdir=$MPI_LIB --libexecdir=$MPI_LIB \\\
--with-hdf5 %withcgns \\\
--with-blas --with-blas-libs=-lopenblas \\\
--with-blas-include=%_includedir/openblas \\\
--without-salome --with-modules=openmpi-%arch LIBS=-lbz2 \\\
CC=mpicc \
make %{?_smp_mflags}
mkdir openmpi mpich
pushd openmpi
%_openmpi_load
%do_build
%_openmpi_unload
popd
%if %{with mpich}
pushd mpich
%_mpich_load
%do_build
%_mpich_unload
popd
%endif
%install
%_openmpi_load
make -C openmpi install DESTDIR=$RPM_BUILD_ROOT
%_openmpi_unload
%if %{with mpich}
%_mpich_load
make -C mpich install DESTDIR=$RPM_BUILD_ROOT
%_mpich_unload
%endif
install -m644 -D %{S:1} $RPM_BUILD_ROOT/%{_datadir}/pixmaps/%{name}.png
rm -f $RPM_BUILD_ROOT/usr/share/%name/COPYING
find $RPM_BUILD_ROOT%_libdir/ -type f -name '*.la' -exec rm {} \;
# The two steps are necessary so that $RPM_BUILD_ROOT isn't found in
# cs_solver by rpm check -- chrpath -d doesn't actually remove the
# RPATH string. Expurgating -rpath looks non-trivial.
chrpath -r %_libdir $RPM_BUILD_ROOT%_libdir/openmpi/lib/%name/cs_solver
chrpath --delete $RPM_BUILD_ROOT%_libdir/openmpi/lib/%name/cs_solver
chrpath --delete $RPM_BUILD_ROOT%{_libdir}/openmpi/lib/*.so.*
%if %{with mpich}
chrpath -r %_libdir $RPM_BUILD_ROOT%_libdir/mpich/lib/%name/cs_solver
chrpath --delete $RPM_BUILD_ROOT%_libdir/mpich/lib/%name/cs_solver
chrpath --delete $RPM_BUILD_ROOT%{_libdir}/mpich/lib/*.so.*
%endif
chmod +x $RPM_BUILD_ROOT%python_sitelib/%name/cs_{case_coupling,case_domain,case,compile,create,exec_environment,info,run,salome,script,xml_reader}.py
chmod +x $RPM_BUILD_ROOT%_datadir/%name/cs_user_scripts.py
install -m 644 -D %SOURCE1 $RPM_BUILD_ROOT%_mandir/man1/ple-config.1
cp -r examples $RPM_BUILD_ROOT%_datadir/%name/doc
%find_lang %name --all-name
%files common -f %name.lang
%doc AUTHORS NEWS COPYING README QUALITY_ASSURANCE
%exclude %{_datadir}/%name/user*
%{_datadir}/%name
# owned, per packaging guidelines
%{_sysconfdir}/bash_completion.d
%config(noreplace) %{_sysconfdir}/%name.cfg.template
%{python_sitelib}/%name
%{_datadir}/pixmaps/%{name}.png
%files openmpi -f %name.lang
%exclude %{_datadir}/doc/%{name}
%{_libdir}/openmpi/bin/%name
%{_libdir}/openmpi/lib/*.so.*
%{_libdir}/openmpi/lib/%name
%files openmpi-devel
%{_libdir}/openmpi/lib/*.so
%{_libdir}/openmpi/bin/ple-config
%{_mandir}/man1/ple-config.*
%{_includedir}/openmpi*/*
%{_datadir}/%name/user*
%if %{with mpich}
%files mpich -f %name.lang
%exclude %{_datadir}/doc/%{name}
%{_libdir}/mpich/bin/%name
%{_libdir}/mpich/lib/*.so.*
%{_libdir}/mpich/lib/%name
%files mpich-devel
%{_libdir}/mpich/lib/*.so
%{_libdir}/mpich/bin/ple-config
%{_mandir}/man1/ple-config.*
%{_includedir}/mpich*/*
%{_datadir}/%name/user*
%endif
%files doc
%{_datadir}/doc/%{name}
%_mandir/man1/%{name}*
%changelog
* Tue Aug 20 2019 Dave Love - 5.0.10-1
- New version
* Mon Jan 21 2019 Dave Love - 5.0.9-1
- New version
- Use ptscotch
* Wed Aug 24 2016 Dave Love - 4.3.0-1
- New version
- Remove buildroot and clean stanza, assuming el6+
- Fix up lang-processing to cover ple
* Thu Jul 21 2016 Dave Love - 4.0.5-1
- New version
* Sat Jun 6 2015 Dave Love - 4.0.1-1
- New version
- Drop patch
- .a files no longer built
* Sat Jan 3 2015 Dave Love - 3.3.0-3
- Update for RHEL6.6 mpich
- Make cgns conditional
* Fri Jun 20 2014 Dave Love - 3.3.0-2
- Ship examples
- Add ple-config.1
- Don't require grace
* Thu Jun 12 2014 Dave Love - 3.3.0-1
- Update to version 3.3.0
- Move libs to openmpi hierarchy
* Thu Jun 12 2014 Dave Love - 3.2.2-1
- Make doc package noarch
- Make common package
- Exclude user* from main package
- Don't make bash_completion file config
* Thu May 8 2014 Dave Love - 3.2.2-1
- Update version
* Tue Feb 18 2014 Dave Love - 3.2.1-2
- Add sip build-dep
- Modify MPI configuration
- Add %dist to version
* Mon Feb 17 2014 Dave Love - 3.2.1-1
- Initial Fedora packaging, partly based on OpenSuSE and Debian