/[meta-cvs]/meta-cvs/F-195D68910132763D8CBE18A3CAE8CF11
ViewVC logotype

Contents of /meta-cvs/F-195D68910132763D8CBE18A3CAE8CF11

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Sun Aug 4 15:49:29 2002 UTC (11 years, 8 months ago) by kaz
Branch: MAIN
CVS Tags: mcvs-0-24, mcvs-1-0-branch~merged-to-HEAD-1, mcvs-1-0-branch~merged-to-HEAD-0, symlink-branch~branch-point, mcvs-0-22, mcvs-0-23, asdf-import-branch~merged-to-HEAD-0, mcvs-1-1-98, mcvs-0-21, mcvs-1-0-branch~branch-point, mcvs-1-0-11, mcvs-1-0-10, mcvs-1-0-13, mcvs-1-0-12, asdf-import-branch~branch-point, mcvs-1-1-0, symlink-branch~merged-to-HEAD-0, mcvs-1-0-9, mcvs-1-0-8, mcvs-1-0-5, mcvs-1-0-4, mcvs-1-0-7, mcvs-1-0-6, mcvs-1-0-3, mcvs-1-0-2, HEAD
Branch point for: symlink-branch, mcvs-1-0-branch, asdf-import-branch
Retargetting CVS with new system call bindings that are not GNU/Linux
specific.
1 #!/bin/sh
2 # Usage: clisp-link command [more args]
3 # where
4 # command = link, create-module-set, add-module-set, add-module-sets, run
5 # For more usage information, see <doc/impnotes.html#modules>.
6 # Or <http://clisp.cons.org/impnotes.html#modules>.
7 # Bruno Haible 19.10.1994
8
9 # This could as well be written in Lisp, for portability. But I don't like
10 # the idea to have one Lisp process running while the next one is built.
11
12 usage () {
13 echo "Usage: $0 [ link | create-module-set | add-module-set | add-module-sets | run ] ..." 1>&2
14 exit 1
15 }
16
17 link () {
18 # Make a link from $1 to $2. Try symbolic link, hard link, file copying.
19 dirname=`echo "$1" | sed -e 's,/[^/]*$,,'`
20 test -n "$dirname" || dirname='/'
21 basename=`echo "$1" | sed -e 's,^.*/,,'`
22 absolute_dirname=`cd "$dirname" ; /bin/pwd`
23 ln -s "$absolute_dirname"/"$basename" "$2" 2>/dev/null ||
24 ln "$1" "$2" 2>/dev/null ||
25 cp -p "$1" "$2"
26 }
27
28 echotab () {
29 cat <<!!
30 $1
31 !!
32 }
33
34 # Print the commands being executed
35 vecho () {
36 echo "$@"
37 }
38
39 verbose () {
40 echo "$@"
41 "$@"
42 }
43
44 # Remove the comment to Set debugging output on
45 #set -x
46
47 # Exit immediately if some command fails.
48 set -e
49
50 # Check number of arguments. Need at least one argument.
51 if [ $# = 0 ] ; then
52 usage
53 fi
54
55 # Where is the link kit?
56 if [ -n "$CLISP_LINKKIT" ] ; then
57 linkkitdir="$CLISP_LINKKIT"
58 else
59 linkkitdir=./linkkit
60 fi
61 if [ ! -r "$linkkitdir"/modules.d -o ! -r "$linkkitdir"/modules.c -o ! -r "$linkkitdir"/clisp.h ] ; then
62 echo "$0: No link kit found in $CLISP_LINKKIT" 1>&2
63 exit 1
64 fi
65 absolute_linkkitdir=`cd "$linkkitdir" ; /bin/pwd`
66
67 # Dispatch according to the first argument.
68 case "$1" in
69
70 link)
71 # This is actually obsolete because it is easier done by a simple
72 # "make" w.r.t. to the distmakefile.
73 # Usage: clisp-link link dir
74 if [ $# != 2 ] ; then
75 echo "Usage: $0 link dir" 1>&2
76 exit 1
77 fi
78 dir="$2"
79 # What to do if we abort.
80 trap 'rm -f "$dir"/lisp.run "$dir"/wlisp.run' 1 2 15
81 # Read the variables CC, CFLAGS, CLFLAGS, LIBS, X_LIBS, RANLIB, FILES
82 . "$dir"/makevars
83 vecho "$0: Entering directory \`$dir'"
84 # Generate new modules.o, compiled from modules.c, includes modules.h
85 (cd "$dir" ; link "$absolute_linkkitdir"/modules.c modules.c ; verbose ${CC} ${CFLAGS} -I"$absolute_linkkitdir" -c modules.c ; rm -f modules.c)
86 # Generate new lisp.run
87 (cd "$dir" ; verbose ${CC} ${CFLAGS} ${CLFLAGS} modules.o ${LIBS} -o lisp.run)
88 vecho "$0: Leaving directory \`$dir'"
89 # Done.
90 trap '' 1 2 15
91 ;;
92
93 create-module-set)
94 # Usage: clisp-link create-module-set moduledir {file}*
95 case $# in
96 0 | 1) echo "Usage: $0 create-module-set moduledir file ..." 1>&2
97 exit 1 ;;
98 esac
99 moduledir="$2"
100 shift
101 shift
102 files="$*"
103 if [ -r "$moduledir" ] ; then
104 if [ -d "$moduledir" ] ; then
105 echo "$0: $moduledir already exists" 1>&2
106 exit 1
107 else
108 echo "$0: $moduledir is not a directory" 1>&2
109 exit 1
110 fi
111 fi
112 mkdir "$moduledir"
113 modulename=`echo "$moduledir" | sed -e 's,^.*/,,'`
114 files_c=''
115 files_o=''
116 for file in $files; do
117 file=`echo "$file" | sed -e 's,\.c$,,'`.c
118 filename=`echo "$file" | sed -e 's,^.*/,,'`
119 case "$file" in
120 /*) relative_file="$file" ;;
121 *) case "$moduledir" in
122 /*) relative_file="$file" ;;
123 *) relative_file=`echo "$moduledir"/ | sed -e 's,[^/][^/]*/*/,../,g'`"$file" ;;
124 esac ;;
125 esac
126 ln -s "$relative_file" "$moduledir"/"$filename" || ln "$file" "$moduledir"/"$filename" || cp -p "$file" "$moduledir"/"$filename"
127 files_c="$files_c"' '"$filename"
128 files_o="$files_o"' '`echo "$filename" | sed -e 's,\.c$,,'`.o
129 done
130 if false; then
131 # No Makefile
132 (echo "file_list=''"
133 for fc in $files_c; do
134 fo=`echo "$fc" | sed -e 's,\.c$,,'`.o
135 echo 'if test -r '"$fc"'; then'
136 echo " if test '"'!'"' -f $fo || test $fo -ot $fc; then"
137 echo ' ${CC} ${CFLAGS} -I"$absolute_linkkitdir" -c '"$fc"
138 echo ' fi'
139 echo ' file_list="$file_list"'"' $fo'"
140 echo 'fi'
141 done
142 echo 'NEW_FILES="$file_list"'
143 echo 'NEW_LIBS="$file_list"'
144 echo "TO_LOAD=''"
145 ) > "$moduledir"/link.sh
146 else
147 # With Makefile
148 (echo "# Makefile for CLISP module set $modulename"
149 echo
150 echo "CC ="
151 echo "CFLAGS ="
152 echo "INCLUDES="
153 echo
154 echo "CLISP ="
155 echo
156 echo "SHELL = /bin/sh"
157 echo
158 for fc in $files_c; do
159 fo=`echo "$fc" | sed -e 's,\.c$,,'`.o
160 echo "$fo : $fc"
161 echotab '$(CC) $(CFLAGS) -I$(INCLUDES) -c '"$fc"
162 echo
163 done
164 echo "clisp-module :$files_o"
165 echo
166 ) > "$moduledir"/Makefile
167 (echo "file_list=''"
168 echo "mod_list=''"
169 for fc in $files_c; do
170 fo=`echo "$fc" | sed -e 's,\.c$,,'`.o
171 mod=`echo "$fc" | sed -e 's,\.c$,,' | sed -e 's,[^A-Za-z0-9_],_,g'`
172 # The last sed command must agree with foreign1.lisp:to-module-name.
173 echo 'if test -r '"$fc"'; then'
174 echo ' file_list="$file_list"'"' $fo'"
175 echo ' mod_list="$mod_list"'"' $mod'"
176 echo 'fi'
177 done
178 echo 'make clisp-module CC="${CC}" CFLAGS="${CFLAGS}" INCLUDES="$absolute_linkkitdir"'
179 echo 'NEW_FILES="$file_list"'
180 echo 'NEW_LIBS="$file_list"'
181 echo 'NEW_MODULES="$mod_list"'
182 echo "TO_LOAD=''"
183 ) > "$moduledir"/link.sh
184 fi
185 ;;
186
187 add-module-set)
188 # Usage: clisp-link add-module-set moduledir source-dir destination-dir
189 if [ $# != 4 ] ; then
190 echo "Usage: $0 add-module-set moduledir source-dir destination-dir" 1>&2
191 exit 1
192 fi
193 moduledir="$2"
194 sourcedir="$3"
195 destinationdir="$4"
196 if [ ! -d "$moduledir" ] ; then
197 echo "$0: $moduledir is not a directory" 1>&2
198 exit 1
199 fi
200 if [ ! -d "$sourcedir" ] ; then
201 echo "$0: $sourcedir is not a directory" 1>&2
202 exit 1
203 fi
204 if [ -r "$destinationdir" ] ; then
205 if [ -d "$destinationdir" ] ; then
206 echo "$0: $destinationdir already exists" 1>&2
207 exit 1
208 else
209 echo "$0: $destinationdir is not a directory" 1>&2
210 exit 1
211 fi
212 fi
213 mkdir "$destinationdir"
214 absolute_currentdir=`/bin/pwd`
215 absolute_sourcedir=`cd "$sourcedir" ; /bin/pwd`
216 absolute_destinationdir=`cd "$destinationdir" ; /bin/pwd`
217 installbasedir=`dirname "$sourcedir"`
218 # What to do if we abort.
219 trap 'rm -rf "$absolute_destinationdir"' 1 2 15
220 if [ "$absolute_sourcedir" = "$absolute_destinationdir" ] ; then
221 echo "$0: directories $sourcedir and $destinationdir may not be the same" 1>&2
222 exit 1
223 fi
224 if [ ! -r "$sourcedir"/lisp.a -o ! -x "$sourcedir"/lisp.run -o ! -r "$sourcedir"/lispinit.mem -o ! -r "$sourcedir"/modules.h -o ! -r "$sourcedir"/modules.o -o ! -r "$sourcedir"/makevars ] ; then
225 echo "$0: directory $sourcedir does not contain a clisp linking set" 1>&2
226 exit 1
227 fi
228 if [ ! -r "$moduledir/link.sh" ] ; then
229 echo "$0: directory $moduledir does not contain a clisp module" 1>&2
230 exit 1
231 fi
232 modulename=`echo "$moduledir" | sed -e 's,^.*/,,'`
233 # Read the variables CC, CFLAGS, CLFLAGS, LIBS, X_LIBS, RANLIB, FILES
234 . "$sourcedir"/makevars
235 # Prepare the module directory and read the variables NEW_FILES, NEW_LIBS
236 NEW_FILES=''
237 NEW_LIBS=''
238 NEW_MODULES=''
239 TO_PRELOAD=''
240 TO_LOAD=''
241 cd "$moduledir"
242 . ./link.sh
243 cd "$absolute_currentdir"
244 # Generate new modules.h
245 (cat "$sourcedir"/modules.h
246 for mod in $NEW_MODULES ; do
247 echo 'MODULE('"$mod"')'
248 done) > "$destinationdir"/modules.h
249 # Generate new lisp.a
250 for f in ${FILES}; do
251 link "$sourcedir"/$f "$destinationdir"/$f
252 done
253 # Generate other libraries
254 for f in ${NEW_FILES}; do
255 link "$moduledir"/$f "$destinationdir"/$f
256 done
257 # Update the LIBS and FILES variables
258 LIBS=${NEW_LIBS}' '${LIBS}
259 FILES=${FILES}' '${NEW_FILES}
260 # Generate new modules.o, compiled from modules.c, includes new modules.h
261 (cd "$destinationdir" ; link "$absolute_linkkitdir"/modules.c modules.c ; verbose ${CC} ${CFLAGS} -I"$absolute_linkkitdir" -c modules.c ; rm -f modules.c)
262 # Generate new lisp.run
263 (cd "$destinationdir" ; verbose ${CC} ${CFLAGS} ${CLFLAGS} modules.o ${LIBS} -o lisp.run)
264 if [ -n "$TO_PRELOAD" ] ; then
265 # Generate new preliminary lispinit.mem
266 to_preload=''
267 for f in $TO_PRELOAD; do
268 to_preload="$to_preload $moduledir/$f"
269 done
270 verbose "$sourcedir"/lisp.run -B "$installbasedir" -M "$sourcedir"/lispinit.mem -norc -q -i $to_preload -x "(saveinitmem \"$destinationdir/lispinit.mem\")"
271 lispinitdir="$destinationdir"
272 else
273 lispinitdir="$sourcedir"
274 fi
275 # Generate new lispinit.mem
276 to_load=''
277 for f in $TO_LOAD; do
278 to_load="$to_load $moduledir/$f"
279 done
280 verbose "$destinationdir"/lisp.run -B "$installbasedir" -M "$lispinitdir"/lispinit.mem -norc -q -i $to_load -x "(saveinitmem \"$destinationdir/lispinit.mem\")"
281 # Generate new makevars
282 LIBS=`echo $LIBS | sed s/','/'\\,'/g`
283 sed -e "s,^LIBS=.*\$,LIBS='${LIBS}'," -e "s,^FILES=.*\$,FILES='${FILES}'," < "$sourcedir"/makevars > "$destinationdir"/makevars
284 # Done.
285 trap '' 1 2 15
286 ;;
287
288 add-module-sets)
289 # This is functionally the same as multiple add-module-set commands,
290 # but is faster and requires less disk space.
291 # Usage: clisp-link add-module-sets source-dir destination-dir moduledir...
292 if [ $# -lt 3 ] ; then
293 echo "Usage: $0 add-module-sets source-dir destination-dir moduledir..." 1>&2
294 exit 1
295 fi
296 sourcedir="$2"
297 destinationdir="$3"
298 shift
299 shift
300 shift
301 moduledirs="$@"
302 if [ ! -d "$sourcedir" ] ; then
303 echo "$0: $sourcedir is not a directory" 1>&2
304 exit 1
305 fi
306 if [ -r "$destinationdir" ] ; then
307 if [ -d "$destinationdir" ] ; then
308 echo "$0: $destinationdir already exists" 1>&2
309 exit 1
310 else
311 echo "$0: $destinationdir is not a directory" 1>&2
312 exit 1
313 fi
314 fi
315 for moduledir in $moduledirs; do
316 if [ ! -d "$moduledir" ] ; then
317 echo "$0: $moduledir is not a directory" 1>&2
318 exit 1
319 fi
320 done
321 mkdir "$destinationdir"
322 absolute_currentdir=`/bin/pwd`
323 absolute_sourcedir=`cd "$sourcedir" ; /bin/pwd`
324 absolute_destinationdir=`cd "$destinationdir" ; /bin/pwd`
325 installbasedir=`dirname "$sourcedir"`
326 # What to do if we abort.
327 trap 'rm -rf "$absolute_destinationdir"' 1 2 15
328 if [ "$absolute_sourcedir" = "$absolute_destinationdir" ] ; then
329 echo "$0: directories $sourcedir and $destinationdir may not be the same" 1>&2
330 exit 1
331 fi
332 if [ ! -r "$sourcedir"/lisp.a -o ! -x "$sourcedir"/lisp.run -o ! -r "$sourcedir"/lispinit.mem -o ! -r "$sourcedir"/modules.h -o ! -r "$sourcedir"/modules.o -o ! -r "$sourcedir"/makevars ] ; then
333 echo "$0: directory $sourcedir does not contain a clisp linking set" 1>&2
334 exit 1
335 fi
336 for moduledir in $moduledirs; do
337 if [ ! -r "$moduledir/link.sh" ] ; then
338 echo "$0: directory $moduledir does not contain a clisp module" 1>&2
339 exit 1
340 fi
341 done
342 # Read the variables CC, CFLAGS, CLFLAGS, LIBS, X_LIBS, RANLIB, FILES
343 . "$sourcedir"/makevars
344 if [ -z "$moduledirs" ] ; then
345 # Just make links from $destinationdir to $sourcedir
346 for f in lisp.run lispinit.mem modules.h modules.o makevars ${FILES}; do
347 link "$sourcedir"/$f "$destinationdir"/$f
348 done
349 else
350 # Prepare the module directories and read their variables
351 allmodulevars=''
352 for moduledir in $moduledirs; do
353 modulename=`echo "$moduledir" | sed -e 's,^.*/,,'`
354 # Prepare the module directory and read the variables NEW_FILES, NEW_LIBS
355 NEW_FILES=''
356 NEW_LIBS=''
357 NEW_MODULES=''
358 TO_PRELOAD=''
359 TO_LOAD=''
360 cd "$moduledir"
361 . ./link.sh
362 cd "$absolute_currentdir"
363 # This is a crazy way to build doubly nested lists.
364 allmodulevars="$allmodulevars""@@SEP1@@""moduledir=\""`echo "$moduledir" | sed -e 's,",\\\\",g' -e 's, ,@@SEP3@@,g'`"\""
365 allmodulevars="$allmodulevars""@@SEP2@@""modulename=\""`echo "$modulename" | sed -e 's,",\\\\",g' -e 's, ,@@SEP3@@,g'`"\""
366 allmodulevars="$allmodulevars""@@SEP2@@""NEW_FILES=\""`echo "$NEW_FILES" | sed -e 's,",\\\\",g' -e 's, ,@@SEP3@@,g'`"\""
367 allmodulevars="$allmodulevars""@@SEP2@@""NEW_LIBS=\""`echo "$NEW_LIBS" | sed -e 's,",\\\\",g' -e 's, ,@@SEP3@@,g'`"\""
368 allmodulevars="$allmodulevars""@@SEP2@@""NEW_MODULES=\""`echo "$NEW_MODULES" | sed -e 's,",\\\\",g' -e 's, ,@@SEP3@@,g'`"\""
369 allmodulevars="$allmodulevars""@@SEP2@@""TO_PRELOAD=\""`echo "$TO_PRELOAD" | sed -e 's,",\\\\",g' -e 's, ,@@SEP3@@,g'`"\""
370 allmodulevars="$allmodulevars""@@SEP2@@""TO_LOAD=\""`echo "$TO_LOAD" | sed -e 's,",\\\\",g' -e 's, ,@@SEP3@@,g'`"\""
371 done
372 # Generate new modules.h
373 (cat "$sourcedir"/modules.h
374 for modulevars in `echo $allmodulevars | sed -e 's,@@SEP1@@, ,g'`; do
375 for assignment in `echo $modulevars | sed -e 's,@@SEP2@@, ,g'`; do
376 eval `echo $assignment | sed -e 's,@@SEP3@@, ,g'`
377 done
378 for mod in $NEW_MODULES ; do
379 echo 'MODULE('"$mod"')'
380 done
381 done) > "$destinationdir"/modules.h
382 # Generate new lisp.a
383 for f in ${FILES}; do
384 link "$sourcedir"/$f "$destinationdir"/$f
385 done
386 PRELOAD=''
387 LOAD=''
388 for modulevars in `echo $allmodulevars | sed -e 's,@@SEP1@@, ,g'`; do
389 for assignment in `echo $modulevars | sed -e 's,@@SEP2@@, ,g'`; do
390 eval `echo $assignment | sed -e 's,@@SEP3@@, ,g'`
391 done
392 # Generate other libraries
393 for f in ${NEW_FILES}; do
394 link "$moduledir"/$f "$destinationdir"/$f
395 done
396 # Update the LIBS and FILES variables
397 LIBS=${NEW_LIBS}' '${LIBS}
398 FILES=${FILES}' '${NEW_FILES}
399 for f in $TO_PRELOAD; do
400 PRELOAD=${PRELOAD}' '"$moduledir/$f"
401 done
402 for f in $TO_LOAD; do
403 LOAD=${LOAD}' '"$moduledir/$f"
404 done
405 done
406 # Generate new modules.o, compiled from modules.c, includes new modules.h
407 (cd "$destinationdir" ; link "$absolute_linkkitdir"/modules.c modules.c ; verbose ${CC} ${CFLAGS} -I"$absolute_linkkitdir" -c modules.c ; rm -f modules.c)
408 # Generate new lisp.run
409 (cd "$destinationdir" ; verbose ${CC} ${CFLAGS} ${CLFLAGS} modules.o ${LIBS} -o lisp.run)
410 if [ -n "$PRELOAD" ] ; then
411 # Generate new preliminary lispinit.mem
412 verbose "$sourcedir"/lisp.run -B "$installbasedir" -M "$sourcedir"/lispinit.mem -norc -q -i ${PRELOAD} -x "(saveinitmem \"$destinationdir/lispinit.mem\")"
413 fi
414 # Generate new lispinit.mem
415 if [ -n "$PRELOAD" ] ; then
416 verbose "$destinationdir"/lisp.run -B "$installbasedir" -M "$destinationdir"/lispinit.mem -norc -q -i ${LOAD} -x "(saveinitmem \"$destinationdir/lispinit.mem\")"
417 else
418 verbose "$destinationdir"/lisp.run -B "$installbasedir" -M "$sourcedir"/lispinit.mem -norc -q -i ${LOAD} -x "(saveinitmem \"$destinationdir/lispinit.mem\")"
419 fi
420 # Generate new makevars
421 LIBS=`echo $LIBS | sed s/','/'\\,'/g`
422 sed -e "s,^LIBS=.*\$,LIBS='${LIBS}'," -e "s,^FILES=.*\$,FILES='${FILES}'," < "$sourcedir"/makevars > "$destinationdir"/makevars
423 fi
424 # Done.
425 trap '' 1 2 15
426 ;;
427
428 run)
429 # This is functionally the same as an add-module-sets command, followed
430 # by running the resulting linking set, but is faster and requires less
431 # disk space if dynamic loading is available.
432 # Usage: clisp-link run source-dir moduledir...
433 if [ $# -lt 2 ] ; then
434 echo "Usage: $0 run source-dir moduledir..." 1>&2
435 exit 1
436 fi
437 sourcedir="$2"
438 installbasedir=`dirname "$sourcedir"`
439 shift
440 shift
441 if test -n ""; then
442 moduledirs="$@"
443 if [ ! -d "$sourcedir" ] ; then
444 echo "$0: $sourcedir is not a directory" 1>&2
445 exit 1
446 fi
447 for moduledir in $moduledirs; do
448 if [ ! -d "$moduledir" ] ; then
449 echo "$0: $moduledir is not a directory" 1>&2
450 exit 1
451 fi
452 done
453 absolute_currentdir=`/bin/pwd`
454 if [ ! -r "$sourcedir"/lisp.a -o ! -x "$sourcedir"/lisp.run -o ! -r "$sourcedir"/lispinit.mem -o ! -r "$sourcedir"/modules.h -o ! -r "$sourcedir"/modules.o -o ! -r "$sourcedir"/makevars ] ; then
455 echo "$0: directory $sourcedir does not contain a clisp linking set" 1>&2
456 exit 1
457 fi
458 for moduledir in $moduledirs; do
459 if [ ! -r "$moduledir/link.sh" ] ; then
460 echo "$0: directory $moduledir does not contain a clisp module" 1>&2
461 exit 1
462 fi
463 done
464 # Read the variables CC, CFLAGS, CLFLAGS, LIBS, X_LIBS, RANLIB, FILES
465 . "$sourcedir"/makevars
466 if [ -z "$moduledirs" ] ; then
467 "$sourcedir"/lisp.run -B "$installbasedir" -M "$sourcedir"/lispinit.mem
468 else
469 # Prepare the module directories and read their variables
470 allmodulevars=''
471 for moduledir in $moduledirs; do
472 modulename=`echo "$moduledir" | sed -e 's,^.*/,,'`
473 # Prepare the module directory and read the variables NEW_FILES, NEW_LIBS
474 NEW_FILES=''
475 NEW_LIBS=''
476 NEW_MODULES=''
477 TO_PRELOAD=''
478 TO_LOAD=''
479 cd "$moduledir"
480 . ./link.sh
481 cd "$absolute_currentdir"
482 # This is a crazy way to build doubly nested lists.
483 allmodulevars="$allmodulevars""@@SEP1@@""moduledir=\""`echo "$moduledir" | sed -e 's,",\\\\",g' -e 's, ,@@SEP3@@,g'`"\""
484 allmodulevars="$allmodulevars""@@SEP2@@""modulename=\""`echo "$modulename" | sed -e 's,",\\\\",g' -e 's, ,@@SEP3@@,g'`"\""
485 allmodulevars="$allmodulevars""@@SEP2@@""NEW_FILES=\""`echo "$NEW_FILES" | sed -e 's,",\\\\",g' -e 's, ,@@SEP3@@,g'`"\""
486 allmodulevars="$allmodulevars""@@SEP2@@""NEW_LIBS=\""`echo "$NEW_LIBS" | sed -e 's,",\\\\",g' -e 's, ,@@SEP3@@,g'`"\""
487 allmodulevars="$allmodulevars""@@SEP2@@""NEW_MODULES=\""`echo "$NEW_MODULES" | sed -e 's,",\\\\",g' -e 's, ,@@SEP3@@,g'`"\""
488 allmodulevars="$allmodulevars""@@SEP2@@""TO_PRELOAD=\""`echo "$TO_PRELOAD" | sed -e 's,",\\\\",g' -e 's, ,@@SEP3@@,g'`"\""
489 allmodulevars="$allmodulevars""@@SEP2@@""TO_LOAD=\""`echo "$TO_LOAD" | sed -e 's,",\\\\",g' -e 's, ,@@SEP3@@,g'`"\""
490 done
491 PRELOAD=''
492 LINKLIBS=''
493 MODULES=''
494 LOAD=''
495 for modulevars in `echo $allmodulevars | sed -e 's,@@SEP1@@, ,g'`; do
496 for assignment in `echo $modulevars | sed -e 's,@@SEP2@@, ,g'`; do
497 eval `echo $assignment | sed -e 's,@@SEP3@@, ,g'`
498 done
499 for f in $TO_PRELOAD; do
500 PRELOAD=${PRELOAD}' '"$moduledir/$f"
501 done
502 NEW_LIBS_ABS=''
503 for f in ${NEW_LIBS}; do
504 case "$f" in
505 -* | /*) NEW_LIBS_ABS="$NEW_LIBS_ABS $f" ;;
506 *) NEW_LIBS_ABS="$NEW_LIBS_ABS $moduledir/$f" ;;
507 esac
508 done
509 LINKLIBS=${NEW_LIBS_ABS}' '${LINKLIBS}
510 for mod in $NEW_MODULES; do
511 MODULES=${MODULES}' '"$mod"
512 done
513 for f in $TO_LOAD; do
514 LOAD=${LOAD}' '"$moduledir/$f"
515 done
516 done
517 tmpsharedlib="${TMPDIR-/tmp}/clisplink$$.so"
518 tmpinitlisp="${TMPDIR-/tmp}/clisplink$$.lisp"
519 # What to do if we abort.
520 trap 'rm -f "$tmpsharedlib" "$tmpinitlisp"' 0 1 2 15
521 # Create an initialization file with a couple of load forms.
522 (for f in $PRELOAD; do echo "(load \"${f}\")"; done
523 echo "(system::dynload-modules \"$tmpsharedlib\" (quote ("
524 for mod in $MODULES; do echo " \"${mod}\""; done
525 echo ")))"
526 for f in $LOAD; do echo "(load \"${f}\")"; done ) > "$tmpinitlisp"
527 # Create a shared library.
528 lib="$tmpsharedlib"; libs="$LINKLIBS"; verbose
529 # Run clisp, attach the shared library and load the Lisp stuff.
530 "$sourcedir"/lisp.run -B "$installbasedir" -M "$sourcedir"/lispinit.mem -i "$tmpinitlisp"
531 rm -f "$tmpsharedlib" "$tmpinitlisp"
532 trap '' 0 1 2 15
533 fi
534 else
535 destinationdir="${TMPDIR-/tmp}/clisplink$$"
536 # What to do if we abort.
537 trap 'rm -rf "$destinationdir"' 0 1 2 15
538 "$0" add-module-sets "$sourcedir" "$destinationdir" "$@" && "$destinationdir"/lisp.run -B "$installbasedir" -M "$destinationdir"/lispinit.mem
539 rm -rf "$destinationdir"
540 trap '' 0 1 2 15
541 fi
542 ;;
543
544 *) usage;;
545 esac
546

  ViewVC Help
Powered by ViewVC 1.1.5