source: trunk/abcl/build-from-lisp.sh @ 12046

Last change on this file since 12046 was 12046, checked in by Mark Evenson, 13 years ago

Shell script interface to building ABCL from within another Lisp. (Tobias Rittweiler)

Tested from SBCL, CLISP, and CCL.

  • Property svn:executable set to *
File size: 2.5 KB
Line 
1#!/bin/bash
2# $Id$
3#
4# Build ABCL from a supported Lisp
5
6usage()
7{
8   echo "$0 <implementation> [[ --clean=T | --full=T | --batch=NIL ]]"
9}
10
11if [ -z "$1" ]; then
12    usage
13    exit 1
14fi
15
16check_boolean()
17{
18    if [ "$1" == "t" ]   || \
19       [ "$1" == "T" ]   || \
20       [ "$1" == "nil" ] || \
21       [ "$1" == "NIL" ]
22    then
23        return
24    else
25        usage
26        echo "Error: Argument \`$1' is neither \"nil\" nor \"t\"."
27        exit 1
28    fi
29}
30
31IMPL="$1"
32TEMP=$(getopt --long clean:,full:,batch: -n "$0" -- "$@") 
33
34if [ $? != 0 ] ; then 
35    usage
36    exit 1
37fi
38eval set -- "$TEMP"
39
40CLEAN="t"
41FULL="t"
42BATCH="t"
43
44while true ; do
45    case "$1" in
46        --clean) 
47            check_boolean "$2"
48            CLEAN="$2" 
49            shift 2 
50            ;;
51        --full) 
52            check_boolean "$2"
53            FULL="$2"
54            shift 2 
55            ;;
56        --batch) 
57            check_boolean "$2"
58            BATCH="$2" 
59            shift 2 
60            ;;
61        --) shift; break ;;
62        *)  echo "Internal error!" ; exit 1 ;;
63        esac
64done
65
66FORM="(build-abcl:build-abcl :clean $CLEAN :full $FULL :batch $BATCH)"
67FILE="build-abcl.lisp"
68
69
70abcl()
71{
72    exec "$1" --load "$2" --eval "(progn $3 (ext:quit))"
73}
74
75clisp()
76{ 
77    exec "$1" -ansi -q -norc -i "$2" -x "(progn $3 (ext:quit)"
78}
79
80sbcl()
81{
82    exec "$1" --no-userinit --load "$2" --eval "(progn $3 (sb-ext:quit))"
83}
84
85cmucl()
86{
87    exec "$1" -noinit -load "$2" -eval '(setq *load-verbose* nil)' \
88                                 -eval "(progn $3 (ext:quit))"
89}
90
91ccl()
92{
93    exec "$1" -Q --no-init --load "$2" --eval "(progn $3 (ccl:quit))"
94}
95
96notimplemented()
97{
98    usage
99    echo "Error: The build script does not currently support $1."
100    echo "It's easy to change, though. Look at $0, and send a patch!"
101    exit 1
102}
103
104
105
106# We pass along and execute "$1" so users can pass "sbcl-cvs"
107# etc. instead of "sbcl".
108
109case "$IMPL" in
110    abcl*)
111        abcl  "$IMPL" "$FILE" "$FORM"          ;;
112    clisp*)
113        clisp "$IMPL" "$FILE" "$FORM"          ;;
114    sbcl*)
115        sbcl  "$IMPL" "$FILE" "$FORM"          ;;
116    lisp)
117        cmucl "$IMPL" "$FILE" "$FORM"          ;;   
118    ccl*)
119        ccl   "$IMPL" "$FILE" "$FORM"          ;;
120    gcl*)
121        notimplemented "$IMPL" "$FILE" "$FORM" ;;
122    ecl*)
123        notimplemented "$IMPL" "$FILE" "$FORM" ;;
124    alisp*)
125        notimplemented "$IMPL" "$FILE" "$FORM" ;;
126    *)
127        usage; 
128        echo "Error: Unrecognized implementation: $IMPL"
129        exit 1 
130        ;;
131esac
Note: See TracBrowser for help on using the repository browser.