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