source: branches/0.26.x/abcl/build-from-lisp.sh

Last change on this file was 13041, checked in by Mark Evenson, 13 years ago

Reworked Lisp-based build now works for ecl.

Based on a patch from Pascal J. Bourguignon.

Refactored elements of Lisp-based build to improve error handling and
present more of a informative view of what is occuring.

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 2.5 KB
Line 
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
6usage()
7{
8   echo "$0 <implementation> [[ --clean=T | --full=T | --batch=NIL ]]"
9}
10
11if [ -z "$1" ]; then
12    usage
13    exit 1
14fi
15
16check_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
31IMPL="$1"
32TEMP=$(getopt --long clean:,full:,batch: -n "$0" -- "$@") 
33
34if [ $? != 0 ] ; then 
35    usage
36    exit 1
37fi
38eval set -- "$TEMP"
39
40CLEAN="t"
41FULL="t"
42BATCH="t"
43
44while 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
64done
65
66FORM="(build-abcl:build-abcl :clean $CLEAN :full $FULL :batch $BATCH)"
67FILE="build-abcl.lisp"
68
69
70abcl()
71{
72    exec "$1" --load "$2" --eval "(progn $3 (ext:quit))"
73}
74
75ecl()
76{
77    exec "$1" -norc -load "$2" -eval "(progn $3 (ext:quit))"
78}
79
80clisp()
81{ 
82    exec "$1" -ansi -q -norc -i "$2" -x "(progn $3 (ext:quit))"
83}
84
85sbcl()
86{
87    exec "$1" --no-userinit --load "$2" --eval "(progn $3 (sb-ext:quit))"
88}
89
90cmucl()
91{
92    exec "$1" -noinit -load "$2" -eval '(setq *load-verbose* nil)' \
93                                 -eval "(progn $3 (ext:quit))"
94}
95
96ccl()
97{
98    exec "$1" -Q --no-init --load "$2" --eval "(progn $3 (ccl:quit))"
99}
100
101notimplemented()
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
114case "$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        ;;
136esac
Note: See TracBrowser for help on using the repository browser.