source: tags/1.4.0/build-from-lisp.bash

Last change on this file was 14846, checked in by Mark Evenson, 10 years ago

Exit from Bash build script if 'customizations.lisp' isn't present

Change extension of build script to denote usage of bash-isms.

More portabily use any bash found in PATH rather than relying on
absolute location (c.f. FreeBSD).

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 2.9 KB
Line 
1#!/usr/bin/env bash
2# $Id: build-from-lisp.bash 14846 2016-02-27 07:29:33Z mevenson $
3#
4# Build ABCL from a supported Lisp
5
6usage()
7{
8    echo "WARNING: This build method can produce slightly different results than"
9    echo "         the canonical Ant build method."
10    echo
11    echo "USAGE:"
12    echo "$0 <implementation> [[ --clean=T | --full=T | --batch=NIL ]]"
13}
14
15if [ -z "$1" ]; then
16    usage
17    exit 1
18fi
19
20check_boolean()
21{
22    case "$1" in
23        [Tt]|[Nn][Ii][Ll])
24            :;;
25        *)
26            usage
27            echo "Error: Argument \`$1' is neither \"nil\" nor \"t\"."
28            exit 1
29            ;;
30    esac
31}
32
33IMPL="$1"
34TEMP=$(getopt --long clean:,full:,batch: -n "$0" -- "$@") 
35
36if [ $? != 0 ] ; then 
37    usage
38    exit 1
39fi
40eval set -- "$TEMP"
41
42CLEAN="t"
43FULL="t"
44BATCH="t"
45
46while true ; do
47    case "$1" in
48        --clean) 
49            check_boolean "$2"
50            CLEAN="$2" 
51            shift 2 
52            ;;
53        --full) 
54            check_boolean "$2"
55            FULL="$2"
56            shift 2 
57            ;;
58        --batch) 
59            check_boolean "$2"
60            BATCH="$2" 
61            shift 2 
62            ;;
63        --) shift; break ;;
64        *)  echo "Internal error!" ; exit 1 ;;
65        esac
66done
67
68FORM="(build-abcl:build-abcl :clean $CLEAN :full $FULL :batch $BATCH)"
69FILE="build-abcl.lisp"
70
71if [[ ! -r customizations.lisp ]]; then
72    cat <<-EOF
73
74Failed to find configuration in 'customizations.lisp'.  Please copy
75'customizations.lisp.in' to 'customizations.lisp', editing it to
76reflect local configuration.
77
78EOF
79    exit 1
80fi
81
82
83
84abcl()
85{
86    exec "$1" --load "$2" --eval "(progn $3 (ext:quit))"
87}
88
89ecl()
90{
91    exec "$1" -norc -load "$2" -eval "(progn $3 (ext:quit))"
92}
93
94clisp()
95{ 
96    exec "$1" -ansi -q -norc -i "$2" -x "(progn $3 (ext:quit))"
97}
98
99sbcl()
100{
101    exec "$1" --no-userinit --load "$2" --eval "(progn $3 (sb-ext:quit))"
102}
103
104cmucl()
105{
106    exec "$1" -noinit -load "$2" -eval '(setq *load-verbose* nil)' \
107                                 -eval "(progn $3 (ext:quit))"
108}
109
110ccl()
111{
112    exec "$1" -Q --no-init --load "$2" --eval "(progn $3 (ccl:quit))"
113}
114
115notimplemented()
116{
117    usage
118    echo "Error: The build script does not currently support $1."
119    echo "It's easy to change, though. Look at $0, and send a patch!"
120    exit 1
121}
122
123
124
125# We pass along and execute "$1" so users can pass "sbcl-cvs"
126# etc. instead of "sbcl".
127
128case "$IMPL" in
129    abcl*)
130        abcl  "$IMPL" "$FILE" "$FORM"          ;;
131    clisp*)
132        clisp "$IMPL" "$FILE" "$FORM"          ;;
133    sbcl*)
134        sbcl  "$IMPL" "$FILE" "$FORM"          ;;
135    lisp)
136        cmucl "$IMPL" "$FILE" "$FORM"          ;;   
137    ccl*)
138        ccl   "$IMPL" "$FILE" "$FORM"          ;;
139    gcl*)
140        notimplemented "$IMPL" "$FILE" "$FORM" ;;
141    ecl*)
142        ecl   "$IMPL" "$FILE" "$FORM"          ;;
143    alisp*)
144        notimplemented "$IMPL" "$FILE" "$FORM" ;;
145    *)
146        usage; 
147        echo "Error: Unrecognized implementation: $IMPL"
148        exit 1 
149        ;;
150esac
Note: See TracBrowser for help on using the repository browser.