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