STYLE: date
[OpenFOAM-2.0.x.git] / bin / tools / foamListThirdPartyBinDirs
blobc97fefede75e2364ab4d7d099f0a1a14c6178b87
1 #!/bin/sh
2 #------------------------------------------------------------------------------
3 # ========= |
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / O peration |
6 # \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
7 # \\/ M anipulation |
8 #-------------------------------------------------------------------------------
9 # License
10 # This file is part of OpenFOAM.
12 # OpenFOAM is free software: you can redistribute it and/or modify it
13 # under the terms of the GNU General Public License as published by
14 # the Free Software Foundation, either version 3 of the License, or
15 # (at your option) any later version.
17 # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
18 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 # for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 # Script
26 # foamListThirdPartyBinDirs <directory> [archOptions]
28 # Description
29 # Lists directories containing binary files for OpenFOAM ThirdParty
31 # Note
32 # Not normally called directly by the user.
33 #------------------------------------------------------------------------------
34 toolsDir="${0%/*}" # this script is already located in the tools/ directory
36 [ $# -eq 1 -o $# -eq 2 ] || {
37 cat <<USAGE 1>&2
38 Usage : ${0##*/} <packDir> [archOptions]
40 * List directories containing binary files for OpenFOAM ThirdParty
42 The value of 'archOptions' normally corresponds to \$WM_OPTIONS
43 The current value of \$WM_OPTIONS = $WM_OPTIONS
45 USAGE
46 exit 1
49 #------------------------------------------------------------------------------
50 packDir="$1"
52 # default to same as $WM_OPTIONS - eg, 'linux64GccDPOpt'
53 archOptions="${2:-$WM_OPTIONS}"
55 [ -n "$archOptions" ] || {
56 echo "Error: no archOptions specified" 1>&2
57 exit 1
60 # base arch (w/o precision, optimization, etc)
61 # same as "$WM_ARCH$WM_COMPILER"
62 archCompiler=$(echo "$archOptions" | sed -e 's@[DS]P.*$@@')
64 # same as $WM_ARCH - eg, 'linux64'
65 # TODO: only works for Gcc, Icc, Clang
66 archOS=$(echo "$archOptions" | sed -e 's@[GI]cc.*$@@' -e 's@Clang.*$@@')
68 # links for 32-bit version, eg convert linux64 -> linux-64
69 arch3264=$(echo "$archOS" | sed -e 's@64@-64@')
72 #------------------------------------------------------------------------------
73 # check for essential directories
74 for dir in \
75 $packDir \
76 $packDir/platforms/$archOptions/lib \
79 [ -d $dir ] || {
80 echo "Error: directory $dir does not exist" 1>&2
81 exit 1
83 done
85 #------------------------------------------------------------------------------
86 # list of directories
87 dirList=$(
88 for dir in \
89 $packDir/platforms/$archOptions \
90 $packDir/platforms/$archCompiler \
91 $packDir/platforms/$archOS \
94 [ -d $dir ] && echo $dir
95 done
97 # add in links for 32-bit version
98 if [ "$archOS" != "$arch3264" ]
99 then
100 for dir in \
101 $packDir/platforms/$arch3264 \
104 [ -d $dir -a -L $dir ] && echo $dir
105 done
110 cat <<INFO 1>&2
111 -------------------------------------------------------------------------------
112 Packing $archOptions ($archCompiler) port of $packDir
113 archOS = $archOS
114 32bit archOS = $arch3264
116 dirs:
117 $(echo ${dirList:-NONE})
119 INFO
121 echo "$dirList"
123 #------------------------------------------------------------------------------