summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xvar/spack/repos/builtin/packages/openfoam-com/common/spack-Allwmake7
-rw-r--r--var/spack/repos/builtin/packages/openfoam-com/package.py68
2 files changed, 53 insertions, 22 deletions
diff --git a/var/spack/repos/builtin/packages/openfoam-com/common/spack-Allwmake b/var/spack/repos/builtin/packages/openfoam-com/common/spack-Allwmake
index 6c53c2fd70..eb2d097c4e 100755
--- a/var/spack/repos/builtin/packages/openfoam-com/common/spack-Allwmake
+++ b/var/spack/repos/builtin/packages/openfoam-com/common/spack-Allwmake
@@ -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
diff --git a/var/spack/repos/builtin/packages/openfoam-com/package.py b/var/spack/repos/builtin/packages/openfoam-com/package.py
index cdb6ae1dac..60a35d75db 100644
--- a/var/spack/repos/builtin/packages/openfoam-com/package.py
+++ b/var/spack/repos/builtin/packages/openfoam-com/package.py
@@ -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 @@ class OpenfoamCom(Package):
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 @@ class OpenfoamCom(Package):
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 @@ class OpenfoamCom(Package):
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 @@ class OpenfoamCom(Package):
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):