| 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 ) goto again1 |
| 54 |
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 |
set rmake=$idir/rmake |
| 76 |
if ( "`ls -tL $rmake $0 |& head -1`" == $rmake ) goto gotrmake |
| 77 |
set newrmake |
| 78 |
goto skiplicense |
| 79 |
cat << _EOF_ |
| 80 |
|
| 81 |
RADIANCE LICENSE AGREEMENT |
| 82 |
|
| 83 |
Radiance is a registered copyright of The Regents of the University of |
| 84 |
California ("The Regents"). The Regents grant to you a nonexclusive, |
| 85 |
nontransferable license ("License") to use Radiance source code without |
| 86 |
fee. You may not sell or distribute Radiance to others without the |
| 87 |
prior express written permission of The Regents. You may compile and |
| 88 |
use this software on any machines to which you have personal access, |
| 89 |
and may share its use with others who have access to the same machines. |
| 90 |
|
| 91 |
NEITHER THE UNITED STATES NOR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY |
| 92 |
OF THEIR EMPLOYEES, MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY |
| 93 |
LEGAL LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS |
| 94 |
OF ANY INFORMATION, APPARATUS, PRODUCT, OR PROCESS DISCLOSED, OR REPRESENTS |
| 95 |
THAT ITS USE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS. By downloading, using |
| 96 |
or copying this software, you agree to abide by the intellectual property laws |
| 97 |
and all other applicable laws of the United States, and by the terms of this |
| 98 |
License Agreement. Ownership of the software shall remain solely in The |
| 99 |
Regents. The Regents shall have the right to terminate this License |
| 100 |
immediately by written notice upon your breach of, or noncompliance with, any |
| 101 |
of its terms. You shall be liable for any infringement or damages resulting |
| 102 |
from your failure to abide by the terms of this License Agreement. |
| 103 |
|
| 104 |
_EOF_ |
| 105 |
echo -n "Do you understand and accept the terms of this agreement [n]? " |
| 106 |
set ans="$<" |
| 107 |
if ( "$ans" !~ [yY]* ) exit |
| 108 |
echo -n "Are you a new Radiance user or with a new address [y]? " |
| 109 |
set ans="$<" |
| 110 |
if ( "$ans" !~ [nN]* ) then |
| 111 |
csh -f newuser |
| 112 |
else |
| 113 |
echo `cat src/rt/VERSION` compiled by `whoami` | mail [email protected] |
| 114 |
endif |
| 115 |
skiplicense: |
| 116 |
set special= |
| 117 |
set arch= |
| 118 |
set opt= |
| 119 |
set mach= |
| 120 |
set compat= |
| 121 |
set extras= |
| 122 |
cat << _EOF_ |
| 123 |
|
| 124 |
Please select your system type from the following list: |
| 125 |
|
| 126 |
1) Sun Solaris |
| 127 |
2) HP workstation |
| 128 |
3) Silicon Graphics |
| 129 |
4) AIX (RS/6000) |
| 130 |
5) BSDI BSD/386 |
| 131 |
6) Linux |
| 132 |
7) MacOS X |
| 133 |
8) FreeBSD |
| 134 |
9) Other |
| 135 |
|
| 136 |
_EOF_ |
| 137 |
echo -n "Choice? " |
| 138 |
set arch="$<" |
| 139 |
switch ("$arch") |
| 140 |
case 1: # SPARC Station |
| 141 |
set arch=sun |
| 142 |
if ( `uname -r` =~ 4.* ) then |
| 143 |
set mach="-fsingle -DBSD /usr/lib/libm.il -I/usr/openwin/include -L/usr/openwin/lib -DNOSTEREO" |
| 144 |
set opt="-O -pipe -DSPEED=12" |
| 145 |
set special="sun" |
| 146 |
set compat="bmalloc.o strcmp.o" |
| 147 |
else |
| 148 |
set mach="-I/usr/openwin/include -L/usr/openwin/lib -DNOSTEREO" |
| 149 |
set opt="-O -DSPEED=80" |
| 150 |
set special="ogl" |
| 151 |
set compat="bmalloc.o strcmp.o getpagesize.o" |
| 152 |
endif |
| 153 |
breaksw |
| 154 |
case 2: # HP workstation |
| 155 |
set mach="" |
| 156 |
set opt="-O -DSPEED=80 -Aa -D_HPUX_SOURCE" |
| 157 |
set compat="malloc.o getpagesize.o strcmp.o" |
| 158 |
set arch=hpux |
| 159 |
breaksw |
| 160 |
case 3: # Silicon Graphics |
| 161 |
set arch=sgi |
| 162 |
switch (`uname -r`) |
| 163 |
case 3.*: |
| 164 |
set mach="-noprototypes" |
| 165 |
set opt="-O -DSPEED=80" |
| 166 |
set special="sgi" |
| 167 |
set compat="malloc.o strcmp.o" |
| 168 |
breaksw |
| 169 |
case 4.*: |
| 170 |
set mach="" |
| 171 |
set opt="-O2 -DSPEED=100" |
| 172 |
set compat="malloc.o strcmp.o" |
| 173 |
set extras='"MLIB=-lfastm -lm"' |
| 174 |
breaksw |
| 175 |
default: # 5.x or later |
| 176 |
ln -s `which wish` $idir/wish4.0 |
| 177 |
set path=($idir $path) |
| 178 |
set mach="-w" |
| 179 |
set opt="-O2 -DSPEED=200" |
| 180 |
set special="ogl" |
| 181 |
set compat="malloc.o strcmp.o" |
| 182 |
breaksw |
| 183 |
endsw |
| 184 |
breaksw |
| 185 |
case 4: # AIX |
| 186 |
set mach="-Dvoid=char -D_NO_PROTO -DINCL_SEL_H" |
| 187 |
set opt="-O" |
| 188 |
set compat="bmalloc.o erf.o" |
| 189 |
breaksw |
| 190 |
case 5: # BSDI BSD/386 |
| 191 |
set mach="-DBSD -L/usr/X11/lib -I/usr/X11/include" |
| 192 |
set opt="-O -DSPEED=100" |
| 193 |
set arch=IBMPC |
| 194 |
set compat="malloc.o erf.o strcmp.o" |
| 195 |
breaksw |
| 196 |
case 6: # Linux |
| 197 |
set mach="-Dlinux -L/usr/X11R6/lib -I/usr/include/X11 -DNOSTEREO" |
| 198 |
set opt="-O2 -DSPEED=200" |
| 199 |
set arch=IBMPC |
| 200 |
set compat="bmalloc.o erf.o getpagesize.o" |
| 201 |
set extras=CC=gcc |
| 202 |
breaksw |
| 203 |
case 7: # MacOS X |
| 204 |
set mach="-DBSD -DNOSTEREO -Dfreebsd -I/usr/X11R6/include -L/usr/X11R6/lib" |
| 205 |
set opt="-O2 -DSPEED=200" |
| 206 |
set arch=PowerPC |
| 207 |
set compat="bmalloc.o" |
| 208 |
set extras="CC=cc CONFIGURE_ARCH=powerpc" |
| 209 |
set special="ogl" |
| 210 |
breaksw |
| 211 |
case 8: # FreeBSD |
| 212 |
set mach="-DBSD -DNOSTEREO -Dfreebsd -I/usr/X11R6/include -L/usr/X11R6/lib" |
| 213 |
set opt="-O -DSPEED=200" |
| 214 |
set compat="bmalloc.o erf.o" |
| 215 |
set extras="CC=cc" |
| 216 |
set arch=IBMPC |
| 217 |
breaksw |
| 218 |
case 9: # Other |
| 219 |
set opt="-O" |
| 220 |
set compat="bmalloc.o erf.o strcmp.o" |
| 221 |
echo -n "Are you using the GNU C compiler [n]? " |
| 222 |
if ( "$<" =~ [yY]* ) then |
| 223 |
set extras="CC=gcc" |
| 224 |
endif |
| 225 |
breaksw |
| 226 |
default: |
| 227 |
echo "Illegal choice\!" |
| 228 |
echo "Installation aborted." |
| 229 |
exit 1 |
| 230 |
breaksw |
| 231 |
endsw |
| 232 |
# We don't seem to have any more cramped machines out there, so... |
| 233 |
set mem="-DBIGMEM" |
| 234 |
if ( $?mem ) then |
| 235 |
set mach="$mach $mem" |
| 236 |
else |
| 237 |
echo -n "Does the target machine have more than 24 Mbytes of RAM? " |
| 238 |
set ans="$<" |
| 239 |
if ( "$ans" =~ [yY]* ) then |
| 240 |
echo -n "More than 96 Mbytes? " |
| 241 |
set ans="$<" |
| 242 |
if ( "$ans" =~ [yY]* ) then |
| 243 |
set mach="$mach -DBIGMEM" |
| 244 |
set sizemod="huge models (100,000+ surfaces)" |
| 245 |
else |
| 246 |
set sizemod="very large models (30,000+ surfaces)" |
| 247 |
endif |
| 248 |
else |
| 249 |
set sizemod="large models (10,000+ surfaces)" |
| 250 |
endif |
| 251 |
endif |
| 252 |
# echo "Do you expect to be rendering $sizemod?" |
| 253 |
# echo -n '(Answering "yes" may adversly affect rendering time and geometric accuracy) ' |
| 254 |
# set ans="$<" |
| 255 |
# if ( "$ans" =~ [yY]* ) then |
| 256 |
# set opt="$opt -DSMLFLT" |
| 257 |
# endif |
| 258 |
# echo -n "Do you have X10 support [n]? " |
| 259 |
# if ( "$<" =~ [yY]* ) then |
| 260 |
# set special="$special x10" |
| 261 |
# endif |
| 262 |
source installib |
| 263 |
sed 's/[ ]*$//' > $rmake << _EOF_ |
| 264 |
#!/bin/sh |
| 265 |
exec make "SPECIAL=$special" \ |
| 266 |
"OPT=$opt" \ |
| 267 |
"MACH=$mach" \ |
| 268 |
ARCH=$arch "COMPAT=$compat" \ |
| 269 |
INSTDIR=$idir \ |
| 270 |
LIBDIR=$ldir \ |
| 271 |
$extras "\$@" -f Rmakefile |
| 272 |
_EOF_ |
| 273 |
chmod 755 $rmake |
| 274 |
chmod 644 src/*/Rmakefile src/rt/devtable.c |
| 275 |
gotrmake: |
| 276 |
echo "Current rmake command is:" |
| 277 |
cat $rmake |
| 278 |
echo -n "Do you want to change it? " |
| 279 |
set ans="$<" |
| 280 |
if ( "$ans" =~ [yY]* ) then |
| 281 |
cp $rmake /tmp/rmake$$ |
| 282 |
$EDITOR $rmake |
| 283 |
if ( `cat $rmake /tmp/rmake$$ | grep OPT= | uniq | wc -l` == 2 ) set newrmake |
| 284 |
rm -f /tmp/rmake$$ |
| 285 |
endif |
| 286 |
if ( ! -d src/lib ) then |
| 287 |
mkdir src/lib |
| 288 |
endif |
| 289 |
if ( $?newrmake ) then |
| 290 |
echo 'New rmake command -- running "makeall clean"...' |
| 291 |
csh -f $0 clean |
| 292 |
endif |
| 293 |
cd src |
| 294 |
echo "Making programs..." |
| 295 |
set errs=0 |
| 296 |
foreach i ( $srcdirs ) |
| 297 |
pushd $i |
| 298 |
echo "In directory $i..." |
| 299 |
$rmake -k $* |
| 300 |
@ errs += $status |
| 301 |
popd |
| 302 |
end |
| 303 |
if ( $errs ) then |
| 304 |
echo "There were some errors." |
| 305 |
else |
| 306 |
echo "Done." |
| 307 |
endif |
| 308 |
cd .. |
| 309 |
if (! -d /usr/tmp) then |
| 310 |
ln -s /tmp /usr/tmp |
| 311 |
if ($status) then |
| 312 |
echo "" |
| 313 |
echo "IMPORTANT: Execute 'sudo ln -s /tmp /usr/tmp'" |
| 314 |
echo "" |
| 315 |
endif |
| 316 |
endif |
| 317 |
else |
| 318 |
cd src |
| 319 |
foreach i ( $srcdirs ) |
| 320 |
pushd $i |
| 321 |
echo "In directory $i..." |
| 322 |
make -f Rmakefile $* |
| 323 |
popd |
| 324 |
end |
| 325 |
echo "Done." |
| 326 |
cd .. |
| 327 |
endif |
| 328 |
foreach i ( $* ) |
| 329 |
if ( "$i" == clean ) then |
| 330 |
echo "Removing library archives..." |
| 331 |
rm -f src/lib/*.a |
| 332 |
endif |
| 333 |
end |
| 334 |
exit 0 |