1 | #!/bin/bash |
---|
2 | # $Id: build-from-lisp.sh 12052 2009-07-20 04:52:38Z mevenson $ |
---|
3 | # |
---|
4 | # Build ABCL from a supported Lisp |
---|
5 | |
---|
6 | usage() |
---|
7 | { |
---|
8 | echo "$0 <implementation> [[ --clean=T | --full=T | --batch=NIL ]]" |
---|
9 | } |
---|
10 | |
---|
11 | if [ -z "$1" ]; then |
---|
12 | usage |
---|
13 | exit 1 |
---|
14 | fi |
---|
15 | |
---|
16 | check_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 | |
---|
31 | IMPL="$1" |
---|
32 | TEMP=$(getopt --long clean:,full:,batch: -n "$0" -- "$@") |
---|
33 | |
---|
34 | if [ $? != 0 ] ; then |
---|
35 | usage |
---|
36 | exit 1 |
---|
37 | fi |
---|
38 | eval set -- "$TEMP" |
---|
39 | |
---|
40 | CLEAN="t" |
---|
41 | FULL="t" |
---|
42 | BATCH="t" |
---|
43 | |
---|
44 | while 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 |
---|
64 | done |
---|
65 | |
---|
66 | FORM="(build-abcl:build-abcl :clean $CLEAN :full $FULL :batch $BATCH)" |
---|
67 | FILE="build-abcl.lisp" |
---|
68 | |
---|
69 | |
---|
70 | abcl() |
---|
71 | { |
---|
72 | exec "$1" --load "$2" --eval "(progn $3 (ext:quit))" |
---|
73 | } |
---|
74 | |
---|
75 | clisp() |
---|
76 | { |
---|
77 | exec "$1" -ansi -q -norc -i "$2" -x "(progn $3 (ext:quit))" |
---|
78 | } |
---|
79 | |
---|
80 | sbcl() |
---|
81 | { |
---|
82 | exec "$1" --no-userinit --load "$2" --eval "(progn $3 (sb-ext:quit))" |
---|
83 | } |
---|
84 | |
---|
85 | cmucl() |
---|
86 | { |
---|
87 | exec "$1" -noinit -load "$2" -eval '(setq *load-verbose* nil)' \ |
---|
88 | -eval "(progn $3 (ext:quit))" |
---|
89 | } |
---|
90 | |
---|
91 | ccl() |
---|
92 | { |
---|
93 | exec "$1" -Q --no-init --load "$2" --eval "(progn $3 (ccl:quit))" |
---|
94 | } |
---|
95 | |
---|
96 | notimplemented() |
---|
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 | |
---|
109 | case "$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 | ;; |
---|
131 | esac |
---|