summary refs log tree commit diff stats
path: root/build.sh
diff options
context:
space:
mode:
authorSoniEx2 <endermoneymod@gmail.com>2024-06-05 01:18:21 -0300
committerSoniEx2 <endermoneymod@gmail.com>2024-06-05 01:18:21 -0300
commit1f8140c95ced6b7ce291e16c26c80800fa4f1f9d (patch)
treeb5d5008a3c9fc6b97953f254ef9cbe7b06aa912c /build.sh
parentdba1285ca98d7a325f05b77b805089b3edd61867 (diff)
Update README, misc cleanups
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh17
1 files changed, 13 insertions, 4 deletions
diff --git a/build.sh b/build.sh
index 06686dd..325b3a3 100755
--- a/build.sh
+++ b/build.sh
@@ -8,6 +8,7 @@ case "$LUA_INTERPRETER" in
 		ENV_WRAPPER=${ENV_WRAPPER:-"$(command -v env)"}
 		;;
 esac
+cratera_path_for_display="$(env -i "$LUA_INTERPRETER" src/host/genpath.lua display)"
 
 do_build() {
 	mkdir -p out/lua/cratera/prebuilt/ || exit 1
@@ -23,11 +24,15 @@ do_build() {
 	fi
 	tail -n +2 src/bin/cratera.lua >>out/bin/cratera || exit 1
 	chmod +x out/bin/cratera || exit 1
-	env -i "$LUA_INTERPRETER" src/host/genpath.lua >out/lua/cratera/prebuilt/path.lua || exit 1
+	if [ -n "${DEFAULT_CRATERA_PATH+x}" ]; then
+		env -i "DEFAULT_CRATERA_PATH=$DEFAULT_CRATERA_PATH" "$LUA_INTERPRETER" src/host/genpath.lua >out/lua/cratera/prebuilt/path.lua || exit 1
+	else
+		env -i "$LUA_INTERPRETER" src/host/genpath.lua >out/lua/cratera/prebuilt/path.lua || exit 1
+	fi
 }
 
 test_wrapper() {
-	eval "$@" || {
+	eval "$*" || {
 		printf 'Test failed:'
 		printf ' %s' "$@"
 		printf '\n'
@@ -74,11 +79,15 @@ case "$1" in
 		printf '%s\n' \
 			'The Cratera "Build System"' \
 			'To build, use '\''./build.sh build'\''. Files will be put in '\''out/'\''.' \
-			'To run tests, use '\''./build.sh test'\''.' \
+			'To run tests, use '\''./build.sh test'\'', this will also rebuild cratera.' \
+			'To run tests without rebuilding, use '\''./build.sh test-only'\''.' \
+			'    (Note: you must build at least once before using this option.)' \
 			'The currently selected Lua interpreter is:' \
 			"$(printf '    LUA_INTERPRETER=%s' "$LUA_INTERPRETER")" \
 			'The currently selected env wrapper is:' \
-			"$(printf '    ENV_WRAPPER=%s' "$ENV_WRAPPER")"
+			"$(printf '    ENV_WRAPPER=%s' "$ENV_WRAPPER")" \
+			'The default Cratera path is:' \
+			"$(printf '    CRATERA_DEFAULT_PATH=%s' "$cratera_path_for_display")" \
 		;;
 	interp)
 		do_build