| 1 | #!/bin/bash |
|---|
| 2 | # $Id: build-from-lisp.sh 13041 2010-11-21 19:40:25Z 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 | ecl() |
|---|
| 76 | { |
|---|
| 77 | exec "$1" -norc -load "$2" -eval "(progn $3 (ext:quit))" |
|---|
| 78 | } |
|---|
| 79 | |
|---|
| 80 | clisp() |
|---|
| 81 | { |
|---|
| 82 | exec "$1" -ansi -q -norc -i "$2" -x "(progn $3 (ext:quit))" |
|---|
| 83 | } |
|---|
| 84 | |
|---|
| 85 | sbcl() |
|---|
| 86 | { |
|---|
| 87 | exec "$1" --no-userinit --load "$2" --eval "(progn $3 (sb-ext:quit))" |
|---|
| 88 | } |
|---|
| 89 | |
|---|
| 90 | cmucl() |
|---|
| 91 | { |
|---|
| 92 | exec "$1" -noinit -load "$2" -eval '(setq *load-verbose* nil)' \ |
|---|
| 93 | -eval "(progn $3 (ext:quit))" |
|---|
| 94 | } |
|---|
| 95 | |
|---|
| 96 | ccl() |
|---|
| 97 | { |
|---|
| 98 | exec "$1" -Q --no-init --load "$2" --eval "(progn $3 (ccl:quit))" |
|---|
| 99 | } |
|---|
| 100 | |
|---|
| 101 | notimplemented() |
|---|
| 102 | { |
|---|
| 103 | usage |
|---|
| 104 | echo "Error: The build script does not currently support $1." |
|---|
| 105 | echo "It's easy to change, though. Look at $0, and send a patch!" |
|---|
| 106 | exit 1 |
|---|
| 107 | } |
|---|
| 108 | |
|---|
| 109 | |
|---|
| 110 | |
|---|
| 111 | # We pass along and execute "$1" so users can pass "sbcl-cvs" |
|---|
| 112 | # etc. instead of "sbcl". |
|---|
| 113 | |
|---|
| 114 | case "$IMPL" in |
|---|
| 115 | abcl*) |
|---|
| 116 | abcl "$IMPL" "$FILE" "$FORM" ;; |
|---|
| 117 | clisp*) |
|---|
| 118 | clisp "$IMPL" "$FILE" "$FORM" ;; |
|---|
| 119 | sbcl*) |
|---|
| 120 | sbcl "$IMPL" "$FILE" "$FORM" ;; |
|---|
| 121 | lisp) |
|---|
| 122 | cmucl "$IMPL" "$FILE" "$FORM" ;; |
|---|
| 123 | ccl*) |
|---|
| 124 | ccl "$IMPL" "$FILE" "$FORM" ;; |
|---|
| 125 | gcl*) |
|---|
| 126 | notimplemented "$IMPL" "$FILE" "$FORM" ;; |
|---|
| 127 | ecl*) |
|---|
| 128 | ecl "$IMPL" "$FILE" "$FORM" ;; |
|---|
| 129 | alisp*) |
|---|
| 130 | notimplemented "$IMPL" "$FILE" "$FORM" ;; |
|---|
| 131 | *) |
|---|
| 132 | usage; |
|---|
| 133 | echo "Error: Unrecognized implementation: $IMPL" |
|---|
| 134 | exit 1 |
|---|
| 135 | ;; |
|---|
| 136 | esac |
|---|