ENH: installation helpers

----
install-dirs: a general directory installer

  Copy installs non-binary (platform) directories.
  Eg,

      install-dirs -prefix=... -devel
      install-dirs -prefix=... -default -no-app

----
install-platform: a platform (binary) installer

  This is primarily driven by the need to install into system mpi
  directories. The problem noted in issue #1893 is caused by the
  rpm-mpi-hooks (fedora and redhat-8).

  For the additional mpi library qualifier (openmpi-x86_64) to be
  added to the requirements, the mpi-specific libraries (eg,
  libPstream.so) need to be installed in the mpi system directory
  (eg, /usr/lib64/openmpi).

  However, then need symlinks from the system locations back to our
  local directories to ensure that the libraries are correctly found
  via our LD_LIBRARY_PATH and we don't get dummy libraries.

----
update-mpi-links: a post-install update hook

  Expected paths are registered as persistent information into the
  hook during packaging. Triggering the hook after installation
  completes the creation of the symlinks.

Normal usage,
```
prefix="/tmp/local-install/openfoam"

bin/tools/install-dirs -prefix="$prefix" -common
bin/tools/install-platform -prefix="$prefix"
```
Installs
 - /tmp/local-install/openfoam/META-INFO
 - /tmp/local-install/openfoam/bin
 - /tmp/local-install/openfoam/etc
 - /tmp/local-install/openfoam/platforms/linux64GccDPInt32Opt/bin
 - /tmp/local-install/openfoam/platforms/linux64GccDPInt32Opt/lib

Can also place architecture-dependent bits elsewhere,
```
prefix="/tmp/local-install/openfoam"
multi_arch="$(dpkg-architecture -qDEB_TARGET_MULTIARCH)"

bin/tools/install-dirs -prefix="$prefix" -common
bin/tools/install-platform -exec-prefix="$prefix/$multi_arch"
```
Installs
 - /tmp/local-install/openfoam/META-INFO
 - /tmp/local-install/openfoam/bin
 - /tmp/local-install/openfoam/etc
 - /tmp/local-install/openfoam/x86_64-linux-gnu/bin
 - /tmp/local-install/openfoam/x86_64-linux-gnu/lib

Can use it to flatten out platforms entirely,
```
prefix="/tmp/local-install/openfoam"
bin/tools/install-dirs -prefix="$prefix" -common
bin/tools/install-platform -exec-prefix="$prefix"
```
Installs
 - /tmp/local-install/openfoam/META-INFO
 - /tmp/local-install/openfoam/bin
 - /tmp/local-install/openfoam/etc
 - /tmp/local-install/openfoam/lib
This commit is contained in:
Mark Olesen 2020-11-18 11:19:38 +01:00
parent c2bf9e1cc8
commit 9fe09ad21d
3 changed files with 880 additions and 0 deletions

430
bin/tools/install-dirs Executable file
View File

@ -0,0 +1,430 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# install-dirs
#
# Example usage
# install-dirs -prefix=/opt/openfoam/openfoamVER -core
#
# Description
# Simple installer to copy architecture-independent directories.
#
#------------------------------------------------------------------------------
printHelp() {
cat<<USAGE
Usage: ${0##*/} [OPTION]
input options:
-source=SOURCE Source directory
[\$WM_PROJECT_DIR ${WM_PROJECT_DIR:-''}]
-platform=PLATFORM OpenFOAM platform name [\$WM_OPTIONS ${WM_OPTIONS:-''}]
-foam-mpi=FOAM_MPI OpenFOAM mpi name [\$FOAM_MPI ${FOAM_MPI:-''}]
target options:
-prefix=PREFIX Top-level installation directory in PREFIX ['']
selections:
-[no-]common [do not] install (bin, etc, META-INFO)
-[no-]devel [do not] install (applications, src, wmake)
-[no-]doc [do not] install (doc)
-[no-]tut [do not] install (tutorials)
-no-app, -no-apps do not install (applications)
-no-src do not install (src)
-no-wmake do not install (wmake)
bundled selections:
-core Select: -common -devel
-default Select: -common -devel -doc -tut
tuning options:
-collate Collate modules (doc, tutorials)
-collate-doc Collate modules (doc) into doc/modules
-collate-tut Collate modules (tutorials) into tutorials/modules
general options:
-dry-run, -n Do not perform any operations
-force, -f Ignored
-verbose, -v Additional verbosity
-help Print the help and exit
Simple installer to copy OpenFOAM non-binary directories.
Example,
${0##*/} -prefix=/opt/openfoamVER
USAGE
exit 0 # A clean exit
}
unset optDryRun hadError
# Report error and exit
die()
{
exec 1>&2
echo
echo "Error encountered:"
while [ "$#" -ge 1 ]; do echo " $1"; shift; done
echo
echo "See '${0##*/} -help' for usage"
echo
exit 1
}
# Report error and exit
warnOrDie()
{
if [ -n "$optDryRun" ]
then
hadError=true
while [ "$#" -ge 1 ]; do echo "Error: $1" 1>&2; shift; done
else
die "$@"
fi
}
# Get the option's value (argument), or die on missing or empty value
# $1 option=value
getOptionValue()
{
local value="${1#*=}"
# Remove any surrounding double quotes
value="${value%\"}"
value="${value#\"}"
[ -n "$value" ] || die "'${1%=}' option requires a value"
echo "$value"
}
# Test for '-no-' or '-without-' prefix. Return "false" or "true"
# $1 option
# [$2] truth value <true>
getBoolOption()
{
case "$1" in
(-no-* | -without-*) echo "false" ;;
(*) echo "${2:-true}" ;;
esac
}
#-------------------------------------------------------------------------------
# Defaults from current OpenFOAM environment
sourceDir="$WM_PROJECT_DIR"
platform="$WM_OPTIONS"
foam_mpi="$FOAM_MPI"
unset install_common install_devel
unset install_app install_src install_wmake
unset install_doc optCollate_doc
unset install_tut optCollate_tut
unset optCollate
unset prefix exec_prefix bindir libdir libdir_mpi optVerbose
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help*) printHelp ;;
-n | -dry-run) optDryRun="(dry-run) " ;;
-v | -verbose) optVerbose=true ;;
-f | -force) echo "Ignored option: ${1%%=*}" 1>&2 ;;
# Inputs
-source=*) sourceDir="$(getOptionValue "$1")" ;;
-platform=*) echo "Ignored option: ${1%%=*}" 1>&2 ;;
-foam-mpi=*) echo "Ignored option: ${1%%=*}" 1>&2 ;;
# Targets
-prefix=*) prefix="$(getOptionValue "$1")" ;;
-exec-prefix=*) echo "Ignored option: ${1%%=*}" 1>&2 ;;
# Selections
-common | -no-common) install_common="$(getBoolOption "$1")" ;;
-devel | -no-devel) install_devel="$(getBoolOption "$1")" ;;
-doc | -no-doc) install_doc="$(getBoolOption "$1")" ;;
-tut | -no-tut) install_tut="$(getBoolOption "$1")" ;;
-no-app | -no-apps) install_app="$(getBoolOption "$1")" ;;
-no-src) install_src="$(getBoolOption "$1")" ;;
-no-wmake) install_wmake="$(getBoolOption "$1")" ;;
-core)
install_common=true
install_devel=true
;;
-default | -all)
[ "$1" = "-all" ] && echo "Compat: treat $1 like -default" 1>&2
install_common=true
install_devel=true
install_doc=true
install_tut=true
;;
-collate | -no-collate)
optCollate="$(getBoolOption "$1")"
if [ "${optCollate:-false}" = false ]
then
unset optCollate optCollate_doc optCollate_tut
fi
;;
-collate-doc) optCollate_doc=true ;;
-collate-tut) optCollate_tut=true ;;
(*) die "Unknown option/argument: $1" ;;
esac
shift
done
#-------------------------------------------------------------------------------
[ "${install_common:-false}" = false ] && unset install_common
if [ "${install_devel:-false}" = false ]
then
unset install_devel install_app install_src install_wmake
fi
if [ "${install_doc:-false}" = false ]
then
unset install_doc
elif [ "$optCollate_doc" = true ] || [ "$optCollate" = true ]
then
install_doc=collate
fi
if [ "${install_tut:-false}" = false ]
then
unset install_tut
elif [ "$optCollate_tut" = true ] || [ "$optCollate" = true ]
then
install_tut=collate
fi
# Input checks
[ -d "$sourceDir" ] || warnOrDie "Invalid -source directory: $sourceDir"
# Installation sanity check
[ -n "$prefix" ] || warnOrDie "Must specify -prefix"
if [ -n "$hadError" ]
then
echo "Errors encounters in dry-run. Stopping" 1>&2
exit 1
fi
if [ -z "${install_common}${install_devel}${install_doc}${install_tut}" ]
then
exec 1>&2
echo "Nothing specified to install"
echo
echo "See '${0##*/} -help' for usage"
echo
exit 0 # Treat as not an error
fi
# Report settings
echo "Preparing install with the following parameters" 1>&2
echo "source:" 1>&2
echo " directory $sourceDir" 1>&2
echo 1>&2
echo "target" 1>&2
echo " prefix ${prefix-[]}" 1>&2
##echo " binary ${install_binary:-[disabled]}" 1>&2
echo " common ${install_common:-[disabled]}" 1>&2
echo -n " devel " 1>&2
if [ -n "$install_devel" ]
then
echo -n "true" 1>&2
[ "$install_app" = false ] && echo -n " [app=disabled]" 1>&2
[ "$install_src" = false ] && echo -n " [src=disabled]" 1>&2
[ "$install_wmake" = false ] && echo -n " [wmake=disabled]" 1>&2
echo 1>&2
else
echo "[disabled]" 1>&2
fi
echo " doc ${install_doc:-[disabled]}" 1>&2
echo " tut ${install_tut:-[disabled]}" 1>&2
echo 1>&2
#------------------------------------------------------------------------------
# Proper umask
umask 022
# The commands
copy_cmd="cp -a ${optVerbose:+-v}"
mkdir_cmd="mkdir -p"
if [ -n "$optDryRun" ]
then
if [ -n "$optVerbose" ]
then
copy_cmd="echo cp -a"
mkdir_cmd="echo mkdir -p"
else
copy_cmd="true"
mkdir_cmd="true"
fi
fi
# Copy file or directory to <prefix>
doCopy()
{
$mkdir_cmd "$prefix" 2>/dev/null
for i in "$@"
do
if [ -e "$sourceDir/$i" ]
then
$copy_cmd "$sourceDir/$i" "$prefix"
nCopied="x$nCopied"
else
echo "Missing? $sourceDir/$i" 1>&2
fi
done
echo "${optDryRun}${#nCopied} items copied" 1>&2
}
# Collate (doc | tutorials)
# Eg,
# modules/{NAME}/tutorials
# => tutorials/modules/{NAME}
collateModuleFiles()
{
local subDir="$1"
local subTarget="$prefix/$subDir/modules"
if [ -d "$sourceDir/modules" ]
then
(
cd "$sourceDir/modules" || exit
$mkdir_cmd "$subTarget"
for i in $(find . -mindepth 2 -maxdepth 2 -name "$subDir" -type d)
do
$mkdir_cmd "$subTarget/${i%/*}"
$copy_cmd "$i"/* "$subTarget/${i%/*}"
done
)
fi
}
#------------------------------------------------------------------------------
# common
# ----
message="${optDryRun}Install common:"
if [ -n "$install_common" ]
then
echo "${message} bin etc META-INFO" 1>&2
doCopy bin etc META-INFO
else
echo "${message} [disabled]" 1>&2
fi
# ----
# develop (or source)
# ----
message="${optDryRun}Install devel:" 1>&2
unset dirNames blockMessage
if [ -n "$install_devel" ]
then
if [ "$install_wmake" = false ]
then
blockMessage="$blockMessage [wmake=disabled]"
else
dirNames="$dirNames wmake"
fi
if [ "$install_src" = false ]
then
blockMessage="$blockMessage [src=disabled]"
else
dirNames="$dirNames src"
fi
if [ "$install_app" = false ]
then
blockMessage="$blockMessage [app=disabled]"
else
dirNames="$dirNames applications"
fi
fi
if [ -n "$dirNames" ]
then
echo "${message}${dirNames}${blockMessage}" 1>&2
doCopy $dirNames # Unquoted - uses word splitting
else
echo "${message} [disabled]" 1>&2
fi
# ----
# doc
# ----
message="${optDryRun}Install doc:" 1>&2
if [ -n "$install_doc" ]
then
echo "${message}" 1>&2
doCopy doc
if [ "$install_doc" = collate ]
then
echo "${optDryRun}Collate module doc:" 1>&2
collateModuleFiles doc
fi
else
echo "${message} [disabled]" 1>&2
fi
# ----
# tutorials
# ----
message="${optDryRun}Install tutorials:" 1>&2
if [ -n "$install_tut" ]
then
echo "${message}" 1>&2
doCopy tutorials
if [ "$install_tut" = collate ]
then
echo "${optDryRun}Collate module tutorials:" 1>&2
collateModuleFiles tutorials
fi
else
echo "${message} [disabled]" 1>&2
fi
# ----
if [ -n "$optDryRun" ]
then
[ -n "$optVerbose" ] && echo 1>&2
echo "${optDryRun}Done" 1>&2
fi
exit 0 # clean exit
#------------------------------------------------------------------------------

375
bin/tools/install-platform Executable file
View File

@ -0,0 +1,375 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# install-platform
#
# Example usage
# install-platform -prefix=/opt/openfoam/openfoamVER
#
# Description
# Simple installer to copy OpenFOAM binary bin/, lib/ (platforms)
# directories.
#
# Note
# The platforms/tools directory still must be handled separately
#
# Layout of OpenFOAM platforms
#
# platforms
# |-- <WM_OPTIONS>
# |-- bin
# | |-- ...
# `-- lib
# |-- ...
# |-- dummy
# | `-- ...
# |-- sys-openmpi
# | |-- libPstream.so
# | `-- libptscotchDecomp.so
# `-- paraview-MAJ.MIN
# `-- ...
#
#------------------------------------------------------------------------------
printHelp() {
cat<<USAGE
Usage: ${0##*/} [OPTION]
input options:
-source=SOURCE Source directory
[\$WM_PROJECT_DIR ${WM_PROJECT_DIR:-''}]
-platform=PLATFORM OpenFOAM platform name [\$WM_OPTIONS ${WM_OPTIONS:-''}]
-foam-mpi=FOAM_MPI OpenFOAM mpi name [\$FOAM_MPI ${FOAM_MPI:-''}]
target options:
-prefix=PREFIX Top-level installation directory in PREFIX ['']
-exec-prefix=EPREFIX Architecture-dependent in EPREFIX
[PREFIX/platforms/PLATFORM]
-bindir=DIR bin directory [EPREFIX/bin]
-libdir=DIR lib directory [EPREFIX/lib]
-mpi-libdir=DIR mpi libdir [<libdir>/FOAM_MPI]
tuning options:
-no-bin Do not install bin directory
-no-lib Do not install lib directory
-no-mpi Do not install mpi lib directory
-mpi-only Only install mpi lib directory
-mpi-mkdir Create foam-mpi directory within libdir
general options:
-dry-run, -n Do not perform any operations
-force, -f Ignored
-verbose, -v Additional verbosity
-help Print the help and exit
Simple installer to copy OpenFOAM binary bin/, lib/ (platforms) directories.
Example,
${0##*/} -prefix=/opt/openfoamVER
USAGE
exit 0 # A clean exit
}
unset optDryRun hadError
# Report error and exit
die()
{
exec 1>&2
echo
echo "Error encountered:"
while [ "$#" -ge 1 ]; do echo " $1"; shift; done
echo
echo "See '${0##*/} -help' for usage"
echo
exit 1
}
# Report error and exit
warnOrDie()
{
if [ -n "$optDryRun" ]
then
hadError=true
while [ "$#" -ge 1 ]; do echo "Error: $1" 1>&2; shift; done
else
die "$@"
fi
}
# Get the option's value (argument), or die on missing or empty value
# $1 option=value
getOptionValue()
{
local value="${1#*=}"
# Remove any surrounding double quotes
value="${value%\"}"
value="${value#\"}"
[ -n "$value" ] || die "'${1%=}' option requires a value"
echo "$value"
}
# Test for '-no-' or '-without-' prefix. Return "false" or "true"
# $1 option
# [$2] truth value <true>
getBoolOption()
{
case "$1" in
(-no-* | -without-*) echo "false" ;;
(*) echo "${2:-true}" ;;
esac
}
#-------------------------------------------------------------------------------
# Defaults from current OpenFOAM environment
sourceDir="$WM_PROJECT_DIR"
platform="$WM_OPTIONS"
foam_mpi="$FOAM_MPI"
unset install_bin install_lib
unset optMkdir_mpi
install_mpi=true
unset prefix exec_prefix bindir libdir libdir_mpi optVerbose
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help*) printHelp ;;
-n | -dry-run) optDryRun="(dry-run) " ;;
-v | -verbose) optVerbose=true ;;
-f | -force) echo "Ignored option: ${1%%=*}" 1>&2 ;;
# Inputs
-source=*) sourceDir="$(getOptionValue "$1")" ;;
-platform=*) platform="$(getOptionValue "$1")" ;;
-foam-mpi=*) foam_mpi="$(getOptionValue "$1")" ;;
# Targets
-prefix=*) prefix="$(getOptionValue "$1")" ;;
-exec-prefix=*) exec_prefix="$(getOptionValue "$1")" ;;
-bindir=*) bindir="$(getOptionValue "$1")" ;;
-libdir=*) libdir="$(getOptionValue "$1")" ;;
-mpi-libdir=*) libdir_mpi="$(getOptionValue "$1")" ;;
-no-bin) install_bin=false ;;
-no-lib) install_lib=false ;;
-no-mpi) install_mpi=false ;;
-mpi-only) install_mpi=exclusive ;;
-mpi-mkdir) optMkdir_mpi=true ;;
(*) die "Unknown option/argument: $1" ;;
esac
shift
done
#-------------------------------------------------------------------------------
# Default <exec_prefix> based on <prefix>
if [ -z "$exec_prefix" ] && [ -n "$prefix" ]
then
exec_prefix="$prefix/platforms/$platform"
fi
# Default <bindir>, <libdir> based on <exec_prefix>
if [ -n "$exec_prefix" ]
then
[ -n "$bindir" ] || bindir="$exec_prefix/bin"
[ -n "$libdir" ] || libdir="$exec_prefix/lib"
fi
# Default <mpi-libdir> based on <libdir> and <foam-mpi>
if [ -z "$libdir_mpi" ] && [ -n "$libdir" ]
then
libdir_mpi="$libdir/$foam_mpi"
fi
# Exclusions
if [ "$install_bin" = false ] || [ "$install_mpi" = exclusive ]
then
unset bindir
fi
if [ "$install_lib" = false ] || [ "$install_mpi" = exclusive ]
then
unset libdir
fi
if [ "$install_mpi" = false ]
then
unset libdir_mpi
fi
# Input checks
sourcePlatform="$sourceDir/platforms/$platform"
[ -d "$sourceDir" ] || warnOrDie "Invalid -source directory: $sourceDir"
[ -n "$platform" ] || warnOrDie "No -platform detected or specified"
[ -n "$foam_mpi" ] || warnOrDie "No -foam-mpi detected or specified"
[ -d "$sourcePlatform" ] || \
warnOrDie "Missing platforms directory for: $platform"
# Installation sanity check
[ -n "$bindir$libdir$libdir_mpi" ] || \
warnOrDie "Must specify at least one of -prefix, -exec-prefix, -bindir, -libdir, -mpi-libdir"
if [ -n "$hadError" ]
then
echo "Errors encounters in dry-run. Stopping" 1>&2
exit 1
fi
# Report settings
echo "Preparing install with the following parameters" 1>&2
echo "source:" 1>&2
echo " directory $sourceDir" 1>&2
echo " platform $platform" 1>&2
echo " foam-mpi $foam_mpi" 1>&2
echo 1>&2
echo "target (mpi-install: $install_mpi)" 1>&2
echo " prefix ${prefix-[]}" 1>&2
echo " exec-prefix ${exec_prefix:-[]}" 1>&2
echo " bindir ${bindir:-[]}" 1>&2
echo " libdir ${libdir:-[]}" 1>&2
echo " libdir(mpi) ${libdir_mpi:-[]}" 1>&2
echo 1>&2
#------------------------------------------------------------------------------
# Proper umask
umask 022
# The commands
copy_cmd="cp -a ${optVerbose:+-v}"
mkdir_cmd="mkdir -p"
if [ -n "$optDryRun" ]
then
if [ -n "$optVerbose" ]
then
copy_cmd="echo cp -a"
mkdir_cmd="echo mkdir -p"
else
copy_cmd="true"
mkdir_cmd="true"
fi
fi
# bin/
# ----
message="${optDryRun}Install bindir:"
if [ -n "$bindir" ]
then
input="$sourcePlatform/bin"
echo "From $input" 1>&2
echo "${message} $bindir" 1>&2
$mkdir_cmd "$bindir" 2>/dev/null
for i in "$input/"*
do
if [ -e "$i" ]
then
$copy_cmd "$i" "$bindir"
fi
done
else
echo "${message} [disabled]" 1>&2
fi
# ----
# lib/ without mpi
# ----
message="${optDryRun}Install libdir(non-mpi):"
if [ -n "$libdir" ]
then
input="$sourcePlatform/lib"
echo "From $input" 1>&2
echo "${message} $libdir" 1>&2
$mkdir_cmd "$libdir" 2>/dev/null
for i in "$input/"*
do
if [ "${i##*/}" = "$foam_mpi" ]
then
if [ "$optMkdir_mpi" = true ]
then
$mkdir_cmd "$libdir/$foam_mpi"
fi
elif [ -e "$i" ]
then
$copy_cmd "$i" "$libdir"
else
echo "bogus lib entry? $i" 1>&2
fi
done
else
echo "${message} [disabled]" 1>&2
fi
# ----
# lib/mpi
# ----
message="${optDryRun}Install libdir(mpi):"
if [ -n "$libdir_mpi" ]
then
input="$sourcePlatform/lib/$foam_mpi"
echo "From $input" 1>&2
echo "${message} $libdir_mpi" 1>&2
$mkdir_cmd "$libdir_mpi" 2>/dev/null
for i in "$input"/*
do
if [ -e "$i" ]
then
# Always verbose (not many files anyhow)
$copy_cmd -v "$i" "$libdir_mpi"
else
echo "bogus mpi-lib entry? $i" 1>&2
fi
done
else
echo "${message} [disabled]" 1>&2
fi
# ----
if [ -n "$optDryRun" ]
then
[ -n "$optVerbose" ] && echo 1>&2
echo "${optDryRun}Done" 1>&2
fi
exit 0 # A clean exit
#------------------------------------------------------------------------------

View File

@ -0,0 +1,75 @@
#!/bin/sh
FOAM_MPI="@FOAM_MPI@"
FOAM_SYSTEM_MPI_LIBBIN="@FOAM_SYSTEM_MPI_LIBBIN@"
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Description
# Update of links from system mpi lib/ to local lib/mpi-name
#
# Note
# Normally located as a trigger within the platforms/ directory
# Uses hard-coded values (eg, generated with autoconfig).
#
#------------------------------------------------------------------------------
cd "${0%/*}" || exit # Run from this directory
# Local values
FOAM_LIBBIN="$(pwd -P)/lib"
FOAM_MPI_LIBBIN="$FOAM_LIBBIN/$FOAM_MPI"
#------------------------------------------------------------------------------
echo "Link OpenFOAM ($FOAM_MPI) from system locations"
echo "Target: $FOAM_MPI_LIBBIN"
echo "Source: $FOAM_SYSTEM_MPI_LIBBIN"
if [ -z "$FOAM_MPI" ]
then
echo "FOAM_MPI not defined - skipping"
exit 0
fi
if [ -z "$FOAM_SYSTEM_MPI_LIBBIN" ]
then
echo "FOAM_SYSTEM_MPI_LIBBIN not defined - skipping"
exit 0
fi
if [ ! -d "$FOAM_SYSTEM_MPI_LIBBIN" ]
then
echo "No system mpi lib: $FOAM_SYSTEM_MPI_LIBBIN"
echo "... not updating"
exit 0
fi
if [ ! -d "$FOAM_LIBBIN" ]
then
echo "Missing $FOAM_LIBBIN"
exit 0
fi
#------------------------------------------------------------------------------
mkdir -p "$FOAM_MPI_LIBBIN"
# Create symlinks
(
cd "$FOAM_MPI_LIBBIN" || exit
for i in "$FOAM_SYSTEM_MPI_LIBBIN"/*
do
if [ -f "$i" ]
then
ln -svf "$i" "${i##*/}"
fi
done
)
exit 0 # clean exit
#------------------------------------------------------------------------------