changed build.sh to error if it fails
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Fri, 8 Dec 2023 01:54:44 +0000 (19:54 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Fri, 8 Dec 2023 01:54:44 +0000 (19:54 -0600)
build.sh

index 871e42bb5eb30d9ff878879111e03fe85b9ce994..5abcb16856edf2e646d0d9580afd31f6272587b4 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+set -e
+
 DIST_DIR="./dist"
 
 compile_all() {
@@ -38,20 +40,22 @@ package_all() {
     cp ./scripts/onyx-pkg.onyx "$DIST_DIR/tools"
     cp ./scripts/default.json "$DIST_DIR/tools/pkg_templates"
 
-    echo "Installing runtime library"
-    mkdir -p "$DIST_DIR/lib"
-    mkdir -p "$DIST_DIR/include"
-
-    case "$(uname)" in
-        Linux)  suffix='so' ;;
-        *BSD)   suffix='so' ;;
-        Darwin) suffix='dylib' ;;
-        *)      suffix='dll' ;;
-    esac
-
-    [ -f runtime/onyx_runtime.$suffix ] && cp runtime/onyx_runtime.$suffix "$DIST_DIR/lib/"
-    cp "shared/include/onyx_library.h" "$DIST_DIR/include/onyx_library.h"
-    cp "shared/include/wasm.h" "$DIST_DIR/include/wasm.h"
+    if [ ! -z ${ONYX_RUNTIME_LIBRARY+x} ]; then
+        echo "Installing runtime library"
+        mkdir -p "$DIST_DIR/lib"
+        mkdir -p "$DIST_DIR/include"
+
+        case "$(uname)" in
+            Linux)  suffix='so' ;;
+            *BSD)   suffix='so' ;;
+            Darwin) suffix='dylib' ;;
+            *)      suffix='dll' ;;
+        esac
+
+        [ -f runtime/onyx_runtime.$suffix ] && cp runtime/onyx_runtime.$suffix "$DIST_DIR/lib/"
+        cp "shared/include/onyx_library.h" "$DIST_DIR/include/onyx_library.h"
+        cp "shared/include/wasm.h" "$DIST_DIR/include/wasm.h"
+    fi
 
     cp -r "tests" "$DIST_DIR/"
     cp -r "examples" "$DIST_DIR/"
@@ -61,6 +65,7 @@ package_all() {
     cp misc/onyx-windows.sublime-build "$DIST_DIR/misc"
     cp misc/onyx-mode.el "$DIST_DIR/misc"
     cp misc/onyx.sublime-syntax "$DIST_DIR/misc"
+    cp misc/onyx.tmPreferences "$DIST_DIR/misc"
     cp misc/vscode/onyxlang-0.1.9.vsix "$DIST_DIR/misc"
 
     cp LICENSE "$DIST_DIR/LICENSE"