Debian Codegraph @

scripts/clisp/unix/mkbergman

raw symbols SCIP
1 #!/bin/sh
2
3 # CHANGES:
4
5 # KAE 2005-08-03 Changed to use top compile sources from psl
6
7 # Removed the temporary compilation of safe./JoeB 2005-03-14
8
9 # KAE 2004-06-05
10 # Added the mkenvv.lsp staff to set env. variables from inside bergman
11 # Deleted env. vars setiings from the bergman starting script
12
13 # Added the compilation of safe, as a temporary measure./JoeB 2004-06-02
14 # Assuming that the name of the executable file is clisp
15
16 PrintUsage()
17 {
18 echo "Usage:"
19 echo "1. For automatic [interactive] configuration:"
20 echo " $0 -auto [-i]"
21 echo "2. For nointeractive manual configuration"
22 echo " $0 <clisp-dir> [<bergman-root-dir> [<lisp-executable-file-name]]"
23 }
24
25 dblecho()
26 {
27 echo "$1"
28 echo "$1" >>bergman.log
29 }
30
31 DoAutoConf()
32 {
33 if [ $# -ne 1 ]
34 then
35 echo "Usage: DoAutoConf [1|0]"
36 exit 1
37 fi
38
39 DACwhclisp=`which clisp`
40 if [ -n "`echo $DACwhclisp | grep 'not found'`" -o -n "`echo $DACwhclisp | grep 'no clisp in'`" ]
41 then
42 echo "I can't find clisp. Try manual installation."
43 exit 1
44 fi
45 DACcd=`pwd`
46 cd ../../..
47 DACbmroot=`pwd`
48 cd $DACcd
49 if [ "$1" = 0 ]
50 then
51 bmroot=$DACbmroot
52 clispfile=$DACwhclisp
53 clispb=$DACwhclisp
54 return
55 fi
56
57 # interactive
58 echo "Found Common Lisp as $DACwhclisp"
59 echo -n "Change? [n] "
60 read DACans
61 if [ "$DACans" = "y" ]
62 then
63 echo -n "Enter new value: "
64 read DACwhclisp
65 if [ ! -x "$DACwhclisp" ]
66 then
67 echo "Something wrong with $DACwhclisp"
68 exit 1
69 fi
70 fi
71 echo "Bergman root is $DACbmroot"
72 echo -n "Change? [n] "
73 read DACans
74 if [ "$DACans" = "y" ]
75 then
76 echo -n "Enter new value: "
77 read DACbmroot
78 if [ ! -d "$DACbmroot" ]
79 then
80 "Something wrong with $DACbmroot"
81 exit 1
82 fi
83 fi
84 bmroot=$DACbmroot
85 clispfile=$DACwhclisp
86 clispb=$DACwhclisp
87 return
88 }
89
90 checkcode ()
91 {
92 if [ $? -ne 0 ]
93 then
94 echo "Something wrong in executing CLISP"
95 deletetempfilesandexit
96 fi
97 }
98
99 noextfilesweareusing ()
100 {
101 DwrK=""
102 if [ $# -ne 0 ]
103 then
104 DwrK="$1/"
105 fi
106 echo "${DwrK}anick ${DwrK}hseries ${DwrK}full ${DwrK}full1 ${DwrK}auxil ${DwrK}stg"
107 }
108
109 deletetempfilesandexit ()
110 {
111 rm -f *.sl *.lsp *.fas *.lib *.mem
112 rm -f `noextfilesweareusing`
113 mv bergman.log $bmroot/logs/clunix.log
114 cd $currentdir
115 exit 1
116 }
117
118 case "$#" in
119 0)
120 PrintUsage
121 exit 1
122 ;;
123
124 1)
125 if [ "$1" = "-auto" ]
126 then
127 DoAutoConf 0
128 elif [ -d "$1" -a "$1/clisp" ]
129 then
130 savecd=`pwd`
131 cd ../../..
132 bmroot=`pwd`
133 cd $savecd
134 clispfile="$1/clisp"
135 clispb="$1/clisp"
136 else
137 echo "Directories do not exist: $1, or $1/clisp"
138 exit 1
139 fi
140 ;;
141
142 2)
143 if [ "$1" = "-auto" ]
144 then
145 if [ "$2" = "-i" ]
146 then
147 DoAutoConf 1
148 else
149 PrintUsage
150 exit 1
151 fi
152 elif [ -d "$1" -a -d "$2" -a "$1/clisp" ]
153 then
154 bmroot=$2
155 clispfile="$1/clisp"
156 clispb="$1/clisp"
157 else
158 echo "Directories do not exist: $1, or $2, or $1/clisp"
159 exit 1
160 fi
161 ;;
162
163 3)
164 if [ -d "$1" -a -d "$2" -x "$1/$3" ]
165 then
166 bmroot=$2
167 clispfile="$1/$3"
168 clispb="$1/$3"
169 else
170 echo "Something do not exists: $1, or $2, or $1/$3"
171 exit 1
172 fi
173 ;;
174
175 *)
176 PrintUsage
177 exit 1
178 esac
179
180 echo "Installing bergman package..."
181 echo "Using root: [$bmroot]"
182 echo "Using Common Lisp command line: [$clispb]"
183
184 echo "Step 1 of 12: Setting the environment"
185 bmsrc=$bmroot/src
186 bmdomains=$bmroot/domains
187 bmaux=$bmroot/auxil
188 bmauxil=$bmroot/auxil
189 bmload=$bmroot/lap/clisp/unix
190 bmexe=$bmroot/bin/clisp/unix
191 bmvers=`cat $bmauxil/version`
192
193 clsrc=$bmroot/scripts/clisp/unix
194 clbin=$bmroot/bin/clisp/unix
195 clasrc=$bmaux/clisp
196 export bmroot bmsrc bmdomains bmaux bmauxil bmload bmexe bmvers
197
198 currentdir=`pwd`
199
200 #echo "Current dir is: $currentdir"
201
202 #rem checking CLISP version
203 echo "Step 2 of 12: Checking CLISP version"
204 $clispb $clasrc/prelisp.lsp
205 if [ $? -ne 0 ]
206 then
207 echo "Please upgrade your CLISP version at least to 2.39 (2006-07-16)"
208 exit 1
209 fi
210
211 cd $bmexe
212 echo "Installing bergman package..." >bergman.log
213 echo "Using root: [$bmroot]" >>bergman.log
214 echo "Using Common Lisp command line: [$clispb]" >>bergman.log
215 echo "Step 1 of 12: Setting the environment" >>bergman.log
216 echo "Step 2 of 12: Checking CLISP version" >>bergman.log
217
218 #rem Copying necessary files
219 dblecho "Step 3 of 12: Copying necessary files"
220 cp $clsrc/setcmp1.sl speccmp1.sl
221 cp $clsrc/setcmp2.sl speccmp2.sl
222 cp $clsrc/setlisp.sl speclisp.sl
223 cp $clsrc/setmacr.sl specmacr.sl
224 cp $clsrc/setmode.sl specmode.sl
225 cp $clasrc/versmacr.sl .
226 cp $clasrc/switches.lsp .
227 cp $clasrc/environ.lsp .
228 cp $clasrc/environ0.lsp .
229 cat $clasrc/envhead-cl.lsp $clasrc/compext-cl.lsp > ./compext-cl.lsp
230 cat $clasrc/envhead-cl.lsp $clasrc/comphead-cl.lsp $bmaux/compile.sl $clasrc/comptail-cl.lsp > ./compile-cl.lsp
231 cat $clasrc/envhead-cl.lsp $clasrc/comphead-cl.lsp $bmaux/compan.sl $clasrc/comptail-cl.lsp > ./compan.lsp
232 cat $clasrc/envhead-cl.lsp $clasrc/bmhead-cl.lsp $bmaux/bmtop.sl $clasrc/bmtail-cl.lsp > ./bmtop-cl.lsp
233 cp $bmsrc/alg2lsp.sl .
234 #cp -f $clasrc/anick .
235 #cp -f $clasrc/hseries .
236 cp $clasrc/checkerr.lsp .
237 # KAE 2004-06-05 (mkenvv)
238 cp $clasrc/mkenvv.lsp .
239
240 #rem Deleting previous binaries
241 dblecho "Step 4 of 12: Deleting previous binaries"
242 rm -f $bmload/*
243 rm -f lispbergman.mem `noextfilesweareusing`
244 rm -f bergman.exe
245
246 #rem Creating fullversion
247 dblecho "Step 5 of 12: Creating fullversion"
248 rm -f $bmauxil/fullversion
249 cat $bmauxil/fvstart $bmauxil/version $bmauxil/fvend > $bmauxil/fullversion
250
251 #rem Compiling environ
252 dblecho "Step 6 of 12: Compiling environ"
253 # KAE 2004-06-05 (mkenvv)
254 $clispb <mkenvv.lsp >>bergman.log
255 checkcode
256
257 #rem Compiling SL extensions
258 dblecho "Step 7 of 12: Compiling slext"
259 $clispb <compext-cl.lsp >>bergman.log
260 checkcode
261
262 # Compiling Bergman and hseries
263 dblecho "Step 8 of 12: Compiling Bergman and hseries"
264 $clispb <compile-cl.lsp >>bergman.log
265 checkcode
266
267 # Compiling anick
268 dblecho "Step 9 of 12: Compiling anick"
269 $clispb <compan.lsp >>bergman.log
270 checkcode
271
272 # Copying generated files
273 dblecho "Step 10 of 12: Copying generated files"
274 cp `noextfilesweareusing "$bmload"` .
275 cp $bmload/alg2lsp.* .
276 cp $bmload/alg2lsp.fas $bmload/alg2lsp.b
277
278 # Generating image
279 dblecho "Step 11 of 12: Generating image"
280 $clispb <bmtop-cl.lsp >>bergman.log
281 checkcode
282
283 # Checking the log
284 dblecho "Step 12 of 12: Checking the log"
285 $clispb checkerr.lsp
286 if [ $? -ne 0 ]
287 then
288 dblecho "There are errors. Please check the log file"
289 deletetempfilesandexit
290 fi
291
292 # mv lispinit.mem lispbergman.mem
293 cat >bergman <<EObergman
294 exec $bmexe/bergman.exe \$1 \$2 \$3 \$4 \$5 \$6 \$7 \$8 \$9
295 EObergman
296
297 chmod a+x bergman
298
299 rm -f `noextfilesweareusing` *.sl *.lsp *.fas *.lib
300 cp $bmload/anick .
301 cp $bmload/hseries .
302 if [ -f $bmroot/logs/clunix.log ]
303 then
304 mv $bmroot/logs/clunix.log $bmroot/logs/clunix.old
305 fi
306 dblecho "Installation successful"
307 dblecho "Now you can use Bergman system by calling $bmexe/bergman"
308 mv bergman.log $bmroot/logs/clunix.log
309
310 cd $currentdir
311