1 arta 1.1 #! /bin/csh -f
2
|
3 arta 1.26 # set up $JSOC_MACHINE
4 set JSOC_MACHINE = `build/jsoc_machine.csh`
5 echo "Machine type is $JSOC_MACHINE"
6 echo ""
|
7 arta 1.24
|
8 arta 1.1 set CLEAN = "no"
|
9 arta 1.61 set PROJCONFIG = ""
10 set CLEANCMD = "d"
11 set CONFIGCMD = "c"
|
12 arta 1.51 set LOCALIZE = "L"
|
13 arta 1.1
|
14 arta 1.60 set CUSTOMDEFSFILE = ""
15
|
16 arta 1.1 foreach ARG ($argv)
|
17 arta 1.61 set FLAG = `echo $ARG | awk '{print substr($0, 2, 1)}'`
18
19 if ($FLAG == $CLEANCMD) then
|
20 arta 1.1 set CLEAN = "yes"
|
21 arta 1.61 else if ($FLAG == $CONFIGCMD) then
22 set PROJCONFIG = `echo $ARG | awk '{print substr($0, 3)}'`
|
23 arta 1.1 endif
24 end
25
|
26 arta 1.63 # Backward compatibility - remove the links to the old make files in projconf
27 if (-d proj) then
28 cd proj
29 if (-e configure) then
30 rm configure
31 endif
32 if (-e make_basic.mk) then
33 rm make_basic.mk
34 endif
35 if (-e Rules.mk) then
36 rm Rules.mk
37 endif
38 if (-e target.mk) then
39 rm target.mk
40 endif
41 cd ..
42 endif
43
|
44 arta 1.1 echo -n "Remove links to man pages..."
|
45 arta 1.47 if (-e man) then
46 rm -rf man
47 endif
|
48 arta 1.1 echo "done"
49
50 echo -n "Removing links to headers..."
|
51 arta 1.10 if (-d base/include) then
|
52 arta 1.47 cd base/include
53 find . -name "*.h" -exec rm {} \;
54 cd ../..
|
55 arta 1.1 endif
|
56 arta 1.19
57 if (-d include) then
|
58 arta 1.47 cd include
59 find . -name "*.h" -exec rm {} \;
60 cd ..
|
61 arta 1.19 endif
|
62 arta 1.1 echo "done"
63
64 echo -n "Removing links to scripts..."
65 if (-d scripts) then
|
66 arta 1.47 cd scripts
67 find . -name "*" -exec rm {} \;
68 cd ..
|
69 arta 1.1 endif
70 echo "done"
71
72 echo -n "Removing links to jsds..."
73 if (-d jsds) then
|
74 arta 1.47 cd jsds
75 find . -name "*" -exec rm {} \;
76 cd ..
|
77 arta 1.1 endif
78 echo "done"
79
80 echo
81
82 if ($CLEAN == "yes") then
|
83 arta 1.10 if (-x base/local/libs/dsds/scripts/rmlinks.csh) then
84 base/local/libs/dsds/scripts/rmlinks.csh
|
85 arta 1.1 endif
86
|
87 arta 1.10 if (-x base/local/libs/soi/scripts/rmlinks.csh) then
88 base/local/libs/soi/scripts/rmlinks.csh
|
89 arta 1.1 endif
90 else
|
91 arta 1.53 # Make include directories here, since they are used by multiple script blocks below
92 if (!(-d base/include)) then
93 mkdir -p base/include
94 endif
95
96 if (!(-d include)) then
97 mkdir -p include
98 endif
99
|
100 arta 1.13 echo "Setting links to man pages..."
101 if (-d /home/jsoc/man) then
102 if (!(-e man)) then
103 ln -s /home/jsoc/man man
104 endif
105 endif
|
106 arta 1.1 echo "done"
|
107 arta 1.52 echo
|
108 arta 1.1
109 echo "Setting links to jsds..."
|
110 arta 1.47 if (!(-d jsds)) then
111 mkdir jsds
112 endif
|
113 arta 1.1 cd jsds
|
114 arta 1.10 find ../base \( -name \*.jsd -exec ln -s {} . \; -a -exec echo " " {} " OK" \; \) -o \( -name \*.jsd -exec echo " " {} " ERROR - couldn't create link" \; \)
|
115 arta 1.1 cd ..
116 echo "done"
117 echo
|
118 arta 1.14
|
119 arta 1.1 # generate links for DSDS/SOI dynamic libraries - only do this if
120 # user's environment has access to /home/soi/CM
121 if (-d /home/soi/CM/include && -d /home/soi/CM/src) then
|
122 arta 1.10 if (-x base/local/libs/dsds/scripts/genlinks.csh) then
123 base/local/libs/dsds/scripts/genlinks.csh
|
124 arta 1.1 endif
125
|
126 arta 1.10 if (-x base/local/libs/soi/scripts/genlinks.csh) then
127 base/local/libs/soi/scripts/genlinks.csh
|
128 arta 1.1 endif
129 endif
|
130 arta 1.53
|
131 arta 1.57 echo "done"
132 echo
133
|
134 arta 1.53 # Site Localization
|
135 arta 1.57
136 # Path to the configuration file - at some point, make this an argument to the configure script
|
137 arta 1.58 set LOCALIZATIONDIR = ""
|
138 arta 1.57 set conflocal = "config.local"
|
139 arta 1.58
140 if (-e $conflocal) then
141 set LOCALIZATIONDIR = `perl -n -e 'if ($_ =~ /^LOCALIZATIONDIR\s+(.+)/) { print $1; }' $conflocal`
142 endif
|
143 arta 1.57
144 if ($LOCALIZATIONDIR == "") then
145 set LOCALIZATIONDIR = ${PWD}/localization
146 endif
147
148 # Eventually, dump all these generated files into a user-specified location.
149 # This script will need to read the config.local file to get the
150 # localization directory. Otherwise, just use JSOC/localization as the default.
151 # We should put custom.mk in the localization directory too.
152 if (!(-d ${LOCALIZATIONDIR})) then
153 mkdir ${LOCALIZATIONDIR}
154 if ($? != 0) then
155 echo "Error creating localization directory."
156 endif
157 endif
158
159 if (-e ${LOCALIZATIONDIR}/custom.mk) then
160 rm ${LOCALIZATIONDIR}/custom.mk
161 endif
162
|
163 arta 1.61 if (!(-e configsdp.txt)) then
|
164 arta 1.53 if (!(-e config.local)) then
165 echo "Error: config.local not found. If you have a saved version of this"
166 echo " file from a previous installation, you should copy that into"
167 echo " this directory and rerun configure. Otherwise, copy the file"
168 echo " config.local.template to config.local and edit the config.local"
169 echo " file to contain site-appropriate values."
170 echo
171 echo "*** IMPORTANT *** The edited config.local will contain site-specific"
172 echo " values that should not be modified during subsequent updates to"
173 echo " NetDRMS. Keep a safe copy of it somewhere outside of the DRMS"
174 echo " directory tree, for example in /usr/local. After each NetDRMS"
175 echo " update, ensure this file is in place."
|
176 arta 1.54 exit 1;
|
177 arta 1.53 else
|
178 arta 1.57 echo "CUSTOM_DEFINES = __LOCALIZED_DEFS__" >> ${LOCALIZATIONDIR}/custom.mk
|
179 arta 1.53 ./gen_init.csh
|
180 arta 1.60
181 set CUSTOMDEFSFILE = "base/include/localization.h"
182
183 # run moreconfigure.pl - this script is written in perl because it is easier to do the compiler detection
|
184 arta 1.61 # in perl. It also reads configdsp.txt (if it exists) to set the default Stanford values for certain make variables
|
185 arta 1.60 ./moreconfigure.pl -d${LOCALIZATIONDIR} -fcustom.mk -c${CUSTOMDEFSFILE}
186
187 # must follow moreconfigure.pl, because moreconfigure.pl will possibly set the compiler make variables,
188 # which are then referenced by lines in custom.mk generated by customizemake.pl.
|
189 arta 1.57 ./customizemake.pl ./config.local ${LOCALIZATIONDIR}
|
190 arta 1.53 endif
191 else if (-e config.local) then
192 # config.local is optional at Stanford, but it won't necessarily contain the same information that
193 # a NetDRMS config.local contains. The first section contains items that will override the
194 # the items in serverdefs.h. The second section contains items used to populate custom.mk,
195 # which causes make systems variables to be defined that override the default make behavior
196 # (such as overriding the name of the directory to which binary data are written - linux_x86_64_n02
197 # instead of linux_x86_64, for example).
198
199 # Override the defaults defined in serverdefs.h (don't use gen_init.csh as it does several things,
200 # most of which are relevant only to non-SU NetDRMS sites). This script causes all
201 # items included in config.local to override those defined in serverdefs.h, but not all
202 # items need be specified in config.local.
|
203 arta 1.60 echo "CUSTOM_DEFINES = __CUSTOMIZED_DEFS__" >> ${LOCALIZATIONDIR}/custom.mk
|
204 arta 1.53 ./customizedefs.pl
|
205 arta 1.60
206 set CUSTOMDEFSFILE = "base/include/customizeddefs.h"
207
208 # run moreconfigure.pl - this script is written in perl because it is easier to do the compiler detection
|
209 arta 1.61 # in perl. It also reads configsdp.txt (if it exists) to set the default Stanford values for certain make variables
|
210 arta 1.60 ./moreconfigure.pl -d${LOCALIZATIONDIR} -fcustom.mk -c${CUSTOMDEFSFILE}
|
211 arta 1.53
212 # update custom.mk with data from config.local
|
213 arta 1.60 # must follow moreconfigure.pl, because moreconfigure.pl will possibly set the compiler make variables,
214 # which are then referenced by lines in custom.mk generated by customizemake.pl.
|
215 arta 1.57 ./customizemake.pl ./config.local ${LOCALIZATIONDIR}
|
216 arta 1.60 else
217 # run moreconfigure.pl - this script is written in perl because it is easier to do the compiler detection
|
218 arta 1.61 # in perl. It also reads configsdp.txt (if it exists) to set the default Stanford values for certain make variables
|
219 arta 1.60 ./moreconfigure.pl -d${LOCALIZATIONDIR} -fcustom.mk
|
220 arta 1.53 endif
221
|
222 arta 1.61 if (${PROJCONFIG} == "") then
223 if (-e configsdp.txt) then
224 set PROJCONFIG = configsdp.txt
225 endif
226 endif
227
228 if (-e configsdp.txt) then
229 set PROJCONFIGEXE = "/home/jsoc/bin/linux_x86_64/perl5.12.2 configproj.pl"
230 else
|
231 arta 1.62 set PROJCONFIGEXE = "configproj.pl"
|
232 arta 1.61 endif
233
234 if (${PROJCONFIG} != "") then
|
235 arta 1.62 echo "Running project configuration [${PROJCONFIGEXE} -c${PROJCONFIG} -d${LOCALIZATIONDIR}]."
|
236 arta 1.61 ${PROJCONFIGEXE} -c${PROJCONFIG} -d${LOCALIZATIONDIR}
237 endif
238
|
239 arta 1.62 echo "Setting links to scripts..."
240 if (!(-d scripts)) then
241 mkdir scripts
242 endif
243 cd scripts
244
245 # Sums scripts
246 find ../base/sums/scripts -mindepth 1 \( -path \*CVS -prune -o -exec ln -s {} . \; -a -exec echo " " {} " OK" \; \) -o -exec echo " " {} " ERROR - couldn't create link" \;
247
248 # Util scripts
249 find ../base/util/scripts -mindepth 1 \( -path \*CVS -prune -o -exec ln -s {} . \; -a -exec echo " " {} " OK" \; \) -o -exec echo " " {} " ERROR - couldn't create link" \;
250
251 # Export scripts
252 find ../base/export/scripts -mindepth 1 \( -path \*CVS -prune -o -exec ln -s {} . \; -a -exec echo " " {} " OK" \; \) -o -exec echo " " {} " ERROR - couldn't create link" \;
253
254 # DRMS / IDL-interface scripts
255 find ../base/drms/scripts -mindepth 1 \( -path \*CVS -prune -o -exec ln -s {} . \; -a -exec echo " " {} " OK" \; \) -o -exec echo " " {} " ERROR - couldn't create link" \;
256
257 # Project-specific scripts - these won't show up if you don't have the project source.
258 if (-x ${LOCALIZATIONDIR}/configure) then
259 ${LOCALIZATIONDIR}/configure
260 arta 1.62 endif
261
262 cd ..
263 echo "done"
264 echo
265
|
266 arta 1.53 echo "Setting links to headers..."
267
268 cd base/include
269 find .. -path '../include' -prune -o -name \*.h \( \( -exec ln -s {} . \; -a -exec echo " " {} " OK" \; \) -o -exec echo " " {} " ERROR - couldn't create link" \; \)
270 cd ../..
271
272 cd include
273 if (-d ../base/include) then
274 find ../base/include -name \*.h -exec ln -s {} . \;
275 endif
276 cd ..
277 echo "done"
278 echo
279
|
280 arta 1.55 # Custom make variable values - these will override the values set in moreconfigure.pl
|
281 arta 1.53 # echo "JSOC_COMPILER = gcc" >> custom.mk
282 # echo "JSOC_FCOMPILER = gfortran" >> custom.mk
|
283 arta 1.55 # echo "DRMS_DEFAULT_RETENTION = -10" >> custom.mk
|
284 arta 1.53
|
285 arta 1.1 endif
286
|
287 arta 1.33
|