-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmy_halld_build_jlab
executable file
·195 lines (180 loc) · 4.18 KB
/
my_halld_build_jlab
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
#!/bin/bash
echo "For usage message, type \"$(basename "$0") -h\""
usage="$(basename "$0") [-h] [-x filename] [-n nthreads] [package_1] [package_2] ...
where:
-h show this help text
-x set name of version set XML file
(default: /group/halld/www/halldweb/html/halld_versions/version.xml)
-n set number of threads to use in builds (default: 1)
-r remove inconsistent packages from the environment
(default: keep all packages that appear in the input xml file)
package_n package name, choose from:
hdds
sim-recon
halld_recon
halld_sim
hdgeant4
gluex_root_analysis
amptools
if no package name supplied all except sim-recon will be built"
mydir=`pwd`
mydate=`date +%F`
if [ -z "$BUILD_SCRIPTS" ]
then export BUILD_SCRIPTS=/group/halld/Software/build_scripts
fi
rm -fv version.xml
cmd="$BUILD_SCRIPTS/customize_version.pl -o version.xml"
list=""
while [[ $# -gt 0 ]]
do
key=$1
case $key in
-h)
echo "$usage"
exit 0
;;
-x)
xmlfile="$2"
shift
shift
;;
-n)
threads_option="-j$2"
shift
shift
;;
-r)
remove_inconsistent_packages=true
shift
;;
hdds)
cmd="$cmd -g $mydir/hdds"
list="$list hdds"
shift
;;
sim-recon)
cmd="$cmd -s $mydir/sim-recon"
list="$list sim-recon"
shift
;;
halld_recon)
cmd="$cmd -r $mydir/halld_recon"
list="$list halld_recon"
shift
;;
halld_sim)
cmd="$cmd -m $mydir/halld_sim"
list="$list halld_sim"
shift
;;
hdgeant4)
cmd="$cmd -4 $mydir/hdgeant4"
list="$list hdgeant4"
shift
;;
gluex_root_analysis)
cmd="$cmd -a $mydir/gluex_root_analysis"
list="$list gluex_root_analysis"
shift
;;
amptools)
cmd="$cmd -t $mydir/AmpTools"
list="$list amptools"
shift
;;
*)
echo error: unknown package name or option = $key
exit 1
;;
esac
done
if [ -z "$xmlfile" ]
then xmlfile=/group/halld/www/halldweb/html/halld_versions/version.xml
fi
if [ -z "$list" ]
then
list="hdds halld_recon halld_sim hdgeant4 gluex_root_analysis amptools"
cmd="$cmd -g $mydir/hdds"
cmd="$cmd -r $mydir/halld_recon"
cmd="$cmd -m $mydir/halld_sim"
cmd="$cmd -4 $mydir/hdgeant4"
cmd="$cmd -a $mydir/gluex_root_analysis"
cmd="$cmd -t $mydir/AmpTools"
fi
if [ "$remove_inconsistent_packages" == true ]
then
if [[ $list = *amptools* ]]
then
if [[ $list != *halld_sim* ]]
then
cmd="$cmd -m none"
fi
if [[ $list != *halld_recon* ]]
then
cmd="$cmd -r none"
fi
fi
if [[ $list = *halld_recon* ]]
then
if [[ $list != *halld_sim* ]]
then
cmd="$cmd -m none"
fi
if [[ $list != *hdgeant4* ]]
then
cmd="$cmd -4 none"
fi
if [[ $list != *gluex_root_analysis* ]]
then
cmd="$cmd -a none"
fi
fi
if [[ $list = *hdds* ]]
then
if [[ $list != *halld_recon* ]]
then
cmd="$cmd -r none"
fi
fi
fi
cmd="$cmd -i $xmlfile"
$cmd
prompt="Will build the following packages in the local directory:
$list
Is this OK? "
while true; do
read -p "$prompt" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
echo source $BUILD_SCRIPTS/gluex_env_jlab.sh $mydir/version.xml \
> setup_gluex.sh
echo source $BUILD_SCRIPTS/gluex_env_jlab.csh $mydir/version.xml \
> setup_gluex.csh
source $BUILD_SCRIPTS/gluex_env_clean.sh
source $BUILD_SCRIPTS/gluex_env_jlab.sh $mydir/version.xml
set -e
if [[ $list = *amptools* ]]
then make -f $BUILD_SCRIPTS/Makefile_amptools
fi
if [[ $list = *hdds* ]]
then make -f $BUILD_SCRIPTS/Makefile_hdds
fi
if [[ $list = *sim-recon* ]]
then make -f $BUILD_SCRIPTS/Makefile_sim-recon SIM_RECON_SCONS_OPTIONS="$threads_option"
fi
if [[ $list = *halld_recon* ]]
then make -f $BUILD_SCRIPTS/Makefile_halld_recon HALLD_RECON_SCONS_OPTIONS="$threads_option"
fi
if [[ $list = *halld_sim* ]]
then make -f $BUILD_SCRIPTS/Makefile_halld_sim HALLD_SIM_SCONS_OPTIONS="$threads_option"
fi
if [[ $list = *hdgeant4* ]]
then make -f $BUILD_SCRIPTS/Makefile_hdgeant4
fi
if [[ $list = *gluex_root_analysis* ]]
then make -f $BUILD_SCRIPTS/Makefile_gluex_root_analysis
fi