From a16a091bf36ddc7b4d207a49415e04c63254b5e4 Mon Sep 17 00:00:00 2001
From: Josef Hrabal <josef.hrabal@vsb.cz>
Date: Wed, 12 Apr 2017 11:05:56 +0200
Subject: [PATCH] Added OpenFOAM 4.1 and dependencies

---
 b/Boost/Boost-1.63.0-intel-2017a.eb          |   4 +-
 c/CGAL/CGAL-4.8.1-intel-2017a.eb             |   7 +-
 l/LLVM/LLVM-3.8.1-intel-2017a.eb             |  42 +++
 l/libGLU/libGLU-9.0.0.eb                     |  21 ++
 l/libdrm/libdrm-2.4.75.eb                    |  26 ++
 l/libpthread-stubs/libpthread-stubs-0.4.eb   |  20 ++
 l/libxml2/libxml2-2.9.4.eb                   |  25 ++
 m/METIS/METIS-5.1.0-intel-2017a.eb           |  25 ++
 m/Mako/Mako-1.0.4-Python-2.7.13.eb           |  22 ++
 m/Mesa/Mesa-12.0.2-intel-2017a.eb            |  59 ++++
 n/nettle/nettle-3.2-intel-2017a.eb           |  28 ++
 o/OpenFOAM/OpenFOAM-4.1-cleanup.patch        | 291 +++++++++++++++++++
 o/OpenFOAM/OpenFOAM-4.1-intel-2017a.eb       |  15 +-
 p/ParaView/ParaView-5.1.2-intel-2017a-mpi.eb |  12 +-
 p/pkg-config/pkg-config-0.29.2.eb            |  27 ++
 q/Qt5/Qt5-5.8.0-GCC-6.3.0-2.27.eb            |  33 +++
 x/X11/X11-20160819.eb                        | 131 +++++++++
 17 files changed, 771 insertions(+), 17 deletions(-)
 create mode 100644 l/LLVM/LLVM-3.8.1-intel-2017a.eb
 create mode 100644 l/libGLU/libGLU-9.0.0.eb
 create mode 100644 l/libdrm/libdrm-2.4.75.eb
 create mode 100644 l/libpthread-stubs/libpthread-stubs-0.4.eb
 create mode 100644 l/libxml2/libxml2-2.9.4.eb
 create mode 100644 m/METIS/METIS-5.1.0-intel-2017a.eb
 create mode 100644 m/Mako/Mako-1.0.4-Python-2.7.13.eb
 create mode 100644 m/Mesa/Mesa-12.0.2-intel-2017a.eb
 create mode 100644 n/nettle/nettle-3.2-intel-2017a.eb
 create mode 100644 o/OpenFOAM/OpenFOAM-4.1-cleanup.patch
 create mode 100644 p/pkg-config/pkg-config-0.29.2.eb
 create mode 100644 q/Qt5/Qt5-5.8.0-GCC-6.3.0-2.27.eb
 create mode 100644 x/X11/X11-20160819.eb

diff --git a/b/Boost/Boost-1.63.0-intel-2017a.eb b/b/Boost/Boost-1.63.0-intel-2017a.eb
index 15b63be4..69993d3c 100644
--- a/b/Boost/Boost-1.63.0-intel-2017a.eb
+++ b/b/Boost/Boost-1.63.0-intel-2017a.eb
@@ -11,8 +11,8 @@ source_urls = [SOURCEFORGE_SOURCE]
 sources = ['%%(namelower)s_%s.tar.gz' % '_'.join(version.split('.'))]
 
 dependencies = [
-    ('bzip2', '1.0.6'),
-    ('zlib', '1.2.11'),
+    ('bzip2', '1.0.6', '', True),
+    ('zlib', '1.2.11', '', True),
 ]
 
 configopts = '--without-libraries=python'
diff --git a/c/CGAL/CGAL-4.8.1-intel-2017a.eb b/c/CGAL/CGAL-4.8.1-intel-2017a.eb
index 9f940415..454ff971 100644
--- a/c/CGAL/CGAL-4.8.1-intel-2017a.eb
+++ b/c/CGAL/CGAL-4.8.1-intel-2017a.eb
@@ -15,9 +15,10 @@ dependencies = [
     ('zlib', '1.2.11', '', True),
     ('Boost', '1.63.0'),
     ('MPFR', '3.1.4'),
-    ('GMP', '6.1.1'),
-    ('libGLU', '9.0.0'),
-    ('Qt5', '5.7.0'),
+    ('GMP', '6.1.1', '', True),
+    ('Mesa', '12.0.2'),
+    ('libGLU', '9.0.0', '', True),
+    ('Qt5', '5.8.0', '', ('GCC', '6.3.0-2.27')),
 ]
 
 builddependencies = [
diff --git a/l/LLVM/LLVM-3.8.1-intel-2017a.eb b/l/LLVM/LLVM-3.8.1-intel-2017a.eb
new file mode 100644
index 00000000..901283b5
--- /dev/null
+++ b/l/LLVM/LLVM-3.8.1-intel-2017a.eb
@@ -0,0 +1,42 @@
+easyblock = 'CMakeMake'
+
+name = 'LLVM'
+version = '3.8.1'
+
+homepage = "http://llvm.org/"
+description = """The LLVM Core libraries provide a modern source- and target-independent
+ optimizer, along with code generation support for many popular CPUs
+ (as well as some less common ones!) These libraries are built around a well
+ specified code representation known as the LLVM intermediate representation
+ ("LLVM IR"). The LLVM Core libraries are well documented, and it is
+ particularly easy to invent your own language (or port an existing compiler)
+ to use LLVM as an optimizer and code generator."""
+
+toolchain = {'name': 'intel', 'version': '2017a'}
+toolchainopts = {'cstd': 'gnu++11'}
+
+source_urls = ["http://llvm.org/releases/%(version)s"]
+sources = ["llvm-%(version)s.src.tar.xz"]
+
+builddependencies = [
+    ('CMake', '3.7.2', '', True),
+    ('Python', '2.7.13', '', True),
+]
+
+dependencies = [
+    ('ncurses', '6.0', '', True),
+    ('zlib', '1.2.11', '', True),
+]
+
+configopts = '-DBUILD_SHARED_LIBS=ON -DCMAKE_EXE_LINKER_FLAGS="$LDFLAGS -shared-intel" '
+# required to install extra tools in bin/
+configopts += "-DLLVM_INSTALL_UTILS=ON -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_ENABLE_ZLIB=ON"
+
+sanity_check_paths = {
+    'files': ['bin/llvm-ar', 'bin/FileCheck'],
+    'dirs': ['include/llvm', 'include/llvm-c'],
+}
+
+separate_build_dir = True
+
+moduleclass = 'compiler'
diff --git a/l/libGLU/libGLU-9.0.0.eb b/l/libGLU/libGLU-9.0.0.eb
new file mode 100644
index 00000000..bc9d52a0
--- /dev/null
+++ b/l/libGLU/libGLU-9.0.0.eb
@@ -0,0 +1,21 @@
+easyblock = 'ConfigureMake'
+
+name = 'libGLU'
+version = '9.0.0'
+
+homepage = 'ftp://ftp.freedesktop.org/pub/mesa/glu/'
+description = """The OpenGL Utility Library (GLU) is a computer graphics library for OpenGL. """
+
+toolchain = {'name': 'dummy', 'version': ''}
+toolchainopts = {'pic': True}
+
+source_urls = ['ftp://ftp.freedesktop.org/pub/mesa/glu/']
+sources = ['glu-%(version)s.tar.bz2']
+
+
+sanity_check_paths = {
+    'files': ['lib/libGLU.so.1'],
+    'dirs': [],
+}
+
+moduleclass = 'vis'
diff --git a/l/libdrm/libdrm-2.4.75.eb b/l/libdrm/libdrm-2.4.75.eb
new file mode 100644
index 00000000..3855972e
--- /dev/null
+++ b/l/libdrm/libdrm-2.4.75.eb
@@ -0,0 +1,26 @@
+easyblock = 'ConfigureMake'
+
+name = 'libdrm'
+version = '2.4.75'
+
+homepage = 'http://dri.freedesktop.org'
+description = """Direct Rendering Manager runtime library."""
+
+source_urls = ['http://dri.freedesktop.org/libdrm/']
+sources = [SOURCELOWER_TAR_GZ]
+
+toolchain = {'name': 'dummy', 'version': ''}
+
+dependencies = [
+    ('X11', '20160819'),
+    ('libpthread-stubs', '0.4'),
+    ('libpciaccess', '0.13.1'),
+]
+
+sanity_check_paths = {
+    'files': ['include/xf86drm.h', 'include/xf86drmMode.h', 'lib/libdrm_intel.%s' % SHLIB_EXT,
+              'lib/libdrm_radeon.%s' % SHLIB_EXT, 'lib/libdrm.%s' % SHLIB_EXT, 'lib/libkms.%s' % SHLIB_EXT],
+    'dirs': ['include/libdrm', 'include/libkms', 'lib/pkgconfig'],
+}
+
+moduleclass = 'lib'
diff --git a/l/libpthread-stubs/libpthread-stubs-0.4.eb b/l/libpthread-stubs/libpthread-stubs-0.4.eb
new file mode 100644
index 00000000..e697737a
--- /dev/null
+++ b/l/libpthread-stubs/libpthread-stubs-0.4.eb
@@ -0,0 +1,20 @@
+easyblock = 'ConfigureMake'
+
+name = 'libpthread-stubs'
+version = '0.4'
+
+homepage = 'http://xcb.freedesktop.org/'
+description = """The X protocol C-language Binding (XCB) is a replacement for Xlib featuring a small footprint,
+latency hiding, direct access to the protocol, improved threading support, and extensibility."""
+
+source_urls = ['http://xcb.freedesktop.org/dist/']
+sources = [SOURCELOWER_TAR_GZ]
+
+toolchain = {'name': 'dummy', 'version': ''}
+
+sanity_check_paths = {
+    'files': ['lib/pkgconfig/pthread-stubs.pc'],
+    'dirs': [],
+}
+
+moduleclass = 'lib'
diff --git a/l/libxml2/libxml2-2.9.4.eb b/l/libxml2/libxml2-2.9.4.eb
new file mode 100644
index 00000000..0fbfde08
--- /dev/null
+++ b/l/libxml2/libxml2-2.9.4.eb
@@ -0,0 +1,25 @@
+easyblock = 'ConfigureMake'
+
+name = 'libxml2'
+version = '2.9.4'
+
+homepage = 'http://xmlsoft.org/'
+description = """Libxml2 is the XML C parser and 
+toolchain developed for the Gnome project
+ (but usable outside of the Gnome platform)."""
+
+toolchain = {'name': 'dummy', 'version': ''}
+
+source_urls = [
+    'http://xmlsoft.org/sources/',
+    'http://xmlsoft.org/sources/old/'
+]
+sources = [SOURCELOWER_TAR_GZ]
+
+preconfigopts = 'export LDFLAGS="-L$EBROOTZLIB/lib" && '
+
+configopts = 'CC="$CC" CXX="$CXX" --with-pic --without-python'
+
+dependencies = [('zlib', '1.2.11')]
+
+moduleclass = 'lib'
diff --git a/m/METIS/METIS-5.1.0-intel-2017a.eb b/m/METIS/METIS-5.1.0-intel-2017a.eb
new file mode 100644
index 00000000..18767397
--- /dev/null
+++ b/m/METIS/METIS-5.1.0-intel-2017a.eb
@@ -0,0 +1,25 @@
+name = 'METIS'
+version = '5.1.0'
+
+homepage = 'http://glaros.dtc.umn.edu/gkhome/metis/metis/overview'
+description = """METIS is a set of serial programs for partitioning graphs, partitioning finite element meshes,
+and producing fill reducing orderings for sparse matrices. The algorithms implemented in METIS are based on the
+multilevel recursive-bisection, multilevel k-way, and multi-constraint partitioning schemes."""
+
+toolchain = {'name': 'intel', 'version': '2017a'}
+toolchainopts = {'pic': True}
+
+sources = [SOURCELOWER_TAR_GZ]
+source_urls = [
+    'http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis',
+    'http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/OLD',
+]
+
+# We use 32bit for indices and 64bit for content
+patches = ['METIS-5.1.0-use-doubles.patch']
+
+builddependencies = [('CMake', '3.7.2', '', True)]
+
+configopts = ['', 'shared=1']
+
+moduleclass = 'math'
diff --git a/m/Mako/Mako-1.0.4-Python-2.7.13.eb b/m/Mako/Mako-1.0.4-Python-2.7.13.eb
new file mode 100644
index 00000000..351c9539
--- /dev/null
+++ b/m/Mako/Mako-1.0.4-Python-2.7.13.eb
@@ -0,0 +1,22 @@
+easyblock = 'PythonPackage'
+
+name = 'Mako'
+version = '1.0.4'
+versionsuffix = '-Python-%(pyver)s'
+
+homepage = 'http://www.makotemplates.org'
+description = """A super-fast templating language that borrows the best ideas from the existing templating languages"""
+
+toolchain = {'name': 'dummy', 'version': ''}
+
+source_urls = [PYPI_SOURCE]
+sources = [SOURCE_TAR_GZ]
+
+dependencies = [('Python', '2.7.13')]
+
+sanity_check_paths = {
+    'files': ['bin/mako-render'],
+    'dirs': ['lib/python%(pyshortver)s/site-packages/%(name)s-%(version)s-py%(pyshortver)s.egg'],
+}
+
+moduleclass = 'devel'
diff --git a/m/Mesa/Mesa-12.0.2-intel-2017a.eb b/m/Mesa/Mesa-12.0.2-intel-2017a.eb
new file mode 100644
index 00000000..d01166d7
--- /dev/null
+++ b/m/Mesa/Mesa-12.0.2-intel-2017a.eb
@@ -0,0 +1,59 @@
+# the purpose of the easyconfig is to build a Mesa for software rendering,
+# not hardware rendering. This means you want at least SSE4.2. We build:
+# - llvmpipe: the high-performance Gallium LLVM driver
+# - swr: Intel's OpenSWR
+# it will try to use the llvmpipe by default. It you want swr, do:
+# GALLIUM_DRIVER=swr
+
+easyblock = 'ConfigureMake'
+
+name = 'Mesa'
+version = '12.0.2'
+
+homepage = 'http://www.mesa3d.org/'
+description = """Mesa is an open-source implementation of the OpenGL specification -
+ a system for rendering interactive 3D graphics."""
+
+toolchain = {'name': 'intel', 'version': '2017a'}
+# swr detects and builds parts specific for AVX and AVX2. If we use
+# -xHost, this always gets overwritten and will fail.
+toolchainopts = {'optarch': False}
+
+sources = [SOURCELOWER_TAR_XZ]
+source_urls = [
+    'https://mesa.freedesktop.org/archive/%(version)s',
+    'ftp://ftp.freedesktop.org/pub/mesa/%(version)s',
+    'ftp://ftp.freedesktop.org/pub/mesa/older-versions/%(version_major)s.x/%(version)s',
+]
+
+builddependencies = [
+    ('flex', '2.6.0', '', True),
+    ('Bison', '3.0.4', '', True),
+    ('Autotools', '20150215', '', True),
+    ('pkg-config', '0.29.2', '', True),
+    ('Mako', '1.0.4', '-Python-2.7.13', True),
+    ('libxml2', '2.9.4', '', True),
+]
+
+dependencies = [
+    ('zlib', '1.2.11', '', True),
+    ('nettle', '3.2'),
+    ('libdrm', '2.4.75', '', True),
+    ('LLVM', '3.8.1'),
+    ('X11', '20160819', '', True),
+]
+
+# GLU is not part anymore of Mesa package!
+configopts = " --disable-osmesa --enable-gallium-osmesa --enable-gallium-llvm --enable-glx --disable-dri"
+configopts += " --disable-driglx-direct --with-gallium-drivers='swrast,swr' --disable-egl"
+configopts += " --with-osmesa-bits=32 --enable-texture-float --enable-llvm-shared-libs "
+
+sanity_check_paths = {
+    'files': ['lib/libGL.%s' % SHLIB_EXT, 'lib/libOSMesa.%s' % SHLIB_EXT, 'lib/libGLESv1_CM.%s' % SHLIB_EXT,
+              'lib/libGLESv2.%s' %SHLIB_EXT, 'include/GL/glext.h', 'include/GL/gl_mangle.h', 'include/GL/glx.h',
+              'include/GL/osmesa.h', 'include/GL/wglext.h', 'include/GL/gl.h', 'include/GL/glxext.h',
+              'include/GL/glx_mangle.h', 'include/GLES/gl.h', 'include/GLES2/gl2.h', 'include/GLES3/gl3.h'],
+    'dirs': []
+}
+
+moduleclass = 'vis'
diff --git a/n/nettle/nettle-3.2-intel-2017a.eb b/n/nettle/nettle-3.2-intel-2017a.eb
new file mode 100644
index 00000000..537f3d1d
--- /dev/null
+++ b/n/nettle/nettle-3.2-intel-2017a.eb
@@ -0,0 +1,28 @@
+easyblock = 'ConfigureMake'
+
+name = 'nettle'
+version = '3.2'
+
+homepage = 'http://www.lysator.liu.se/~nisse/nettle/'
+description = """Nettle is a cryptographic library that is designed to fit easily
+ in more or less any context: In crypto toolkits for object-oriented
+ languages (C++, Python, Pike, ...), in applications like LSH or GNUPG,
+ or even in kernel space."""
+
+toolchain = {'name': 'intel', 'version': '2017a'}
+
+source_urls = [GNU_SOURCE]
+sources = [SOURCE_TAR_GZ]
+
+dependencies = [
+    ('GMP', '6.1.1', '', True),
+]
+
+sanity_check_paths = {
+    'files': ['bin/%s' % x for x in ['nettle-hash', 'nettle-lfib-stream', 'pkcs1-conv', 'sexp-conv']] +
+             ['lib64/libhogweed.a', 'lib64/libhogweed.%s' % SHLIB_EXT,
+              'lib64/libnettle.a', 'lib64/libnettle.%s' % SHLIB_EXT],
+    'dirs': ['include/nettle'],
+}
+
+moduleclass = 'lib'
diff --git a/o/OpenFOAM/OpenFOAM-4.1-cleanup.patch b/o/OpenFOAM/OpenFOAM-4.1-cleanup.patch
new file mode 100644
index 00000000..d01502d3
--- /dev/null
+++ b/o/OpenFOAM/OpenFOAM-4.1-cleanup.patch
@@ -0,0 +1,291 @@
+# This patch removes all need for the ThirdParty files of OpenFOAM:
+# we use EB dependencies for everything. It adjusts the paths, variables, etc
+# We also let the install dir, compiler, etc be set by EB.
+# Lastly, we also fix a small compile issue in 'ptscotchDecomp.C'
+# Ward Poelmans <wpoely86@gmail.com>
+diff -ur OpenFOAM-4.1.orig/applications/utilities/mesh/manipulation/setSet/Allwmake OpenFOAM-4.1/applications/utilities/mesh/manipulation/setSet/Allwmake
+--- OpenFOAM-4.1.orig/applications/utilities/mesh/manipulation/setSet/Allwmake	2016-06-24 23:33:52.000000000 +0200
++++ OpenFOAM-4.1/applications/utilities/mesh/manipulation/setSet/Allwmake	2016-09-02 15:44:36.305512075 +0200
+@@ -9,11 +9,11 @@
+ #
+ # use readline if available
+ #
+-if [ -f /usr/include/readline/readline.h ]
++if [ -f $EBROOTLIBREADLINE/include/readline/readline.h ]
+ then
+     echo "Found <readline/readline.h>  --  enabling readline support."
+     export COMP_FLAGS="-DHAS_READLINE"
+-    export LINK_FLAGS="-lreadline"
++    export LINK_FLAGS="-L$EBROOTLIBREADLINE/lib -lreadline -L$EBROOTNCURSES -lncurses"
+ fi
+
+ wmake
+diff -ur OpenFOAM-4.1.orig/applications/utilities/postProcessing/graphics/PVReaders/Allwmake OpenFOAM-4.1/applications/utilities/postProcessing/graphics/PVReaders/Allwmake
+--- OpenFOAM-4.1.orig/applications/utilities/postProcessing/graphics/PVReaders/Allwmake	2016-06-24 23:33:52.000000000 +0200
++++ OpenFOAM-4.1/applications/utilities/postProcessing/graphics/PVReaders/Allwmake	2016-09-02 15:44:36.305512075 +0200
+@@ -16,7 +16,7 @@
+         }
+
+         # ensure CMake gets the correct C++ compiler
+-        [ -n "$WM_CXX" ] && export CXX="$WM_CXX"
++#        [ -n "$WM_CXX" ] && export CXX="$WM_CXX"
+
+         wmake $targetType vtkPVReaders
+         PVblockMeshReader/Allwmake $*
+diff -ur OpenFOAM-4.1.orig/etc/bashrc OpenFOAM-4.1/etc/bashrc
+--- OpenFOAM-4.1.orig/etc/bashrc	2016-06-24 23:33:52.000000000 +0200
++++ OpenFOAM-4.1/etc/bashrc	2016-09-02 15:43:37.773220097 +0200
+@@ -42,9 +42,8 @@
+ #
+ # Please set to the appropriate path if the default is not correct.
+ #
+-[ $BASH_SOURCE ] && \
+-export FOAM_INST_DIR=$(cd ${BASH_SOURCE%/*/*/*} && pwd -P) || \
+-export FOAM_INST_DIR=$HOME/$WM_PROJECT
++# For Easybuild: set by the module
++#
+ # export FOAM_INST_DIR=~$WM_PROJECT
+ # export FOAM_INST_DIR=/opt/$WM_PROJECT
+ # export FOAM_INST_DIR=/usr/local/$WM_PROJECT
+diff -ur OpenFOAM-4.1.orig/etc/config.sh/CGAL OpenFOAM-4.1/etc/config.sh/CGAL
+--- OpenFOAM-4.1.orig/etc/config.sh/CGAL	2016-06-24 23:33:52.000000000 +0200
++++ OpenFOAM-4.1/etc/config.sh/CGAL	2016-09-02 15:43:37.773220097 +0200
+@@ -36,37 +36,7 @@
+ #
+ #------------------------------------------------------------------------------
+
+-boost_version=boost-system
+-cgal_version=cgal-system
+-#cgal_version=CGAL-4.8
+-
+-if [ -z "$SOURCE_CGAL_VERSIONS_ONLY" ]
+-then
+-
+-    common_path=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER
+-
+-    export BOOST_ARCH_PATH=$common_path/$boost_version
+-    export CGAL_ARCH_PATH=$common_path/$cgal_version
+-
+-    if [ "$FOAM_VERBOSE" -a "$PS1" ]
+-    then
+-        echo "Using CGAL and boost" 1>&2
+-        echo "    $cgal_version at $CGAL_ARCH_PATH" 1>&2
+-        echo "    $boost_version at $BOOST_ARCH_PATH" 1>&2
+-    fi
+-
+-    if [ -d "$CGAL_ARCH_PATH" -a "$cgal_version" != "cgal-system" ]
+-    then
+-        _foamAddLib $CGAL_ARCH_PATH/lib
+-    fi
+-
+-    if [ -d "$BOOST_ARCH_PATH" -a "$boost_version" != "boost-system" ]
+-    then
+-        _foamAddLib $BOOST_ARCH_PATH/lib
+-    fi
+-
+-    unset boost_version cgal_version common_path
+-
+-fi
++export CGAL_ARCH_PATH=$EBROOTCGAL
++export BOOST_ARCH_PATH=$EBROOTBOOST
+
+ #------------------------------------------------------------------------------
+diff -ur OpenFOAM-4.1.orig/etc/config.sh/gperftools OpenFOAM-4.1/etc/config.sh/gperftools
+--- OpenFOAM-4.1.orig/etc/config.sh/gperftools	2016-06-24 23:33:52.000000000 +0200
++++ OpenFOAM-4.1/etc/config.sh/gperftools	2016-09-02 15:43:37.773220097 +0200
+@@ -29,13 +29,7 @@
+ #
+ #------------------------------------------------------------------------------
+
+-version=svn
+-gperftools_install=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER
+-
+-GPERFTOOLS_VERSION=gperftools-$version
+-GPERFTOOLS_ARCH_PATH=$gperftools_install/$GPERFTOOLS_VERSION
+-
+-export PATH=$GPERFTOOLS_ARCH_PATH/bin:$PATH
+-export LD_LIBRARY_PATH=$GPERFTOOLS_ARCH_PATH/lib:$LD_LIBRARY_PATH
++GPERFTOOLS_VERSION=gperftools-$EBVERSIONGPERFTOOLS
++GPERFTOOLS_ARCH_PATH=$EBROOTGPERFTOOLS
+
+ #------------------------------------------------------------------------------
+diff -ur OpenFOAM-4.1.orig/etc/config.sh/metis OpenFOAM-4.1/etc/config.sh/metis
+--- OpenFOAM-4.1.orig/etc/config.sh/metis	2016-06-24 23:33:52.000000000 +0200
++++ OpenFOAM-4.1/etc/config.sh/metis	2016-09-02 15:43:37.773220097 +0200
+@@ -34,7 +34,7 @@
+ #
+ #------------------------------------------------------------------------------
+
+-export METIS_VERSION=metis-5.1.0
+-export METIS_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$METIS_VERSION
++export METIS_VERSION=metis-$EBVERSIONMETIS
++export METIS_ARCH_PATH=$EBROOTMETIS
+
+ #------------------------------------------------------------------------------
+diff -ur OpenFOAM-4.1.orig/etc/config.sh/mpi OpenFOAM-4.1/etc/config.sh/mpi
+--- OpenFOAM-4.1.orig/etc/config.sh/mpi	2016-06-24 23:33:52.000000000 +0200
++++ OpenFOAM-4.1/etc/config.sh/mpi	2016-09-02 15:43:37.773220097 +0200
+@@ -243,6 +243,9 @@
+     _foamAddPath    $MPI_ARCH_PATH/bin64
+     _foamAddLib     $MPI_ARCH_PATH/lib64
+     ;;
++EASYBUILDMPI)
++    export FOAM_MPI=mpi
++    ;;
+ *)
+     export FOAM_MPI=dummy
+     ;;
+diff -ur OpenFOAM-4.1.orig/etc/config.sh/paraview OpenFOAM-4.1/etc/config.sh/paraview
+--- OpenFOAM-4.1.orig/etc/config.sh/paraview	2016-06-24 23:33:52.000000000 +0200
++++ OpenFOAM-4.1/etc/config.sh/paraview	2016-09-02 15:43:37.773220097 +0200
+@@ -41,21 +41,6 @@
+         ) \
+         && PATH="$cleaned"
+
+-# Determine the cmake to be used
+-unset CMAKE_HOME
+-for cmake in cmake-3.2.1 cmake-2.8.12.1 cmake-2.8.8 cmake-2.8.4 cmake-2.8.3 \
+-             cmake-2.8.1
+-do
+-    cmake=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cmake
+-    if [ -r $cmake ]
+-    then
+-        export CMAKE_HOME=$cmake
+-        export CMAKE_ROOT=$cmake
+-        export PATH=$CMAKE_HOME/bin:$PATH
+-        break
+-    fi
+-done
+-
+
+ #- ParaView version, automatically determine major version
+ #export ParaView_VERSION=3.12.0
+@@ -64,7 +49,7 @@
+ #export ParaView_VERSION=4.3.1
+ #export ParaView_VERSION=4.4.0
+ #export ParaView_VERSION=5.0.0
+-export ParaView_VERSION=5.0.1
++export ParaView_VERSION=$EBVERSIONPARAVIEW
+ export ParaView_MAJOR=detect
+
+
+@@ -105,21 +90,15 @@
+ paraviewInstDir=$WM_THIRD_PARTY_DIR/ParaView-$ParaView_VERSION
+ paraviewArchName=ParaView-$ParaView_VERSION
+
+-export ParaView_DIR=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$paraviewArchName
++export ParaView_DIR=$EBROOTPARAVIEW
+
+ # Set paths if binaries or source are present
+ if [ -r $ParaView_DIR -o -r $paraviewInstDir ]
+ then
+     export ParaView_INCLUDE_DIR=$ParaView_DIR/include/paraview-$ParaView_MAJOR
+-    if [ ! -d $ParaView_INCLUDE_DIR -a -d $ParaView_DIR/include/paraview-3.0 ]
+-    then
+-        export ParaView_INCLUDE_DIR=$ParaView_DIR/include/paraview-3.0
+-    fi
+
+     ParaView_LIB_DIR=$ParaView_DIR/lib/paraview-$ParaView_MAJOR
+
+-    export PATH=$ParaView_DIR/bin:$PATH
+-    export LD_LIBRARY_PATH=$ParaView_LIB_DIR:$LD_LIBRARY_PATH
+     export PV_PLUGIN_PATH=$FOAM_LIBBIN/paraview-$ParaView_MAJOR
+
+     if [ "$FOAM_VERBOSE" -a "$PS1" ]
+@@ -131,17 +110,6 @@
+         echo "    PV_PLUGIN_PATH       : $PV_PLUGIN_PATH"
+     fi
+
+-    # Add in python libraries if required
+-    paraviewPython=$ParaView_DIR/Utilities/VTKPythonWrapping
+-    if [ -r $paraviewPython ]
+-    then
+-        if [ "$PYTHONPATH" ]
+-        then
+-            export PYTHONPATH=$PYTHONPATH:$paraviewPython:$ParaView_LIB_DIR
+-        else
+-            export PYTHONPATH=$paraviewPython:$ParaView_LIB_DIR
+-        fi
+-    fi
+ else
+     unset PV_PLUGIN_PATH
+ fi
+diff -ur OpenFOAM-4.1.orig/etc/config.sh/scotch OpenFOAM-4.1/etc/config.sh/scotch
+--- OpenFOAM-4.1.orig/etc/config.sh/scotch	2016-06-24 23:33:52.000000000 +0200
++++ OpenFOAM-4.1/etc/config.sh/scotch	2016-09-02 15:43:37.773220097 +0200
+@@ -37,7 +37,7 @@
+ #
+ #------------------------------------------------------------------------------
+
+-export SCOTCH_VERSION=scotch_6.0.3
+-export SCOTCH_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$SCOTCH_VERSION
++export SCOTCH_VERSION=scotch_$EBVERSIONSCOTCH
++export SCOTCH_ARCH_PATH=$EBROOTSCOTCH
+
+ #------------------------------------------------------------------------------
+diff -ur OpenFOAM-4.1.orig/etc/config.sh/settings OpenFOAM-4.1/etc/config.sh/settings
+--- OpenFOAM-4.1.orig/etc/config.sh/settings	2016-06-24 23:33:52.000000000 +0200
++++ OpenFOAM-4.1/etc/config.sh/settings	2016-09-02 15:43:37.773220097 +0200
+@@ -56,11 +56,11 @@
+         64)
+             WM_ARCH=linux64
+             export WM_COMPILER_LIB_ARCH=64
+-            export WM_CC='gcc'
+-            export WM_CXX='g++'
+-            export WM_CFLAGS='-m64 -fPIC'
+-            export WM_CXXFLAGS='-m64 -fPIC -std=c++0x'
+-            export WM_LDFLAGS='-m64'
++            export WM_CC=$CC
++            export WM_CXX=$CXX
++            export WM_CFLAGS=$CFLAGS
++            export WM_CXXFLAGS=$CXXFLAGS
++            export WM_LDFLAGS=$LDFLAGS
+             ;;
+         *)
+             echo "Unknown WM_ARCH_OPTION '$WM_ARCH_OPTION', should be 32 or 64"\
+diff -ur OpenFOAM-4.1.orig/src/parallel/decompose/ptscotchDecomp/Make/options OpenFOAM-4.1/src/parallel/decompose/ptscotchDecomp/Make/options
+--- OpenFOAM-4.1.orig/src/parallel/decompose/ptscotchDecomp/Make/options	2016-06-24 23:33:52.000000000 +0200
++++ OpenFOAM-4.1/src/parallel/decompose/ptscotchDecomp/Make/options	2016-09-02 15:44:36.305512075 +0200
+@@ -3,10 +3,8 @@
+
+ EXE_INC = \
+     $(PFLAGS) $(PINC) \
+-    -I$(SCOTCH_ROOT)/include \
+     -I$(SCOTCH_ARCH_PATH)/include/$(FOAM_MPI) \
+-    -I/usr/include/scotch \
+     -I../decompositionMethods/lnInclude
+
+ LIB_LIBS = \
+-    -L$(SCOTCH_ROOT)/lib -L$(FOAM_EXT_LIBBIN)/$(FOAM_MPI) -lptscotch -lptscotcherrexit -lscotch ${LINK_FLAGS} -lrt
++    -L$(SCOTCH_ARCH_PATH)/lib -L$(FOAM_EXT_LIBBIN)/$(FOAM_MPI) -lptscotch -lptscotcherrexit -lscotch ${LINK_FLAGS} -lrt
+diff -ur OpenFOAM-4.1.orig/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C OpenFOAM-4.1/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C
+--- OpenFOAM-4.1.orig/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C	2016-06-24 23:33:52.000000000 +0200
++++ OpenFOAM-4.1/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C	2016-09-02 15:45:13.376950242 +0200
+@@ -30,10 +30,11 @@
+ #include "globalIndex.H"
+ #include "SubField.H"
+
++#include <mpi.h>
++
+ extern "C"
+ {
+     #include <stdio.h>
+-    #include <mpi.h>
+     #include "ptscotch.h"
+ }
+
+diff -ur OpenFOAM-4.1.orig/src/parallel/decompose/scotchDecomp/Make/options OpenFOAM-4.1/src/parallel/decompose/scotchDecomp/Make/options
+--- OpenFOAM-4.1.orig/src/parallel/decompose/scotchDecomp/Make/options	2016-06-24 23:33:52.000000000 +0200
++++ OpenFOAM-4.1/src/parallel/decompose/scotchDecomp/Make/options	2016-09-02 15:44:36.305512075 +0200
+@@ -7,10 +7,8 @@
+
+ EXE_INC = \
+     $(PFLAGS) $(PINC) \
+-    -I$(SCOTCH_ROOT)/include \
+     -I$(SCOTCH_ARCH_PATH)/include \
+-    -I/usr/include/scotch \
+     -I../decompositionMethods/lnInclude
+
+ LIB_LIBS = \
+-    -L$(SCOTCH_ROOT)/lib -L$(FOAM_EXT_LIBBIN) -lscotch -lscotcherrexit -lrt
++    -L$(SCOTCH_ARCH_PATH)/lib -L$(FOAM_EXT_LIBBIN) -lscotch -lscotcherrexit -lrt
diff --git a/o/OpenFOAM/OpenFOAM-4.1-intel-2017a.eb b/o/OpenFOAM/OpenFOAM-4.1-intel-2017a.eb
index fcf08777..172d130b 100644
--- a/o/OpenFOAM/OpenFOAM-4.1-intel-2017a.eb
+++ b/o/OpenFOAM/OpenFOAM-4.1-intel-2017a.eb
@@ -18,19 +18,22 @@ checksums = ['318a446c4ae6366c7296b61184acd37c']
 patches = ['OpenFOAM-%(version)s-cleanup.patch']
 
 dependencies = [
-    ('libreadline', '6.3'),
-    ('ncurses', '6.0'),
+    ('libreadline', '6.3', '', True),
+    ('ncurses', '6.0', '', True),
     # OpenFOAM requires 64 bit METIS using 32 bit indexes (array indexes)
-    ('METIS', '5.1.0', '', True),
+    ('METIS', '5.1.0'),
     ('SCOTCH', '6.0.4'),
     ('CGAL', '4.8.1'),
+    # Maximum ParaView version 5.2! (ADD_PARAVIEW_OBJECT_PANEL is no longer supported)
     ('ParaView', '5.1.2', '-mpi'),
 ]
 
 builddependencies = [
-    ('Bison', '3.0.4'),
-    ('CMake', '3.7.2'),
-    ('flex', '2.6.3', '', ('GCCcore', '6.3.0')),
+    ('Bison', '3.0.4', '', True),
+    ('CMake', '3.7.2', '', True),
+    ('flex', '2.6.0', '', True),
 ]
 
+modextrapaths = {'PATH': 'OpenFOAM-%(version)s/bin'}
+
 moduleclass = 'cae'
diff --git a/p/ParaView/ParaView-5.1.2-intel-2017a-mpi.eb b/p/ParaView/ParaView-5.1.2-intel-2017a-mpi.eb
index 6d85b172..1cb08dee 100644
--- a/p/ParaView/ParaView-5.1.2-intel-2017a-mpi.eb
+++ b/p/ParaView/ParaView-5.1.2-intel-2017a-mpi.eb
@@ -15,13 +15,13 @@ source_urls = ['http://www.paraview.org/paraview-downloads/%s' % download_suffix
 sources = ["ParaView-v%(version)s.tar.gz"]
 
 dependencies = [
-    ('X11', '20160819'),
+    ('X11', '20160819', '', True),
     ('Mesa', '12.0.2'),
-    ('libGLU', '9.0.0'),
-    ('Qt', '4.8.7'),
+    ('libGLU', '9.0.0', '', True),
+    ('Qt', '4.8.6', '', True),
     ('zlib', '1.2.11', '', True),
     ('HDF5', '1.8.17'),
-    ('Python', '2.7.12'),
+    ('Python', '2.7.13', '', True),
 ]
 
 builddependencies = [('CMake', '3.7.2', '', True)]
@@ -41,10 +41,10 @@ configopts += '-DBUILD_TESTING=OFF '
 # Or consult https://gitlab.kitware.com/vtk/vtk/blob/master/Documentation/dev/git/data.md
 # and download ExternalData to $EASYBUILD_SOURCEPATH and adjust -DExternalData_OBJECT_STORES accordingly
 # Without internet connection, comment the following two lines (configopts and prebuildopts)
-configopts += '-DExternalData_OBJECT_STORES=%(builddir)s/ExternalData '
+#configopts += '-DExternalData_OBJECT_STORES=%(builddir)s/ExternalData '
 # The ParaView server can be cranky, test downloads are quite often failing, especially in the case
 # of parallel downloads. Using ; insted of && gives a second chance to download the test files, if the
 # first serial attempt would fail.
-prebuildopts = 'make VTKData ;'
+#prebuildopts = 'make VTKData ;'
 
 moduleclass = 'vis'
diff --git a/p/pkg-config/pkg-config-0.29.2.eb b/p/pkg-config/pkg-config-0.29.2.eb
new file mode 100644
index 00000000..9cb31afe
--- /dev/null
+++ b/p/pkg-config/pkg-config-0.29.2.eb
@@ -0,0 +1,27 @@
+easyblock = 'ConfigureMake'
+
+name = 'pkg-config'
+version = '0.29.2'
+
+homepage = 'http://www.freedesktop.org/wiki/Software/pkg-config/'
+description = """pkg-config is a helper tool used when compiling applications and libraries. It helps you insert the
+ correct compiler options on the command line so an application can use
+  gcc -o test test.c `pkg-config --libs --cflags glib-2.0`
+ for instance, rather than hard-coding values on where to find glib (or other libraries)."""
+
+# don't use PAX, it might break.
+tar_config_opts = True
+
+toolchain = {'name': 'dummy', 'version': ''}
+
+sources = [SOURCELOWER_TAR_GZ]
+source_urls = ['http://pkgconfig.freedesktop.org/releases/']
+
+configopts = " --with-internal-glib"
+
+sanity_check_paths = {
+    'files': ['bin/pkg-config'],
+    'dirs': [],
+}
+
+moduleclass = 'devel'
diff --git a/q/Qt5/Qt5-5.8.0-GCC-6.3.0-2.27.eb b/q/Qt5/Qt5-5.8.0-GCC-6.3.0-2.27.eb
new file mode 100644
index 00000000..40cc94bb
--- /dev/null
+++ b/q/Qt5/Qt5-5.8.0-GCC-6.3.0-2.27.eb
@@ -0,0 +1,33 @@
+easyblock = 'EB_Qt'
+
+name = 'Qt5'
+version = '5.8.0'
+
+homepage = 'http://qt.io/'
+description = "Qt is a comprehensive cross-platform C++ application framework."
+
+toolchain = {'name': 'GCC', 'version': '6.3.0-2.27'}
+
+source_urls = [
+    'http://download.qt.io/official_releases/qt/%(version_major_minor)s/%(version)s/single/',
+    'http://download.qt.io/archive/qt/%(version_major_minor)s/%(version)s/single/'
+]
+sources = ['qt-everywhere-opensource-src-%(version)s.tar.xz']
+
+patches = ['Qt5-5.7.1_fix-nan-inf.patch']
+
+builddependencies = [
+    ('pkg-config', '0.29.2', '', True),
+]
+
+# qtgamepad needs recent kernel/libevdev (fails on RHEL 6.x)
+configopts = '-skip qtgamepad'
+
+dependencies = [
+    ('GLib', '2.40.0', '', True),
+    ('libpng', '1.6.12', '', True),
+    ('X11', '20160819', '', True),
+    ('libGLU', '9.0.0', '', True),
+]
+
+moduleclass = 'devel'
diff --git a/x/X11/X11-20160819.eb b/x/X11/X11-20160819.eb
new file mode 100644
index 00000000..5c4b34da
--- /dev/null
+++ b/x/X11/X11-20160819.eb
@@ -0,0 +1,131 @@
+easyblock = 'Bundle'
+
+name = 'X11'
+version = '20160819'
+
+homepage = 'https://www.x.org'
+description = "The X Window System (X11) is a windowing system for bitmap displays"
+
+toolchain = {'name': 'dummy', 'version': ''}
+
+source_urls = [
+    XORG_LIB_SOURCE,
+    XORG_PROTO_SOURCE,
+    'http://xcb.freedesktop.org/dist/',
+    'http://xkbcommon.org/download/',
+    'http://cgit.freedesktop.org/xorg/util/macros/snapshot',
+]
+
+builddependencies = [
+    ('Autotools', '20150215'),
+    ('pkg-config', '0.29.2'),
+]
+dependencies = [
+    ('freetype', '2.5.3'),
+    ('fontconfig', '2.11.1'),
+    ('zlib', '1.2.11'),
+    ('bzip2', '1.0.6'),
+]
+
+default_easyblock = 'ConfigureMake'
+
+common_specs = {
+    'sources': [SOURCE_TAR_GZ],
+    'start_dir': '%(name)s-%(version)s',
+}
+components = [
+    ('xorg-macros', '1.19.0', {
+        'sources': ['util-macros-%(version)s.tar.gz'],
+        'start_dir': 'util-macros-%(version)s',
+    }),
+    ('libpthread-stubs', '0.3', common_specs),
+    ('bigreqsproto', '1.1.2', common_specs),
+    ('compositeproto', '0.4.2', common_specs),
+    ('damageproto', '1.2.1', common_specs),
+    ('dmxproto', '2.3.1', common_specs),
+    ('dri2proto', '2.8', common_specs),
+    ('dri3proto', '1.0', common_specs),
+    ('fixesproto', '5.0', common_specs),
+    ('fontsproto', '2.1.3', common_specs),
+    ('glproto', '1.4.17', common_specs),
+    ('inputproto', '2.3.1', common_specs),
+    ('kbproto', '1.0.7', common_specs),
+    ('presentproto', '1.0', common_specs),
+    ('randrproto', '1.5.0', common_specs),
+    ('recordproto', '1.14.2', common_specs),
+    ('renderproto', '0.11', common_specs),
+    ('resourceproto', '1.2.0', common_specs),
+    ('scrnsaverproto', '1.2.2', common_specs),
+    ('videoproto', '2.3.3', common_specs),
+    ('xcmiscproto', '1.2.2', common_specs),
+    ('xextproto', '7.3.0', common_specs),
+    ('xf86bigfontproto', '1.2.0', common_specs),
+    ('xf86dgaproto', '2.1', common_specs),
+    ('xf86driproto', '2.1.1', common_specs),
+    ('xf86vidmodeproto', '2.3.1', common_specs),
+    ('xineramaproto', '1.2.1', common_specs),
+    ('xproto', '7.0.28', common_specs),
+    ('libXau', '1.0.8', common_specs),
+    ('libXdmcp', '1.1.2', common_specs),
+    ('xcb-proto', '1.11', common_specs),
+    ('libxcb', '1.11.1', common_specs),
+    ('xtrans', '1.3.5', common_specs),
+    ('libxkbcommon', '0.6.1', {
+        'sources': ['libxkbcommon-%(version)s.tar.xz'],
+        'start_dir': 'libxkbcommon-%(version)s',
+    }),
+    ('libX11', '1.6.3', common_specs),
+    ('libXext', '1.3.3', common_specs),
+    ('libFS', '1.0.7', common_specs),
+    ('libICE', '1.0.9', common_specs),
+    ('libSM', '1.2.2', common_specs),
+    ('libXScrnSaver', '1.2.2', common_specs),
+    ('libXt', '1.1.5', common_specs),
+    ('libXmu', '1.1.2', common_specs),
+    ('libXpm', '3.5.11', common_specs),
+    ('libXaw', '1.0.13', common_specs),
+    ('libXfixes', '5.0.2', common_specs),
+    ('libXcomposite', '0.4.4', common_specs),
+    ('libXrender', '0.9.9', common_specs),
+    ('libXcursor', '1.1.14', common_specs),
+    ('libXdamage', '1.1.4', common_specs),
+    ('libfontenc', '1.1.3', common_specs),
+    ('libXfont', '1.5.1', common_specs),
+    ('libXft', '2.3.2', common_specs),
+    ('libXi', '1.7.6', common_specs),
+    ('libXinerama', '1.1.3', common_specs),
+    ('libXrandr', '1.5.0', common_specs),
+    ('libXres', '1.0.7', common_specs),
+    ('libXtst', '1.2.2', common_specs),
+    ('libXv', '1.0.10', common_specs),
+    ('libXvMC', '1.0.9', common_specs),
+    ('libXxf86dga', '1.1.4', common_specs),
+    ('libXxf86vm', '1.1.4', common_specs),
+    ('libdmx', '1.1.3', common_specs),
+    ('libpciaccess', '0.13.4', common_specs),
+    ('libxkbfile', '1.0.9', common_specs),
+    ('libxshmfence', '1.2', common_specs),
+    ('xcb-util', '0.4.0', common_specs),
+    ('xcb-util-image', '0.4.0', common_specs),
+    ('xcb-util-keysyms', '0.4.0', common_specs),
+    ('xcb-util-renderutil', '0.3.9', common_specs),
+    ('xcb-util-wm', '0.4.1', common_specs),
+    ('xcb-util-cursor', '0.1.3', common_specs),
+]
+
+# Python is required for xcb-proto
+allow_system_deps = [('Python', SYS_PYTHON_VERSION)]
+pyshortver = '.'.join(SYS_PYTHON_VERSION.split('.')[0:2])
+
+preconfigopts = "if [ ! -f configure ]; then ./autogen.sh; fi && "
+
+# specify that Bundle easyblock should run a full sanity check, rather than just trying to load the module
+full_sanity_check = True
+
+sanity_check_paths = {
+    'files': ['include/X11/Xlib.h', 'include/X11/Xutil.h'],
+    'dirs': ['include/GL', 'include/X11', 'include/X11/extensions', 'lib',
+             'lib/python%s/site-packages/xcbgen' % pyshortver, 'lib/pkgconfig', 'share/pkgconfig'],
+}
+
+moduleclass = 'vis'