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
|
#!/bin/csh -f
# Arguments: runtimeversion compilerversion edwinversion 6001version
# The versions can be omitted, and if they are, the current version
# as determined by the appropriate RCS file (e.g. runtime/version.scm)
# is built.
# If a version is the string "none", the corresponding band is not built,
# nor is the corresponding subsystem recompiled.
# If either the compiler or edwin is re-built, the combined (c+e) band
# is re-built as well.
# This script silently ignores additional arguments.
# Stage 1: Choose architecture and directories
hp9000s300
if ("$status" == 0) then
set root="/scheme/300"
set student_constant=""
endif
hp9000s800
if ("$status" == 0) then
set root="/scheme/700"
set student_constant=" -constant 2000"
endif
set noclobber
set lock="$root/tmp/lock"
(echo "### Rebuild in progress started by" `whoami` "on" `date` "on" `hostname` > $lock)
if ("$status" != 0) then
cat "$lock"
exit 1
endif
# Stage 2: Determine what to do
onintr abort_and_exit
if ("$1" != "none") then
if (("$1" == "") || ("$1" == "next")) then
set runver=`rcsversion /scheme/src/runtime/version.scm`
else
set runver="$1"
endif
echo "### Making runtime system version $runver..."
set runtime="$root/backup/runtime-$runver"
else
set runtime=""
endif
if ("$2" != "none") then
if (("$2" == "") || ("$2" == "next")) then
set compver=`rcsversion /scheme/src/compiler/base/make.scm`
else
set compver="$2"
endif
echo "### Making compiler version $compver..."
set complr="$root/backup/complr-$compver"
else
set complr=""
endif
if ("$3" != "none") then
if (("$3" == "") || ("$3" == "next")) then
set edver=`rcsversion /scheme/src/edwin/make.scm`
else
set edver="$3"
endif
echo "### Making edwin version $edver..."
set edwin="$root/backup/edwin-$edver"
else
set edwin=""
endif
if ("$4" != "none") then
if (("$4" == "") || ("$4" == "next")) then
set stver=`rcsversion /scheme/src/6001/make.scm`
else
set stver="$4"
endif
echo "### Making 6.001 student band version $stver..."
set student="$root/backup/6001-$stver"
else
set student=""
endif
if (("$runtime" == "") \
&& ("$complr" == "") \
&& ("$edwin" == "") \
&& ("$student" == "")) then
echo "### No systems to rebuild."
rm -f "$lock"
exit 0
endif
# Stage 4: Re-build bands in staging area
if ("$runtime" != "") then
echo "### cd $root/runtime"
cd $root/runtime
rm -f ../tmp/runtime.com
echo "### scheme -large -fasl make.com -no-init-file"
scheme -large -fasl make.com -no-init-file <<*END*
(begin
(disk-save "../tmp/runtime.com")
(write-line '(saved runtime band))
(%exit 0))
(%exit 1)
*END*
set result="$status"
if ("$result" != 0) then
echo "### Re-building the runtime system failed."
rm -f ../tmp/runtime.com "$lock"
exit "$result"
endif
set runband="$root/tmp/runtime.com"
set runbandarg="-band $runband"
else
set runband=""
set runbandarg=""
endif
if ("$complr" != "") then
echo "### cd $root/sf"
cd $root/sf
rm -f ../tmp/complr.com
echo "### scheme -large $runbandarg -no-init-file"
scheme -large $runbandarg -no-init-file <<*END*
(begin
(load "make.com")
(cd "../compiler")
(load "make.com")
(disk-save "../tmp/complr.com")
(write-line '(saved compiler band))
(%exit 0))
(%exit 1)
*END*
set result="$status"
if ("$result" != 0) then
echo "### Re-building the compiler failed."
rm -f ../tmp/runtime.com ../tmp/complr.com "$lock"
exit "$result"
endif
set compband="$root/tmp/complr.com"
set cbandarg="-band $compband"
else
set compband=""
set cbandarg=""
endif
if ("$edwin" != "") then
echo "### cd $root/edwin"
cd $root/edwin
rm -f ../tmp/edwin.com
echo "### scheme -large $runbandarg -no-init-file"
scheme -large $runbandarg -no-init-file <<*END*
(begin
(load "make.com")
(disk-save "../tmp/edwin.com")
(write-line '(saved edwin band))
(%exit 0))
(%exit 1)
*END*
set result="$status"
if ("$result" != 0) then
echo "### Re-building edwin failed."
rm -f ../tmp/runtime.com ../tmp/complr.com ../tmp/edwin.com "$lock"
exit "$result"
endif
set edwinband="$root/tmp/edwin.com"
else
set edwinband=""
endif
if (("$edwin" != "") || ("$complr" != "")) then
echo "### cd $root/edwin"
cd $root/edwin
rm -f ../tmp/c+e.com
echo "### scheme -constant 2000 -heap 2000 -compiler $cbandarg -no-init-file"
scheme -constant 2000 -heap 2000 -compiler $cbandarg -no-init-file <<*END*
(begin
(load "make.com")
(disk-save "../tmp/c+e.com")
(write-line '(saved c+e band))
(%exit 0))
(%exit 1)
*END*
set result="$status"
if ("$result" != 0) then
echo "### Re-building c+e failed."
set fullband=""
else
set fullband="$root/tmp/c+e.com"
endif
else
set fullband=""
endif
if ("$student" != "") then
echo "### cd $root/runtime-check"
cd $root/runtime-check
rm -f ../tmp/6001.com
echo "### scheme -large$student_constant -fasl make.com -no-init-file"
scheme -large$student_constant -fasl make.com -no-init-file <<*END*
(begin
(cd "../edwin")
(load "make.com")
(cd "../6001")
(load "make.com")
(disk-save "../tmp/6001.com")
(write-line '(saved 6001 band))
(%exit 0))
(%exit 1)
*END*
set result="$status"
if ("$result" != 0) then
echo "### Re-building 6.001 student band failed."
rm -f ../tmp/runtime.com ../tmp/complr.com ../tmp/edwin.com ../tmp/6001.com "$lock"
exit "$result"
endif
set studband="$root/tmp/6001.com"
else
set studband=""
endif
# Stage 5: Install bands
# This part should be atomic
onintr -
if ("$runtime" != "") then
set backup=`nextver $runtime.gz`
if ("$backup" != "$runtime.gz") then
echo "###" mv -f "$runtime.gz" "$backup"
mv -f "$runtime.gz" "$backup"
endif
echo "### gzip $runtime"
cpx $runband $runtime
gzip $runtime
chmod a-w $runtime.gz
echo "###" mv -f "$runband" "$root/lib/runtime.com"
mv -f "$runband" "$root/lib/runtime.com"
endif
if ("$complr" != "") then
set backup=`nextver $complr.gz`
if ("$backup" != "$complr.gz") then
echo "###" mv -f "$complr.gz" "$backup"
mv -f "$complr.gz" "$backup"
endif
echo "### gzip $complr"
cpx $compband $complr
gzip $complr
chmod a-w $complr.gz
echo "###" mv -f "$compband" "$root/lib/compiler.com"
mv -f "$compband" "$root/lib/compiler.com"
endif
if ("$edwin" != "") then
# Don't save this -- CPH
# set backup=`nextver $edwin.gz`
# if ("$backup" != "$edwin.gz") then
# echo "###" mv -f "$edwin.gz" "$backup"
# mv -f "$edwin.gz" "$backup"
# endif
# echo "### gzip $edwin"
# cpx $edwinband $edwin
# gzip $edwin
# chmod a-w $edwin.gz
echo "###" mv -f "$edwinband" "$root/lib/edwin.com"
mv -f "$edwinband" "$root/lib/edwin.com"
endif
if ("$fullband" != "") then
echo "###" mv -f "$fullband" "$root/lib/c+e.com"
mv -f "$fullband" "$root/lib/c+e.com"
endif
if ("$student" != "") then
# Don't save this -- CPH
# set backup=`nextver $student.gz`
# if ("$backup" != "$student.gz") then
# echo "###" mv -f "$student.gz" "$backup"
# mv -f "$student.gz" "$backup"
# endif
# echo "### gzip $student"
# cpx $studband $student
# gzip $student
# chmod a-w $student.gz
echo "###" mv -f "$studband" "$root/lib/6001.com"
mv -f "$studband" "$root/lib/6001.com"
endif
rm -f "$lock"
echo "### Done."
exit 0
abort_and_exit:
echo ""
echo "### Aborting -- Cleaning up..."
if ("`jobs`" != "") then
kill %1
wait
endif
cd "$root/tmp"
rm -f runtime.com complr.com edwin.com c+e.com 6001.com "$lock"
echo "### Cleaned up."
exit 1
|