summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorNorbert Weber2018-06-28 12:20:34 +0200
committerNorbert Weber2018-06-28 12:20:34 +0200
commit2027d4fd9c08cd5bbe3e7955bdc4b469293799dc (patch)
tree5f28246a959b78a3b1c2237125fafa904af1794f
downloadaur-2027d4fd9c08cd5bbe3e7955bdc4b469293799dc.tar.gz
esi openfoam using system paraview
-rw-r--r--.SRCINFO24
-rw-r--r--PKGBUILD117
2 files changed, 141 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..09bb86f92a8f
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,24 @@
+pkgbase = openfoam-esi
+ pkgdesc = The open source CFD toolbox (ESI-OpenCFD version)
+ pkgver = v1712
+ pkgrel = 1
+ url = http://www.openfoam.com/
+ arch = i686
+ arch = x86_64
+ license = GPL
+ depends = gcc7
+ depends = cgal
+ depends = cmake
+ depends = fftw
+ depends = boost
+ depends = openmpi
+ depends = paraview
+ source = https://newcontinuum.dl.sourceforge.net/project/openfoamplus/v1712/OpenFOAM-v1712.tgz
+ source = https://sourceforge.net/projects/openfoamplus/files/v1712/ThirdParty-v1712.tgz/download
+ source = http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-5.1.0.tar.gz
+ md5sums = 6ad92df051f4d52c7d0ec34f4b8eb3bc
+ md5sums = c5662a79d4e997472a78b7cc6da98edd
+ md5sums = 5465e67079419a69e0116de24fce58fe
+
+pkgname = openfoam-esi
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..f8a1898e1ab0
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,117 @@
+# Maintainer: Norbert Weber <norbert.weber_at_hzdr.de>
+# Contributor: Xwang <xwaang1976@gmail.com>
+# Contributor: George Eleftheriou <eleftg>
+# Contributor: Andrew Fischer <andrew_at_apastron.co>
+# Contributor: <gucong43216@gmail.com>
+
+pkgname=openfoam-esi
+pkgver=v1712
+_distname=OpenFOAM
+_dist=$_distname-$pkgver
+pkgrel=1
+pkgdesc="The open source CFD toolbox (ESI-OpenCFD version)"
+arch=('i686' 'x86_64')
+url="http://www.openfoam.com/"
+license=('GPL')
+depends=('gcc7' 'cgal' 'cmake' 'fftw' 'boost' 'openmpi' 'paraview')
+
+source=("https://newcontinuum.dl.sourceforge.net/project/openfoamplus/${pkgver}/${_dist}.tgz"
+ "https://sourceforge.net/projects/openfoamplus/files/v1712/ThirdParty-v1712.tgz/download"
+ "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-5.1.0.tar.gz")
+
+md5sums=('6ad92df051f4d52c7d0ec34f4b8eb3bc'
+ 'c5662a79d4e997472a78b7cc6da98edd'
+ '5465e67079419a69e0116de24fce58fe')
+
+prepare() {
+ cd "$srcdir/$_dist"
+
+ # gcc8 does currently not work, so use gcc7
+ sed -i 's/export WM_CC="gcc"/export WM_CC="gcc-7"/g' etc/config.sh/settings
+ sed -i 's/export WM_CXX="g++"/export WM_CXX="g++-7"/g' etc/config.sh/settings
+ sed -i 's/WM_COMPILER=Gcc/WM_COMPILER=Gcc7/g' etc/bashrc
+ [ ! -d wmake/rules/linux64Gcc7 ] && cp -r wmake/rules/linux64Gcc wmake/rules/linux64Gcc7
+ sed -i 's/g++ -std=c++11/g++-7 -std=c++11/g' wmake/rules/linux64Gcc7/c++
+
+ # Generate and install the system preferences file
+ echo "export compilerInstall=system" > ${srcdir}/prefs.sh
+ echo "export cmake_version=cmake-system" >> ${srcdir}/prefs.sh
+ echo "export ParaView_QT=qt-system" >> ${srcdir}/prefs.sh
+ cp ${srcdir}/prefs.sh ${srcdir}/${_distname}-${pkgver}/etc
+
+ # get paraview-5.5 directories
+ # paraview-5.5
+ para_dir=`pacman -Q -l paraview | grep "include" | head -n3 | tail -n1 | sed -e 's!p.*/p!p!g' | sed -e 's!/.*!!g'`
+ # /usr/include
+ para_include_dir=`pacman -Q -l paraview | grep "include" | head -n3 | tail -n1 | awk '{print $2}' | sed 's!/paraview.*!!g'`
+ # /usr/bin
+ para_bin_dir=`which paraview | sed -e 's!/paraview!!g'`
+ # /usr/lib
+ para_lib_dir=`echo $para_bin_dir | sed -e 's/bin/lib/g'`
+
+ # the variable ParaView_DIR must be defined to compile paraFoam,
+ # but it cannot be /usr as it should be
+ # (otherwise all pathes containing /usr are removed from PATH)
+ arbitrary_dir=`echo ${srcdir}/ThirdParty-${pkgver}/paraview`
+ [ ! -d "$arbitrary_dir" ] && mkdir $arbitrary_dir
+
+ # this is needed for compiling paraFoam
+ echo "export ParaView_DIR=\$WM_THIRD_PARTY_DIR/paraview" > ${srcdir}/system_paraview
+ echo "export ParaView_INCLUDE_DIR=$para_include_dir/$para_dir" >> ${srcdir}/system_paraview
+ echo "export PV_PLUGIN_PATH=\$FOAM_LIBBIN/$para_dir" >> ${srcdir}/system_paraview
+ echo "export PATH=$para_bin_dir:\$PATH" >> ${srcdir}/system_paraview
+ echo "export LD_LIBRARY_PATH=$para_lib_dir/$para_dir:\$LD_LIBRARY_PATH" >> ${srcdir}/system_paraview
+ echo "unset ParaView_VERSION" >> ${srcdir}/system_paraview
+ cp ${srcdir}/system_paraview ${srcdir}/${_distname}-${pkgver}/etc/config.sh
+
+ cd ${srcdir}/${_distname}-${pkgver}/etc/config.sh
+ # write content of system_paraview into file "paraview"
+ sed -i "/ParaView_VERSION=5./r system_paraview" ${srcdir}/${_distname}-${pkgver}/etc/config.sh/paraview
+ # remove ParaView_VERSION in order to use system paraview
+ sed -i '/ParaView_VERSION=5./d' ${srcdir}/${_distname}-${pkgver}/etc/config.sh/paraview
+
+ # create link to metis
+ cd "$srcdir/ThirdParty-v1712"
+ [[ ! -e "metis-5.1.0" ]] && ln -s ../metis-5.1.0 metis-5.1.0
+ return 0
+}
+
+build() {
+ export FOAM_INST_DIR=${srcdir}
+ foamDotFile=${srcdir}/${_dist}/etc/bashrc
+ [ -f ${foamDotFile} ] && . ${foamDotFile}
+
+ echo " "
+ echo "Give write access to cmake directory using chmod."
+ echo "This is needed to compile paraFoam."
+ echo " "
+ sudo chmod 757 /usr/lib/cmake/paraview*/Modules
+
+ cd "$srcdir/$_dist"
+ ./Allwmake -j `nproc` 2>&1 | tee log.wmake
+
+ # you need to enter the root password after 2 hours
+ #sudo chmod 755 /usr/lib/cmake/paraview*/Modules
+
+ wclean all
+ wmakeLnIncludeAll
+}
+
+package() {
+ cd ${srcdir}
+
+ # Create destination directories
+ install -d ${pkgdir}/opt/${_distname} ${pkgdir}/etc/profile.d
+
+ # copy package to pkgdir
+ cp -r "${srcdir}/${_dist}" "${pkgdir}/opt/${_distname}"
+ cp -r "${srcdir}/ThirdParty-${pkgver}" "${pkgdir}/opt/${_distname}"
+
+ # create alias in .bashrc
+ echo "alias ofoam=\"source /opt/${_distname}/${_dist}/etc/bashrc\"" >> ~/.bashrc
+
+ # Permission fixes - for system-wide install and use
+ chmod -R go+r ${pkgdir}/opt
+ chmod -R 755 ${pkgdir}/opt/${_distname}/${_dist}/bin
+ chmod -R 755 ${pkgdir}/opt/${_distname}/${_dist}/etc
+}