Skip to content

Instantly share code, notes, and snippets.

@envolution
Last active May 20, 2025 01:05
Show Gist options
  • Select an option

  • Save envolution/a8ed98a5fd63dbb7256f618c8e012490 to your computer and use it in GitHub Desktop.

Select an option

Save envolution/a8ed98a5fd63dbb7256f618c8e012490 to your computer and use it in GitHub Desktop.
--- /github/envolution/aur/maintain/build/openfoam/PKGBUILD 2025-02-07 03:58:55.974030381 -0500
+++ PKGBUILD 2025-05-19 17:20:24.168928213 -0400
@@ -11,7 +11,7 @@
_pkgver="${pkgver%.*}"
_subver="${pkgver#*.}"
[[ "$pkgver" = "$_subver" ]] && _subver="version-$pkgver"
-pkgrel=4
+pkgrel=5
pkgdesc="The open source CFD toolbox (www.openfoam.org)"
_distpkgbase=OpenFOAM
_gitname=$_distpkgbase-$_pkgver
@@ -38,7 +38,6 @@
if [ ! -d $srcdir/$_distpkgbase-$_pkgver ]; then
mv $srcdir/$_gitname-$_subver $srcdir/$_distpkgbase-$_pkgver
# Extract the current version and major of paraview and of scotch for use in the system preferences
- #_pversion=`pacman -Q paraview | sed -e 's/.* //; s/-.*//g'`
_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')
@@ -79,11 +78,13 @@
# Build and clean up OpenFOAM
bash -c """
+ # see if we have extra processes defined in /etc/makepkg.conf MAKEFLAGS (taken from slack build)
+ jval="$(echo $MAKEFLAGS |grep -o "\-j *[0-9]*" | grep -o "[0-9]*")" || true
+
export PATH="/opt/paraview/bin:\$PATH"
source ${foamDotFile}
- ./Allwmake
- wclean all
wmakeLnIncludeAll
+ ./Allwmake -s -q -j ${jval:=1}
"""
}
@@ -96,6 +97,10 @@
# Copy package to pkgdir
cp -r "${srcdir}/${_distpkgbase}-${_pkgver}" "${pkgdir}/opt/${_distpkgbase}"
+ # Clean up build files (https://openfoamwiki.net/index.php/Installation/Delete_intermediate_files#OpenFOAM_v1706_and_newer)
+ _baseclean="${pkgdir}/opt/${_distpkgbase}/${_distpkgbase}-${_pkgver}"
+ rm -rf ${_baseclean}/platforms/*/applications ${_baseclean}/platforms/*/src
+
# Add source file
echo "export FOAM_INST_DIR=/opt/${_distpkgbase}" >${pkgdir}/etc/profile.d/openfoam-${_pkgver}.sh
echo "export PATH=/opt/paraview/bin:\$PATH" >>${pkgdir}/etc/profile.d/openfoam-${_pkgver}.sh
@@ -107,10 +112,10 @@
# Permission fixes - for system-wide install and use
chmod -R go+r "${pkgdir}/opt"
- chmod -R 755 "${pkgdir}/opt/${_distpkgbase}/${_distpkgbase}-${_pkgver}/bin"
- chmod -R 755 "${pkgdir}/opt/${_distpkgbase}/${_distpkgbase}-${_pkgver}/etc"
+ chmod -R 775 "${pkgdir}/opt/${_distpkgbase}/${_distpkgbase}-${_pkgver}/bin"
+ chmod -R 775 "${pkgdir}/opt/${_distpkgbase}/${_distpkgbase}-${_pkgver}/etc"
rm "${pkgdir}/opt/${_distpkgbase}/${_distpkgbase}-${_pkgver}/etc/bashrc"
- install -Dm 755 "${srcdir}/${_distpkgbase}-${_pkgver}/etc/bashrc.prepared" "${pkgdir}/opt/${_distpkgbase}/${_distpkgbase}-${_pkgver}/etc/bashrc"
+ install -Dm 775 "${srcdir}/${_distpkgbase}-${_pkgver}/etc/bashrc.prepared" "${pkgdir}/opt/${_distpkgbase}/${_distpkgbase}-${_pkgver}/etc/bashrc"
}
# vim:set ts=2 sw=2 et:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment