1 |
greg |
1.1 |
#!/bin/csh -f |
2 |
greg |
1.10 |
# RCSid $Id: makeall,v 1.9 2003/08/30 08:22:47 schorsch Exp $ |
3 |
greg |
1.1 |
# |
4 |
|
|
# Make all the Radiance programs |
5 |
|
|
# |
6 |
|
|
if ( $#argv < 1 ) then |
7 |
|
|
echo "Usage: makeall install [clean] [make options]" |
8 |
|
|
echo " or: makeall clean" |
9 |
|
|
echo " or: makeall library" |
10 |
|
|
exit 1 |
11 |
|
|
endif |
12 |
|
|
if ( "$1" == library ) then |
13 |
|
|
source installib |
14 |
greg |
1.8 |
cp -f src/*/*.{cal,tab,hex} $ldir |
15 |
greg |
1.1 |
echo "" |
16 |
|
|
echo "Set the environment variable RAYPATH=.:$ldir" |
17 |
|
|
echo 'For C-shell users, put the following into ~/.cshrc' |
18 |
|
|
echo " setenv RAYPATH .:$ldir" |
19 |
|
|
echo 'For Bourne shell users, put the following into $HOME/profile' |
20 |
|
|
echo " RAYPATH=.:$ldir" |
21 |
|
|
echo " export RAYPATH" |
22 |
|
|
echo "" |
23 |
|
|
exit 0 |
24 |
|
|
endif |
25 |
|
|
set srcdirs=( common meta cv gen ot rt px hd util cal ) |
26 |
|
|
if ( "$1" == install ) then |
27 |
|
|
cat << _EOF_ |
28 |
|
|
|
29 |
|
|
`cat src/rt/VERSION` INSTALLATION |
30 |
|
|
|
31 |
|
|
This script rebuilds all of the Radiance programs and installs |
32 |
|
|
them on your system. You should read the file README before running |
33 |
|
|
this script. You can type ^C (followed by return) at any time to abort. |
34 |
|
|
|
35 |
|
|
You must first answer the following questions. |
36 |
|
|
|
37 |
|
|
_EOF_ |
38 |
|
|
if ( ! $?EDITOR ) then |
39 |
|
|
echo -n "What is your preferred editor [vi]? " |
40 |
|
|
set ans="$<" |
41 |
|
|
if ( "$ans" != "" ) then |
42 |
|
|
setenv EDITOR "$ans" |
43 |
|
|
else |
44 |
|
|
setenv EDITOR vi |
45 |
|
|
endif |
46 |
|
|
endif |
47 |
|
|
again1: |
48 |
|
|
echo -n "Where do you want the executables [/usr/local/bin]? " |
49 |
|
|
set idir=$< |
50 |
|
|
(echo $idir) >/dev/null |
51 |
greg |
1.4 |
if ( $status ) then |
52 |
|
|
goto again1 |
53 |
|
|
endif |
54 |
greg |
1.1 |
set idir=$idir |
55 |
|
|
if ( "$idir" == "" ) then |
56 |
|
|
set idir=/usr/local/bin |
57 |
|
|
else if ( "$idir" !~ /* ) then |
58 |
|
|
echo "Directory must be relative to root, please reenter" |
59 |
|
|
goto again1 |
60 |
|
|
endif |
61 |
|
|
if ( ! -d $idir ) then |
62 |
|
|
mkdir $idir |
63 |
|
|
if ( $status ) then |
64 |
|
|
echo "Cannot create directory, please reenter" |
65 |
|
|
goto again1 |
66 |
|
|
endif |
67 |
|
|
endif |
68 |
|
|
if ( ! -d $idir/dev ) then |
69 |
|
|
mkdir $idir/dev |
70 |
|
|
if ( $status ) then |
71 |
|
|
echo "Cannot create subdirectory, please reenter" |
72 |
|
|
goto again1 |
73 |
|
|
endif |
74 |
|
|
endif |
75 |
greg |
1.10 |
set inpath=0 |
76 |
|
|
foreach i ( $path ) |
77 |
|
|
if ( "$i" == "$idir" ) then |
78 |
|
|
set inpath=1 |
79 |
|
|
break |
80 |
|
|
endif |
81 |
|
|
end |
82 |
greg |
1.1 |
set rmake=$idir/rmake |
83 |
greg |
1.4 |
if ( "`ls -tL $rmake $0 |& head -1`" == $rmake ) then |
84 |
|
|
goto gotrmake |
85 |
|
|
endif |
86 |
greg |
1.1 |
set newrmake |
87 |
|
|
goto skiplicense |
88 |
|
|
cat << _EOF_ |
89 |
|
|
|
90 |
|
|
RADIANCE LICENSE AGREEMENT |
91 |
|
|
|
92 |
|
|
Radiance is a registered copyright of The Regents of the University of |
93 |
|
|
California ("The Regents"). The Regents grant to you a nonexclusive, |
94 |
|
|
nontransferable license ("License") to use Radiance source code without |
95 |
|
|
fee. You may not sell or distribute Radiance to others without the |
96 |
|
|
prior express written permission of The Regents. You may compile and |
97 |
|
|
use this software on any machines to which you have personal access, |
98 |
|
|
and may share its use with others who have access to the same machines. |
99 |
|
|
|
100 |
|
|
NEITHER THE UNITED STATES NOR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY |
101 |
|
|
OF THEIR EMPLOYEES, MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY |
102 |
|
|
LEGAL LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS |
103 |
|
|
OF ANY INFORMATION, APPARATUS, PRODUCT, OR PROCESS DISCLOSED, OR REPRESENTS |
104 |
|
|
THAT ITS USE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS. By downloading, using |
105 |
|
|
or copying this software, you agree to abide by the intellectual property laws |
106 |
|
|
and all other applicable laws of the United States, and by the terms of this |
107 |
|
|
License Agreement. Ownership of the software shall remain solely in The |
108 |
|
|
Regents. The Regents shall have the right to terminate this License |
109 |
|
|
immediately by written notice upon your breach of, or noncompliance with, any |
110 |
|
|
of its terms. You shall be liable for any infringement or damages resulting |
111 |
|
|
from your failure to abide by the terms of this License Agreement. |
112 |
|
|
|
113 |
|
|
_EOF_ |
114 |
|
|
echo -n "Do you understand and accept the terms of this agreement [n]? " |
115 |
|
|
set ans="$<" |
116 |
|
|
if ( "$ans" !~ [yY]* ) exit |
117 |
|
|
echo -n "Are you a new Radiance user or with a new address [y]? " |
118 |
|
|
set ans="$<" |
119 |
|
|
if ( "$ans" !~ [nN]* ) then |
120 |
|
|
csh -f newuser |
121 |
|
|
else |
122 |
|
|
echo `cat src/rt/VERSION` compiled by `whoami` | mail [email protected] |
123 |
|
|
endif |
124 |
|
|
skiplicense: |
125 |
|
|
set special= |
126 |
|
|
set arch= |
127 |
|
|
set opt= |
128 |
|
|
set mach= |
129 |
|
|
set compat= |
130 |
|
|
set extras= |
131 |
schorsch |
1.9 |
set esuffix= |
132 |
greg |
1.1 |
cat << _EOF_ |
133 |
|
|
|
134 |
|
|
Please select your system type from the following list: |
135 |
|
|
|
136 |
|
|
1) Sun Solaris |
137 |
|
|
2) HP workstation |
138 |
|
|
3) Silicon Graphics |
139 |
|
|
4) AIX (RS/6000) |
140 |
|
|
5) BSDI BSD/386 |
141 |
|
|
6) Linux |
142 |
schorsch |
1.9 |
7) MacOS X |
143 |
greg |
1.1 |
8) FreeBSD |
144 |
schorsch |
1.9 |
9) Cygwin |
145 |
|
|
10) Other |
146 |
greg |
1.1 |
|
147 |
|
|
_EOF_ |
148 |
|
|
echo -n "Choice? " |
149 |
|
|
set arch="$<" |
150 |
|
|
switch ("$arch") |
151 |
|
|
case 1: # SPARC Station |
152 |
|
|
set arch=sun |
153 |
greg |
1.4 |
set mach="-I/usr/openwin/include -L/usr/openwin/lib -DNOSTEREO" |
154 |
|
|
set opt="-O -DSPEED=80" |
155 |
|
|
set compat="bmalloc.o strcmp.o getpagesize.o" |
156 |
greg |
1.1 |
breaksw |
157 |
|
|
case 2: # HP workstation |
158 |
|
|
set mach="" |
159 |
|
|
set opt="-O -DSPEED=80 -Aa -D_HPUX_SOURCE" |
160 |
greg |
1.3 |
set compat="bmalloc.o getpagesize.o strcmp.o" |
161 |
greg |
1.1 |
set arch=hpux |
162 |
|
|
breaksw |
163 |
|
|
case 3: # Silicon Graphics |
164 |
|
|
set arch=sgi |
165 |
|
|
switch (`uname -r`) |
166 |
|
|
case 3.*: |
167 |
|
|
set mach="-noprototypes" |
168 |
|
|
set opt="-O -DSPEED=80" |
169 |
|
|
set special="sgi" |
170 |
|
|
set compat="malloc.o strcmp.o" |
171 |
|
|
breaksw |
172 |
|
|
case 4.*: |
173 |
|
|
set mach="" |
174 |
|
|
set opt="-O2 -DSPEED=100" |
175 |
|
|
set compat="malloc.o strcmp.o" |
176 |
|
|
set extras='"MLIB=-lfastm -lm"' |
177 |
|
|
breaksw |
178 |
|
|
default: # 5.x or later |
179 |
|
|
ln -s `which wish` $idir/wish4.0 |
180 |
|
|
set path=($idir $path) |
181 |
|
|
set mach="-w" |
182 |
|
|
set opt="-O2 -DSPEED=200" |
183 |
|
|
set special="ogl" |
184 |
greg |
1.3 |
set compat="bmalloc.o strcmp.o" |
185 |
greg |
1.1 |
breaksw |
186 |
|
|
endsw |
187 |
|
|
breaksw |
188 |
|
|
case 4: # AIX |
189 |
|
|
set opt="-O" |
190 |
greg |
1.6 |
set compat="bmalloc.o erf.o strcmp.o" |
191 |
|
|
set arch=PowerPC |
192 |
greg |
1.1 |
breaksw |
193 |
|
|
case 5: # BSDI BSD/386 |
194 |
|
|
set mach="-DBSD -L/usr/X11/lib -I/usr/X11/include" |
195 |
|
|
set opt="-O -DSPEED=100" |
196 |
|
|
set arch=IBMPC |
197 |
|
|
set compat="malloc.o erf.o strcmp.o" |
198 |
|
|
breaksw |
199 |
|
|
case 6: # Linux |
200 |
schorsch |
1.7 |
set mach="-Dlinux -D_FILE_OFFSET_BITS=64 -L/usr/X11R6/lib -I/usr/include/X11 -DNOSTEREO" |
201 |
greg |
1.1 |
set opt="-O2 -DSPEED=200" |
202 |
|
|
set arch=IBMPC |
203 |
|
|
set compat="bmalloc.o erf.o getpagesize.o" |
204 |
|
|
set extras=CC=gcc |
205 |
|
|
breaksw |
206 |
schorsch |
1.9 |
case 7: # MacOS X |
207 |
|
|
set mach="-DBSD -DNOSTEREO -Dfreebsd -I/usr/X11R6/include -L/usr/X11R6/lib" |
208 |
|
|
set opt="-O2 -DSPEED=200" |
209 |
|
|
set arch=PowerPC |
210 |
|
|
set compat="bmalloc.o" |
211 |
|
|
set extras="CC=cc CONFIGURE_ARCH=powerpc" |
212 |
greg |
1.1 |
set special="ogl" |
213 |
schorsch |
1.9 |
breaksw |
214 |
greg |
1.1 |
case 8: # FreeBSD |
215 |
schorsch |
1.9 |
set mach="-DBSD -DNOSTEREO -Dfreebsd -I/usr/X11R6/include -L/usr/X11R6/lib" |
216 |
|
|
set opt="-O -DSPEED=200" |
217 |
|
|
set compat="bmalloc.o erf.o" |
218 |
|
|
set extras="CC=cc" |
219 |
greg |
1.1 |
set arch=IBMPC |
220 |
schorsch |
1.9 |
breaksw |
221 |
|
|
case 9: # Cygwin |
222 |
|
|
set mach="-Dfreebsd -L/usr/lib -L/usr/X11R6/lib -I/usr/include/X11 -I/usr/X11R6/include -DNOSTEREO" |
223 |
|
|
set opt="-O2 -DSPEED=200" |
224 |
|
|
set arch=IBMPC |
225 |
|
|
set compat="bmalloc.o erf.o getpagesize.o" |
226 |
|
|
set extras="CC=gcc" |
227 |
|
|
set special="ogl" |
228 |
|
|
set esuffix=".exe" |
229 |
|
|
breaksw |
230 |
|
|
case 10: # Other |
231 |
greg |
1.1 |
set opt="-O" |
232 |
|
|
set compat="bmalloc.o erf.o strcmp.o" |
233 |
|
|
echo -n "Are you using the GNU C compiler [n]? " |
234 |
|
|
if ( "$<" =~ [yY]* ) then |
235 |
|
|
set extras="CC=gcc" |
236 |
|
|
endif |
237 |
greg |
1.6 |
set arch=other |
238 |
greg |
1.1 |
breaksw |
239 |
|
|
default: |
240 |
|
|
echo "Illegal choice\!" |
241 |
|
|
echo "Installation aborted." |
242 |
|
|
exit 1 |
243 |
|
|
breaksw |
244 |
|
|
endsw |
245 |
|
|
source installib |
246 |
|
|
sed 's/[ ]*$//' > $rmake << _EOF_ |
247 |
|
|
#!/bin/sh |
248 |
|
|
exec make "SPECIAL=$special" \ |
249 |
|
|
"OPT=$opt" \ |
250 |
|
|
"MACH=$mach" \ |
251 |
|
|
ARCH=$arch "COMPAT=$compat" \ |
252 |
|
|
INSTDIR=$idir \ |
253 |
|
|
LIBDIR=$ldir \ |
254 |
schorsch |
1.9 |
ESUFFIX=$esuffix \ |
255 |
greg |
1.1 |
$extras "\$@" -f Rmakefile |
256 |
|
|
_EOF_ |
257 |
|
|
chmod 755 $rmake |
258 |
|
|
chmod 644 src/*/Rmakefile src/rt/devtable.c |
259 |
|
|
gotrmake: |
260 |
|
|
echo "Current rmake command is:" |
261 |
|
|
cat $rmake |
262 |
|
|
echo -n "Do you want to change it? " |
263 |
|
|
set ans="$<" |
264 |
|
|
if ( "$ans" =~ [yY]* ) then |
265 |
|
|
cp $rmake /tmp/rmake$$ |
266 |
|
|
$EDITOR $rmake |
267 |
|
|
if ( `cat $rmake /tmp/rmake$$ | grep OPT= | uniq | wc -l` == 2 ) set newrmake |
268 |
|
|
rm -f /tmp/rmake$$ |
269 |
|
|
endif |
270 |
|
|
if ( ! -d src/lib ) then |
271 |
|
|
mkdir src/lib |
272 |
|
|
endif |
273 |
|
|
if ( $?newrmake ) then |
274 |
|
|
echo 'New rmake command -- running "makeall clean"...' |
275 |
|
|
csh -f $0 clean |
276 |
|
|
endif |
277 |
|
|
cd src |
278 |
|
|
echo "Making programs..." |
279 |
|
|
set errs=0 |
280 |
|
|
foreach i ( $srcdirs ) |
281 |
|
|
pushd $i |
282 |
|
|
echo "In directory $i..." |
283 |
|
|
$rmake -k $* |
284 |
|
|
@ errs += $status |
285 |
|
|
popd |
286 |
|
|
end |
287 |
|
|
if ( $errs ) then |
288 |
|
|
echo "There were some errors." |
289 |
|
|
else |
290 |
|
|
echo "Done." |
291 |
|
|
endif |
292 |
|
|
cd .. |
293 |
greg |
1.10 |
if (! $inpath ) then |
294 |
|
|
echo "" |
295 |
|
|
echo "Add $idir to the beginning of your execution path:" |
296 |
|
|
echo 'For C-shell users, put the following into ~/.cshrc' |
297 |
|
|
echo " set path=( $idir "'$path )' |
298 |
|
|
echo 'For Bourne shell users, put the following into $HOME/profile' |
299 |
|
|
echo " PATH=$idir"':$PATH' |
300 |
|
|
echo " export PATH" |
301 |
|
|
endif |
302 |
greg |
1.1 |
if (! -d /usr/tmp) then |
303 |
|
|
ln -s /tmp /usr/tmp |
304 |
|
|
if ($status) then |
305 |
|
|
echo "" |
306 |
|
|
echo "IMPORTANT: Execute 'sudo ln -s /tmp /usr/tmp'" |
307 |
|
|
endif |
308 |
|
|
endif |
309 |
|
|
else |
310 |
|
|
cd src |
311 |
|
|
foreach i ( $srcdirs ) |
312 |
|
|
pushd $i |
313 |
|
|
echo "In directory $i..." |
314 |
|
|
make -f Rmakefile $* |
315 |
|
|
popd |
316 |
|
|
end |
317 |
|
|
cd .. |
318 |
|
|
foreach i ( $* ) |
319 |
|
|
if ( "$i" == clean ) then |
320 |
|
|
echo "Removing library archives..." |
321 |
greg |
1.3 |
rm -f src/lib/*.[ao] |
322 |
greg |
1.1 |
endif |
323 |
|
|
end |
324 |
greg |
1.10 |
echo "Done." |
325 |
|
|
endif |
326 |
greg |
1.1 |
exit 0 |