-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpgplot.install
executable file
·245 lines (207 loc) · 6.47 KB
/
pgplot.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
#! /bin/csh -f
#
# Install PGPLOT from dir=$NEMO/local/pgplot into lib=$NEMOLIB
#
# NOTE: Although meant for ease of install within $NEMO, you
# may also find this file within the WIP distribution.
# The master version should however stay within NEMO
#
#
# 3-apr-01 allowed final directory also to be configurable
# and some NEMO V3 support added
# 9-apr-01 added support if file= is given to directly specify pgplot tar ball
# 11-jun-01 for new pgplot file name convention (520, 521, 522....)
# 11-jan-02 also allow pgplot directory in $NEMO/local/pgplot
# 9-apr-02 fixed caltech links
# 5-dec-02 added tcl/tk driver for carma
# 29-jun-03 added darwin (tested w/ MacOSX 10.2)
# 23-jan-04 fixed linux when CC and F77 present (e.g. intel compiler)
# 27-mar-04 force rebuilding some executables upon reload (+typo fix)
# 28-jun-04 debug option
# 20-may-05 make script more generic, less dependant on NEMO, and distribute with WIP
# 10-jul-05 removed the always problematic never used TKDRIV driver
# 16-jul-05 removed pp,gi,wd from drivers for gfortran
# 5-dec-05 abuse the new 4th (optional) argument to makemake
# Other places to get pgplot from
# cvs -d :pserver:[email protected]:/cvs co thirdparty/caltech/pgplot
# ftp://ftp.astro.caltech.edu/pub/pgplot/pgplot522.tar.gz (or whichever version)
# Example standalone WIP install outside of MIRIAD or NEMO
# ------------------------------------------------------------------------------------------
# cvs co wip
# cvs co pgplot
# set w=`pwd`
# wip/pgplot.install dir=$w lib=$w/lib host=linux
# rm lib/libpgplot.so
# cd wip
# ./makewip -pgplot $w/lib -wip $w/wip -bin $w/lib -xlib /usr/X11R6/lib -readline "" -wiphelp $w/lib
# (bug: wiphelp is kept in wip directory, not in lib)
# ------------------------------------------------------------------------------------------
# TODO:
# $F77 and $CC should be obtained from NEMO's configure process
#
# .. command line keywords that can be modifid ..
set version=522
set ftp=ftp.astro.caltech.edu
if ($?NEMO) then
set dir=$NEMO/local
endif
if ($?NEMOLIB) then
set lib=$NEMOLIB
endif
set drivers=CGDRIV,GIDRIV,NUDRIV,PGDRIV,PPDRIV,PSDRIV,WDDRIV,XWDRIV
set drivers_gfortran=CGDRIV,NUDRIV,PGDRIV,PSDRIV,XWDRIV
set drivers_g95=CGDRIV,NUDRIV,PGDRIV,PPDRIV,PSDRIV,XWDRIV
if ($?NEMOHOST) then
set host=$NEMOHOST
endif
set debug=0
# dir: where the source code will be extracted
# lib: where the library (PGPLOT_DIR) will be placed
# .. parse command line ..
foreach arg ($*)
set check = `echo $argv[1] | awk -F= '{print NF}'`
if ("$check" == 1) break
echo Setting: $arg
set $arg
end
# basic check of the command line arguments
if ($?dir == 0) goto usage
if ($?lib == 0) goto usage
if ($?host == 0) goto usage
if (! -e $lib) mkdir $lib
if ($status) goto usage
# override the compiler default, but both 'f77' and 'cc' need to be set
if ($?f77 && $?cc) then
setenv F77 $f77
setenv CC $cc
endif
# handle new 4th and up arguments to makemake, quite an ugly hack....
set new4=()
if ($?F77) then
set base=(ifc ifort g77 g95 gfortran)
foreach b ($base)
echo $F77 | grep -q $b
if ($status == 0) then
set new4=($new4 $b=$F77)
setenv F77 $b
break
endif
end
endif
if ($?CC) then
set base=(gcc icc)
foreach b ($base)
echo $CC | grep -q $b
if ($status == 0) then
set new4=($new4 $b=$CC)
setenv CC $b
break
endif
end
endif
if ($?new4) then
echo Note: using new4: $new4
endif
cd $dir
if (-d pgplot) then
echo Assuming your $dir/pgplot is current
else
if ($?file == 0) set file=$dir/pgplot${version}.tar.gz
if (! -e $file) then
echo No file $file, you need to pick it up, e.g.
echo ncftp ftp://ftp.astro.caltech.edu/pub/pgplot/pgplot${version}.tar.gz
echo Or use the slightly improved MIRIAD cvs version
exit 1
else
echo Found $file
endif
gunzip -dc $file | tar xf -
endif
cd pgplot
cp drivers.list $lib
cd $lib
cp drivers.list new.list
cp drivers.list old.list
if ($?F77) then
if ($F77 == gfortran) then
echo NOTE: SPECIAL lightweight pgplot for stricter gfortran
set drivers=$drivers_gfortran
endif
if ($F77 == g95) then
echo NOTE: SPECIAL lightweight pgplot for stricter g95
set drivers=$drivers_g95
endif
endif
echo Building drivers for $drivers
foreach d (`echo $drivers | sed 's/,/ /g'`)
sed 's/\! '$d/$d/g < old.list > new.list
cp new.list old.list
end
mv new.list drivers.list
rm old.list
echo Renaming old X server to force it to rebuild
if (-e pgxwin_server) mv pgxwin_server pgxwin_server.old
switch ($host)
case *darwin*:
$dir/pgplot/makemake $dir/pgplot darwin g77_gcc
breaksw
case SunOS:
case solaris*:
case sparc*:
case sun5:
if ($?CC && $?F77) then
echo ${F77}_${CC}
$dir/pgplot/makemake $dir/pgplot sol2 ${F77}_${CC} $new4
else
$dir/pgplot/makemake $dir/pgplot sol2 f77_cc $new4
endif
breaksw
case Linux:
case linux:
case *linux-gnu:
if (-e /usr/X11R6/lib64) then
echo Warning: found /usr/X11R6/lib64
set new4=($new4 /X11R6/lib=/X11R6/lib64)
endif
if ($?CC && $?F77) then
$dir/pgplot/makemake $dir/pgplot linux ${F77}_${CC} $new4
else
$dir/pgplot/makemake $dir/pgplot linux g77_gcc $new4
endif
if (! -e /usr/X11) then
echo You may need to patch your Linux distribution:
echo ln -s /usr/X11R6 /usr/X11
endif
breaksw
case sgi:
$dir/pgplot/makemake $dir/pgplot irix
breaksw
default:
if (-d $dir/sys_$host) then
$dir/pgplot/makemake $dir/pgplot $host
breaksw
else
echo host=$host not supported yet
exit 1
endif
endsw
make -i
make -i cpg
if ($debug == 0) then
make -i clean
\rm -fr pgdemo*
endif
# may also need to change LD_LIBRARY_PATH with $NEMOLIB
# set PGPLOT_DIR to $NEMOLIB
exit 0
usage:
echo "The most common non-NEMO usage will be:"
echo "get a pgplot directory in your current directory"
echo "and use/override any of the following commandline parameters:"
echo " drivers=$drivers"
echo " dir=`pwd` directory within which pgplot/ resides"
echo " lib=`pwd`/lib directory where PGPLOT_DIR will be"
echo " host=`uname -s` host type (examples are in pgplot/sys_*)"
echo " debug=0 clean demo example from lib"
echo " cc=gcc changed a (supperted) C compiler for this system"
echo " f77=g77 changed a (supperted) Fortran compiler for this system"