From bbb9f04eecc66a9e8e208cc4abc0466697807765 Mon Sep 17 00:00:00 2001 From: SoniEx2 Date: Mon, 27 May 2024 10:57:51 -0300 Subject: More POSIX-related clean ups --- build.sh | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'build.sh') diff --git a/build.sh b/build.sh index 1a9a1ec..9b78d8c 100755 --- a/build.sh +++ b/build.sh @@ -13,7 +13,7 @@ do_build() { mkdir -p out/lua/cratera/ || exit 1 mkdir -p out/bin || exit 1 # worst tool for this job - cp -R src/cratera/* out/lua/cratera/ || exit 1 + cp -R src/cratera out/lua/ || exit 1 if [ "$ENV_WRAPPER" = '' ]; then printf "#!%s\n" "$LUA_INTERPRETER" >out/bin/cratera || exit 1 else @@ -26,7 +26,6 @@ do_build() { do_test() { # FIXME this does NOT handle LUA_PATH correctly. # FIXME nor LUA_INIT. - do_build || exit 1 mkdir -p out/test || exit 2 # these tests use the regular lua interpreter LUA_PATH='./out/lua/?.lua;./out/lua/?/init.lua;;' "$LUA_INTERPRETER" test/testp.lua || exit 2 @@ -38,23 +37,26 @@ do_test() { case "$1" in -h|--help|help) - echo 'The Cratera "Build System"' - echo 'To build, use './build.sh build'. Files will be put in out/.' - echo 'To run tests, use './build.sh test'.' - echo 'The currently selected Lua interpreter is:' - printf ' LUA_INTERPRETER=%s' "$LUA_INTERPRETER" - echo '' - echo 'The currently selected env wrapper is:' - printf ' ENV_WRAPPER=%s' "$ENV_WRAPPER" - echo '' + 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'\''.' \ + 'The currently selected Lua interpreter is:' \ + "$(printf ' LUA_INTERPRETER=%s' "$LUA_INTERPRETER")" \ + 'The currently selected env wrapper is:' \ + "$(printf ' ENV_WRAPPER=%s' "$ENV_WRAPPER")" + ;; + test-only) + do_test ;; test) - do_test || exit $? + do_build + do_test ;; build|'') - do_build || exit $? + do_build ;; *) - echo 'sorry' + printf '%s\n' 'sorry' ;; esac -- cgit 1.4.1