build-from-lisp.bash 2.58 KB
Newer Older
1
#!/usr/bin/env bash 
2 3 4 5 6 7
# $Id$
#
# Build ABCL from a supported Lisp

usage()
{
8 9
    echo
    echo "USAGE:"
10 11
        echo "$0 <implementation>"
#    echo "$0 <implementation> [[ --clean=T | --full=T | --batch=NIL ]]"
12 13 14 15 16 17 18 19 20
}

if [ -z "$1" ]; then
    usage
    exit 1
fi

check_boolean()
{
21 22 23 24 25 26 27 28 29
    case "$1" in
        [Tt]|[Nn][Ii][Ll])
            :;;
        *)
            usage
            echo "Error: Argument \`$1' is neither \"nil\" nor \"t\"."
            exit 1
            ;;
    esac
30 31 32 33 34 35 36 37 38 39 40
}

IMPL="$1"
TEMP=$(getopt --long clean:,full:,batch: -n "$0" -- "$@") 

if [ $? != 0 ] ; then 
    usage 
    exit 1
fi
eval set -- "$TEMP"

41
# TODO all ignored
42 43 44 45
CLEAN="t"
FULL="t"
BATCH="t"

46
# TODO all ignored
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
while true ; do
    case "$1" in
        --clean) 
            check_boolean "$2"
            CLEAN="$2" 
            shift 2 
            ;;
        --full)  
            check_boolean "$2"
            FULL="$2"
            shift 2 
            ;;
        --batch) 
            check_boolean "$2"
            BATCH="$2" 
            shift 2 
            ;;
        --) shift; break ;;
        *)  echo "Internal error!" ; exit 1 ;;
        esac
done

69 70
FORM="(abcl/build:abcl/build)"
FILE="src/org/abcl/lisp/build/build-abcl.lisp"
71 72 73 74 75 76

abcl()
{
    exec "$1" --load "$2" --eval "(progn $3 (ext:quit))"
}

77 78 79 80 81
ecl()
{
    exec "$1" -norc -load "$2" -eval "(progn $3 (ext:quit))"
}

82 83
clisp()
{ 
84
    exec "$1" -ansi -q -norc -i "$2" -x "(progn $3 (ext:quit))"
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
}

sbcl()
{
    exec "$1" --no-userinit --load "$2" --eval "(progn $3 (sb-ext:quit))"
}

cmucl()
{
    exec "$1" -noinit -load "$2" -eval '(setq *load-verbose* nil)' \
                                 -eval "(progn $3 (ext:quit))"
}

ccl()
{
    exec "$1" -Q --no-init --load "$2" --eval "(progn $3 (ccl:quit))"
}

notimplemented()
{
    usage
    echo "Error: The build script does not currently support $1."
    echo "It's easy to change, though. Look at $0, and send a patch!"
    exit 1
}



# We pass along and execute "$1" so users can pass "sbcl-cvs"
# etc. instead of "sbcl".

case "$IMPL" in
    abcl*)
        abcl  "$IMPL" "$FILE" "$FORM"          ;;
    clisp*)
        clisp "$IMPL" "$FILE" "$FORM"          ;;
    sbcl*)
        sbcl  "$IMPL" "$FILE" "$FORM"          ;;
    lisp)
        cmucl "$IMPL" "$FILE" "$FORM"          ;;   
    ccl*)
        ccl   "$IMPL" "$FILE" "$FORM"          ;;
    gcl*)
        notimplemented "$IMPL" "$FILE" "$FORM" ;;
    ecl*)
130
        ecl   "$IMPL" "$FILE" "$FORM"          ;;
131 132 133 134 135 136 137
    alisp*)
        notimplemented "$IMPL" "$FILE" "$FORM" ;;
    *)
        usage; 
        echo "Error: Unrecognized implementation: $IMPL"
        exit 1 
        ;;
138
esac