# Decide which MPI versions to build %global with_mpich2 1 %global with_openmpi 1 # Do we want to build docs? Note that document building requires with_openmpi %global build_doc 1 # No mpich2 on ppc64 in EL %if 0%{?rhel} %ifarch ppc64 %global with_mpich2 0 %endif %endif # No openmpi on s390(x) %ifarch s390 s390x %global with_openmpi 0 %endif %if %{with_mpich2} %global mpi_list mpich2 %endif %if %{with_openmpi} %global mpi_list %{?mpi_list} openmpi %endif Name: dolfin Version: 1.0.0 Release: 0.3%{?dist} Summary: DOLFIN is the C++/Python interface of FEniCS Group: Applications/Engineering License: LGPLv3 URL: http://fenicsproject.org Source0: https://launchpad.net/dolfin/1.0.x/%{version}/+download/%{name}-%{version}.tar.gz # Fixes incorrect paths in the dolfin-config.cmake file # https://bugs.launchpad.net/dolfin/+bug/1000191 Patch0: dolfin-1.0.0-fix-dolfin-config.cmake.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %if 0%{?rhel} && (0%{?rhel} <= 6) BuildRequires: cmake28 %else BuildRequires: cmake %endif BuildRequires: boost-devel BuildRequires: boost-math BuildRequires: python-ufc BuildRequires: armadillo-devel BuildRequires: libxml2-devel BuildRequires: python-devel BuildRequires: numpy BuildRequires: suitesparse-devel BuildRequires: python-sphinx # Needed for building the documentation: BuildRequires: python-ufl BuildRequires: python-ufc BuildRequires: python-instant BuildRequires: python-ffc BuildRequires: python-fiat BuildRequires: python-viper Requires: numpy Requires: python-ufc Requires: python-ufl Requires: python-instant Requires: python-ffc Requires: python-fiat Requires: python-viper %description DOLFIN is the C++/Python interface of FEniCS, providing a consistent PSE (Problem Solving Environment) for ordinary and partial differential equations. %package devel Summary: Development files for DOLFIN Group: Applications/Engineering Requires: %{name}%{?_isa} = %{version}-%{release} Requires: boost-devel Requires: suitesparse-devel Requires: libxml2-devel Requires: armadillo-devel %description devel This package contains development files for DOLFIN %if %{with_openmpi} %package openmpi Summary: DOLFIN runtime with OpenMPI support Group: Applications/Engineering Requires: %{name} = %{version}-%{release} BuildRequires: openmpi-devel boost-openmpi-devel %description openmpi This package contains DOLFIN compiled with OpenMPI support %package openmpi-devel Summary: Development files for DOLFIN with OpenMPI support Group: Applications/Engineering Requires: %{name}-openmpi%{?_isa} = %{version}-%{release} Requires: boost-devel Requires: boost-openmpi-devel Requires: suitesparse-devel Requires: libxml2-devel Requires: armadillo-devel %description openmpi-devel This package contains development files for DOLFIN with OpenMPI support %if %{build_doc} %package doc Summary: Documentation for DOLFIN and FEniCS components Group: Applications/Engineering %description doc This package contains extensive documentation for DOLFIN and the FEniCS components %endif %endif %if %{with_mpich2} %package mpich2 Summary: DOLFIN runtime with MPICH2 support Group: Applications/Engineering Requires: %{name} = %{version}-%{release} BuildRequires: mpich2-devel boost-mpich2-devel %description mpich2 This package contains DOLFIN compiled with MPICH2 support %package mpich2-devel Summary: Development files for DOLFIN with MPICH2 support Group: Applications/Engineering Requires: %{name}-mpich2%{?_isa} = %{version}-%{release} Requires: boost-devel Requires: boost-mpich2-devel Requires: suitesparse-devel Requires: libxml2-devel Requires: armadillo-devel %description mpich2-devel This package contains development files for DOLFIN with MPICH2 support %endif %prep %setup -q %patch0 -p1 -b .fix-dolfin-config.cmake %build %if 0%{?rhel} && (0%{?rhel} <= 6) %global cmake_do %%cmake28 %global cmake_cmd cmake28 %else %global cmake_do %%cmake %global cmake_cmd cmake %endif mkdir serial pushd serial %cmake_do -DDOLFIN_ENABLE_MPI=off \ -DDOLFIN_INSTALL_PYTHON_MODULE_DIR=%{python_sitelib} \ -DDOLFIN_INSTALL_PYTHON_EXT_DIR=%{python_sitearch} \ -DDOLFIN_BIN_DIR=%{_bindir} \ -DDOLFIN_LIB_DIR=%{_libdir} \ -DDOLFIN_INCLUDE_DIR=%{_includedir} \ -DDOLFIN_PKGCONFIG_DIR=%{_libdir}/pkgconfig \ -DDOLFIN_SHARE_DIR=%{_datadir}/dolfin \ -DDOLFIN_MAN_DIR=%{_mandir} \ .. make %{?_smp_mflags} popd # Build parallel versions: set compiler variables to MPI wrappers export CC=mpicc export CXX=mpicxx export FC=mpif90 export F77=mpif77 for mpi in %{?mpi_list} ; do mkdir $mpi pushd $mpi module load $mpi-%{_arch} export BOOST_LIBRARYDIR=%{_libdir}:$MPI_LIB %cmake_cmd -DDOLFIN_INSTALL_PYTHON_MODULE_DIR=%{python_sitelib}/$mpi \ -DDOLFIN_INSTALL_PYTHON_PURE_MODULE_DIR=%{python_sitelib}/$mpi \ -DDOLFIN_INSTALL_PYTHON_EXT_DIR=$MPI_PYTHON_SITEARCH \ -DDOLFIN_BIN_DIR=$MPI_BIN \ -DDOLFIN_LIB_DIR=$MPI_LIB \ -DDOLFIN_INCLUDE_DIR=$MPI_INCLUDE \ -DDOLFIN_PKGCONFIG_DIR=$MPI_LIB/pkgconfig \ -DDOLFIN_SHARE_DIR=$MPI_HOME/share/dolfin \ -DDOLFIN_MAN_DIR=$MPI_MAN \ -DDOLFIN_DOC_DIR=%{_docdir}/%{name}-doc-%{version} \ -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \ -DCMAKE_INSTALL_LIBDIR:PATH=$MPI_LIB \ -DINCLUDE_INSTALL_DIR:PATH=$MPI_INCLUDE \ -DLIB_INSTALL_DIR:PATH=$MPI_LIB \ -DSYSCONF_INSTALL_DIR:PATH=$MPI_SYSCONFIG \ -DSHARE_INSTALL_PREFIX:PATH=$MPI_HOME/share \ %if "%{?_lib}" == "lib64" %{?_cmake_lib_suffix64} \ %endif %{?_cmake_skip_rpath} \ -DBUILD_SHARED_LIBS:BOOL=ON \ .. make %{?_smp_mflags} module purge popd done %install rm -rf $RPM_BUILD_ROOT # Install serial version. pushd serial make install DESTDIR=$RPM_BUILD_ROOT popd # Install MPI versions for mpi in %{?mpi_list} ; do module load $mpi-%{_arch} pushd $mpi make install DESTDIR=$RPM_BUILD_ROOT popd module purge done # Building the documentation requires the python modules to be # importable and so installed. Hence we have to build the docs here in # %%install rather than in %%build. Annoyingly, building the docs also # requires openmpi to be present, otherwise it fails. Worse yet, # importing the python dolfin module requires that the vtk shared # library /usr/lib(64)/vtk/libvtkNetCDF_cxx.so is found by the linker, # otherwise the Viper stuff doesn't work. That file comes from # vtk-devel, which doesn't call ldconfig upon install, and so the # linker doesn't find the file, and so we need to add that directory # to LD_LIBRARY_PATH (since we can't call ldconfig inside the mock # chroot). %if (%{with_openmpi} && %{build_doc}) module load openmpi-%{_arch} pushd openmpi export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:%{_libdir}/vtk export PYTHONPATH=$RPM_BUILD_ROOT%{python_sitelib}:$RPM_BUILD_ROOT%{python_sitarch} make doc popd module purge %endif %clean rm -rf $RPM_BUILD_ROOT %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %if %{with_openmpi} %post openmpi -p /sbin/ldconfig %postun openmpi -p /sbin/ldconfig %endif %if %{with_mpich2} %post mpich2 -p /sbin/ldconfig %postun mpich2 -p /sbin/ldconfig %endif %files %defattr(-,root,root,-) %doc ChangeLog COPYING COPYING.LESSER README AUTHORS TODO %{_bindir}/* %{_datadir}/dolfin/ %exclude %{_datadir}/dolfin/demo %exclude %{_datadir}/dolfin/cmake %{python_sitelib}/dolfin/ %{python_sitelib}/dolfin_utils/ %{_mandir}/man1/* %{_libdir}/*.so.* %files devel %defattr(-,root,root,-) %{_includedir}/dolfin.h %{_includedir}/dolfin/ %{_libdir}/*.so %{_libdir}/pkgconfig/dolfin.pc %{_datadir}/dolfin/demo %{_datadir}/dolfin/cmake %if %{with_openmpi} %files openmpi %defattr(-,root,root,-) %{_libdir}/openmpi/bin/* %{_libdir}/openmpi/share/dolfin %exclude %{_libdir}/openmpi/share/dolfin/demo %exclude %{_libdir}/openmpi/share/dolfin/cmake %{python_sitelib}/openmpi/dolfin/ %{python_sitelib}/openmpi/dolfin_utils/ %{_mandir}/openmpi-%{_arch}/man1/* %{_libdir}/openmpi/lib/*.so.* %files openmpi-devel %defattr(-,root,root,-) %{_includedir}/openmpi-%{_arch}/dolfin.h %{_includedir}/openmpi-%{_arch}/dolfin/ %{_libdir}/openmpi/lib/*.so %{_libdir}/openmpi/lib/pkgconfig/dolfin.pc %{_libdir}/openmpi/share/dolfin/demo %{_libdir}/openmpi/share/dolfin/cmake %if %{build_doc} %files doc %defattr(-,root,root,-) # This mimics what make doc_install would do %doc openmpi/doc/sphinx-cpp openmpi/doc/sphinx-python %endif %endif %if %{with_mpich2} %files mpich2 %defattr(-,root,root,-) %{_libdir}/mpich2/bin/* %{_libdir}/mpich2/share/dolfin %exclude %{_libdir}/mpich2/share/dolfin/demo %exclude %{_libdir}/mpich2/share/dolfin/cmake %{python_sitelib}/mpich2/dolfin/ %{python_sitelib}/mpich2/dolfin_utils/ %{_libdir}/mpich2/lib/*.so.* %if 0%{?rhel} && (0%{?rhel} <= 6) # MPICH2 on rhel6 puts man pages in the wrong place # See https://bugzilla.redhat.com/show_bug.cgi?id=786201 %{_mandir}/mpich2/man1/* %else %{_mandir}/mpich2-%{_arch}/man1/* %endif %files mpich2-devel %defattr(-,root,root,-) %{_includedir}/mpich2-%{_arch}/dolfin.h %{_includedir}/mpich2-%{_arch}/dolfin/ %{_libdir}/mpich2/lib/*.so %{_libdir}/mpich2/lib/pkgconfig/dolfin.pc %{_libdir}/mpich2/share/dolfin/demo %{_libdir}/mpich2/share/dolfin/cmake %endif %changelog * Wed May 15 2012 Jonathan G. Underwood - 1.0.0-0.3 - Added Requires: libxml2-devel, armadillo-devel to the -devel packages - Added Requires: boost-mpich2-devel to the -mpich2-devel package - Added Requires: boost-openmpi-devel to the -openmpi-devel package - Re-added a Requires for the main package to the -openmpi and -mpich2 package * Wed May 15 2012 Jonathan G. Underwood - 1.0.0-0.2 - Added fully versioned Requires including %%{_isa} to the -devel packages - Removed unececessary Requires of the -openmpi and -mpich packages on the dolfin package - Added Requires for boost-devel and suitesparse-devel to the devel packages - Fix conditional tests for rhel 6 in spec file - Move the /share/dolfin/cmake directories to the -devel packages - Add patch to correct DOLFIN_INCLUDE_DIRS and DOLFIN_LIBRARIES in dolfin-config.cmake * Mon May 14 2012 Jonathan G. Underwood - 1.0.0-0.1 - Initial package