Debian Codegraph @

scripts/clisp/unix/mkbergman

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