Merge branch 'master' of ssh://opencfd@repo.or.cz/srv/git/OpenFOAM-1.5.x
[OpenFOAM-1.5.x.git] / etc / bashrc
blob1744e6232cf844359fd95f549c25e6d71f65a8d0
1 #----------------------------------*-sh-*--------------------------------------
2 # =========                 |
3 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4 #  \\    /   O peration     |
5 #   \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
6 #    \\/     M anipulation  |
7 #------------------------------------------------------------------------------
8 # License
9 #     This file is part of OpenFOAM.
11 #     OpenFOAM is free software; you can redistribute it and/or modify it
12 #     under the terms of the GNU General Public License as published by the
13 #     Free Software Foundation; either version 2 of the License, or (at your
14 #     option) any later version.
16 #     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 #     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 #     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19 #     for more details.
21 #     You should have received a copy of the GNU General Public License
22 #     along with OpenFOAM; if not, write to the Free Software Foundation,
23 #     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 # Script
26 #     etc/bashrc
28 # Description
29 #     Startup file for OpenFOAM
30 #     Sourced from ~/.profile or ~/.bashrc
31 #     Should be usable by any POSIX-compliant shell (eg, ksh)
33 #------------------------------------------------------------------------------
35 export WM_PROJECT=OpenFOAM
36 export WM_PROJECT_VERSION=1.5.x
38 #!!User:
39 #    either set $FOAM_INST_DIR before sourcing this file or set
40 #    $foamInstall below to where OpenFOAM is installed
42 # Location of FOAM installation
43 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
44 foamInstall=$HOME/$WM_PROJECT
45 # foamInstall=~$WM_PROJECT
46 # foamInstall=/usr/local/$WM_PROJECT
47 # foamInstall=/opt/$WM_PROJECT
49 : ${FOAM_INST_DIR:=$foamInstall}; export FOAM_INST_DIR
52 # Location of site/user files
53 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~
54 export WM_PROJECT_INST_DIR=$FOAM_INST_DIR
55 export WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/$WM_PROJECT-$WM_PROJECT_VERSION
56 export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
59 # Location of third-party software
60 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
61 export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/ThirdParty
64 # Compiler: set to Gcc, Gcc42 or Icc (for Intel's icc)
65 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
66 : ${WM_COMPILER:=Gcc}; export WM_COMPILER
68 export WM_COMPILER_ARCH=
69 export WM_COMPILER_LIB_ARCH=
72 # Compilation options (architecture, precision, optimised, debug or profiling)
73 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
74 # WM_ARCH_OPTION = 32 | 64
75 : ${WM_ARCH_OPTION:=64}; export WM_ARCH_OPTION
77 # WM_PRECISION_OPTION = DP | SP
78 : ${WM_PRECISION_OPTION:=DP}; export WM_PRECISION_OPTION
80 # WM_COMPILE_OPTION = Opt | Debug | Prof
81 : ${WM_COMPILE_OPTION:=Opt}; export WM_COMPILE_OPTION
83 # WM_JAVAC_OPTION = Opt | Debug
84 : ${WM_JAVAC_OPTION:=Opt}; export WM_JAVAC_OPTION
86 # WM_MPLIB = | OPENMPI| LAM | MPICH | MPICH-GM | HPMPI | GAMMA | MPI | QSMPI
87 : ${WM_MPLIB:=OPENMPI}; export WM_MPLIB
90 # Run options (floating-point signal handling and memory initialisation)
91 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
92 export FOAM_SIGFPE=
93 # export FOAM_SETNAN=
96 # Detect system type and set environment variables appropriately
97 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
98 export WM_ARCH=`uname -s`
100 case $WM_ARCH in
101 Linux)
102     WM_ARCH=linux
104     # compiler specifics
105     case `uname -m` in
106     i686)
107         ;;
109     x86_64)
110         case $WM_ARCH_OPTION in
111         32)
112             export WM_COMPILER_ARCH='-64'
113             export WM_CC='gcc'
114             export WM_CXX='g++'
115             export WM_CFLAGS='-m32 -fPIC'
116             export WM_CXXFLAGS='-m32 -fPIC'
117             export WM_LDFLAGS='-m32'
118             ;;
119         64)
120             WM_ARCH=linux64
121             export WM_COMPILER_LIB_ARCH=64
122             export WM_CC='gcc'
123             export WM_CXX='g++'
124             export WM_CFLAGS='-m64 -fPIC'
125             export WM_CXXFLAGS='-m64 -fPIC'
126             export WM_LDFLAGS='-m64'
127             ;;
128         *)
129             echo Unknown WM_ARCH_OPTION $WM_ARCH_OPTION, should be 32 or 64
130             ;;
131         esac
132         ;;
134     ia64)
135         WM_ARCH=linuxIA64
136         export WM_COMPILER=I64
137         ;;
139     mips64)
140         WM_ARCH=SiCortex64
141         export WM_COMPILER_LIB_ARCH=64
142         export WM_CC='gcc'
143         export WM_CXX='g++'
144         export WM_CFLAGS='-mabi=64 -fPIC'
145         export WM_CXXFLAGS='-mabi=64 -fPIC'
146         export WM_LDFLAGS='-mabi=64 -G0'
147         export WM_MPLIB=MPI
148         ;;
150     *)
151         echo Unknown processor type `uname -m` for Linux
152         ;;
154     esac
155     ;;
157 SunOS)
158     WM_ARCH=SunOS64
159     export WM_COMPILER_LIB_ARCH=64
160     export WM_CC='gcc'
161     export WM_CXX='g++'
162     export WM_CFLAGS='-mabi=64 -fPIC'
163     export WM_CXXFLAGS='-mabi=64 -fPIC'
164     export WM_LDFLAGS='-mabi=64 -G0'
165     export WM_MPLIB=FJMPI
166     ;;
168 *)      # an unsupported operating system
169     cat <<USAGE
171     Your "$WM_ARCH" operating system is not supported by this release
172     of OpenFOAM. For further assistance, please contact www.openfoam.org
174 USAGE
175     ;;
176 esac
179 # Clean standard environment variables (PATH, MANPATH, LD_LIBRARY_PATH)
180 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
181 cleanProg=$WM_PROJECT_DIR/bin/foamCleanPath
183 # Remove anything under top-level foam directory
184 wildCards="$WM_PROJECT_INST_DIR $HOME/$WM_PROJECT/$USER"
186 #- Clean path/PATH
187 cleanPath=`$cleanProg "$PATH" "$wildCards"` && PATH="$cleanPath"
189 #- Clean LD_LIBRARY_PATH
190 cleanPath=`$cleanProg "$LD_LIBRARY_PATH" "$wildCards"` && LD_LIBRARY_PATH="$cleanPath"
192 #- Clean MANPATH
193 cleanPath=`$cleanProg "$MANPATH" "$wildCards"` && MANPATH="$cleanPath"
195 export PATH LD_LIBRARY_PATH MANPATH
197 # Source project setup files
198 # ~~~~~~~~~~~~~~~~~~~~~~~~~~
199 _foamSource()
201    while [ $# -ge 1 ]
202    do
203       [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "Sourcing: $1"
204       . $1
205       shift
206    done
210 _foamSource $WM_PROJECT_DIR/etc/settings.sh
211 _foamSource $WM_PROJECT_DIR/etc/aliases.sh
214 # Source user setup files for optional packages
215 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
216 # _foamSource $WM_PROJECT_DIR/etc/apps/paraview/bashrc
217 _foamSource $WM_PROJECT_DIR/etc/apps/paraview3/bashrc
218 # _foamSource $WM_PROJECT_DIR/etc/apps/ensightFoam/bashrc
219 _foamSource $WM_PROJECT_DIR/etc/apps/cint/bashrc
222 # Again clean environment (path, PATH, MANPATH, LD_LIBRARY_PATH)
223 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
224 #- Clean path/PATH. Only remove duplicates
225 cleanPath=`$cleanProg "$PATH"` && PATH="$cleanPath"
227 #- Clean LD_LIBRARY_PATH
228 cleanPath=`$cleanProg "$LD_LIBRARY_PATH"` && LD_LIBRARY_PATH="$cleanPath"
230 #- Clean MANPATH
231 cleanPath=`$cleanProg "$MANPATH"` && MANPATH="$cleanPath"
233 export PATH LD_LIBRARY_PATH MANPATH
235 #- Clean LD_PRELOAD
236 if [ "$LD_PRELOAD" != "" ]; then
237     cleanPath=`$cleanProg "$LD_PRELOAD"` && LD_PRELOAD="$cleanPath"
238     export LD_PRELOAD
242 # cleanup environment:
243 # ~~~~~~~~~~~~~~~~~~~~
244 unset cleanPath cleanProg foamInstall
245 unset _foamSource
247 # -----------------------------------------------------------------------------