source: project/chicken/trunk/scripts/chicken-scheme @ 16115

Last change on this file since 16115 was 16115, checked in by felix winkelmann, 10 years ago

tweaks in chicken-scheme script

  • Property svn:executable set to *
File size: 1.2 KB
Line 
1#!/bin/bash
2### usage: chicken-scheme [-h] [FILENAME]
3#
4# variables:
5#
6# CHICKEN_SCHEME_DEBUG
7# CHICKEN_SCHEME_HOOK
8
9
10#XXX change these on installation:
11chickenprefix=${HOME}
12cscprogram=csc
13csiprogram=csi
14
15dbgoption=-S
16cache=${HOME}/.chicken-scheme.cache
17uname=`uname`
18wd=`pwd`
19
20if test "$1" == "-h"; then
21    echo "usage: chicken-scheme [-h] [FILENAME]"
22    exit 0
23fi
24
25if test -n "$CHICKEN_SCHEME_DEBUG"; then
26    set -x
27    dbgoption="${dbgoption} -v2"
28fi
29
30if test $# == 0; then
31    exec "${chickenprefix}/bin/${csiprogram}"
32else
33    prg="$1"
34fi
35
36if test "${uname}" = "Darwin"; then
37    prgh=`md5 -q ${prg}`
38else
39    prgh=`md5sum ${prg} | sed -n -e 's/\([^[:space:]]*\).*/\1/p'`
40fi
41
42compile_log="${cache}/${prgh}.compile"
43
44if test \! -d "${cache}"; then
45    mkdir -p "${cache}"
46fi
47
48if test "${prg}" -nt "${cache}/${prgh}"; then
49    if test -n "${CHICKEN_SCHEME_HOOK}"; then
50        ${CHICKEN_SCHEME_HOOK} "${prg}" "${cache}/${prgh}"
51    fi
52    if "${chickenprefix}/bin/${cscprogram}" ${dbgoption} "${prg}" -o "${cache}/${prgh}" > "${compile_log}" 2>&1; then :
53    else
54        cat "${compile_log}"
55        rm -f "${compile_log}"
56        exit 1
57    fi
58fi
59
60rm -f "${compile_log}"
61
62if test -x "${cache}/${prgh}"; then
63    shift
64    exec "${cache}/${prgh}" "$@"
65else
66    echo "can not run ${prg}"
67fi
Note: See TracBrowser for help on using the repository browser.