-
Notifications
You must be signed in to change notification settings - Fork 111
Expand file tree
/
Copy pathmake.sh
More file actions
executable file
·99 lines (87 loc) · 2.13 KB
/
make.sh
File metadata and controls
executable file
·99 lines (87 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/sh
set -e
BASE=$(dirname "$0")
cd "$BASE"
# Defaults
HOST=sbcl
JSCL_PATH=""
OUTPUT_DIR="dist/"
VERBOSE=nil
usage() {
cat <<EOF
Usage: $0 [OPTIONS]
Build JSCL (jscl.js, REPLs, and test suite).
Options:
--sbcl Use SBCL as host compiler (default)
--jscl=<path> Use JSCL binary as host compiler
-o <dir> Output directory (default: dist/)
-v Verbose output
--help Show this help message
EOF
}
while [ $# -gt 0 ]; do
case "$1" in
--sbcl)
HOST=sbcl
shift
;;
--jscl=*)
HOST=jscl
JSCL_PATH="${1#--jscl=}"
shift
;;
-o)
OUTPUT_DIR="$2"
shift 2
;;
-v)
VERBOSE=t
shift
;;
--help|-h)
usage
exit 0
;;
*)
echo "Unknown option: $1" >&2
usage >&2
exit 1
;;
esac
done
# Unix timestamp of the commit we are building
export SOURCE_DATE_EPOCH=$(git show -s --format=%ct HEAD)
mkdir -p "$OUTPUT_DIR"
tmpfile=$(mktemp /tmp/jscl-make.XXXXXX.lisp)
cat > "$tmpfile" << EOF
(load "jscl.lisp")
(jscl-xc::%with-compilation-unit ()
(jscl-xc:bootstrap "$OUTPUT_DIR" "jscl" :verbose $VERBOSE)
(jscl-xc:build-node-repl "$OUTPUT_DIR"))
EOF
case "$HOST" in
sbcl)
sbcl --non-interactive --load "$tmpfile"
;;
jscl)
node --stack-size=65536 "$JSCL_PATH" "$tmpfile"
;;
esac
rm -f "$tmpfile"
# Build web and deno REPLs using the bootstrapped JSCL
tmpfile=$(mktemp /tmp/jscl-repl-build.XXXXXX.lisp)
cat > "$tmpfile" << EOF
(load "web/build.lisp")
(build-web-repl "$OUTPUT_DIR")
(load "deno/build.lisp")
(build-deno-repl "$OUTPUT_DIR")
(load "worker/build.lisp")
(build-worker-repl "$OUTPUT_DIR")
EOF
node --stack-size=65536 "${OUTPUT_DIR}jscl-node.js" "$tmpfile"
rm -f "$tmpfile"
echo "Built: ${OUTPUT_DIR}jscl.js" >&2
echo "Built: ${OUTPUT_DIR}jscl-node.js" >&2
echo "Built: ${OUTPUT_DIR}jscl-web.js" >&2
echo "Built: ${OUTPUT_DIR}jscl-deno.js" >&2
echo "Built: ${OUTPUT_DIR}jscl-worker.js" >&2