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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
|
$NetBSD: patch-aa,v 1.7 2015/10/17 22:34:21 dholland Exp $
csh programming considered harmful.
note that this is now a sh script, but I can't patch the #! line
because there's an rcsid in the way.
--- makeall.orig 2003-12-14 17:24:09.000000000 +0000
+++ makeall
@@ -3,27 +3,27 @@
#
# Make all the Radiance programs
#
-if ( $#argv < 1 ) then
+if [ $# -lt 1 ]; then
echo "Usage: makeall install [clean] [make options]"
echo " or: makeall clean"
echo " or: makeall library"
exit 1
-endif
-if ( "$1" == library ) then
- source installib
+fi
+if [ x"$1" = xlibrary ]; then
+ . ./installib
cp -f src/*/*.{cal,tab,hex} $ldir
echo ""
echo "Set the environment variable RAYPATH=.:$ldir"
echo 'For C-shell users, put the following into ~/.cshrc'
echo " setenv RAYPATH .:$ldir"
- echo 'For Bourne shell users, put the following into $HOME/profile'
+ echo 'For Bourne shell users, put the following into $HOME/.profile'
echo " RAYPATH=.:$ldir"
echo " export RAYPATH"
echo ""
exit 0
-endif
-set srcdirs=( common meta cv gen ot rt px hd util cal )
-if ( "$1" == install ) then
+fi
+srcdirs='common meta cv gen ot rt px hd util cal'
+if [ x"$1" = xinstall ]; then
cat << _EOF_
`cat src/rt/VERSION` INSTALLATION
@@ -35,183 +35,167 @@ this script. You can type ^C (followed
You must first answer the following questions.
_EOF_
-if ( ! $?EDITOR ) then
- echo -n "What is your preferred editor [vi]? "
- set ans="$<"
- if ( "$ans" != "" ) then
- setenv EDITOR "$ans"
- else
- setenv EDITOR vi
- endif
-endif
-again1:
-echo -n "Where do you want the executables [/usr/local/bin]? "
-set idir=$<
-(echo $idir) >/dev/null
-if ( $status ) then
- goto again1
-endif
-set idir=$idir
-if ( "$idir" == "" ) then
- set idir=/usr/local/bin
-else if ( "$idir" !~ /* ) then
- echo "Directory must be relative to root, please reenter"
- goto again1
-endif
-if ( ! -d $idir ) then
- mkdir $idir
- if ( $status ) then
+if [ x"$EDITOR" = x ]; then
+ EDITOR=vi
+ export EDITOR
+fi
+
+idir=@WRKSRC@/radiance/bin
+#(echo $idir) >/dev/null
+#if ( $status ) then
+# continue
+#endif
+#set idir=$idir
+#if ( "$idir" == "" ) then
+# set idir=/usr/local/bin
+#endif
+if [ ! -d "$idir" ]; then
+ mkdir -p "$idir"
+ if [ $? != 0 ]; then
echo "Cannot create directory, please reenter"
- goto again1
- endif
-endif
-if ( ! -d $idir/dev ) then
- mkdir $idir/dev
- if ( $status ) then
+ exit 1
+ fi
+fi
+if [ ! -d "$idir/../dev" ]; then
+ mkdir -p "$idir/../dev"
+ if [ $? != 0 ]; then
echo "Cannot create subdirectory, please reenter"
- goto again1
- endif
-endif
-set inpath=0
-foreach i ( $path )
- if ( "$i" == "$idir" ) then
- set inpath=1
+ exit 1
+ fi
+fi
+inpath=0
+for i in $(echo $PATH | tr ':' ' '); do
+ if [ "$i" = "$idir" ]; then
+ inpath=1
break
- endif
-end
-set rmake=$idir/rmake
-if ( "`ls -tL $rmake $0 |& head -1`" == $rmake ) then
- goto gotrmake
-endif
-set newrmake
-more src/common/copyright.h
-echo -n "Do you understand and accept the terms of this agreement [n]? "
-set ans="$<"
-if ( "$ans" !~ [yY]* ) exit
-set special=
-set arch=
-set opt=
-set mach=
-set compat=
-set extras=
-set esuffix=
-cat << _EOF_
-
-Please select your system type from the following list:
-
- 1) Sun Solaris
- 2) HP workstation
- 3) Silicon Graphics
- 4) AIX (RS/6000)
- 5) BSDI BSD/386
- 6) Linux
- 7) MacOS X
- 8) FreeBSD
- 9) Cygwin
- 10) Other
-
-_EOF_
-echo -n "Choice? "
-set arch="$<"
-switch ("$arch")
-case 1: # SPARC Station
- set arch=sun
- set mach="-I/usr/openwin/include -L/usr/openwin/lib -DNOSTEREO"
- set opt="-O -DSPEED=80"
- set compat="bmalloc.o strcmp.o getpagesize.o"
- breaksw
-case 2: # HP workstation
- set mach=""
- set opt="-O -DSPEED=80 -Aa -D_HPUX_SOURCE"
- set compat="bmalloc.o getpagesize.o strcmp.o"
- set arch=hpux
- breaksw
-case 3: # Silicon Graphics
- set arch=sgi
- switch (`uname -r`)
- case 3.*:
- set mach="-noprototypes"
- set opt="-O -DSPEED=80"
- set special="sgi"
- set compat="malloc.o strcmp.o"
- breaksw
- case 4.*:
- set mach=""
- set opt="-O2 -DSPEED=100"
- set compat="malloc.o strcmp.o"
- set extras='"MLIB=-lfastm -lm"'
- breaksw
- default: # 5.x or later
+ fi
+done
+rmake=$idir/rmake
+#rmake2=`ls -tL $rmake $0 2>&1 | head -1`
+if [ ! -f "$rmake" -o "$0" -nt "$rmake" ]; then
+
+newrmake=
+special=
+arch=
+opt=
+mach=
+compat=
+extras=
+esuffix=
+arch=@PKGSRC_ARCH@
+case "$arch" in
+ 1) # SPARC Station
+ arch=sun
+ mach="-I/usr/openwin/include -L/usr/openwin/lib -DNOSTEREO"
+ opt="-O -DSPEED=80"
+ compat="bmalloc.o strcmp.o getpagesize.o"
+ ;;
+ 2) # HP workstation
+ mach=""
+ opt="-O -DSPEED=80 -Aa -D_HPUX_SOURCE"
+ compat="bmalloc.o getpagesize.o strcmp.o"
+ arch=hpux
+ ;;
+ 3) # Silicon Graphics
+ arch=sgi
+ case `uname -r` in
+ 3.*)
+ mach="-noprototypes"
+ opt="-O -DSPEED=80"
+ special="sgi"
+ compat="malloc.o strcmp.o"
+ ;;
+ 4.*)
+ mach=""
+ opt="-O2 -DSPEED=100"
+ compat="malloc.o strcmp.o"
+ extras='"MLIB=-lfastm -lm"'
+ ;;
+ *) # 5.x or later
ln -s `which wish` $idir/wish4.0
- set path=($idir $path)
- set mach="-w"
- set opt="-O2 -DSPEED=200"
- set special="ogl"
- set compat="bmalloc.o strcmp.o"
- breaksw
- endsw
- breaksw
-case 4: # AIX
- set opt="-O"
- set compat="bmalloc.o erf.o strcmp.o"
- set arch=PowerPC
- breaksw
-case 5: # BSDI BSD/386
- set mach="-DBSD -L/usr/X11/lib -I/usr/X11/include"
- set opt="-O -DSPEED=100"
- set arch=IBMPC
- set compat="malloc.o erf.o strcmp.o"
- breaksw
-case 6: # Linux
- set mach="-Dlinux -D_FILE_OFFSET_BITS=64 -L/usr/X11R6/lib -I/usr/include/X11 -DNOSTEREO"
- set opt="-O2 -DSPEED=200"
- set arch=IBMPC
- set compat="bmalloc.o erf.o getpagesize.o"
- set extras=CC=gcc
- breaksw
-case 7: # MacOS X
- set mach="-DBSD -DNOSTEREO -Dfreebsd -I/usr/X11R6/include -L/usr/X11R6/lib"
- set opt="-O2 -DSPEED=200"
- set arch=PowerPC
- set compat="bmalloc.o"
- set extras="CC=cc CONFIGURE_ARCH=powerpc"
- set special="ogl"
- breaksw
-case 8: # FreeBSD
- set mach="-DBSD -DNOSTEREO -Dfreebsd -I/usr/X11R6/include -L/usr/X11R6/lib"
- set opt="-O -DSPEED=200"
- set compat="bmalloc.o erf.o"
- set extras="CC=cc"
- set arch=IBMPC
- breaksw
-case 9: # Cygwin
- set mach="-Dfreebsd -L/usr/lib -L/usr/X11R6/lib -I/usr/include/X11 -I/usr/X11R6/include -DNOSTEREO"
- set opt="-O2 -DSPEED=200"
- set arch=IBMPC
- set compat="bmalloc.o erf.o getpagesize.o"
- set extras="CC=gcc"
- set special="ogl"
- set esuffix=".exe"
- breaksw
-case 10: # Other
- set opt="-O"
- set compat="bmalloc.o erf.o strcmp.o"
+ PATH="${idir}:$PATH"
+ mach="-w"
+ opt="-O2 -DSPEED=200"
+ special="ogl"
+ compat="bmalloc.o strcmp.o"
+ ;;
+ esac
+ ;;
+ 4) # AIX
+ opt="-O"
+ compat="bmalloc.o erf.o strcmp.o"
+ arch=PowerPC
+ ;;
+ 5) # BSDI BSD/386
+ mach="-DBSD -L/usr/X11/lib -I/usr/X11/include"
+ opt="-O -DSPEED=100"
+ arch=IBMPC
+ compat="malloc.o erf.o strcmp.o"
+ ;;
+ 6) # Linux
+ mach="-Dlinux -D_FILE_OFFSET_BITS=64 -L${X11BASE}/lib -I${X11BASE}/include -DNOSTEREO"
+ opt="-O2 -DSPEED=200"
+ arch=IBMPC
+ compat="bmalloc.o erf.o getpagesize.o"
+ extras=CC=gcc
+ ;;
+ 7) # MacOS X
+ mach="-DBSD -DNOSTEREO -Dfreebsd -I${X11BASE}/include -L${X11BASE}/lib"
+ opt="-O2 -DSPEED=200"
+ arch=PowerPC
+ compat="bmalloc.o"
+ extras="CC=cc CONFIGURE_ARCH=powerpc"
+ special="ogl"
+ ;;
+ 8) # FreeBSD
+ mach="-DBSD -DNOSTEREO -Dfreebsd -I${X11BASE}/include -L${X11BASE}/lib"
+ opt="-O -DSPEED=200"
+ compat="bmalloc.o erf.o"
+ arch=IBMPC
+ ;;
+ 9) # NetBSD
+ mach="-DBSD -DNOSTEREO -Dnetbsd -I${X11BASE}/include -L${X11BASE}/lib"
+ opt="-O -DSPEED=200"
+ compat="bmalloc.o erf.o"
+ arch=IBMPC
+ ;;
+ 10) # Cygwin
+ mach="-Dfreebsd -L/usr/lib -L${X11BASE} -I${X11BASE}/include -DNOSTEREO"
+ opt="-O2 -DSPEED=200"
+ arch=IBMPC
+ compat="bmalloc.o erf.o getpagesize.o"
+ extras="CC=gcc"
+ special="ogl"
+ esuffix=".exe"
+ ;;
+ 11) # Other
+ opt="-O"
+ compat="bmalloc.o erf.o strcmp.o"
+ # XXX
echo -n "Are you using the GNU C compiler [n]? "
- if ( "$<" =~ [yY]* ) then
- set extras="CC=gcc"
- endif
- set arch=other
- breaksw
-default:
- echo "Illegal choice\!"
+ read FOO
+ case "$FOO" in
+ y*|Y*) extras="CC=gcc";;
+ esac
+ arch=other
+ ;;
+ 12) # DragonFly
+ mach="-DBSD -DNOSTEREO -Ddragonfly -I${X11BASE}/include -L${X11BASE}/lib"
+ opt="-O -DSPEED=200"
+ compat="bmalloc.o erf.o"
+ arch=IBMPC
+ ;;
+ *)
+ echo "Illegal architecture choice\!"
echo "Installation aborted."
+ echo "(You must set PKGSRC_ARCH in the pkgsrc makefile.)"
exit 1
- breaksw
-endsw
-source installib
+ ;;
+esac
+. ./installib
sed 's/[ ]*$//' > $rmake << _EOF_
#!/bin/sh
-exec make "SPECIAL=$special" \
+exec @MAKE@ "SPECIAL=$special" \
"OPT=$opt" \
"MACH=$mach" \
ARCH=$arch "COMPAT=$compat" \
@@ -222,71 +206,47 @@ exec make "SPECIAL=$special" \
_EOF_
chmod 755 $rmake
chmod 644 src/*/Rmakefile src/rt/devtable.c
-gotrmake:
+
+# matches [ "$0" -nt "$rmake" ] above
+fi
+
echo "Current rmake command is:"
cat $rmake
-echo -n "Do you want to change it? "
-set ans="$<"
-if ( "$ans" =~ [yY]* ) then
- cp $rmake /tmp/rmake$$
- $EDITOR $rmake
- if ( `cat $rmake /tmp/rmake$$ | grep OPT= | uniq | wc -l` == 2 ) set newrmake
- rm -f /tmp/rmake$$
-endif
-if ( ! -d src/lib ) then
+if [ ! -d src/lib ]; then
mkdir src/lib
-endif
-if ( $?newrmake ) then
- echo 'New rmake command -- running "makeall clean"...'
- csh -f $0 clean
-endif
+fi
cd src
echo "Making programs..."
-set errs=0
-foreach i ( $srcdirs )
- pushd $i
+errs=0
+for i in $srcdirs; do
+ (
+ cd $i
echo "In directory $i..."
- $rmake -k $*
- @ errs += $status
- popd
-end
-if ( $errs ) then
- echo "There were some errors."
-else
- echo "Done."
-endif
+ $rmake $* || exit 1
+ ) || exit 1
+done
+echo "Done."
cd ..
-if (! $inpath ) then
- echo ""
- echo "Add $idir to the beginning of your execution path:"
- echo 'For C-shell users, put the following into ~/.cshrc'
- echo " set path=( $idir "'$path )'
- echo 'For Bourne shell users, put the following into $HOME/profile'
- echo " PATH=$idir"':$PATH'
- echo " export PATH"
-endif
-if (! -d /usr/tmp) then
- ln -s /tmp /usr/tmp
- if ($status) then
- echo ""
- echo "IMPORTANT: Execute 'sudo ln -s /tmp /usr/tmp'"
- endif
-endif
-else
+
+else # [ $1 = install ]
+
cd src
-foreach i ( $srcdirs )
- pushd $i
+for i in $srcdirs; do
+ (
+ cd $i
echo "In directory $i..."
- make -f Rmakefile $*
- popd
-end
+ make -f Rmakefile $* || exit 1
+ ) || exit 1
+done
cd ..
-foreach i ( $* )
- if ( "$i" == clean ) then
+for i in "$@"; do
+ if [ x"$i" = xclean ]; then
echo "Removing library archives..."
rm -f src/lib/*.[ao]
- endif
-end
+ fi
+done
echo "Done."
-endif
+
+fi # [ $1 = install ]
+
exit 0
|