diff options
Diffstat (limited to 'pcr/openfoam')
-rw-r--r-- | pcr/openfoam/PKGBUILD | 87 | ||||
-rw-r--r-- | pcr/openfoam/openfoam.install | 31 |
2 files changed, 118 insertions, 0 deletions
diff --git a/pcr/openfoam/PKGBUILD b/pcr/openfoam/PKGBUILD new file mode 100644 index 000000000..65f07025a --- /dev/null +++ b/pcr/openfoam/PKGBUILD @@ -0,0 +1,87 @@ +# Maintainer (AUR): Jingbei Li <i@jingbei.li> +# Contributor (AUR): Xwang <xwaang1976@gmail.com> +# Contributor (AUR): George Eleftheriou <eleftg> +# Contributor (AUR): Andrew Fischer <andrew_at_apastron.co> +# Contributor: bill-auger <bill-auger@programmer.net> + +# parabola changes and rationale: +# - removed parametis support + + +pkgname=openfoam +_majorver=7 +_minorver=20200508 # git-tagged release version +pkgver=${_majorver}.${_minorver} +pkgrel=1 +pkgdesc="computational fluid dynamics (CFD) toolbox, without non-free parmetis support" +arch=('x86_64') +url="http://www.openfoam.org" +license=("GPL") + +depends=('bzip2' 'paraview' 'scotch' 'boost' 'flex' 'cgal') +makedepends=('bash') +conflicts=(openfoam3.0-git) +repalces=(openfoam3.0-git) + +source=(OpenFOAM-${_majorver}::https://github.com/OpenFOAM/OpenFOAM-${_majorver}/archive/${_minorver}.tar.gz) +install=openfoam.install +sha256sums=('54e637521a89c96ad69d53a260c908a2eb429793a74788f24d6ca87ad22db38b') + + +prepare() { + # Extract the current version and major of paraview and of scotch for use in the system preferences + _pversion=$(pacman -Q $(pacman -Qqo $(which paraview)) | sed -e 's/.* //; s/-.*//g') + _pmajor=`echo $_pversion | cut -d '.' -f1` + _sversion=`pacman -Q scotch | sed -e 's/.* //; s/-.*//g'` + + # Generate and install the system preferences file + echo "compilerInstall=system" > "${srcdir}"/prefs.sh + echo "export WM_MPLIB=SYSTEMOPENMPI" >> "${srcdir}"/prefs.sh + echo "export ParaView_VERSION=${_pversion}" >> "${srcdir}"/prefs.sh + echo "export ParaView_MAJOR=${_pmajor}" >> "${srcdir}"/prefs.sh + cp "${srcdir}"/prefs.sh "${srcdir}"/OpenFOAM-${_majorver}/etc #|| return 1 + + # Generate the scotch.sh file for arch + echo "export SCOTCH_VERSION=scotch_${_sversion}" > "${srcdir}"/scotch.sh + echo "export SCOTCH_ARCH_PATH=/usr" >> "${srcdir}"/scotch.sh + cp "${srcdir}"/scotch.sh "${srcdir}"/OpenFOAM-${_majorver}/etc/config #|| return 1 +} + +build() { + # Setup the build environment + export FOAM_INST_DIR="${srcdir}" + foamDotFile="${srcdir}"/OpenFOAM-${_majorver}/etc/bashrc + [ -f ${foamDotFile} ] || return 1 + + # Enter build directory + cd "${srcdir}"/OpenFOAM-${_majorver} + + # Build and clean up OpenFOAM + bash -c "source ${foamDotFile} + ./Allwmake || exit 1 + wclean all || exit 1 + wmakeLnIncludeAll || exit 1" +} + +package() { + cd "${srcdir}" + + # Create destination directories + install -d "${pkgdir}"/opt/OpenFOAM "${pkgdir}"/etc/profile.d || return 1 + + # copy package to pkgdir + cp -r "${srcdir}"/OpenFOAM-${_majorver} "${pkgdir}"/opt/OpenFOAM || return 1 + + # Add source file + echo "export FOAM_INST_DIR=/opt/OpenFOAM" > "${pkgdir}"/etc/profile.d/openfoam-${_majorver}.sh || return 1 + echo "alias ofoam=\"source \${FOAM_INST_DIR}/OpenFOAM-${_majorver}/etc/bashrc\"" >> "${pkgdir}"/etc/profile.d/openfoam-${_majorver}.sh || return 1 + chmod 755 "${pkgdir}"/etc/profile.d/openfoam-${_majorver}.sh || return 1 + + # Add stub thirdparty directory to keep openfoam happy + install -d "${pkgdir}"/opt/OpenFOAM/ThirdParty-${_majorver} || return 1 + + # Permission fixes - for system-wide install and use + chmod -R go+r "${pkgdir}"/opt + chmod -R 755 "${pkgdir}"/opt/OpenFOAM/OpenFOAM-${_majorver}/bin + chmod -R 755 ""${pkgdir}""/opt/OpenFOAM/OpenFOAM-${_majorver}/etc +} diff --git a/pcr/openfoam/openfoam.install b/pcr/openfoam/openfoam.install new file mode 100644 index 000000000..286b28312 --- /dev/null +++ b/pcr/openfoam/openfoam.install @@ -0,0 +1,31 @@ +# arg 1: the new package version +post_install() { + echo "NOTE:" + echo "" + echo "This install of OpenFOAM does NOT include the" + echo "ThirdParty libraries from openfoam's website." + echo "It simply creates a stub OpenFOAM/ThirdParty" + echo "directory to keep the OpenFOAM bashrc happy." + echo "" + echo "The most common use of ThirdParty is to get Paraview." + echo "Modern versions of Paraview include an OpenFOAM" + echo "case file viewer. Instead of installing the ThirdParty" + echo "build of Paraview, using the AUR paraview package is" + echo "advised. https://aur.archlinux.org/packages/paraview" + echo "" + echo "If you need other components of the ThirdParty bundle" + echo "it will have to be installed manually." + echo "See http://www.openfoam.com/download/source.php for details." + echo "" + echo "Don't forget to run the \"ofoam\" alias in order to" + echo "source the OpenFOAM environment (PATH + LD_LIBRARY_PATH)." + echo "This alias has been introduced in order to avoid" + echo "PATH clashes (e.g. other executables such as R from GNU R)" + echo "" +} + +# arg 1: the new package version +# arg 2: the old package version +post_upgrade() { + post_install $1 +} |