ENH: fixes and updates for openfoam-com build (#10065)

- previous removal of FOAM_EXT_LIBBIN (ThirdParty) from the environment
  during the build could lead to the system scotch library being found
  instead of the spack installation.

  Avoid this largely cosmetic change to the setting in favour of
  improved build robustness. These modifications will be largely
  superfluous in the 1812 release anyhow.

- Split the patching algorithm into 'regular' and '@:1806' since the
  next versions of openfoam will again need fewer patches.

- Add hook into foamCreateManpage to be used where available
This commit is contained in:
Mark Olesen 2018-12-17 19:58:09 +01:00 committed by Adam J. Stewart
parent ccce3b79ab
commit cbedd507cf
2 changed files with 53 additions and 22 deletions

View File

@ -12,6 +12,13 @@ then
./Allwmake-spack $@ # Pass arguments
else
./Allwmake $@ # Pass arguments
# Generate manpages
if [ -x bin/tools/foamCreateManpage ]
then
bin/tools/foamCreateManpage -gzip || \
echo "ignore problems generating manpages"
fi
fi

View File

@ -3,6 +3,9 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
#
# Author: Mark Olesen <mark.olesen@esi-group.com>
#
# Legal Notice
# ------------
# OPENFOAM is a trademark owned by OpenCFD Ltd
@ -469,9 +472,14 @@ def patch(self):
Where needed, apply filter as an alternative to normal patching."""
add_extra_files(self, self.common, self.assets)
# Avoid WM_PROJECT_INST_DIR for ThirdParty, site or jobControl.
#
# Filtering: bashrc,cshrc (using a patch is less flexible)
@when('@:1806')
def patch(self):
"""Adjust OpenFOAM build for spack.
Where needed, apply filter as an alternative to normal patching."""
add_extra_files(self, self.common, self.assets)
# Avoid WM_PROJECT_INST_DIR for ThirdParty
# This modification is non-critical
edits = {
'WM_THIRD_PARTY_DIR':
r'$WM_PROJECT_DIR/ThirdParty #SPACK: No separate third-party',
@ -481,18 +489,10 @@ def patch(self):
posix=join_path('etc', 'bashrc'),
cshell=join_path('etc', 'cshrc'))
# Filtering: settings
edits = {
'FOAM_EXT_LIBBIN': '#SPACK: No separate third-party', # ie, unset
}
rewrite_environ_files( # etc/config.{csh,sh}/settings
edits,
posix=join_path('etc', 'config.sh', 'settings'),
cshell=join_path('etc', 'config.csh', 'settings'))
# The following filtering is non-vital. It simply prevents 'site' dirs
# from the the wrong level (likely non-existent anyhow) from being
# added to PATH, LD_LIBRARY_PATH.
# The following filtering is non-critical.
# It simply prevents 'site' dirs at the wrong level
# (likely non-existent anyhow) from being added to
# PATH, LD_LIBRARY_PATH.
for rcdir in ['config.sh', 'config.csh']:
rcfile = join_path('etc', rcdir, 'settings')
if os.path.isfile(rcfile):
@ -632,15 +632,43 @@ def build(self, spec, prefix):
builder = Executable(self.build_script)
builder(*args)
def install(self, spec, prefix):
"""Install under the projectdir"""
def install_write_location(self):
"""Set the installation location (projectdir) in bashrc,cshrc."""
mkdirp(self.projectdir)
# Filtering: bashrc, cshrc
edits = {
'WM_PROJECT_DIR': self.projectdir,
}
etc_dir = join_path(self.projectdir, 'etc')
rewrite_environ_files( # Adjust etc/bashrc and etc/cshrc
edits,
posix=join_path(etc_dir, 'bashrc'),
cshell=join_path(etc_dir, 'cshrc'))
@when('@:1806')
def install_write_location(self):
"""Set the installation location (projectdir) in bashrc,cshrc.
In 1806 and earlier, had WM_PROJECT_INST_DIR as the prefix
directory where WM_PROJECT_DIR was installed.
"""
mkdirp(self.projectdir)
projdir = os.path.basename(self.projectdir)
# Filtering: bashrc, cshrc
edits = {
'WM_PROJECT_INST_DIR': os.path.dirname(self.projectdir),
'WM_PROJECT_DIR': join_path('$WM_PROJECT_INST_DIR', projdir),
}
etc_dir = join_path(self.projectdir, 'etc')
rewrite_environ_files( # Adjust etc/bashrc and etc/cshrc
edits,
posix=join_path(etc_dir, 'bashrc'),
cshell=join_path(etc_dir, 'cshrc'))
def install(self, spec, prefix):
"""Install under the projectdir"""
mkdirp(self.projectdir)
# All top-level files, except spack build info and possibly Allwmake
if '+source' in spec:
@ -681,11 +709,7 @@ def install(self, spec, prefix):
ignore=ignore,
symlinks=True)
etc_dir = join_path(self.projectdir, 'etc')
rewrite_environ_files( # Adjust etc/bashrc and etc/cshrc
edits,
posix=join_path(etc_dir, 'bashrc'),
cshell=join_path(etc_dir, 'cshrc'))
self.install_write_location()
self.install_links()
def install_links(self):