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