Can now use this:
_foamSourceEtc config.sh/scotch
_foamSourceEtc config.csh/scotch
instead of this:
_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/scotch)
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.csh/scotch`
In the bash/sh version, leave the _foamSource function for now, since
ThirdParty is still relying on it.
STYLE: elminate while-loop for _foamAddPath etc since this type of
construct isn't readily possible for csh and isn't being used anywhere.
- It is incorrect to prefix the assignment with an 'export' since this
automatically marks the overall command as successful and circumvents
the fallback.
There is no simple way to have proper behaviour when sourced with a
local directory path, but at least it now uses the fallback.
It is still easy to wreak the mechanism with valid but confusing input.
For example,
". /path/to/openfoam/etc/././bashrc"
The only real certainty is that "${BASH_SOURCE%/*}"
should point to the 'etc/' directory. In which case,
cd ${BASH_SOURCE%/*} # <- now in the etc/ directory
pwd=$(pwd -P) # <- fully-qualified path to etc/
pwd=${pwd%/*/*} # <- up two parent levels
- This works with ". ./bashrc", but fails with ". bashrc"
(probably not so common).
- Con: The construct requires an additional sub-shell.
- instead we use the CGAL settings directly since they have the
same option of (version | system | none)
- may wish to review this again in the future.
- "$FOAM_USER_APPBIN" and "$FOAM_USER_LIBBIN" have been added to
"foamOldDirs" in "etc/bashrc" and "etc/config.sh/unset"
- "$OPAL_PREFIX" is now undefined in the option "SYSTEMOPENMPI" within
"etc/config.sh/mpi", but only if the path defined in this variable
is cleaned when using "foamCleanPath".
- "$OPAL_PREFIX" is now also conditionally undefined in
"etc/config.sh/unset" when the path is picked up by "foamCleanPath".
Patch contributed by Bruno Santos
Resolved bug-report http://bugs.openfoam.org/view.php?id=2210
- export/setenv WM_COMPILER_TYPE as suggested by Mattijs.
- for overall consistency, don't carp about an unset WM_COMPILER_TYPE,
since this would only be on the first instance (prior to the
export/setenv) and would be confusing about why/when this message
may occur.
- reduce clutter: only use (system|ThirdParty) for WM_COMPILER_TYPE.
Drop the old 'OpenFOAM' setting for WM_COMPILER_TYPE, which was
transitional in early 2011.
- make the error messages more meaningful
FOAM_INST_DIR is the location of the OpenFOAM installation which defaults to
the directory containing the etc/bashrc,cshrc file. If this default is
not appropriate FOAM_INST_DIR can be set explicitly.
1. "foamCompiler" was changed to a more permanent "WM_COMPILER_TYPE"
environment variable, so that it can be used by 3rd party
installation scripts, such as "makeGcc", "makeLLVM" and so on. More
on this will be provided in issue #1215.
2. The script functions such as "_foamSource()" and "_foamAddPath()"
were moved to a new file "etc/config.sh/functions". It has the
ability to set or unset, depending on whether "WM_BASH_FUNCTIONS" is
defined or not. This allows for these functions to be reused by
other scripts, such as "makeGcc".
3. The script "etc/config.sh/CGAL" relies on whether a local
environment variable "SOURCE_CGAL_VERSIONS_ONLY" is defined or not,
so that it will load only the version settings if it's defined. This
is to make it easier to call this script from "makeCGAL". Although
it still feels a bit of a clunky hack, but I didn't manage to deduce
any other way we could do this :( I didn't add indentation within
the if-block, to make it easier to read the changes. In addition,
the local variable "common_path" is used to shorten the length of
the lines and use slightly less repeated code.
4. Added another new script "etc/config.sh/compiler", which has only
the version numbers for the compilers taken out from the "settings"
file. It currently depends on "WM_COMPILER_TYPE" for setting the
variables, the same way it did with "foamCompiler". This script is
now always sourced from the "settings" file, for the following
reasons:
- "makeGCC" and "makeLLVM" can now take advantage of this script file.
- The example "compiler" script (detailed next) can rely on this
script file and then override parameters on-demand, as well as
allowing for system compilers to have dedicated settings, such as
setting "WM_CC". This is similar to how the example environment
script for "paraview" works.
5. To the script "etc/config.sh/example/compiler" were added a few more examples:
- It now starts with a block where it first loads the default "compiler" script.
- Has a "WM_COMPILER=Gcc48u" case example for when we try to use GCC
4.8 in Ubuntu 15.10. This is just to give the idea that in a
particular system, we might have several system-wide compiler
versions. For example, in Ubuntu 15.10, there is GCC 4.7, 4.8 and
5.2, which could be used for testing performances or compatibility
with some other 3rd party library.
- Has the "WM_COMPILER=Icc" case example, related to the original bug
report, where "WM_CC=icc" and "WM_CXX=icpc", so that the user then
simply copies this file to their own local preferences folder.
6. Small bug fix in "etc/config.sh/mpi", where unsetting "minBufferSize" was missing at the end of the script.
7. Small change in "etc/config.sh/paraview", where "CMAKE_ROOT" is set
along with "CMAKE_HOME". This is due to a rare issue that occurs on
people's systems where they have a custom system-wide CMake version
installed and which is used by having "CMAKE_ROOT" set on that
environment. This can mess up OpenFOAM's custom ParaView builds,
given that conflicting CMake versions can lead to not building
ParaView at all.
- For more details about "CMAKE_ROOT":
https://cmake.org/Wiki/CMake_Useful_Variables [^]
8. The scripts "_foamAddPath _foamAddLib _foamAddMan" were not being
unset at the end of "settings". They are now unset at the end of
"bashrc", through a call to the new double-use "functions" script.
Additionally all references to "foamCompiler" have been changed to
"WM_COMPILER_TYPE".
See also http://www.openfoam.org/mantisbt/view.php?id=1232
etc/config.sh and etc/config.csh
This structure is more convenient to add support for other shells, e.g. zsh, fish etc.
Resolves feature request to simplify support for other shells in
http://www.openfoam.org/mantisbt/view.php?id=1232
To compile with 64bit labels set
WM_LABEL_SIZE=64
in ~/OpenFOAM/dev/prefs.sh
source ~/.bashrc
then Allwmake in OpenFOAM-dev.
This will build into for example OpenFOAM-dev/platforms/linux64ClangDPInt64Opt
If WM_LABEL_SIZE is unset or set to 32:
WM_LABEL_SIZE=32
the build would be placed into OpenFOAM-dev/platforms/linux64ClangDPInt32Opt
Thus both 32bit and 64bit label builds can coexist without problem.
- drop FOAM_MPI_LIBBIN variable in favour of FOAM_MPI from which
two different locations can be determined.
Previously there was something like this:
FOAM_MPI_LIBBIN = $FOAM_LIBBIN/openmpi-1.5.1
We now instead determine the locations from the FOAM_MPI directly:
FOAM_MPI=openmpi-1.5.1
$FOAM_LIBBIN/$FOAM_MPI -> OpenFOAM mpi-related
$FOAM_EXT_LIBBIN/$FOAM_MPI -> ThirdPary mpi-related
ENH: relocate ParaView libraries and plugins back under FOAM_LIBBIN
- as discussed with Mattijs
- this provides a means to temporarily override the default settings
and/or the prefs.{csh,sh} settings.
bash:
name= -> unset name
name=value -> export name=value
csh:
name= -> unsetenv name
name=value -> setenv name value
eg,
. <WM_PROJECT_DIR>/etc/bashrc WM_COMPILER=Gcc45 WM_MPLIB=
to use gcc 4.5 and the default mplib
- exception calcType.H since it'll most likely be used for building
applications anyhow
- use quailified names in more of the lagrangian code
- killed some tab indents in various places.
- Problem: changing between OpenFOAM versions with different
WM_PROJECT_INST_DIR paths would leave the old paths in the env vars.
- TODO: etc/cshrc is rougned out, but needs work on the corresponding
if-statement
- avoid mkdir except for a few directories
- grouped settings and added comments
- minor bugfix: $FOAM_INST_DIR/linux64/bin was in path (pre OpenFOAM-1.5)
- local (non-exported) variables in lowercase
The call to foamCleanPath from etc/{bashrc,cshrc} passes all the wildcards
together as a single argument - causing nothing to be cleaned. Now split
the args on whitespace. Also added more IFS hacking to reduce forking.