Debian Codegraph @

xbin/cafeobj.in.in

raw
1 #!/bin/sh
2 #
3 # cafeobj wrapper script
4 #
5 # Copyright (c) 2000-2014 Toshimi Sawada. All rights reserved.
6 # Copyright (c) 2014-2015 Norbert Preining. All rights reserved.
7 #
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions
10 # are met:
11 #
12 # * Redistributions of source code must retain the above copyright
13 # notice, this list of conditions and the following disclaimer.
14 #
15 # * Redistributions in binary form must reproduce the above
16 # copyright notice, this list of conditions and the following
17 # disclaimer in the documentation and/or other materials
18 # provided with the distribution.
19 #
20 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
21 # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
24 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
26 # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #
32
33 # TODO
34 # - cmd line for ignoring choices, or extending it with
35 # imagine dist install with local alisp!!!
36
37 acl_interp=@acl_interp@
38 sbcl_interp=@sbcl_interp@
39 cmu_interp=@cmu_interp@
40 clisp_interp=@clisp_interp@
41 gcl_interp=@gcl_interp@
42 ccl32_interp=@ccl32_interp@
43 ccl64_interp=@ccl64_interp@
44
45 # support traditional layout
46 traditional_layout=@enable_traditional_layout@
47 extra=
48 if test "x@enable_traditional_layout@" = "xyes" ; then
49 extra=bin/
50 fi
51 acl_dump=${extra}acl/@acl_dump@
52 acl_standalone_dump=${extra}acl-standalone/@acl_standalone_dump@
53 sbcl_dump=${extra}sbcl/@sbcl_dump@
54 cmu_dump=${extra}cmu/@cmu_dump@
55 clisp_dump=${extra}clisp/@clisp_dump@
56 gcl_dump=${extra}gcl/@gcl_dump@
57 ccl32_dump=${extra}ccl/@ccl32_dump@
58 ccl64_dump=${extra}ccl64/@ccl64_dump@
59
60 binpath=`dirname "$0"`
61 libpath="$binpath/../@LIBPATH@"
62 sharepath="$binpath/../@SHAREPATH@"
63
64 dohelp=0
65
66 engine=@FIRSTCHOICE@
67
68 while [ $# -gt 0 ]
69 do
70 key="$1"
71 case $key in
72 # don't shift away, will be handled by the cafeobj interpreter
73 -h|-help|--help) dohelp=1 ; break ;;
74 -engine|--engine) shift ; engine="$1" ; shift ;;
75 -wrapper-libpath|--wrapper-libpath) shift ; libpath="$1" ; shift ;;
76 -wrapper-sharepath|--wrapper-sharepath) shift ; sharepath="$1" ; shift ;;
77 -list-engines|--list-engines)
78 shift
79 engines=""
80 if [ -r "$libpath/$ccl32_dump" ] ; then engines="ccl $engines" ; fi
81 if [ -r "$libpath/$ccl64_dump" ] ; then engines="ccl64 $engines" ; fi
82 if [ -r "$libpath/$gcl_dump" ] ; then engines="gcl $engines" ; fi
83 if [ -r "$libpath/$cmu_dump" ] ; then engines="cmu $engines" ; fi
84 if [ -r "$libpath/$clisp_dump" ] ; then engines="clisp $engines" ; fi
85 if [ -r "$libpath/$sbcl_dump" ] ; then engines="sbcl $engines" ; fi
86 if [ -r "$libpath/$acl_standalone_dump" ] ; then engines="acl-standalone $engines" ; fi
87 if [ -r "$libpath/$acl_dump" -o -r "$libpath/$acl_standalone_dump" ] ; then engines="acl $engines" ; fi
88 echo "Available engine dumps: $engines"
89 exit 0 ;;
90 --) break ;;
91 *) break ;;
92 esac
93 done
94
95 if [ "$dohelp" = 1 ] ; then
96 echo '
97 Usage: cafeobj [wrapper-options] [options] files ...
98
99 Wrapper options:
100 -engine NAME select the underlying Common Lisp engine.
101 -list-engines lists all available common lisp engines
102 -wrapper-libpath PATH sets the path to memory dumps
103 -wrapper-sharepath PATH sets the path to CafeOBJ initialization files
104 '
105 fi
106
107 case "x$engine" in
108 xacl)
109 if [ -r "$libpath/$acl_dump" ] ; then
110 exec "$acl_interp" -I "$libpath/$acl_dump" -- -prefix "$sharepath" $*
111 elif [ -r "$libpath/$acl_standalone_dump" ] ; then
112 exec "$libpath/$acl_standalone_dump" -- -prefix "$sharepath" $*
113 else
114 echo "ACL dump file not found: $libpath/$acl_dump" 2>&1
115 exit 1
116 fi
117 ;;
118 xacl-standalone)
119 if [ -r "$libpath/$acl_standalone_dump" ] ; then
120 exec "$libpath/$acl_standalone_dump" -- -prefix "$sharepath" $*
121 else
122 echo "ACL standalone dump file not found: $libpath/$acl_standalone_dump" 2>&1
123 exit 1
124 fi
125 ;;
126 xclisp)
127 if [ -r "$libpath/$clisp_dump" ] ; then
128 exec "$clisp_interp" -M "$libpath/$clisp_dump" $*
129 else
130 echo "CLISP dump file not found: $libpath/$clisp_dump" 2>&1
131 exit 1
132 fi
133 ;;
134 xcmu)
135 if [ -r "$libpath/$cmu_dump" ] ; then
136 exec "$cmu_interp" -core "$libpath/$cmu_dump" $*
137 else
138 echo "CMU dump file not found: $libpath/$cmu_dump" 2>&1
139 exit 1
140 fi
141 ;;
142 xgcl)
143 if [ -r "$libpath/$gcl_dump" ] ; then
144 exec "$libpath/$gcl_dump" $*
145 else
146 echo "GCL dump file not found: $libpath/$gcl_dump" 2>&1
147 exit 1
148 fi
149 ;;
150 xccl)
151 if [ -r "$libpath/$ccl_dump" ] ; then
152 exec "$ccl_interp" "$libpath/$ccl_dump" $*
153 else
154 echo "CCL dump file not found: $libpath/$ccl_dump" 2>&1
155 exit 1
156 fi
157 ;;
158 xccl64)
159 if [ -r "$libpath/$ccl64_dump" ] ; then
160 exec "$ccl64_interp" "$libpath/$ccl64_dump" $*
161 else
162 echo "CCL64 dump file not found: $libpath/$ccl64_dump" 2>&1
163 exit 1
164 fi
165 ;;
166 xsbcl)
167 if [ -r "$libpath/$sbcl_dump" ] ; then
168 exec "$libpath/$sbcl_dump" -prefix "$sharepath" $*
169 else
170 echo "SBCL dump file not found: $libpath/$sbcl_dump" 2>&1
171 exit 1
172 fi
173 ;;
174 *)
175 echo "CafeOBJ: unknown engine selection $engine" >&2
176 exit 1
177 ;;
178 esac
179