# Copyright (c) 2014, 2015 Dave Love, University of Liverpool # Licence as for the package itself # NB. This takes a couple of hours to build (on a Sandybridge system # on an NFS filesystem) and over a couple of gigabyte of space. # It requires a packaged version of gcc-c++ >= 4.5, e.g. in Fedora or # from the Red Hat devtoolset-8 collection for el6; el7 also uses # devtoolset-8 in the expectation of producing better code. CGAL rpms # build straight from the Fedora 22 source on EPEL6. Require >=4.6.1 # so that it will work with gmp < 5 (el6, at least). # Fixme: # Try to install under /usr to be suitable for a Fedora package; # Try to provide an option for building with -march=native; # check the separation of sub-packages -- probably needs an expert to # say what should be where; # fix build for paraview: it requires rebuilt paraview packages on EPEL6 # with -devel versions enabled, but fails to build because the paraview # installation is split between /usr and $MPI_HOME (e.g. it needs # $MPI_BIN/vtkWrapClientServer, $MPI_INCLUDE/paraview and # /usr/include/paraview) %if 0%{?el6} # requires paraview -devel %bcond_with paraview %else # see above %bcond_with paraview %endif Name: openfoam Version: 6 Release: 1%{?dist} Summary: Free Computational Fluid Dynamics Package License: GPLv3+ URL: http://www.openfoam.org/ Source0: http://dl.openfoam.org/source/6#/openfoam-%version.tar.gz Source1: openfoam-bashrc Source2: openfoam-module # Supply -g Patch1: openfoam-g.patch # Find libptscotch Patch2: openfoam-ptscotch.patch # maybe paraview version -- see above %if %{with paraview} Patch3: openfoam-paraview.patch %endif # find CGAL #Patch4: openfoam-cgal.patch # it's libboost_thread-mt, not libboost_thread Patch5: openfoam-boostthread.patch # don't fail with systemopenmpi; revert to 2.4.0 version Patch6: openfoam-3.0-mpi.patch %if 0%{?el6}%{?el7} # binutils is necessary to avoid assembler errors but isn't required # by the compiler BuildRequires: devtoolset-8-gcc-c++, devtoolset-8-binutils %else BuildRequires: gcc-c++ %endif BuildRequires: zlib-devel, readline-devel, ncurses-devel BuildRequires: scotch-devel, BuildRequires: flex, bison, CGAL-devel >= 4.6.1 %if %{with paravew} BuildRequires: paraview-devel, cmake %endif # For provide/require filtering: BuildRequires: redhat-rpm-config Requires: environment-modules Prefix: /opt/OpenFOAM/OpenFOAM-%version # Dependency checking misses this for some resason Requires: CGAL # Probably not worth it for the one conversion util #Requires: engrid # Avoid a huge list of provides/requires of (apparently) internal libraries. # NB. The library list needs checking for new releases. %{?filter_setup: %filter_from_requires /lib.*[[:upper:]].*\.so/d %filter_from_requires /lib\(conversion\|decompose\|distributed\|dsmc\|engine\|forces\|lagrangian\|molecule\|potential\|reconstruct\|sampling\|specie\).*\.so/d # Solaris scripts %filter_from_requires /\/usr\/xpg4\/bin/d # csh not really needed %filter_from_requires /\/bin\/csh/d %filter_provides_in \.so$ %filter_setup } # fixme: check this %global __provides_exclude *.so$ %global __requires_exclude /usr/xpg4/bin|/bin/csh|lib.*[[:upper:]].*\.so %global __requires_exclude %__requires_exclude|(lib(conversion|decompose|distributed|dsmc|engine|forces|lagrangian|molecule|potential|reconstruct|sampling|specie|waves).*\.so) %description OpenFOAM is a free computational fluid dynamics (CFD) software package released by the OpenFOAM Foundation. It has a large user base across most areas of engineering and science, from both commercial and academic organisations. OpenFOAM has an extensive range of features to solve anything from complex fluid flows involving chemical reactions, turbulence and heat transfer, to solid dynamics and electromagnetics. # We could, perhaps, have an MPICH version %package openmpi Summary: Openmpi-paralellization for %name BuildRequires: ptscotch-openmpi-devel openmpi-devel %if %{with paravew} BuildRequires: paraview-openmpi-devel %endif Requires: %name%{?_isa} = %version-%release Requires: openmpi%{?_isa} # Avoid auto-dependency on mpich version Requires: ptscotch-openmpi %description openmpi The openmpi parallelization support for %name. %package doc Summary: Documentation for %name BuildArch: noarch %description doc Documentation for %name. %package tutorials Summary: Tutorials for %name Requires: %name%{?_isa} = %version-%release BuildArch: noarch %description tutorials Tutorial material for %name. %package devel Summary: Development material for %name Requires: %name%{?_isa} = %version-%release, ptscotch-openmpi-devel # On the basis that this is basically source: BuildArch: noarch %description devel Sources and build system for developing with %name. %package tests Summary: Tests for %name Requires: %name%{?_isa} = %version-%release BuildArch: noarch %description tests Tests for %name. %prep %setup -q -c tar fx %SOURCE0 mv OpenFOAM-*-version-%version OpenFOAM-%version cd OpenFOAM-%version %patch1 -p1 %patch2 -p1 %if %{with paraview} %patch3 -p1 %endif #%patch4 -p1 #%patch5 -p1 #%patch6 -p1 #sed -e 's/WM_PROJECT_VERSION=.*$/WM_PROJECT_VERSION=%version/' %SOURCE1 > etc/bashrc # Quit immediately when errors occur #find . -name Allwmake -type f -exec sed -i 's|^set -x$|set -x -e|' {} \; %build cd OpenFOAM-%version # This builds straight into (a link into) RPM_BUILD_ROOT in the # absence of an obvious (from the instructions) way to do anything # else. Ugh. # cd $RPM_BUILD_ROOT/opt/OpenFOAM/OpenFOAM-%version # mkdir -p etc %{_openmpi_load} # case %_arch in # *64*) # # compiler and arch seem to be the things that aren't fixed # sed -i -e "s/WM_COMPILER=Gcc/WM_COMPILER=Gcc$GCC/" etc/bashrc ;; # *) # sed -i -e "s/WM_ARCH_OPTION=64/WM_ARCH_OPTION=32" -e "s/WM_COMPILER=Gcc/WM_COMPILER=Gcc$GCC/" etc/bashrc # esac # fixme: have a --with native switch to edit "-march=native" into wmake/rules/linux64Gcc$GCC/cOpt #export FOAM_INST_DIR=$RPM_BUILD_ROOT/opt/OpenFOAM #export FOAM_INST_DIR=$(pwd)/.. # Fixme: why is this giving non-zero cc in rpm, but not interactively? source etc/bashrc || : echo bashrc done WM_NCOMPPROCS=%_smp_mflags export WM_NCOMPPROCS=${WM_NCOMPPROCS:2} # parallel build # Get the right compiler %if 0%{?el6}%{?el7} . /opt/rh/devtoolset-8/enable %endif ./Allwmake -j ${RPM_BUILD_NCPUS:-1} # this step probably isn't necessary if paraview is sorted out %if %{with paraview} pushd $FOAM_UTILITIES/postProcessing/graphics/PV3Readers wmSET ./Allwclean ./Allwmake -j ${RPM_BUILD_NCPUS:-1} popd %endif find -name \*.o | xargs rm -f rm -f .build .gitignore .timeStamp %install %global inst /opt/OpenFOAM/OpenFOAM-%version inst=$RPM_BUILD_ROOT%inst mkdir -p $inst cd OpenFOAM-%version # Not copied because it's >1G mv platforms $inst cp -a * $inst %{_openmpi_load} mfile=$RPM_BUILD_ROOT/etc/modulefiles/openfoam/%version install -D %SOURCE2 $mfile sed -i -e "s:@OFVERSION@:%version:g" -e "s:@OMPIMOD@:$(echo '%_openmpi_load'|grep load):" $mfile case %_arch in *64*) :;; *) sed -i -e "s/linux64/linux/g" -e "s/64/32/g" $mfile;; esac %_openmpi_load mkdir -p %buildroot/$MPI_LIB # \are these names unique enough not to go in a subdir? mv %buildroot%prefix/platforms/linux64GccDPInt32Opt/lib/openmpi-system/*.so %buildroot/$MPI_LIB # fixme: adapt module file %files %license OpenFOAM-%version/COPYING %dir %inst %dir %inst/.. %inst/platforms %inst/etc %inst/bin %inst/doc %exclude %inst/COPYING %exclude %inst/README.* %doc OpenFOAM-%version/README.org %dir /etc/modulefiles/openfoam /etc/modulefiles/openfoam/%version %files openmpi %_libdir/openmpi/lib/*.so %files doc %license OpenFOAM-%version/COPYING %doc OpenFOAM-%version/doc/Guides/OpenFOAMUserGuide-A4.pdf %files tutorials %inst/tutorials %files devel %doc OpenFOAM-%version/doc/codingStyleGuide.org %inst/Allwmake %inst/src %inst/wmake %inst/applications %files tests %inst/test %changelog * Thu Aug 15 2019 Dave love - 6-1 - New version with various build changes * Tue Aug 13 2019 Dave love - 4.1-1 - New version * Thu Mar 10 2016 Dave Love - 3.0.1-1 - New version * Thu Nov 19 2015 Dave Love - 3.0.0-1 - New version, NB not backwards-compatible - Patch to build with MPI - Update bashrc - Define WM_LABEL_SIZE=32 to work with packaged scotch - Drop cgal patch; update -g one - Add doc files * Wed Nov 4 2015 Dave Love - 2.4.0-3 - Require newer CGAL to fix build with gmp 4 - Use devtoolset-3 on EPEL6 because of trouble picking up -2 in mock. * Mon Jun 15 2015 Dave Love - 2.4.0-2 - Quote some values in module file (spotted by Lmod) * Mon Jun 8 2015 Dave Love - 2.4.0-1 - New version; update patches - Require CGAL - Fix using -g and use constant GCC version - Add %%install to get debuginfo processing - Re-jig build not to use RPM_BUILD_ROOT directly * Fri Dec 19 2014 Dave Love - 2.3.1-1 - New version - Fix parallel build and edit for wmake halt on error - Patch for boost_thread-mt v. boost_thread - Fix use of CGAL so that foamyHexMesh, foamyQuadMesh get built * Mon Nov 24 2014 Dave Love - 2.3.0-12 - Use RPM_BUILD_NCPUS (from Douglas Kosovic) - Modify wmake files to halt on error (from Sandro Mani) * Tue Oct 21 2014 Dave Love - 2.3.0-11 - Fix module file generation on epel7 etc. * Fri Oct 17 2014 Dave Love - 2.3.0-10 - Module file additions from Douglas Kosovic - Subsitute the appropriate openmpi module invocation and sanitize OF version substitution * Fri Oct 10 2014 Dave Love - 2.3.0-9 - Default the paraview bits off, as intended * Wed Jul 23 2014 Dave Love - 2.3.0-8 - Own the module directory * Wed Jul 9 2014 Dave Love - 2.3.0-7 - Build paraview bits * Thu Jun 26 2014 Dave Love - 2.3.0-6 - Make devel and tutorial packages noarch * Fri Jun 20 2014 Dave Love - 2.3.0-5 - Use devtoolset-2 for EPEL6 - Build with -g - Move applications to -devel - Add foamyQuadMesh - Fix ptscotch linking * Tue Jun 17 2014 Dave Love - 2.3.0-4 - Own the installation directories * Mon Jun 16 2014 Dave Love - 2.3.0-3 - Use devtoolset-2 explicitly for EPEL to allow copr build * Thu May 29 2014 Dave Love - 2.3.0-2 - Build foamyHexMesh * Mon Mar 24 2014 Dave Love - 2.3.0-1 - Update to v2.3.0 * Fri Feb 7 2014 Dave Love - 2.2.2-4 - Build PV3FoamReader * Thu Jan 16 2014 Dave Love - 2.2.2-3 - Define MPI_ variables in module file * Mon Dec 2 2013 Dave Love - 2.2.2-2 - Split up installation * Fri Nov 15 2013 Dave Love - 2.2.2-1 - Update to version 2.2.2 - Don't require paraview - Install modified bashrc file and module file * Mon Jul 8 2013 Dave Love - 2.2.0-1 - Initial packaging