Commit bcf8a48c authored by Mark Olesen's avatar Mark Olesen
Browse files

CONFIG: add build information into shell session

- more closely reflect what the binaries report
- report the installation path
- change PS1 case/separator to roughly correspond to package names

STYLE: adjust README to mention upcoming v2112
parent 1804d3fe
......@@ -49,7 +49,7 @@
<!--
Providing details of your set-up can help us identify any issues, e.g.
OpenFOAM version : v1806|v1812|v1906|v1912|v2006|v2012|v2106 etc
OpenFOAM version : v2112|v2106|v2012|v2006|v1912|v1906 etc
Operating system : ubuntu|openSUSE|centos etc
Hardware info : any info that may help?
Compiler : gcc|intel|clang etc
......
......@@ -40,9 +40,9 @@ Violations of the Trademark are monitored, and will be duly prosecuted.
If OpenFOAM has already been compiled on your system, simply source
the appropriate `etc/bashrc` or `etc/cshrc` file and get started.
For example, for the OpenFOAM-v2106 version:
For example, for the OpenFOAM-v2112 version:
```
source /installation/path/OpenFOAM-v2106/etc/bashrc
source /installation/path/OpenFOAM-v2112/etc/bashrc
```
## Compiling OpenFOAM
......@@ -127,8 +127,8 @@ These 3rd-party sources are normally located in a directory parallel
to the OpenFOAM directory. For example,
```
/path/parent
|-- OpenFOAM-v2106
\-- ThirdParty-v2106
|-- OpenFOAM-v2112
\-- ThirdParty-v2112
```
There are, however, many cases where this simple convention is inadequate:
......@@ -136,7 +136,7 @@ There are, however, many cases where this simple convention is inadequate:
operating system or cluster installation provides it)
* When we have changed the OpenFOAM directory name to some arbitrary
directory name, e.g. openfoam-sandbox2106, etc..
directory name, e.g. openfoam-sandbox2112, etc..
* When we would like any additional 3rd party software to be located
inside of the OpenFOAM directory to ensure that the installation is
......@@ -156,9 +156,9 @@ when locating the ThirdParty directory with the following precedence:
2. PREFIX/ThirdParty-VERSION
* this corresponds to the traditional approach
3. PREFIX/ThirdParty-vAPI
* allows for an updated value of VERSION, *eg*, `v2106-myCustom`,
* allows for an updated value of VERSION, *eg*, `v2112-myCustom`,
without requiring a renamed ThirdParty. The API value would still
be `2106` and the original `ThirdParty-v2106/` would be found.
be `2112` and the original `ThirdParty-v2112/` would be found.
4. PREFIX/ThirdParty-API
* same as the previous example, but using an unadorned API value.
5. PREFIX/ThirdParty-common
......
......@@ -46,6 +46,9 @@
# The '-show-api' and '-show-patch' options extract values from
# the "META-INFO/api-info" file
#
# The '-show-build' options extract values from
# the "META-INFO/build-info" file
#
# SeeAlso
# META-INFO/README.md for other routines that also use META-INFO.
#
......@@ -71,6 +74,7 @@ options:
-etc=[DIR] set/unset FOAM_CONFIG_ETC for alternative etc directory
-show-api Print META-INFO api value and exit
-show-patch Print META-INFO patch value and exit
-show-build Print META-INFO build value and exit
-with-api=NUM Specify alternative api value to search with
-quiet (-q) Suppress all normal output
-silent (-s) Suppress stderr, except -csh-verbose, -sh-verbose output
......@@ -155,6 +159,14 @@ getApiInfo()
}
# Get 'build' from META-INFO/build-info
getBuildValue()
{
value="$(sed -ne 's@^build *= *\([^ ]*\).*@\1@p' "$projectDir"/META-INFO/build-info 2>/dev/null)"
echo "$value"
}
#-------------------------------------------------------------------------------
unset shellOutput verboseOutput
unset optAll optConfig optList projectApi
......@@ -177,6 +189,10 @@ do
getApiInfo patch
exit $?
;;
-show-build) # Show build information and exit
getBuildValue
exit $?
;;
-with-api=*)
projectApi="${1#*=}"
;;
......
......@@ -5,7 +5,7 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2019-2020 OpenCFD Ltd.
# Copyright (C) 2019-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
......@@ -68,26 +68,48 @@ then
# Some feedback
if [ -n "$PS1" ] && [ -d "$WM_PROJECT_DIR" ]
then
info="$("$WM_PROJECT_DIR"/bin/foamEtcFile -show-patch 2>/dev/null)"
# echo "Using: OpenFOAM-$WM_PROJECT_VERSION ($FOAM_API${info:+ patch=$info}) - visit www.openfoam.com" 1>&2
echo "Using: OpenFOAM-$WM_PROJECT_VERSION${info:+ (patch=$info)} - visit www.openfoam.com" 1>&2
_foam_api="$("$WM_PROJECT_DIR"/bin/foamEtcFile -show-api 2>/dev/null)"
_foam_patch="$("$WM_PROJECT_DIR"/bin/foamEtcFile -show-patch 2>/dev/null)"
_foam_build="$("$WM_PROJECT_DIR"/bin/foamEtcFile -show-build 2>/dev/null)"
if [ "${_foam_patch:-0}" = 0 ]
then
unset _foam_patch
fi
if [ -n "$_foam_build" ]
then
# Everything there - format like binary -help output
_foam_build="${_foam_build}${_foam_patch:+ (patch=${_foam_patch})}"
_foam_verinfo="${_foam_api}"
else
# Missing build info - combine api and patch info together
_foam_verinfo="${_foam_api}${_foam_patch:+ patch=${_foam_patch}}"
fi
echo "Using: OpenFOAM-$WM_PROJECT_VERSION (${_foam_verinfo}) - visit www.openfoam.com" 1>&2
if [ -n "$_foam_build" ]
then
echo "Build: ${_foam_build}" 1>&2
fi
echo "Arch: $WM_OPTIONS (mpi=$FOAM_MPI)" 1>&2
# Arch: LSB;label=32;scalar=64
## echo "$WM_PROJECT_DIR" 1>&2
## echo 1>&2
# Set prompt as reminder that this is a shell session
# Chalmers likes this one:
# PS1="OpenFOAM${FOAM_API:+-$FOAM_API}:"'$(foamPwd)\n\u\$ '
# PS1="openfoam${_foam_api}:"'$(foamPwd)\n\u\$ '
PS1="OpenFOAM${FOAM_API:+-$FOAM_API}:"'\w/\n\u\$ '
PS1="openfoam${_foam_api}:"'\w/\n\u\$ '
unset _foam_api _foam_patch _foam_build _foam_verinfo
fi
else
echo "Could not locate OpenFOAM etc/bashrc in '$projectDir'" 1>&2
fi
echo 1>&2
echo "openfoam = $WM_PROJECT_DIR" 1>&2
echo "OpenFOAM shell session - use exit to quit" 1>&2
echo 1>&2
......
## Known Build Issues (v2012, v2106)
## Known Build Issues (v2012, v2106, v2112)
### Windows cross-compilation
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment