Subversion Repositories lagranto.icon

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 michaesp 1
#!/bin/csh
2
 
3
# -----------------------------------------------------------------------------
4
# Set some general parameters
5
# -----------------------------------------------------------------------------
6
 
7
# Usage
8
if ( $#argv == 0 ) then
9
  echo "install.sh [lib|core|goodies|links|all|docu|clean|tag"
10
  exit 0
11
endif
12
 
13
# Set the mode
14
set mode = $1
15
 
16
# Set path to SVN repository
17
set svnpath=https://svn.iac.ethz.ch/pub/lagranto.icon/
18
 
19
# Set path for development
20
set path_devel = "${DYN_TOOLS}/lagranto.icon/"
21
set path_sync  = "${DYN_TOOLS}/lagranto/"
22
 
23
# Init Fortran compiler and set netCDF acccordingly
24
setenv FORTRAN pgf90
25
 
26
# Init netCDF library depending on the Fortran compiler
27
if ( "${FORTRAN}" == "pgf90" ) then
28
  module purge
29
  module load dyn_tools
30
  # module load netcdf/4.3.2-pgf90
31
  module list 
32
 
33
else if ( "${FORTRAN}" == "gfortran" ) then
34
  module purge
35
  module load gfortran
36
  module load netcdf/4.1.1
37
 
38
else if ( "${FORTRAN}" == "ifort" ) then
39
  module purge
40
  module load ifort/10.1.017
41
  module load netcdf/4.1.1-ifort
42
 
43
else
44
  echo "Fortran Compiler ${FORTRAN} not supported... Exit"
45
  exit 1
46
 
47
endif
48
 
49
# Set Lagranto path
50
setenv LAGRANTO ${path_devel}
51
 
52
# -----------------------------------------------------------------------------
53
# Create a new tag in SVN repository
54
# -----------------------------------------------------------------------------
55
 
56
if ( "${mode}" == "tag" ) then
57
   svn info
58
   if ( "${#argv}" != 2 ) then
59
     echo "Usage: install.csh tag id <id=tag number>"
60
   else
61
     set tagnr = $2
62
   endif
63
   svn copy ${svnpath}/trunk ${svnpath}/tags/${tagnr} -m "Release ${tagnr}"
64
   exit 0
65
endif
66
 
67
# -----------------------------------------------------------------------------
68
# Set internal parameters and detailed installation mode
69
# -----------------------------------------------------------------------------
70
 
71
# Set netCDF paths
72
setenv NETCDF_LIB `nc-config --flibs`
73
setenv NETCDF_INC `nc-config --fflags`
74
 
75
# Set list of core programs
76
set core  = "create_startf caltra trace select density lidar" 
77
 
78
# Set list of goodies
79
set tools = "extract gettidiff getvars list2lsl lsl2list mergetra newtime reformat timeres trainfo difference datelist tracal" 
80
 
81
# Set list of libraries
82
set libs  = "iotra ioinp inter times rotate"
83
 
84
# Core programs
85
foreach prog ( $core )
86
   if ( "${prog}" == "${mode}" ) then
87
      set core  = ${prog}
88
      set mode  = "core"
89
   endif
90
end
91
 
92
# Goodies
93
foreach tool ( $tools )
94
   if ( "${tool}" == "${mode}" ) then
95
      set tools = ${tool}
96
      set mode  = "goodies"
97
   endif
98
end
99
 
100
# Libraries
101
foreach lib ( $libs )
102
   if ( "${lib}" == "${mode}" ) then
103
      set libs  = ${lib}
104
      set mode  = "lib"
105
   endif
106
end
107
 
108
# Check that the mode is ok 
109
if ( "${mode}" == "all"     ) goto modeok
110
if ( "${mode}" == "lib"     ) goto modeok
111
if ( "${mode}" == "core"    ) goto modeok
112
if ( "${mode}" == "goodies" ) goto modeok
113
if ( "${mode}" == "links"   ) goto modeok
114
if ( "${mode}" == "clean"   ) goto modeok
115
if ( "${mode}" == "docu"    ) goto modeok
116
if ( "${mode}" == "sync"    ) goto modeok
117
echo "Unsupported mode ${mode} ... Stop"
118
exit 1
119
 
120
modeok:
121
 
122
# -----------------------------------------------------------------------------
123
# Make clean 
124
# -----------------------------------------------------------------------------
125
 
126
if ( "${mode}" == "clean" ) then
127
 
128
cd ${LAGRANTO}/
129
 
130
foreach prog ( $core )
131
   \rm -f ${prog}/${prog} ${prog}/${prog}.o
132
end
133
\rm -f trace/calvar.o select/special.o
134
 
135
foreach tool ( $tools )
136
  \rm -f goodies/${tool} goodies/${tool}.o 
137
end
138
\rm -f goodies/*.mod goodies/*.o
139
 
140
\rm lib/*.a lib/*.o
141
 
142
foreach prog ( $core )
143
   \rm -f bin/${prog} bin/${prog}.sh  bin/${prog}.icon
144
end
145
\rm -f bin/seltra bin/seltra.sh bin/seltra.icon
146
foreach tool ( $tools )
147
  \rm -f bin/${tool} bin/${tool}.sh bin/${tool}.icon
148
end
149
\rm -f bin/lagrantohelp.sh bin/lagrantohelp.icon
150
\rm -f bin/startf bin/startf.sh bin/startf.icon
151
\rm -f bin/lagranto.sh bin/lagranto.icon
152
 
153
\rm ${LAGRANTO}/startf
154
 
155
exit 0
156
 
157
endif
158
 
159
# -----------------------------------------------------------------------------
160
# Install reference 
161
# -----------------------------------------------------------------------------
162
 
163
if ( ("${mode}" == "docu") | ("${mode}" == "all" ) ) then
164
 
165
echo "-----------------------------------------------------------------"
166
echo "Installing documentation"
167
echo "-----------------------------------------------------------------"
168
echo
169
 
170
cd ${LAGRANTO}/docu/reference/
171
 
172
\rm -f reference.ps
173
\rm -f reference2.ps
174
groff -man ../man/*.0 > reference2.ps
175
ps2pdf reference2.ps
176
 
177
latex title
178
dvips title
179
ps2pdf title.ps
180
 
181
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=reference.pdf title.pdf reference2.pdf
182
 
183
\rm -f *.aux *.log *.dvi
184
\rm -f title.ps  reference2.ps
185
\rm -f title.pdf reference2.pdf
186
 
187
endif
188
 
189
if ( "${mode}" == "docu" ) exit 0
190
 
191
# -----------------------------------------------------------------------------
192
# Install libraries 
193
# -----------------------------------------------------------------------------
194
 
195
if ( ("${mode}" == "lib") | ("${mode}" == "all" ) ) then
196
 
197
echo "-----------------------------------------------------------------"
198
echo "Installing libraries"
199
echo "-----------------------------------------------------------------"
200
echo
201
 
202
# Change to library directory
203
cd ${LAGRANTO}/lib
204
 
205
# Loop over all libraries - compile and make library
206
foreach lib ( $libs )
207
 
208
\rm -f ${lib}.a
209
\rm -f ${lib}.o
210
if ( -f ${lib}.f ) then
211
  echo ${FORTRAN} -c -O ${lib}.f
212
  ${FORTRAN} -c -O ${NETCDF_INC} ${lib}.f
213
endif
214
if ( -f ${lib}.f90 ) then
215
  echo ${FORTRAN} -c -O ${lib}.f90
216
  ${FORTRAN} -c -O ${NETCDF_INC} ${lib}.f90
217
endif
218
ar r ${lib}.a ${lib}.o
219
\rm -f ${lib}.l ${lib}.o
220
ranlib ${lib}.a
221
if ( ! -f ${lib}.a ) then
222
  echo "Problem in compiling ${lib} ... Stop"
223
  exit 1
224
endif
225
 
226
end
227
 
228
endif
229
 
230
if ( "${mode}" == "lib" ) exit 0
231
 
232
# -----------------------------------------------------------------------------
233
# Check that libraries are ok
234
# -----------------------------------------------------------------------------
235
 
236
echo
237
echo "-----------------------------------------------------------------"
238
echo "Check that all libraries are available"
239
echo "-----------------------------------------------------------------"
240
echo
241
 
242
# Change to library directory
243
cd ${LAGRANTO}/lib
244
 
245
# Check whether all libraries are available
246
foreach lib ( $libs )
247
 
248
if ( ! -f ${lib}.a ) then
249
  echo "Library ${lib} missing... Stop"
250
  exit 1
251
else
252
  ls -l ${lib}.a    
253
endif
254
 
255
end
256
 
257
# Exit if only libraries shoudl be installed
258
if ( "${mode}" == "lib" ) exit 0
259
 
260
# -----------------------------------------------------------------------------
261
# Compile Lagrango core programs
262
# -----------------------------------------------------------------------------
263
 
264
if ( ("${mode}" == "all" ) | ("${mode}" == "core" ) ) then
265
 
266
echo
267
echo "-----------------------------------------------------------------"
268
echo "Installing Lagranto core programs"
269
echo "-----------------------------------------------------------------"
270
 
271
foreach prog ( $core )
272
 
273
echo
274
echo "----- $prog"
275
echo
276
cd ${LAGRANTO}/${prog}
277
\rm -f ${prog}.o 
278
\rm -f ${prog}
279
if ( "${prog}" == "trace"  ) \rm calvar.o
280
 
281
if ( -f ${prog}.make ) then
282
   make -f ${prog}.make
283
else if ( -f ${prog}.install ) then
284
   ./${prog}.install
285
endif
286
 
287
if ( ! -f ${prog} ) then
288
  echo "Problem in compiling ${prog} ... Stop"
289
  exit 1
290
endif
291
 
292
end
293
 
294
endif
295
 
296
if ( "${mode}" == "core" ) exit 0
297
 
298
# -----------------------------------------------------------------------------
299
# Check that all Lagranto core programs are available
300
# -----------------------------------------------------------------------------
301
 
302
echo
303
echo "-----------------------------------------------------------------"
304
echo "Check that all Lagranto core programs are available"
305
echo "-----------------------------------------------------------------"
306
echo
307
 
308
foreach prog ( $core )
309
 
310
  cd ${LAGRANTO}/${prog}
311
  if ( ! -f ${prog} ) then
312
    echo "${prog} is missing... Stop"
313
    exit 1
314
  else
315
    ls -l ${prog}    
316
  endif
317
 
318
end
319
 
320
# Exit if only core programs shoudl be installed
321
if ( "${mode}" == "core" ) exit 0
322
 
323
# -----------------------------------------------------------------------------
324
# Compile Lagrango goodies
325
# -----------------------------------------------------------------------------
326
 
327
if ( ("${mode}" == "all" ) | ("${mode}" == "goodies" ) ) then
328
 
329
echo
330
echo "-----------------------------------------------------------------"
331
echo "Installing Lagranto goodies"
332
echo "-----------------------------------------------------------------"
333
 
334
cd ${LAGRANTO}/goodies
335
 
336
foreach tool ( $tools )
337
 
338
echo
339
echo "----- ${tool}"
340
echo
341
\rm -f ${tool}.o
342
\rm -f ${tool}
343
 
344
if ( -f ${tool}.make ) then
345
   make -f ${tool}.make
346
else if ( -f ${tool}.install ) then
347
   ./${tool}.install
348
endif
349
 
350
if ( ! -f ${tool} ) then
351
  echo "Problem in compiling ${tool} ... Stop"
352
  exit 1
353
endif
354
 
355
end
356
 
357
endif
358
 
359
if ( "${mode}" == "goodies" ) exit 0
360
 
361
# -----------------------------------------------------------------------------
362
# Check that all Lagranto goodies are available
363
# -----------------------------------------------------------------------------
364
 
365
echo
366
echo "-----------------------------------------------------------------"
367
echo "Check that all Lagranto goodies are available"
368
echo "-----------------------------------------------------------------"
369
echo
370
 
371
cd ${LAGRANTO}/goodies
372
 
373
foreach tool ( $tools )
374
 
375
if ( ! -f ${tool} ) then
376
  echo "${tool} is missing... Stop"
377
  exit 1
378
else
379
  ls -l ${tool} 
380
endif
381
 
382
end
383
 
384
endif
385
 
386
# Exit if only goodies should be installed
387
if ( "${mode}" == "goodies" ) exit 0
388
 
389
# -----------------------------------------------------------------------------
390
# Create links to programs
391
# -----------------------------------------------------------------------------
392
 
393
if ( ("${mode}" == "all" ) | ("${mode}" == "links" )  ) then
394
 
395
echo
396
echo "-----------------------------------------------------------------"
397
echo "Create links in ${LAGRANTO}/bin/"
398
echo "-----------------------------------------------------------------"
399
echo
400
 
401
cd ${LAGRANTO}/bin
402
 
403
ln -svf ${LAGRANTO}/bin/lagranto                   lagranto.icon 
404
ln -svf ${LAGRANTO}/bin/lagrantohelp               lagrantohelp.icon
405
ln -svf ${LAGRANTO}/caltra/caltra.sh               caltra.icon
406
ln -svf ${LAGRANTO}/create_startf/create_startf.sh create_startf.icon
407
ln -svf ${LAGRANTO}/select/select.sh               select.icon
408
ln -svf ${LAGRANTO}/select/select.sh               seltra.icon
409
ln -svf ${LAGRANTO}/trace/trace.sh                 trace.icon
410
ln -svf ${LAGRANTO}/density/density.sh             density.icon
411
ln -svf ${LAGRANTO}/create_startf/create_startf.sh startf.icon
412
ln -svf ${LAGRANTO}/lidar/lidar.sh                 lidar.icon
413
 
414
ln -svf ${LAGRANTO}/bin/lagranto                   lagranto
415
ln -svf ${LAGRANTO}/bin/lagrantohelp               lagrantohelp
416
ln -svf ${LAGRANTO}/caltra/caltra.sh               caltra
417
ln -svf ${LAGRANTO}/create_startf/create_startf.sh create_startf
418
ln -svf ${LAGRANTO}/select/select.sh               select
419
ln -svf ${LAGRANTO}/trace/trace.sh                 trace
420
ln -svf ${LAGRANTO}/density/density.sh             density
421
ln -svf ${LAGRANTO}/create_startf/create_startf.sh startf
422
ln -svf ${LAGRANTO}/lidar/lidar.sh                 lidar
423
 
424
ln -svf ${LAGRANTO}/bin/lagranto                   lagranto.sh
425
ln -svf ${LAGRANTO}/bin/lagrantohelp               lagrantohelp.sh
426
ln -svf ${LAGRANTO}/caltra/caltra.sh               caltra.sh
427
ln -svf ${LAGRANTO}/create_startf/create_startf.sh create_startf.sh
428
ln -svf ${LAGRANTO}/select/select.sh               select.sh
429
ln -svf ${LAGRANTO}/trace/trace.sh                 trace.sh
430
ln -svf ${LAGRANTO}/density/density.sh             density.sh
431
ln -svf ${LAGRANTO}/create_startf/create_startf.sh startf.sh
432
ln -svf ${LAGRANTO}/lidar/lidar.sh                 lidar.sh
433
 
434
foreach tool ( $tools )
435
 
436
ln -svf ${LAGRANTO}/goodies/${tool}.sh     ${tool}
437
ln -svf ${LAGRANTO}/goodies/${tool}.sh     ${tool}.icon
438
ln -svf ${LAGRANTO}/goodies/${tool}.sh     ${tool}.sh
439
 
440
end
441
 
442
# Set extra name for <select> to avoid conflict in BASH
443
ln -svf ${LAGRANTO}/select/select.sh        seltra
444
ln -svf ${LAGRANTO}/select/select.sh        seltra.sh
445
ln -svf ${LAGRANTO}/select/select.sh        seltra.icon
446
 
447
endif
448
 
449
# Set link startf -> create_startf
450
cd ${LAGRANTO}
451
\rm -f startf
452
ln -svf ${LAGRANTO}/create_startf startf
453
 
454
# -----------------------------------------------------------------------------
455
# Synchronise ( development -> operational ) 
456
# -----------------------------------------------------------------------------
457
 
458
if ( ("${mode}" == "all" ) | ("${mode}" == "sync" )  ) then
459
 
460
echo
461
echo "-----------------------------------------------------------------"
462
echo "Sync ( lagranto.icon -> lagranto )"
463
echo "-----------------------------------------------------------------"
464
echo
465
 
466
cd ${path_sync}/bin/
467
 
468
ln -svf ${path_devel}/bin/lagranto.sh            lagranto.icon
469
ln -svf ${path_devel}/bin/lagrantohelp.sh        lagrantohelp.icon
470
 
471
ln -svf ${path_devel}/caltra/caltra.sh           caltra.icon
472
ln -svf ${path_devel}/startf/create_startf.sh    create_startf.icon
473
ln -svf ${path_devel}/select/select.sh           select.icon
474
ln -svf ${path_devel}/trace/trace.sh             trace.icon
475
ln -svf ${path_devel}/density/density.sh         density.icon
476
ln -svf ${path_devel}/startf/create_startf.sh    startf.icon
477
ln -svf ${path_devel}/lidar/lidar.sh             lidar.icon
478
ln -svf ${path_devel}/lidar/seltra.sh            seltra.icon
479
 
480
foreach tool ( $tools )
481
 
482
ln -svf ${path_devel}/goodies/${tool}.sh      ${tool}.icon
483
 
484
end
485
 
486
# Set link startf -> create_startf
487
cd ${LAGRANTO}
488
\rm -f startf
489
ln -svf ${LAGRANTO}/create_startf startf
490
 
491
# Set all permissions
492
chmod -R og+rx ${path_sync}/bin/
493
 
494
endif
495
 
496
# -----------------------------------------------------------------------------
497
# Final tasks
498
# -----------------------------------------------------------------------------
499
 
500
echo
501
echo "-----------------------------------------------------------------"
502
echo "Installation complete"
503
echo "-----------------------------------------------------------------"
504
echo
505
echo "Please set the environmental variable LAGRANTO"
506
echo
507
echo "    setenv LAGRANTO ${LAGRANTO}"
508
echo
509
 
510
 
511
 
512
 
513