File dolfin.spec of Package dolfin
#
# spec file for package dolfin
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#
Name: dolfin
Version: 1.5.0
Release: 0
Summary: An open source CFD software
License: LGPL-3.0
Group: Development/Libraries/C and C++
Url: http://fenicsproject.org/
Source0: %{name}-%{version}.tar.gz
# PATCH-FIX-OPENSUSE dolfin-1.1.0-suitesparse.patch
Patch0: dolfin-1.1.0-suitesparse.patch
Patch1: cmake-prevent-double-underscore.patch
BuildRequires: Modules
BuildRequires: boost-devel
BuildRequires: cmake
BuildRequires: cppunit-devel
BuildRequires: eigen3-devel
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: gmp-devel
BuildRequires: hdf5-openmpi-devel
BuildRequires: java-devel
BuildRequires: lapack-devel
BuildRequires: libqt4-devel
BuildRequires: libQtWebKit-devel
BuildRequires: libxml2-devel
BuildRequires: openmpi-devel
BuildRequires: pastix-devel
BuildRequires: pastix-openmpi-devel
BuildRequires: petsc-devel
BuildRequires: petsc-openmpi-devel
BuildRequires: pkg-config
BuildRequires: ptscotch-openmpi-devel
BuildRequires: python-FFC
BuildRequires: python-FIAT
BuildRequires: python-sympy
BuildRequires: python-Sphinx
BuildRequires: python-devel
BuildRequires: python-instant
BuildRequires: python-numpy-devel
BuildRequires: python-ply
BuildRequires: python-ufl
BuildRequires: python-uflacs
BuildRequires: python-viper
BuildRequires: scotch-devel
BuildRequires: slepc-devel
BuildRequires: slepc-openmpi-devel
BuildRequires: suitesparse-devel
BuildRequires: swig >= 3.0
BuildRequires: texlive-latex
BuildRequires: ufc-devel
BuildRequires: vtk-devel
%if 0%{?suse_version} <= 1110
%{!?python_sitearch: %global python_sitearch %(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
dolphin is an open source CFD software (FLOW solvER, literally)
written in C++. It is mainly devoted to the resolution of the
turbulent unsteady incompressible Navier-Stokes equations.
%package -n libdolfin1_5
Summary: A package for solving large sparse systems of linear equations
Group: System/Libraries
%description -n libdolfin1_5
dolphin is an open source CFD software (FLOW solvER, literally)
written in C++. It is mainly devoted to the resolution of the
turbulent unsteady incompressible Navier-Stokes equations.
%package -n python-dolfin_utils
Summary: A package for solving large sparse systems of linear equations
Group: Development/Languages/Python
%if 0%{?suse_version} > 1110
BuildArch: noarch
Requires: python(abi) == %{py_ver}
%endif
%description -n python-dolfin_utils
dolphin is an open source CFD software (FLOW solvER, literally)
written in C++. It is mainly devoted to the resolution of the
turbulent unsteady incompressible Navier-Stokes equations.
%package -n python-dolfin
Summary: A package for solving large sparse systems of linear equations
Group: Development/Languages/Python
Requires: dolfin-devel = %{version}
Requires: python-FFC
Requires: python-FIAT
Requires: python-sympy
Requires: python-dolfin_utils
Requires: python-instant
Requires: python-ply
Requires: python-ufl
Requires: python-viper
%if 0%{?suse_version} > 1110
Requires: python(abi) == %{py_ver}
%endif
%description -n python-dolfin
dolphin is an open source CFD software (FLOW solvER, literally)
written in C++. It is mainly devoted to the resolution of the
turbulent unsteady incompressible Navier-Stokes equations.
%package devel
Summary: Development and header files for %{name}
Group: Development/Libraries/C and C++
Provides: pkgconfig(DOLFIN)
Requires: boost-devel
Requires: cmake
Requires: cppunit-devel
Requires: eigen3-devel
Requires: lapack-devel
Requires: libdolfin1_5 = %{version}
Requires: libxml2-devel
Requires: pastix-devel
Requires: petsc-devel
Requires: suitesparse-devel
Requires: ufc-devel
%description devel
The %{name}-devel package contains header files for developing
applications that use %{name}.
%package openmpi
Summary: Development and header files for %{name}
Group: Development/Libraries/C and C++
Requires: openmpi
%description openmpi
dolphin is an open source CFD software (FLOW solvER, literally)
written in C++. It is mainly devoted to the resolution of the
turbulent unsteady incompressible Navier-Stokes equations.
This package contains the dolfin binaries build with openmpi support.
%package openmpi-devel
Summary: Development and header files for %{name}
Group: Development/Libraries/C and C++
Provides: pkgconfig(DOLFIN)
Requires: boost-devel
Requires: cmake
Requires: cppunit-devel
Requires: eigen3-devel
Requires: lapack-devel
Requires: libdolfin1_5-openmpi = %{version}
Requires: libxml2-devel
Requires: openmpi-devel
Requires: pastix-openmpi-devel
Requires: petsc-openmpi-devel
Requires: ptscotch-openmpi-devel
Requires: suitesparse-devel
Requires: ufc-devel
%description openmpi-devel
The %{name}-openmpi-devel package contains header files for developing
applications that use %{name}-openmpi.
%package -n libdolfin1_5-openmpi
Summary: A package for solving large sparse systems of linear equations
Group: System/Libraries
%description -n libdolfin1_5-openmpi
dolphin is an open source CFD software (FLOW solvER, literally)
written in C++. It is mainly devoted to the resolution of the
turbulent unsteady incompressible Navier-Stokes equations.
%package -n python-dolfin_utils-openmpi
Summary: A package for solving large sparse systems of linear equations
Group: Development/Languages/Python
%if 0%{?suse_version} > 1110
Requires: python(abi) == %{py_ver}
%endif
%description -n python-dolfin_utils-openmpi
dolphin is an open source CFD software (FLOW solvER, literally)
written in C++. It is mainly devoted to the resolution of the
turbulent unsteady incompressible Navier-Stokes equations.
%package -n python-dolfin-openmpi
Summary: A package for solving large sparse systems of linear equations
Group: Development/Languages/Python
Requires: dolfin-openmpi-devel = %{version}
Requires: python-FFC
Requires: python-FIAT
Requires: python-sympy
Requires: python-dolfin_utils-openmpi
Requires: python-instant
Requires: python-ply
Requires: python-ufl
Requires: python-viper
%if 0%{?suse_version} > 1110
Requires: python(abi) == %{py_ver}
%endif
%description -n python-dolfin-openmpi
dolphin is an open source CFD software (FLOW solvER, literally)
written in C++. It is mainly devoted to the resolution of the
turbulent unsteady incompressible Navier-Stokes equations.
This package contains the python-dolfin module build with openmpi support.
%package doc
Summary: Documentation files for %{name}
Group: Documentation/HTML
%if 0%{?suse_version} > 1110
BuildArch: noarch
%endif
%description doc
The %{name}-doc package contains documentation files for developing
applications that use %{name}.
%prep
%setup -q
%patch0 -p1
%patch1 -p0
mkdir serial openmpi
%build
export CXXFLAGS="%{optflags} -fpermissive"
%define slepc_ver %(rpm -q slepc-devel --queryformat %%{VERSION})
%define petsc_ver %(rpm -q petsc-devel --queryformat %%{VERSION})
cd openmpi
cmake -DCMAKE_INSTALL_PREFIX=%{_libdir}/mpi/gcc/openmpi \
-DDOLFIN_LIB_DIR:PATH="%_lib" \
-DDOLFIN_PKGCONFIG_DIR:PATH="%_lib/pkgconfig" \
-DDOLFIN_ENABLE_MPI:BOOL=ON \
-DDOLFIN_ENABLE_PARMETIS:BOOL=OFF \
-DDOLFIN_ENABLE_PASTIX:BOOL=ON \
-DDOLFIN_ENABLE_SCOTCH:BOOL=ON \
-DDOLFIN_ENABLE_TRILINOS:BOOL=OFF \
-DHDF5_C_COMPILER_EXECUTABLE=%{_libdir}/mpi/gcc/openmpi/bin/h5pcc \
-DHDF5_CXX_COMPILER_EXECUTABLE=%{_libdir}/mpi/gcc/openmpi/bin/h5pcc \
-DHDF5_Fortran_COMPILER_EXECUTABLE=%{_libdir}/mpi/gcc/openmpi/bin/h5pfc \
-DHDF5_DIFF_EXECUTABLE=%{_libdir}/mpi/gcc/openmpi/bin/h5diff \
-DSCOTCH_LIBRARY=%{_libdir}/mpi/gcc/openmpi/%_lib/libscotch.so \
-DSCOTCH_INCLUDE_DIRS=%{_libdir}/mpi/gcc/openmpi/include \
-DPTSCOTCHERR_LIBRARY=%{_libdir}/mpi/gcc/openmpi/%_lib/libptscotcherr.so \
-DPTSCOTCH_LIBRARY=%{_libdir}/mpi/gcc/openmpi/%_lib/libptscotch.so \
-DPETSC_DIR=%{_libdir}/mpi/gcc/openmpi/%_lib/petsc/%{petsc_ver}/linux-gnu-c-opt \
-DSLEPC_DIR=%{_libdir}/mpi/gcc/openmpi/%_lib/slepc/%{slepc_ver}/linux-gnu-c-opt \
-DDOLFIN_SKIP_BUILD_TESTS:BOOL=ON \
..
make -j1
cd ..
cd serial
unset LD_LIBRARY_PATH
cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DDOLFIN_LIB_DIR:PATH="%_lib" \
-DDOLFIN_PKGCONFIG_DIR:PATH="%_lib/pkgconfig" \
-DDOLFIN_ENABLE_HDF5:BOOL=ON \
-DDOLFIN_ENABLE_MPI:BOOL=OFF \
-DDOLFIN_ENABLE_PARMETIS:BOOL=OFF \
-DDOLFIN_ENABLE_PASTIX:BOOL=ON \
-DDOLFIN_ENABLE_SCOTCH:BOOL=ON \
-DDOLFIN_ENABLE_TRILINOS:BOOL=OFF \
-DPETSC_DIR=%{_libdir}/petsc/%{petsc_ver}/linux-gnu-c-opt \
-DSLEPC_DIR=%{_libdir}/slepc/%{slepc_ver}/linux-gnu-c-opt \
-DDOLFIN_SKIP_BUILD_TESTS:BOOL=ON \
..
make
make -j1
cd ..
%install
cd openmpi
make install DESTDIR=%{buildroot}
# remove RPM_BUILD_ROOT in some .pyc files
pushd %{buildroot}%{_libdir}/mpi/gcc/openmpi/lib/python%{py_ver}/site-packages/dolfin_utils
%py_compile .
popd
pushd %{buildroot}%{_libdir}/mpi/gcc/openmpi/%_lib/python%{py_ver}/site-packages/dolfin
%py_compile .
popd
%fdupes -s %{buildroot}%{_libdir}/mpi/gcc/openmpi/share/%{name}
cd ..
cd serial
unset LD_LIBRARY_PATH
make install DESTDIR=%{buildroot}
# remove RPM_BUILD_ROOT in some .pyc files
pushd %{buildroot}%{python_sitelib}/dolfin_utils
%py_compile .
popd
pushd %{buildroot}%{python_sitearch}/dolfin
%py_compile .
popd
export PYTHONPATH=%{buildroot}%{python_sitelib}:%{buildroot}%{python_sitearch}
export LD_LIBRARY_PATH=%{buildroot}%{_libdir}
python -c "import dolfin"
make doc
mkdir -p %{buildroot}%{_docdir}/%{name}
cp -ar doc/sphinx-cpp/build/html %{buildroot}%{_docdir}/%{name}/cpp-html
cp -ar doc/sphinx-python/build/html %{buildroot}%{_docdir}/%{name}/python-html
%fdupes -s %{buildroot}%{_datadir}/%{name}
%fdupes -s %{buildroot}%{_docdir}/%{name}
cd ..
%post -n libdolfin1_5 -p /sbin/ldconfig
%postun -n libdolfin1_5 -p /sbin/ldconfig
%post -n libdolfin1_5-openmpi -p /sbin/ldconfig
%postun -n libdolfin1_5-openmpi -p /sbin/ldconfig
%files
%defattr(-,root,root)
%{_bindir}/*
%{_mandir}/man1/*
%files -n python-dolfin_utils
%defattr(-,root,root)
%{python_sitelib}/dolfin_utils
%files -n python-dolfin
%defattr(-,root,root)
%{python_sitearch}/dolfin
%{python_sitearch}/fenics
%files -n libdolfin1_5
%defattr(-,root,root)
%doc AUTHORS ChangeLog COPYING COPYING.LESSER README.rst
%{_libdir}/*.so.*
%files devel
%defattr(-,root,root)
%{_includedir}/*
%{_libdir}/*.so
%{_datadir}/%{name}
%{_prefix}/%_lib/pkgconfig/*.pc
%files openmpi
%defattr(-,root,root)
%{_libdir}/mpi/gcc/openmpi/bin/*
%{_libdir}/mpi/gcc/openmpi/share/man/man1/*
%files -n python-dolfin_utils-openmpi
%defattr(-,root,root)
%ifarch ia64 x86_64 ppc64
%dir %{_libdir}/mpi/gcc/openmpi/lib
%endif
%dir %{_libdir}/mpi/gcc/openmpi/lib/python%{py_ver}
%dir %{_libdir}/mpi/gcc/openmpi/lib/python%{py_ver}/site-packages
%{_libdir}/mpi/gcc/openmpi/lib/python%{py_ver}/site-packages/dolfin_utils
%files -n python-dolfin-openmpi
%defattr(-,root,root)
%dir %{_libdir}/mpi/gcc/openmpi/%_lib/python%{py_ver}
%dir %{_libdir}/mpi/gcc/openmpi/%_lib/python%{py_ver}/site-packages
%{_libdir}/mpi/gcc/openmpi/%_lib/python%{py_ver}/site-packages/dolfin
%{_libdir}/mpi/gcc/openmpi/%_lib/python%{py_ver}/site-packages/fenics
%files -n libdolfin1_5-openmpi
%defattr(-,root,root)
%doc AUTHORS ChangeLog COPYING COPYING.LESSER README.rst
%{_libdir}/mpi/gcc/openmpi/%_lib/*.so.*
%files openmpi-devel
%defattr(-,root,root)
%ifarch ia64 x86_64 ppc64
%dir %{_libdir}/mpi/gcc/openmpi/lib
%endif
%dir %{_libdir}/mpi/gcc/openmpi/%_lib/pkgconfig
%{_libdir}/mpi/gcc/openmpi/include/*
%{_libdir}/mpi/gcc/openmpi/%_lib/*.so
%{_libdir}/mpi/gcc/openmpi/share/%{name}
%{_libdir}/mpi/gcc/openmpi/%_lib/pkgconfig/*.pc
%files doc
%defattr(-,root,root)
%{_docdir}/%{name}
%changelog