and change the shell files to use them.
#!/bin/sh
#
-# $Id: build-bands.sh,v 1.12 2007/06/06 19:42:39 cph Exp $
+# $Id: build-bands.sh,v 1.13 2007/06/15 03:40:10 cph Exp $
#
# Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
# 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
set -e
-(
-echo "cd runtime"
-cd runtime
+. etc/functions.sh
-if [ -f make.o ]; then
- FASL=http://www.gnu.org/software/mit-scheme/lib/runtime/make.so
-elif [ -f make.com ]; then
- FASL=make.com
-else
- echo "Can't find argument for --fasl."
- exit 1
-fi
+FASL=`get_fasl_file`
-CMD="../microcode/scheme --library ../lib --fasl ${FASL}"
-echo "${CMD}"
-eval "${CMD}" <<EOF
-(disk-save "../lib/runtime.com")
-EOF
-)
-
-CMD="microcode/scheme --library lib --heap 3000"
-echo "${CMD}"
-eval "${CMD}" <<EOF
+run_cmd_in_dir runtime ../microcode/scheme --library ../lib --heap 6000 \
+ --fasl "${FASL}" <<EOF
(begin
- (load-option (quote COMPILER))
- (load-option (quote EDWIN))
- (disk-save "lib/all.com"))
+ (disk-save "../lib/runtime.com")
+ (load-option (quote compiler))
+ (load-option (quote edwin))
+ (disk-save "../lib/all.com"))
EOF
#!/bin/sh
#
-# $Id: build-boot-compiler.sh,v 1.2 2007/06/08 06:03:44 cph Exp $
+# $Id: build-boot-compiler.sh,v 1.3 2007/06/15 03:40:11 cph Exp $
#
# Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
# 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
set -e
-cd runtime
+. etc/functions.sh
-if [ -f make.o ]; then
- FASL=http://www.gnu.org/software/mit-scheme/lib/runtime/make.so
-elif [ -f make.com ]; then
- FASL=make.com
-else
- echo "Can't find argument for --fasl."
- exit 1
-fi
+FASL=`get_fasl_file`
-CMD="../microcode/scheme --library ../lib --fasl ${FASL} --heap 6000"
-echo "${CMD}"
-eval "${CMD}" <<EOF
+run_cmd_in_dir runtime ../microcode/scheme --library ../lib \
+ --fasl "${FASL}" --heap 6000 <<EOF
(begin
(load-option (quote compiler))
(load-option (quote cref))
#!/bin/sh
#
-# $Id: c-compile.sh,v 1.7 2007/05/14 16:50:43 cph Exp $
+# $Id: c-compile.sh,v 1.8 2007/06/15 03:40:12 cph Exp $
#
# Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
# 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
set -e
-SCHEME_COMPILER="${@}"" --heap 6000 --stack 200"
-echo "${SCHEME_COMPILER}"
-eval "${SCHEME_COMPILER}" <<EOF
+. etc/functions.sh
+
+run_cmd "${@}" --heap 6000 --stack 200 <<EOF
(begin
(load "etc/compile.scm")
(c-compile))
#!/bin/sh
#
-# $Id: c-prepare.sh,v 1.9 2007/06/09 02:38:00 cph Exp $
+# $Id: c-prepare.sh,v 1.10 2007/06/15 03:40:15 cph Exp $
#
# Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
# 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
set -e
+. etc/functions.sh
+
if [ ${#} -eq 1 ]; then
EXE=${1}
else
echo "usage: ${0} <executable>"
exit 1
fi
-CMD="${EXE} --heap 6000 --stack 200"
-echo "${CMD}"
-${CMD} <<EOF
+run_cmd "${EXE}" --heap 6000 --stack 200 <<EOF
(begin
(load "etc/compile.scm")
(c-prepare))
#!/bin/sh
#
-# $Id: compile-boot-compiler.sh,v 1.1 2007/06/06 19:42:39 cph Exp $
+# $Id: compile-boot-compiler.sh,v 1.2 2007/06/15 03:40:13 cph Exp $
#
# Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
# 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
set -e
+. etc/functions.sh
+
if [ ${#} -eq 1 ]; then
EXE=${1}
else
echo "usage: ${0} <executable>"
exit 1
fi
-CMD="${EXE} --heap 6000"
-echo "${CMD}"
-${CMD} <<EOF
+run_cmd "${EXE}" --heap 6000 <<EOF
(begin
(load "etc/compile.scm")
(compile-bootstrap-1))
EOF
-echo "${CMD} --compiler"
-${CMD} --compiler <<EOF
+run_cmd "${EXE}" --heap 6000 --compiler <<EOF
(begin
(load "etc/compile.scm")
(compile-bootstrap-2))
#!/bin/sh
#
-# $Id: compile.sh,v 1.12 2007/05/06 14:17:10 cph Exp $
+# $Id: compile.sh,v 1.13 2007/06/15 03:40:14 cph Exp $
#
# Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
# 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
set -e
+. etc/functions.sh
+
if [ ${#} -eq 0 ]; then
- SCHEME_COMPILER="mit-scheme --compiler"
-else
- SCHEME_COMPILER=${1}
- shift
- while [ ${#} -gt 0 ]; do
- SCHEME_COMPILER="${SCHEME_COMPILER} ${1}"
- shift
- done
+ set mit-scheme --compiler
fi
-SCHEME_COMPILER="${SCHEME_COMPILER} --heap 6000 --stack 200"
-
-echo "${SCHEME_COMPILER}"
-exec ${SCHEME_COMPILER} <<EOF
+run_cmd "${@}" --heap 6000 --stack 200 <<EOF
(begin
(load "etc/compile.scm")
(compile-everything))
#!/bin/sh
-# $Id: create-makefiles.sh,v 1.1 2007/06/06 19:42:39 cph Exp $
+# $Id: create-makefiles.sh,v 1.2 2007/06/15 03:40:16 cph Exp $
#
# Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
# 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
set -e
+. etc/functions.sh
+
if [ ${#} -eq 1 ]; then
NATIVE_CODE=${1}
else
MDIR=`compiler/choose-machine.sh "${NATIVE_CODE}"`
-CMD="rm -f compiler/machine"
-echo "${CMD}"; eval "${CMD}"
-
-CMD="ln -s machines/${MDIR} compiler/machine"
-echo "${CMD}"; eval "${CMD}"
-
-CMD="rm -f compiler/compiler.pkg"
-echo "${CMD}"; eval "${CMD}"
-
-CMD="ln -s machine/compiler.pkg compiler/."
-echo "${CMD}"; eval "${CMD}"
+run_cmd rm -f compiler/machine
+run_cmd ln -s machines/"${MDIR}" compiler/machine
+run_cmd rm -f compiler/compiler.pkg
+run_cmd ln -s machine/compiler.pkg compiler/.
BUNDLES="6001 compiler cref edwin imail sf sos ssp star-parser xdoc xml"
-mit-scheme --heap 4000 <<EOF
+run_cmd mit-scheme --heap 4000 <<EOF
(begin
(load "etc/utilities")
(generate-c-bundles (quote (${BUNDLES})) "${MDIR}"))
#!/bin/sh
#
-# $Id: functions.sh,v 1.8 2007/05/14 16:50:46 cph Exp $
+# $Id: functions.sh,v 1.9 2007/06/15 03:40:17 cph Exp $
#
# Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
# 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# Functions for shell scripts.
-run_setup_cmd ()
+run_cmd ()
{
- echo "${1}"
- eval "${1}"
+ echo "run_cmd:" "${@}"
+ "${@}"
+}
+
+run_configure ()
+{
+ run_cmd ./configure "${@}"
+}
+
+run_make ()
+{
+ run_cmd make "${@}"
+}
+
+run_cmd_in_dir ()
+(
+ cd "${1}"
+ shift
+ run_cmd "${@}"
+)
+
+get_fasl_file ()
+{
+ if [ -f runtime/make.o ]; then
+ echo "http://www.gnu.org/software/mit-scheme/lib/runtime/make.so"
+ return 0
+ elif [ -f runtime/make.com ]; then
+ echo "make.com"
+ return 0
+ else
+ echo "Can't find argument for --fasl." >&2
+ return 1
+ fi
}
maybe_mkdir ()
{
if [ ! -e "${1}" ]; then
- run_setup_cmd "mkdir ${1}"
+ run_cmd mkdir "${1}"
fi
}
maybe_link ()
{
if [ ! -e "${1}" ] && [ ! -L "${1}" ]; then
- run_setup_cmd "ln -s ${2} ${1}"
+ run_cmd ln -s "${2}" "${1}"
fi
}
maybe_unlink ()
{
if maybe_unlink_p "${1}" "${2}"; then
- run_setup_cmd "rm ${1}"
+ run_cmd rm "${1}"
fi
}
maybe_rm ()
{
- FNS=
+ FILES=
DIRS=
for FN in "${@}"; do
if [ ! -L "${FN}" ]; then
if [ -f "${FN}" ]; then
- FNS="${FNS} ${FN}"
+ FILES="${FILES} ${FN}"
elif [ -d "${FN}" ]; then
DIRS="${DIRS} ${FN}"
fi
fi
done
- if [ "${FNS}" ]; then
- run_setup_cmd "rm -f ${FNS}"
+ if [ "${FILES}" ]; then
+ run_cmd rm -f ${FILES}
fi
if [ "${DIRS}" ]; then
- run_setup_cmd "rm -rf ${DIRS}"
+ run_cmd rm -rf ${DIRS}
fi
}
#!/bin/sh
#
-# $Id: install-bin-symlinks.sh,v 1.1 2007/05/02 13:51:50 cph Exp $
+# $Id: install-bin-symlinks.sh,v 1.2 2007/06/15 03:40:18 cph Exp $
#
# Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
# 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
set -e
+. `dirname "${0}"`/functions.sh
+
if [ ${#} -eq 2 ]; then
DIR=${1}
EXE=${2}
fi
if [ "${EXE}" != mit-scheme ] && [ ! -e "${DIR}/mit-scheme" ]; then
- echo "rm -f ${DIR}/mit-scheme"
- rm -f "${DIR}/mit-scheme"
- echo "ln -s ${EXE} ${DIR}/mit-scheme"
- ln -s "${EXE}" "${DIR}/mit-scheme"
+ run_cmd rm -f "${DIR}"/mit-scheme
+ run_cmd ln -s "${EXE}" "${DIR}"/mit-scheme
fi
-echo "rm -f ${DIR}/scheme ${DIR}/bchscheme"
-rm -f "${DIR}/scheme" "${DIR}/bchscheme"
-echo "ln -s mit-scheme ${DIR}/scheme"
-ln -s mit-scheme "${DIR}/scheme"
-echo "ln -s mit-scheme ${DIR}/bchscheme"
-ln -s mit-scheme "${DIR}/bchscheme"
+run_cmd rm -f "${DIR}"/scheme "${DIR}"/bchscheme
+run_cmd ln -s mit-scheme "${DIR}"/scheme
+run_cmd ln -s mit-scheme "${DIR}"/bchscheme
#!/bin/sh
#
-# $Id: make-liarc-dist.sh,v 1.1 2007/06/10 18:29:55 cph Exp $
+# $Id: make-liarc-dist.sh,v 1.2 2007/06/15 03:40:19 cph Exp $
#
# Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
# 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
set -e
-./Setup.sh
-./configure --enable-native-code=c "${@}"
-make liarc-dist
+. etc/functions.sh
+
+run_cmd ./Setup.sh
+run_configure --enable-native-code=c "${@}"
+run_make liarc-dist
#!/bin/sh
#
-# $Id: make-liarc.sh,v 1.1 2007/06/08 06:03:57 cph Exp $
+# $Id: make-liarc.sh,v 1.2 2007/06/15 03:40:20 cph Exp $
#
# Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
# 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
set -e
+. etc/functions.sh
+
FASTP=no
for ARG in "${@}"; do
case ${ARG} in
exec ./configure "${@}"
fi
-./configure --prefix=`pwd`/boot-root --enable-native-code=c
-make stamp_install-liarc-boot-compiler
-make c-clean distclean
+run_configure --prefix=`pwd`/boot-root --enable-native-code=c
+run_make stamp_install-liarc-boot-compiler
+run_make c-clean distclean
-./configure --enable-native-code=c "${@}"
-make stamp_compile-liarc-bundles
-make build-bands
+run_configure --enable-native-code=c "${@}"
+run_make stamp_compile-liarc-bundles
+run_make build-bands
#!/bin/sh
#
-# $Id: native-prepare.sh,v 1.2 2007/06/09 02:38:06 cph Exp $
+# $Id: native-prepare.sh,v 1.3 2007/06/15 03:40:21 cph Exp $
#
# Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
# 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
set -e
+. etc/functions.sh
+
if [ ${#} -eq 1 ]; then
EXE=${1}
else
echo "usage: ${0} <executable>"
exit 1
fi
-CMD="${EXE} --heap 6000 --stack 200"
-echo "${CMD}"
-${CMD} <<EOF
+run_cmd "${EXE}" --heap 6000 --stack 200 <<EOF
(begin
(load "etc/compile.scm")
(native-prepare))