(file) Return to configure CVS log (file) (dir) Up to [Development] / JSOC

  1 arta  1.1 #! /bin/csh -f
  2           
  3 arta  1.78 # The system configuration for configure script
  4 arta  1.64 set PERLBIN = ""
  5 arta  1.86 set PYBIN = "python3"
  6 arta  1.88 set DRMS_PARAMETERS_PACKAGE = "base/libs/py/drms_parameters"
  7 arta  1.87 set PY_LIBS_DIR = "base/libs/py"
  8 arta  1.64 
  9            if ($PERLBIN == "") then
 10 arta  1.74     if (-x /home/jsoc/bin/linux_x86_64/activeperl) then
 11 arta  1.70         set PERLBIN = "/home/jsoc/bin/linux_x86_64/activeperl"
 12 arta  1.74     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 arta  1.73         set PYBIN = "/home/jsoc/bin/linux_x86_64/activepython"
 20 arta  1.64     else
 21 arta  1.86         set PYBIN = "python3"
 22 arta  1.64     endif
 23            endif
 24            
 25 arta  1.26 # set up $JSOC_MACHINE
 26            set JSOC_MACHINE = `build/jsoc_machine.csh`
 27 arta  1.85 if ($? != 0) then
 28                echo "Unable to determine machine type."
 29                exit 1
 30            endif
 31            
 32 arta  1.26 echo "Machine type is $JSOC_MACHINE"
 33            echo ""
 34 arta  1.24 
 35 arta  1.82 # Clean by default.
 36            set CLEAN = "yes"
 37 arta  1.61 set PROJCONFIG = ""
 38            set CLEANCMD = "d"
 39 arta  1.79 set CFGSERVER = "no"
 40            set CFGSERVERARG = "s"
 41 arta  1.60 set CUSTOMDEFSFILE = ""
 42            
 43 arta  1.64 foreach THEARG ($argv)
 44                set LITERALSTR = '{ my($argin) = "'${THEARG}'"; my($flagout); $flagout = ($argin =~ /^-(.+)/)[0]; print $flagout; }'
 45                set FLAG = `$PERLBIN -e "$LITERALSTR"`
 46 arta  1.85     if ($? != 0) then
 47                    echo "Unable to parse command-line arguments."
 48                    exit 1
 49                endif
 50 arta  1.86 
 51 arta  1.61     if ($FLAG == $CLEANCMD) then
 52 arta  1.82         set CLEAN = "no"
 53 arta  1.79     else if ($FLAG == $CFGSERVERARG) then
 54                    set CFGSERVER = "yes"
 55 arta  1.64     else if (-e $THEARG) then
 56                    set PROJCONFIG = $THEARG
 57 arta  1.1      endif
 58            end
 59            
 60 arta  1.64 # Usage:
 61 arta  1.82 #   configure [ -d ] [ -s ] [ <project config file> ]
 62 arta  1.64 
 63 arta  1.63 # Backward compatibility - remove the links to the old make files in projconf
 64 arta  1.86 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 arta  1.63 endif
 80            
 81 arta  1.82     # Always clean up links to man pages and re-create them.
 82                echo -n "Removing links to man pages..."
 83 arta  1.47     if (-e man) then
 84            	rm -rf man
 85                endif
 86 arta  1.1      echo "done"
 87            
 88 arta  1.82     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 arta  1.73 
 98 arta  1.82         # 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 arta  1.19 
107 arta  1.82         # 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 arta  1.1  
117 arta  1.82         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 arta  1.81         endif
126 arta  1.82         echo "done"
127                # End clean flag
128 arta  1.1      endif
129            
130 arta  1.82     # Always clean-up links to jsds and re-create them.
131 arta  1.1      echo -n "Removing links to jsds..."
132                if (-d jsds) then
133 arta  1.47 	cd jsds
134 arta  1.81         if ($? == 0) then
135                        find . -type l -exec rm {} \;
136                    endif
137 arta  1.47 	cd ..
138 arta  1.1      endif
139                echo "done"
140                echo
141            
142                if ($CLEAN == "yes") then
143 arta  1.84         if (-x base/local/libs/dsds/scripts/rmlinks.csh) then
144                        base/local/libs/dsds/scripts/rmlinks.csh
145                    endif
146 arta  1.1  
147 arta  1.84         if (-x base/local/libs/soi/scripts/rmlinks.csh) then
148                        base/local/libs/soi/scripts/rmlinks.csh
149                    endif
150 arta  1.82     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 arta  1.85         if ($? != 0) then
156 arta  1.86             echo "Unable to make base/include directory."
157                        exit 1
158 arta  1.85         endif
159 arta  1.82     endif
160 arta  1.53 
161 arta  1.82     if (!(-d include)) then
162                    mkdir -p include
163 arta  1.85         if ($? != 0) then
164 arta  1.86             echo "Unable to make include directory."
165                        exit 1
166 arta  1.85         endif
167            
168 arta  1.86 
169 arta  1.82     endif
170 arta  1.53 
171 arta  1.82     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 arta  1.13 	endif
176 arta  1.82     endif
177                echo "done"
178                echo
179 arta  1.86 
180 arta  1.82     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 arta  1.86     # generate links for DSDS/SOI dynamic libraries - only do this if
191 arta  1.82     # 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 arta  1.14 
197 arta  1.82 	if (-x base/local/libs/soi/scripts/genlinks.csh) then
198                 	    base/local/libs/soi/scripts/genlinks.csh
199 arta  1.1  	endif
200 arta  1.82     endif
201 arta  1.53 
202 arta  1.82     echo "done"
203                echo
204 arta  1.57 
205 arta  1.84     #######################
206                ## Site Localization ##
207                #######################
208 arta  1.86 
209 arta  1.82     # 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 arta  1.58 
214 arta  1.82     if (-e $conflocal) then
215                    set RELLOCALIZATIONDIR = `perl -n -e 'if ($_ =~ /^LOCALIZATIONDIR\s+(.+)/) { print $1; }' $conflocal`
216                endif
217 arta  1.57 
218 arta  1.82     if ($LOCALIZATIONDIR == "") then
219                    set RELLOCALIZATIONDIR = localization
220                endif
221 arta  1.57 
222 arta  1.82     # Make the path absoluate
223                set LOCALIZATIONDIR = ${PWD}/${RELLOCALIZATIONDIR}
224 arta  1.75 
225 arta  1.84     # Reset localization.
226                if ($CLEAN == "yes") then
227 arta  1.86         # This script will need to read the config.local file to get the
228 arta  1.84         # 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 arta  1.85                 exit 1
234 arta  1.84             endif
235 arta  1.57         endif
236 arta  1.71 
237 arta  1.84         if (-e ${LOCALIZATIONDIR}/drmsparams.h) then
238                        rm ${LOCALIZATIONDIR}/drmsparams.h
239                    endif
240 arta  1.73 
241 arta  1.84         if (-e ${LOCALIZATIONDIR}/drmsparams.mk) then
242                        rm ${LOCALIZATIONDIR}/drmsparams.mk
243                    endif
244 arta  1.71 
245 arta  1.84         if (-e ${LOCALIZATIONDIR}/drmsparams.pm) then
246                        rm ${LOCALIZATIONDIR}/drmsparams.pm
247                    endif
248 arta  1.57 
249 arta  1.84         if (-e ${LOCALIZATIONDIR}/drmsparams.py) then
250                        rm ${LOCALIZATIONDIR}/drmsparams.py
251                    endif
252 arta  1.81 
253 arta  1.84         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 arta  1.86                 echo
262 arta  1.84                 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 arta  1.61         endif
270 arta  1.86 
271 arta  1.83         # We now call localize.py for both Stanford and NetDRMS builds.
272                    if ($CFGSERVER == "yes") then
273 arta  1.85             set cmd = "$PYBIN ./localize.py -d ${LOCALIZATIONDIR} -b drmsparams -s"
274 arta  1.83         else
275 arta  1.85             set cmd = "$PYBIN ./localize.py -d ${LOCALIZATIONDIR} -b drmsparams"
276                    endif
277 arta  1.86 
278 arta  1.85         $cmd
279                    if ($? != 0) then
280 arta  1.86             echo "Failure running localize.py."
281                        exit 1
282 arta  1.83         endif
283 arta  1.85 
284 arta  1.88         # 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 arta  1.87         endif
289 arta  1.84     endif # End reset localization
290 arta  1.61 
291 arta  1.82     echo "Setting links to scripts..."
292 arta  1.84     if (!(-d scripts)) then
293                    mkdir scripts
294 arta  1.85         if ($? != 0) then
295                        echo "Unable to create scripts directory."
296 arta  1.86             exit 1
297 arta  1.85         endif
298 arta  1.84     endif
299 arta  1.86 
300                if ($CLEAN == "yes") then
301 arta  1.84         cd scripts
302 arta  1.61 
303 arta  1.84         # 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 arta  1.62 
306 arta  1.84         # 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 arta  1.62 
309 arta  1.84         # 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 arta  1.62 
312 arta  1.84         # 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 arta  1.62 
315 arta  1.84         # Project-specific scripts - these won't show up if you don't have the project source.
316                    if (-x ${LOCALIZATIONDIR}/configure) then
317                        ${LOCALIZATIONDIR}/configure
318                    endif
319                    cd ..
320 arta  1.82     endif
321 arta  1.62 
322 arta  1.82     echo "done"
323                echo
324 arta  1.62 
325 arta  1.82     echo "Setting links to headers..."
326 arta  1.53 
327 arta  1.82     # 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 arta  1.86     # 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 arta  1.82     # 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 arta  1.73         cd base/drms/apps
335 arta  1.82         ln -s ../../../${RELLOCALIZATIONDIR}/drmsparams.h serverdefs.h
336 arta  1.85         if ($? != 0) then
337                        echo "Failure creating link to "
338                        exit 1
339                    endif
340 arta  1.73         cd ../../..
341 arta  1.82     endif
342 arta  1.73 
343 arta  1.82     if (!(-l base/include/localization.h)) then
344 arta  1.73         cd base/include
345 arta  1.82         ln -s ../../${RELLOCALIZATIONDIR}/drmsparams.h localization.h
346 arta  1.73         cd ../..
347 arta  1.82     endif
348 arta  1.73 
349 arta  1.86     if ($CLEAN == "yes") then
350 arta  1.84         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 arta  1.82 
354 arta  1.84         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 arta  1.82     endif
360 arta  1.53 
361 arta  1.84     cd include
362 arta  1.82     # ${LOCALIZATIONDIR} is an absolute path
363                if (!(-l drmsparams.h)) then
364 arta  1.81         ln -s ../${RELLOCALIZATIONDIR}/drmsparams.h
365 arta  1.82     endif
366                if (!(-l drmsparams.pm)) then
367 arta  1.81         ln -s ../${RELLOCALIZATIONDIR}/drmsparams.pm
368 arta  1.82     endif
369                if (!(-l drmsparams.py)) then
370 arta  1.81         ln -s ../${RELLOCALIZATIONDIR}/drmsparams.py
371 arta  1.1      endif
372            
373 arta  1.82     cd ..
374                echo "done"
375                echo

Karen Tian
Powered by
ViewCVS 0.9.4