ThirdParty: add Zoltan 3.5 to the list of packages, but don't activate the compilatio...
[OpenFOAM-1.6-ext.git] / etc / bashrc
blobeb0968b7470dfefdb86e61ef6b5bdb211495e793
1 #----------------------------------*-sh-*--------------------------------------
2 # =========                 |
3 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4 #  \\    /   O peration     |
5 #   \\  /    A nd           | Copyright held by original author
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.6-ext
38 # helps to easily write #ifdefs to detect a dev-version
39 export FOAM_DEV=1
41 ###############################################################################
42 # USER EDITABLE PART
44 # either set $FOAM_INST_DIR before sourcing this file or set
45 #    $foamInstall below to where OpenFOAM is installed
47 # Location of FOAM installation
48 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
49 foamInstall=$HOME/$WM_PROJECT
50 # foamInstall=~$WM_PROJECT
51 # foamInstall=/usr/local/$WM_PROJECT
52 # foamInstall=/opt/$WM_PROJECT
53 # foamInstall=/usr/lib
55 # END OF (NORMAL) USER EDITABLE PART
56 ################################################################################
58 # note the location for later use (eg, in job scripts)
59 : ${FOAM_INST_DIR:=$foamInstall}; export FOAM_INST_DIR
61 # The old dirs to be cleaned from the various environment variables
62 # - remove anything under top-level directory.
63 # NB: the WM_PROJECT_INST_DIR might not be identical between versions
64 foamOldDirs="$FOAM_INST_DIR $HOME/$WM_PROJECT/$USER"
65 if [ "$WM_PROJECT_INST_DIR" != "$FOAM_INST_DIR" ]
66 then
67     foamOldDirs="$WM_PROJECT_INST_DIR $foamOldDirs"
71 # Location of site/user files
72 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~
73 export WM_PROJECT_INST_DIR=$FOAM_INST_DIR
74 export WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/$WM_PROJECT-$WM_PROJECT_VERSION
75 : ${WM_PROJECT_USER_DIR:=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION}; export WM_PROJECT_USER_DIR
78 # Location of third-party software
79 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
80 #: ${WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION}; export WM_THIRD_PARTY_DIR
81 : ${WM_THIRD_PARTY_DIR=$WM_PROJECT_DIR/ThirdParty}; export WM_THIRD_PARTY_DIR
83 # Source files, possibly with some verbosity
84 _foamSource()
86    while [ $# -ge 1 ]
87    do
88       [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "Sourcing: $1"
89       . $1
90       shift
91    done
94 # Add in preset user or site preferences:
95 foamPrefs=`$WM_PROJECT_DIR/bin/foamEtcFile prefs.sh` && _foamSource $foamPrefs
96 unset foamPrefs
98 # Evaluate command-line parameters
99 while [ $# -gt 0 ]
101     case "$1" in
102     *=)
103         # name=       -> unset name
104         eval "unset ${1%=}"
105         ;;
106     *=*)
107         # name=value  -> export name=value
108         eval "export $1"
109         ;;
110     esac
111     shift
112 done
115 # Operating System/Platform
116 # ~~~~~~~~~~~~~~~~~~~~~~~~~
117 # WM_OSTYPE = POSIX | ????
118 : ${WM_OSTYPE:=POSIX}; export WM_OSTYPE
121 # Compiler: set to Gcc, Gcc43 or Icc (for Intel's icc)
122 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
123 : ${WM_COMPILER:=Gcc}; export WM_COMPILER
125 export WM_COMPILER_ARCH=
126 export WM_COMPILER_LIB_ARCH=
129 # Compilation options (architecture, precision, optimised, debug or profiling)
130 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
131 : ${WM_NCOMPPROCS:=2}; export WM_NCOMPPROCS
133 # WM_ARCH_OPTION = 32 | 64
134 : ${WM_ARCH_OPTION:=64}; export WM_ARCH_OPTION
136 # WM_PRECISION_OPTION = DP | SP
137 : ${WM_PRECISION_OPTION:=DP}; export WM_PRECISION_OPTION
139 # WM_COMPILE_OPTION = Opt | Debug | Prof
140 : ${WM_COMPILE_OPTION:=Opt}; export WM_COMPILE_OPTION
142 # WM_MPLIB = | OPENMPI | MPICH | MPICH-GM | HPMPI | GAMMA | MPI | QSMPI
143 : ${WM_MPLIB:=OPENMPI}; export WM_MPLIB
146 # Run options (floating-point signal handling and memory initialisation)
147 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
148 export FOAM_SIGFPE=
149 # export FOAM_SETNAN=
152 # Detect system type and set environment variables appropriately
153 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
154 export WM_ARCH=`uname -s`
156 case $WM_ARCH in
157 Linux)
158     WM_ARCH=linux
160     # compiler specifics
161     case `uname -m` in
162     i686)
163         ;;
165     x86_64)
166         case $WM_ARCH_OPTION in
167         32)
168             export WM_COMPILER_ARCH='-64'
169             export WM_CFLAGS='-m32 -fPIC'
170             export WM_CXXFLAGS='-m32 -fPIC'
171             export WM_LDFLAGS='-m32'
172             ;;
173         64)
174             WM_ARCH=linux64
175             export WM_COMPILER_LIB_ARCH=64
176             export WM_CFLAGS='-m64 -fPIC'
177             export WM_CXXFLAGS='-m64 -fPIC'
178             export WM_LDFLAGS='-m64'
179             ;;
180         *)
181             echo Unknown WM_ARCH_OPTION $WM_ARCH_OPTION, should be 32 or 64
182             ;;
183         esac
184         ;;
186     ia64)
187         WM_ARCH=linuxIA64
188         export WM_COMPILER=I64
189         ;;
191     mips64)
192         WM_ARCH=SiCortex64
193         export WM_COMPILER_LIB_ARCH=64
194         export WM_CFLAGS='-mabi=64 -fPIC'
195         export WM_CXXFLAGS='-mabi=64 -fPIC'
196         export WM_LDFLAGS='-mabi=64 -G0'
197         export WM_MPLIB=MPI
198         ;;
200     ppc64)
201         WM_ARCH=linuxPPC64
202         export WM_COMPILER_LIB_ARCH=64
203         export WM_CFLAGS='-m64 -fPIC'
204         export WM_CXXFLAGS='-m64 -fPIC'
205         export WM_LDFLAGS='-m64'
206         ;;
208     *)
209         echo Unknown processor type `uname -m` for Linux
210         ;;
211     esac
212     ;;
214 Darwin)
215     # this makes certain things easier
216     export WM_ARCH_BASE=darwin
218     case `uname -p` in
219     powerpc)
220         export WM_ARCH=darwinPpc
221         ;;
222     i386)
223         export WM_ARCH=darwinIntel
224         ;;
225     *)
226         echo "This seems to be neither an Intel-Mac nor a PPC-Mac please tell me the output of 'uname -p'. Bernhard."
227         export WM_ARCH=darwinUnknown
228         ;;
229     esac
230     case $WM_ARCH_OPTION in
231     32)
232         export WM_CFLAGS='-m32 -fPIC'
233         export WM_CXXFLAGS='-m32 -fPIC'
234         export WM_LDFLAGS='-m32'
235         ;;
236     64)
237         export WM_ARCH=${WM_ARCH}64
238         export WM_CFLAGS='-m64 -fPIC'
239         export WM_CXXFLAGS='-m64 -fPIC'
240         export WM_LDFLAGS='-m64'
241         ;;
242     *)
243         echo Unknown WM_ARCH_OPTION $WM_ARCH_OPTION, should be 32 or 64
244         ;;
245     esac
247     # Make sure that binaries use the best features of the used OS-Version
248     export MACOSX_DEPLOYMENT_TARGET=`sw_vers -productVersion`
250     # Use Mac-Ports-Compiler instead of Apple-gcc-4.2
251     case $WM_COMPILER in
252     Gcc43)
253         export WM_CC='gcc-mp-4.3'
254         export WM_CXX='g++-mp-4.3'
255         ;;
256     Gcc44)
257         export WM_CC='gcc-mp-4.4'
258         export WM_CXX='g++-mp-4.4'
259         ;;
260     Gcc45)
261         export WM_CC='gcc-mp-4.5'
262         export WM_CXX='g++-mp-4.5'
263         ;;
264     *)
265         export WM_COMPILER=
266         ;;
267     esac
269     ;;
271 SunOS)
272     WM_ARCH=SunOS64
273     export WM_COMPILER_LIB_ARCH=64
274     export WM_CFLAGS='-mabi=64 -fPIC'
275     export WM_CXXFLAGS='-mabi=64 -fPIC'
276     export WM_LDFLAGS='-mabi=64 -G0'
277     export WM_MPLIB=FJMPI
278     ;;
280 *)      # an unsupported operating system
281     cat <<USAGE
283     Your "$WM_ARCH" operating system is not supported by this release
284     of OpenFOAM. For further assistance, please contact www.extend-project.de
286 USAGE
287     ;;
288 esac
291 # Clean standard environment variables (PATH, LD_LIBRARY_PATH, MANPATH)
292 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
293 cleanProg=$WM_PROJECT_DIR/bin/foamCleanPath
295 #- Clean PATH
296 cleanEnv=`$cleanProg "$PATH" "$foamOldDirs"` && PATH="$cleanEnv"
298 #- Clean LD_LIBRARY_PATH
299 cleanEnv=`$cleanProg "$LD_LIBRARY_PATH" "$foamOldDirs"` && LD_LIBRARY_PATH="$cleanEnv"
301 #- Clean DYLD_LIBRARY_PATH
302 if [[ "$WM_ARCH_BASE" == "darwin" ]] 
303 then
304     cleanEnv=`$cleanProg "$DYLD_LIBRARY_PATH" "$foamOldDirs"` && DYLD_LIBRARY_PATH="$cleanEnv"
307 #- Clean MANPATH
308 cleanEnv=`$cleanProg "$MANPATH" "$foamCleanDirs"` && MANPATH="$cleanEnv"
310 export PATH LD_LIBRARY_PATH MANPATH
312 # Source project setup files
313 # ~~~~~~~~~~~~~~~~~~~~~~~~~~
315 _foamSource $WM_PROJECT_DIR/etc/settings.sh
316 _foamSource $WM_PROJECT_DIR/etc/aliases.sh
319 # Source user setup files for optional packages
320 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
321 # _foamSource $WM_PROJECT_DIR/etc/apps/paraview/bashrc
322 # _foamSource $WM_PROJECT_DIR/etc/apps/paraview3/bashrc
323 # _foamSource $WM_PROJECT_DIR/etc/apps/ensight/bashrc
326 # Clean environment paths again. Only remove duplicates
327 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
328 #- Clean PATH
329 cleanEnv=`$cleanProg "$PATH"` && PATH="$cleanEnv"
331 #- Clean LD_LIBRARY_PATH
332 cleanEnv=`$cleanProg "$LD_LIBRARY_PATH"` && LD_LIBRARY_PATH="$cleanEnv"
334 #- Clean MANPATH
335 cleanEnv=`$cleanProg "$MANPATH"` && MANPATH="$cleanEnv:"
337 export PATH LD_LIBRARY_PATH MANPATH
339 #- Clean LD_PRELOAD
340 if [ "$LD_PRELOAD" != "" ]
341 then
342     cleanEnv=`$cleanProg "$LD_PRELOAD"` && LD_PRELOAD="$cleanEnv"
343     export LD_PRELOAD
347 # cleanup environment:
348 # ~~~~~~~~~~~~~~~~~~~~
349 unset cleanEnv cleanProg foamInstall foamOldDirs
350 unset _foamSource
352 # -----------------------------------------------------------------------------