@@ -0,0 +1,48 @@
1+#!/usr/bin/env sh
2+
3+SRC_DIR="src"
4+OUT_DIR="out"
5+
6+set -e
7+
8+if [[ -z "${SCHEME}" ]]; then
9+ SCHEME="chez"
10+else
11+ SCHEME="${SCHEME}"
12+fi
13+
14+if [ ! -d "${OUT_DIR}" ]; then
15+ mkdir -p "${OUT_DIR}"
16+fi
17+
18+# Building
19+
20+echo | $SCHEME --libdirs $SRC_DIR -q << EOF
21+; setup compiler flags...
22+(generate-covin-files #f)
23+(compile-profile #f)
24+(debug-level 0)
25+(cp0-effort-limit 1)
26+(cp0-score-limit 1)
27+(cp0-outer-unroll-limit 1)
28+(compile-interpret-simple #f)
29+(enable-cross-library-optimization #t)
30+(generate-inspector-information #f)
31+(generate-procedure-source-information #t)
32+(generate-interrupt-trap #t)
33+
34+; compile the program
35+(compile-library "${SRC_DIR}/fac.ss" "${OUT_DIR}/fac.so")
36+(compile-program "${SRC_DIR}/main.ss" "${OUT_DIR}/main.so")
37+EOF
38+
39+# Running
40+
41+$SCHEME --libdirs $OUT_DIR --program ./out/main.so
42+
43+# Note how in both building and running, we specified the libdirs parameter.
44+#
45+# For distributing binaries, we would want to do the following:
46+#
47+# 1. Install built objects somewhere, usually this would be `$PREFIX/lib/`
48+# 2. Generate a shell script that passes libdirs, this would be in `$PREFIX/bin`