updating build systems
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Tue, 15 Mar 2022 15:36:47 +0000 (10:36 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Tue, 15 Mar 2022 15:36:47 +0000 (10:36 -0500)
.github/workflows/windows-build.yml
build.sh

index 6620d3c59f3f1e69f8da62b3f37cfe0a28a9807d..6aebf4363b357b007c3eedbf6701548b6b6e4199 100644 (file)
@@ -39,7 +39,7 @@ jobs:
           path: |
             core
             examples
-            lib/windows_x86_64
+            lib/windows_x86_64/lib/wasmer.dll
             misc
             modules
             onyx_runtime.dll
index 03687aafff1d38a5323daf82a80fa09643da8ad4..7cbc9c0d9c102fc8f73a4d9a8f4f0d5f2d17ff29 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+# The base path for the installation.
+# This is typcially /usr or /usr/local.
 INSTALL_DIR="/usr"
 
 # Where the core libraries for Onyx will go. 
@@ -8,8 +10,16 @@ CORE_DIR="$INSTALL_DIR/share/onyx"
 # Where the onyx executable will be placed.
 BIN_DIR="$INSTALL_DIR/bin"
 
+# The compiler to use. Only GCC and TCC have been tested.
+CC='gcc'
+
+# The architecture of your system. If your not sure, leave this alone.
 ARCH="$(uname -m)"
 
+# Comment this line if you do not want the Wamser libraries installed,
+# and do not with to have the Onyx runtime.
+ENABLE_BUNDLING_WASMER=1
+
 # Where the Wasmer library files can be found.
 # They are bundled with the project, but if a different version is available, these can be changed.
 WASMER_INCLUDE_DIR="$(pwd)/lib/common/include"
@@ -18,23 +28,19 @@ WASMER_LIBRARY_DIR="$(pwd)/lib/linux_$ARCH/lib"
 # Where the intermediate build files go.
 BUILD_DIR='./build'
 
+
+
+
 echo "Installing core libs"
 sudo mkdir -p "$CORE_DIR"
 sudo cp -r ./core/ "$CORE_DIR"
 
-[ "$1" = "libs_only" ] && exit 0
+# This is a development feature to allow for quickly reinstalling core libraries
+# without have to recompile the entire compiler
+[ "$1" = "core" ] && exit 0
 
-if [ ! -f "$CORE_DIR/lib/libwasmer.so" ]; then
-    sudo mkdir -p "$CORE_DIR/lib"
-
-    echo "Copying libwasmer to $CORE_DIR/lib (first install)"
-    # sudo cp "$WASMER_LIBRARY_DIR/libiwasm.so" "$CORE_DIR/lib/libiwasm.so"
-    sudo cp "$WASMER_LIBRARY_DIR/libwasmer.so" "$CORE_DIR/lib/libwasmer.so"
-    sudo cp "$WASMER_LIBRARY_DIR/libwasmer.a" "$CORE_DIR/lib/libwasmer.a"
-fi
 
 C_FILES="onyx astnodes builtins checker clone doc entities errors lex parser symres types utils wasm_emit"
-CC='gcc'
 LIBS=
 INCLUDES=
 
@@ -48,10 +54,22 @@ else
     TARGET='./bin/onyx'
 fi
 
-C_FILES="$C_FILES wasm_runtime"
-FLAGS="$FLAGS -DENABLE_RUN_WITH_WASMER"
-LIBS="-L$CORE_DIR/lib -lwasmer -Wl,-rpath=$CORE_DIR/lib:./ -lpthread -ldl"
-INCLUDES="-I$WASMER_INCLUDE_DIR"
+
+if [ ! -z "$ENABLE_BUNDLING_WASMER" ]; then
+    C_FILES="$C_FILES wasm_runtime"
+    FLAGS="$FLAGS -DENABLE_RUN_WITH_WASMER"
+    LIBS="$LIBS -L$CORE_DIR/lib -lwasmer -Wl,-rpath=$CORE_DIR/lib:./ -lpthread -ldl"
+    INCLUDES="$INCLUDES -I$WASMER_INCLUDE_DIR"
+
+    if [ ! -f "$CORE_DIR/lib/libwasmer.so" ]; then
+        sudo mkdir -p "$CORE_DIR/lib"
+
+        echo "Copying libwasmer to $CORE_DIR/lib (first install)"
+        # sudo cp "$WASMER_LIBRARY_DIR/libiwasm.so" "$CORE_DIR/lib/libiwasm.so"
+        sudo cp "$WASMER_LIBRARY_DIR/libwasmer.so" "$CORE_DIR/lib/libwasmer.so"
+        sudo cp "$WASMER_LIBRARY_DIR/libwasmer.a" "$CORE_DIR/lib/libwasmer.a"
+    fi
+fi
 
 mkdir -p "$BUILD_DIR"
 
@@ -77,15 +95,17 @@ echo "Installing onyx executable"
 sudo mkdir -p "$BIN_DIR"
 sudo cp ./bin/onyx "$BIN_DIR/onyx"
 
-C_FILES="onyxrun wasm_runtime"
-TARGET="./bin/onyxrun"
+if [ ! -z "$ENABLE_BUNDLING_WASMER" ]; then
+    C_FILES="onyxrun wasm_runtime"
+    TARGET="./bin/onyxrun"
 
-compile
-echo "Installing onyxrun executable"
-sudo cp ./bin/onyxrun "$BIN_DIR/onyxrun"
+    compile
+    echo "Installing onyxrun executable"
+    sudo cp ./bin/onyxrun "$BIN_DIR/onyxrun"
 
-./modules/onyx_runtime/build.sh
-sudo mv "./onyx_runtime.so" "$CORE_DIR/lib/onyx_runtime.so"
+    ./modules/onyx_runtime/build.sh
+    sudo mv "./onyx_runtime.so" "$CORE_DIR/lib/onyx_runtime.so"
+fi
 
 # Otherwise the prompt ends on the same line
 printf "\n"