From 1f8140c95ced6b7ce291e16c26c80800fa4f1f9d Mon Sep 17 00:00:00 2001 From: SoniEx2 Date: Wed, 5 Jun 2024 01:18:21 -0300 Subject: Update README, misc cleanups --- build.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'build.sh') 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 -- cgit 1.4.1