ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/JSOC/configure
Revision: 1.89
Committed: Wed Sep 14 15:59:13 2022 UTC (12 months, 1 week ago) by arta
Branch: MAIN
CVS Tags: HEAD
Changes since 1.88: +2 -2 lines
Log Message:
Modifies make system to make it compatible with both the new git-repo structure
and the old cvs structure (commit 1)

File Contents

# Content
1 #! /bin/csh -f
2
3 # The system configuration for configure script
4 set PERLBIN = ""
5 set PYBIN = "python3"
6 set DRMS_PARAMETERS_PACKAGE = "base/libs/py/drms_parameters"
7 set PY_LIBS_DIR = "base/libs/py"
8
9 if ($PERLBIN == "") then
10 if (-x /home/jsoc/bin/linux_x86_64/activeperl) then
11 set PERLBIN = "/home/jsoc/bin/linux_x86_64/activeperl"
12 else
13 set PERLBIN = "perl"
14 endif
15 endif
16
17 if ($PYBIN == "") then
18 if (-x /home/jsoc/bin/linux_x86_64/activepython) then
19 set PYBIN = "/home/jsoc/bin/linux_x86_64/activepython"
20 else
21 set PYBIN = "python3"
22 endif
23 endif
24
25 # set up $JSOC_MACHINE
26 set JSOC_MACHINE = `build/jsoc_machine.csh`
27 if ($? != 0) then
28 echo "Unable to determine machine type."
29 exit 1
30 endif
31
32 echo "Machine type is $JSOC_MACHINE"
33 echo ""
34
35 # Clean by default.
36 set CLEAN = "yes"
37 set PROJCONFIG = ""
38 set CLEANCMD = "d"
39 set CFGSERVER = "no"
40 set CFGSERVERARG = "s"
41 set CUSTOMDEFSFILE = ""
42
43 foreach THEARG ($argv)
44 set LITERALSTR = '{ my($argin) = "'${THEARG}'"; my($flagout); $flagout = ($argin =~ /^-(.+)/)[0]; print $flagout; }'
45 set FLAG = `$PERLBIN -e "$LITERALSTR"`
46 if ($? != 0) then
47 echo "Unable to parse command-line arguments."
48 exit 1
49 endif
50
51 if ($FLAG == $CLEANCMD) then
52 set CLEAN = "no"
53 else if ($FLAG == $CFGSERVERARG) then
54 set CFGSERVER = "yes"
55 else if (-e $THEARG) then
56 set PROJCONFIG = $THEARG
57 endif
58 end
59
60 # Usage:
61 # configure [ -d ] [ -s ] [ <project config file> ]
62
63 # Backward compatibility - remove the links to the old make files in projconf
64 if (-d proj) then
65 cd proj
66 if (-e configure) then
67 rm configure
68 endif
69 if (-e make_basic.mk) then
70 rm make_basic.mk
71 endif
72 if (-e Rules.mk) then
73 rm Rules.mk
74 endif
75 if (-e target.mk) then
76 rm target.mk
77 endif
78 cd ..
79 endif
80
81 # Always clean up links to man pages and re-create them.
82 echo -n "Removing links to man pages..."
83 if (-e man) then
84 rm -rf man
85 endif
86 echo "done"
87
88 if ($CLEAN == "yes") then
89 echo -n "Removing links in base/include to headers..."
90 # Links in base/include
91 if (-d base/include) then
92 cd base/include
93 find . -name "*.h" -exec rm {} \;
94 cd ../..
95 endif
96 echo "done"
97
98 # Special link from base/drms/apps/serverdefs.h to localization/drmsparams.h
99 echo -n "Removing link to serverdefs.h..."
100 if (-e base/drms/apps) then
101 cd base/drms/apps
102 rm serverdefs.h
103 cd ../../..
104 endif
105 echo "done"
106
107 # Links in include
108 echo -n "Removing links in include to headers..."
109 if (-d include) then
110 cd include
111 find . -name "*.h" -exec rm {} \;
112 find . -name "drmsparams*" -exec rm {} \;
113 cd ..
114 endif
115 echo "done"
116
117 echo -n "Removing links to scripts..."
118 # Links in scripts
119 if (-d scripts) then
120 cd scripts
121 if ($? == 0) then
122 find . -type l -exec rm {} \;
123 endif
124 cd ..
125 endif
126 echo "done"
127 # End clean flag
128 endif
129
130 # Always clean-up links to jsds and re-create them.
131 echo -n "Removing links to jsds..."
132 if (-d jsds) then
133 cd jsds
134 if ($? == 0) then
135 find . -type l -exec rm {} \;
136 endif
137 cd ..
138 endif
139 echo "done"
140 echo
141
142 if ($CLEAN == "yes") then
143 if (-x base/local/libs/dsds/scripts/rmlinks.csh) then
144 base/local/libs/dsds/scripts/rmlinks.csh
145 endif
146
147 if (-x base/local/libs/soi/scripts/rmlinks.csh) then
148 base/local/libs/soi/scripts/rmlinks.csh
149 endif
150 endif
151
152 # Make include directories here, since they are used by multiple script blocks below
153 if (!(-d base/include)) then
154 mkdir -p base/include
155 if ($? != 0) then
156 echo "Unable to make base/include directory."
157 exit 1
158 endif
159 endif
160
161 if (!(-d include)) then
162 mkdir -p include
163 if ($? != 0) then
164 echo "Unable to make include directory."
165 exit 1
166 endif
167
168
169 endif
170
171 echo "Setting links to man pages..."
172 if (-d /home/jsoc/man) then
173 if (!(-e man)) then
174 ln -s /home/jsoc/man man
175 endif
176 endif
177 echo "done"
178 echo
179
180 echo "Setting links to jsds..."
181 if (!(-d jsds)) then
182 mkdir jsds
183 endif
184 cd jsds
185 find ../base \( -name \*.jsd -exec ln -s {} . \; -a -exec echo " " {} " OK" \; \) -o \( -name \*.jsd -exec echo " " {} " ERROR - couldn't create link" \; \)
186 cd ..
187 echo "done"
188 echo
189
190 # generate links for DSDS/SOI dynamic libraries - only do this if
191 # user's environment has access to /home/soi/CM
192 if (-d /home/soi/CM/include && -d /home/soi/CM/src) then
193 if (-x base/local/libs/dsds/scripts/genlinks.csh) then
194 base/local/libs/dsds/scripts/genlinks.csh
195 endif
196
197 if (-x base/local/libs/soi/scripts/genlinks.csh) then
198 base/local/libs/soi/scripts/genlinks.csh
199 endif
200 endif
201
202 echo "done"
203 echo
204
205 #######################
206 ## Site Localization ##
207 #######################
208
209 # Path to the configuration file - at some point, make this an argument to the configure script
210 set LOCALIZATIONDIR = ""
211 set RELLOCALIZATIONDIR = ""
212 set conflocal = "config.local"
213
214 if (-e $conflocal) then
215 set RELLOCALIZATIONDIR = `perl -n -e 'if ($_ =~ /^LOCALIZATIONDIR\s+(.+)/) { print $1; }' $conflocal`
216 endif
217
218 if ($LOCALIZATIONDIR == "") then
219 set RELLOCALIZATIONDIR = localization
220 endif
221
222 # Make the path absoluate
223 set LOCALIZATIONDIR = ${PWD}/${RELLOCALIZATIONDIR}
224
225 # Reset localization.
226 if ($CLEAN == "yes") then
227 # This script will need to read the config.local file to get the
228 # localization directory. Otherwise, just use JSOC/localization as the default.
229 if (!(-d ${LOCALIZATIONDIR})) then
230 mkdir ${LOCALIZATIONDIR}
231 if ($? != 0) then
232 echo "Error creating localization directory."
233 exit 1
234 endif
235 endif
236
237 if (-e ${LOCALIZATIONDIR}/drmsparams.h) then
238 rm ${LOCALIZATIONDIR}/drmsparams.h
239 endif
240
241 if (-e ${LOCALIZATIONDIR}/drmsparams.mk) then
242 rm ${LOCALIZATIONDIR}/drmsparams.mk
243 endif
244
245 if (-e ${LOCALIZATIONDIR}/drmsparams.pm) then
246 rm ${LOCALIZATIONDIR}/drmsparams.pm
247 endif
248
249 if (-e ${LOCALIZATIONDIR}/drmsparams.py) then
250 rm ${LOCALIZATIONDIR}/drmsparams.py
251 endif
252
253 if (!(-e configsdp.txt)) then
254 # This is NetDRMS.
255 if (!(-e config.local)) then
256 echo "Error: config.local not found. If you have a saved version of this"
257 echo " file from a previous installation, you should copy that into"
258 echo " this directory and rerun configure. Otherwise, copy the file"
259 echo " config.local.template to config.local and edit the config.local"
260 echo " file to contain site-appropriate values."
261 echo
262 echo "*** IMPORTANT *** The edited config.local will contain site-specific"
263 echo " values that should not be modified during subsequent updates to"
264 echo " NetDRMS. Keep a safe copy of it somewhere outside of the DRMS"
265 echo " directory tree, for example in /usr/local. After each NetDRMS"
266 echo " update, ensure this file is in place."
267 exit 1;
268 endif
269 endif
270
271 # We now call localize.py for both Stanford and NetDRMS builds.
272 if ($CFGSERVER == "yes") then
273 set cmd = "$PYBIN ./localize.py -d ${LOCALIZATIONDIR} -b drmsparams -s"
274 else
275 set cmd = "$PYBIN ./localize.py -d ${LOCALIZATIONDIR} -b drmsparams"
276 endif
277
278 $cmd
279 if ($? != 0) then
280 echo "Failure running localize.py."
281 exit 1
282 endif
283
284 # copy drmsparams.py into the drms_parameters package
285 if (-e ${LOCALIZATIONDIR}/drmsparams.py && -e ${DRMS_PARAMETERS_PACKAGE}) then
286 echo "copying drmsparams.py to drms_parameters package directory"
287 cp ${LOCALIZATIONDIR}/drmsparams.py ${DRMS_PARAMETERS_PACKAGE}/parameters.py
288 endif
289 endif # End reset localization
290
291 echo "Setting links to scripts..."
292 if (!(-d scripts)) then
293 mkdir scripts
294 if ($? != 0) then
295 echo "Unable to create scripts directory."
296 exit 1
297 endif
298 endif
299
300 if ($CLEAN == "yes") then
301 cd scripts
302
303 # Sums scripts
304 find ../base/sums/scripts -mindepth 1 -path \*CVS -prune -o -print | ${PERLBIN} -MFile::Basename -n -e 'my($bn) = basename($_); chomp($bn); my($path) = $_; chomp($path); if (!(-e $bn)) { `ln -s $_`; if ($? >> 8 == 0) { print " " . $path . " OK\n"; } else { print " " . $path . " ERROR - could not create link\n"; } }'
305
306 # Util scripts
307 find ../base/util/scripts -mindepth 1 -path \*CVS -prune -o -print | ${PERLBIN} -MFile::Basename -n -e 'my($bn) = basename($_); chomp($bn); my($path) = $_; chomp($path); if (!(-e $bn)) { `ln -s $_`; if ($? >> 8 == 0) { print " " . $path . " OK\n"; } else { print " " . $path . " ERROR - could not create link\n"; } }'
308
309 # Export scripts
310 find ../base/export/scripts -mindepth 1 -path \*CVS -prune -o -print | ${PERLBIN} -MFile::Basename -n -e 'my($bn) = basename($_); chomp($bn); my($path) = $_; chomp($path); if (!(-e $bn)) { `ln -s $_`; if ($? >> 8 == 0) { print " " . $path . " OK\n"; } else { print " " . $path . " ERROR - could not create link\n"; } }'
311
312 # DRMS / IDL-interface scripts
313 find ../base/drms/scripts -mindepth 1 -path \*CVS -prune -o -print | ${PERLBIN} -MFile::Basename -n -e 'my($bn) = basename($_); chomp($bn); my($path) = $_; chomp($path); if (!(-e $bn)) { `ln -s $_`; if ($? >> 8 == 0) { print " " . $path . " OK\n"; } else { print " " . $path . " ERROR - could not create link\n"; } }'
314
315 # Project-specific scripts - these won't show up if you don't have the project source.
316 find ../proj/lev0/scripts -mindepth 1 -path \*CVS -prune -o -print | ${PERLBIN} -MFile::Basename -n -e 'my($bn) = basename($_); chomp($bn); my($path) = $_; chomp($path); if (!(-e $bn)) { `ln -s $_`; if ($? >> 8 == 0) { print " " . $path . " OK\n"; } else { print " " . $path . " ERROR - could not create link\n"; } }'
317
318 endif
319 cd ..
320 endif
321
322 echo "done"
323 echo
324
325 echo "Setting links to headers..."
326
327 # When localize.py was added, we removed the repository version of serverdefs.h, and we stopped generating JSOC/base/include/localization.h.
328 # To support legacy code, we need to make a link from serverdefs.h to ${LOCALIZATIONDIR}/drmsparams.h (the replacement for serverdefs.h
329 # at Stanford) and from JSOC/base/include/localization.h to ${LOCALIZATIONDIR}/drmsparams.h (the replacement for localization.h
330 # for NetDRMs builds). However, some files are looking for JSOC/base/drms/apps/serverdefs.h (instead of JSOC/base/include, the correct path).
331 # If we make a link from JSOC/base/drms/apps/serverdefs.h to ${LOCALIZATIONDIR}/drmsparams.h, then the script below will make links from
332 # JSOC/base/include/serverdefs.h and JSOC/include/serverdefs.h to JSOC/base/drms/apps/serverdefs.h, which then links to ${LOCALIZATIONDIR}/drmsparams.h.
333 if (!(-l base/drms/apps/serverdefs.h)) then
334 cd base/drms/apps
335 ln -s ../../../${RELLOCALIZATIONDIR}/drmsparams.h serverdefs.h
336 if ($? != 0) then
337 echo "Failure creating link to "
338 exit 1
339 endif
340 cd ../../..
341 endif
342
343 if (!(-l base/include/localization.h)) then
344 cd base/include
345 ln -s ../../${RELLOCALIZATIONDIR}/drmsparams.h localization.h
346 cd ../..
347 endif
348
349 if ($CLEAN == "yes") then
350 cd base/include
351 find .. -path '../include' -prune -o -name \*.h -print | ${PERLBIN} -MFile::Basename -n -e 'my($bn) = basename($_); chomp($bn); my($path) = $_; chomp($path); if (!(-e $bn)) { `ln -s $_`; if ($? >> 8 == 0) { print " " . $path . " OK\n"; } else { print " " . $path . " ERROR - could not create link\n"; } }'
352 cd ../..
353
354 cd include
355 if (-d ../base/include) then
356 find ../base/include -name \*.h -print | ${PERLBIN} -MFile::Basename -n -e 'my($bn) = basename($_); chomp($bn); my($path) = $_; chomp($path); if (!(-e $bn)) { `ln -s $_`; if ($? >> 8 == 0) { print " " . $path . " OK\n"; } else { print " " . $path . " ERROR - could not create link\n"; } }'
357 endif
358 cd ..
359 endif
360
361 cd include
362 # ${LOCALIZATIONDIR} is an absolute path
363 if (!(-l drmsparams.h)) then
364 ln -s ../${RELLOCALIZATIONDIR}/drmsparams.h
365 endif
366 if (!(-l drmsparams.pm)) then
367 ln -s ../${RELLOCALIZATIONDIR}/drmsparams.pm
368 endif
369 if (!(-l drmsparams.py)) then
370 ln -s ../${RELLOCALIZATIONDIR}/drmsparams.py
371 endif
372
373 cd ..
374 echo "done"
375 echo