Ticket #32595: saveimage.sh

File saveimage.sh, 3.4 KB (added by mbrethen@…, 13 years ago)

Takes image file dir and toplevel pslbuild dir pathname as argument

Line 
1#! /bin/sh
2
3# Extract for buildsh to only save a new image.
4# Takes image file dir and toplevel pslbuild dir pathname as arguments
5#
6# Usage:
7#         .../psl/saveimage.sh .../imagedir /usr/lib/reduce/pslbuild
8
9# This script must live in the PSL directory, but it builds things in the
10# current directory.
11
12a=$0
13c=unknown
14case $a in
15/* )
16  c=$a 
17  ;;
18*/* )
19  case $a in
20  ./* )
21    a=`echo $a | sed -e s+./++`
22    ;;
23  esac
24  c=`pwd`/$a
25  ;;
26* ) 
27  for d in $PATH
28  do
29    if test -x $d/$a
30    then
31      c=$d/$a
32    fi
33  done
34  if test $c = "unknown" ;then
35    echo "Unable to find full path for script. Please re-try"
36    echo "launching it using a fully rooted path."
37    exit 1
38  fi
39  ;;
40esac
41
42cpsldir=`echo $c | sed -e 's+/[^/]*$++'`
43creduce=$cpsldir/..
44chere=`pwd`
45cfasl=$chere/red
46
47if test -x /usr/bin/cygpath
48then
49  psldir=`cygpath -m "$cpsldir"`
50  reduce=`cygpath -m "$creduce"`
51  here=`cygpath -m "$chere"`
52  fasl=`cygpath -m "$cfasl"`
53else
54  psldir="$cpsldir"
55  reduce="$creduce"
56  here="$chere"
57  fasl="$cfasl"
58fi
59
60imagedir="$1"
61if test -z "$2"
62then
63  topdir="$here"
64else
65  topdir="$2"
66fi
67
68if test -f psl/64
69then
70STORE=600
71else
72STORE=64000000
73fi
74
75export here fasl psldir reduce
76
77set -xv
78
79cd psl
80
81./bpsl -td $STORE <<XXX > $chere/log/reduce.blg
82% This re-starts a bare reduce and loads in the modules compiled
83% by the very first step. It then checkpoints a system that can be
84% used to rebuild all other modules.
85
86(setq symbolfilename!* "$here/psl/bpsl")
87(setq loaddirectories!* (quote ("" "$here/red/" "$here/psl/")))
88
89(reclaim)
90(setq !*init!-stats!* (list (time) (gtheap nil) (free-bps) nextsymbol))
91
92(setq !*usermode nil)
93(setq !*verboseload t)
94(setq !*argnochk t)                % Check argument count.
95(setq prolog_file 'pslprolo)
96(setq rend_file 'pslrend)
97
98(cond ((filep "symget.b")
99       (dskin "$reduce/psl/symget.dat")))
100
101(cond ((filep "addr2id.b")
102       (load addr2id)))            % For debugging purposes.
103
104(cond ((filep "pipes.b")
105       (load pipes)))              % Unix pipes.
106
107(load zbig)                        % PSL bignums.
108(errorset '(load compat) nil nil)  % Load PSL-based functions if there.
109(load module)                      % Contains definition of load-package.
110(load pslprolo)                    % PSL specific code.
111
112(load!-package 'rlisp)
113(load!-package rend_file)
114(load!-package 'poly)
115(load!-package 'arith)
116(load!-package 'alg)
117(load!-package 'mathpr)
118(load!-package 'entry)
119(setq version!* "REDUCE Experimental Version") (setq date!* (date))
120(initreduce)
121
122(setq !*loadversion t)             % Load entry module during BEGIN.
123(setq !*verboseload nil)           % Inhibit loading messages.
124
125(cond ((and (memq (quote sparc) lispsystem!*)
126            (getd (quote supersparc)))
127       (supersparc)))
128
129(prog nil
130   (reclaim)
131   (terpri)
132   (prin2 "Time for build: ")
133   (prin2 (quotient (difference (time) (car !*init!-stats!*)) 1000.0))
134   (prin2t " secs")
135   (prin2 "Symbols used:   ")
136   (prin2t (difference nextsymbol (cadddr !*init!-stats!*)))
137   (prin2 "Heap used:      ")
138   (prin2t (difference (cadr !*init!-stats!*) (gtheap nil)))
139   (prin2 "BPS used:       ")
140   (prin2t (difference (caddr !*init!-stats!*) (free-bps)))
141   (prin2 "Heap left:      ")
142   (prin2t (gtheap nil))
143   (prin2 "BPS left:       ")
144   (prin2t (free-bps))
145  (setq !*init!-stats!* nil))
146
147(setq symbolfilename!* "$topdir/psl/bpsl")
148(setq loaddirectories!* (quote ("" "$topdir/red/" "$topdir/psl/")))
149
150(savesystem "REDUCE" "$imagedir/reduce" (quote ((read-init-file "reduce"))))
151(bye)
152
153XXX
154