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