-
Notifications
You must be signed in to change notification settings - Fork 7
/
compile
executable file
·47 lines (39 loc) · 1.36 KB
/
compile
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
#!/usr/bin/env bash
# Copyright © 2020 Michiel Borkent
# Original `compile` from https://github.com/borkdude/babashka
if [ -z "$GRAALVM_HOME" ]; then
echo "Please set GRAALVM_HOME"
exit 1
fi
"$GRAALVM_HOME/bin/gu" install native-image || true
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
OS_FLAG="linux"
elif [[ "$OSTYPE" == "darwin"* ]]; then
OS_FLAG="macos"
fi
if [[ "$NI_EXAMPLE" == "sdl" ]]; then
TARGET_JAR="target/examples_sdl.jar"
NAME="sdl_example"
elif [[ "$NI_EXAMPLE" == "ncurses" ]]; then
TARGET_JAR="target/examples_ncurses.jar"
NAME="ncurses_example"
elif [[ "$NI_EXAMPLE" == "bounce" ]]; then
TARGET_JAR="target/examples_bounce.jar"
NAME="bounce_example"
fi
lein with-profiles +clojure-1.10.2-alpha1,+$OS_FLAG,+$NI_EXAMPLE-uberjar do clean, uberjar
args=( "-jar" $TARGET_JAR \
"-H:CLibraryPath=libs" \
"-H:Name=" $NAME \
"-H:+ReportExceptionStackTraces" \
"-J-Dclojure.spec.skip-macros=true" \
"-J-Dclojure.compiler.direct-linking=true" \
"--initialize-at-build-time" \
"-H:Log=registerResource:" \
"--verbose" \
"--no-fallback" \
"--no-server" \
"--report-unsupported-elements-at-runtime" \
"--allow-incomplete-classpath"
)
$GRAALVM_HOME/bin/native-image "${args[@]}"