artifact_name: 'onyx-linux-ovm-amd64'
- build: linux-amd64
os: ubuntu-latest
- runtime_library: ':libwasmer.a'
+ runtime_library: wasmer
artifact_name: 'onyx-linux-wasmer-amd64'
- build: linux-amd64
os: ubuntu-latest
mkdir -p build
- name: Install Linux building dependencies
- if: matrix.runtime_library == ':libwasmer.a'
+ if: matrix.runtime_library == 'wasmer'
run: |
curl https://get.wasmer.io -sSfL | sh
- - name: Setup environment variables for Wasmer
- if: matrix.runtime_library == ':libwasmer.a'
- run: |
- echo "ONYX_LIBRARY_DIR=/home/runner/.wasmer/lib" >> "$GITHUB_ENV"
-
- - name: Setup environment variables for OVM-Wasm
- if: matrix.runtime_library != ':libwasmer.a'
- run: |
- echo "ONYX_LIBRARY_DIR=../shared/lib/linux_x86_64/lib" >> "$GITHUB_ENV"
-
- name: Install Windows building dependencies
if: matrix.build == 'windows-amd64'
uses: ilammy/msvc-dev-cmd@v1
./build.sh compile package
env:
ONYX_CC: gcc
- ONYX_ARCH: x86_64
+ ONYX_ARCH: linux_x86_64
ONYX_RUNTIME_LIBRARY: ${{ matrix.runtime_library }}
- ONYX_INCLUDE_DIR: ../shared/include
- ONYX_LIBRARY_DIR: ${{ env.ONYX_LIBRARY_DIR }}
ONYX_USE_DYNCALL: '1'
- name: Build Onyx for ${{ matrix.build }}
./build.sh compile package
env:
ONYX_CC: gcc
- ONYX_ARCH: x86_64
- ONYX_INCLUDE_DIR: ../shared/include
+ ONYX_ARCH: linux_x86_64
- name: Build Onyx for ${{ matrix.build }}
if: (matrix.build == 'darwin-arm64') && (matrix.runtime_library == 'none')
./build.sh compile package
env:
ONYX_CC: gcc
- ONYX_ARCH: arm64
- ONYX_INCLUDE_DIR: ../shared/include
+ ONYX_ARCH: darwin_arm64
- name: Build Onyx for ${{ matrix.build }}
if: matrix.build == 'windows-amd64'
#!/bin/sh
C_FILES="onyx astnodes builtins checker clone doc entities errors lex parser symres types utils wasm_emit "
-LIBS="-L$ONYX_LIBRARY_DIR -lpthread -ldl -lm"
+LIBS="-lpthread -ldl -lm"
INCLUDES="-I./include -I../shared/include -I../shared/include/dyncall"
WARNINGS='-Wimplicit -Wmisleading-indentation -Wparentheses -Wsequence-point -Wreturn-type -Wshift-negative-value -Wunused-but-set-parameter -Wunused-but-set-variable -Wunused-function -Wunused-label -Wmaybe-uninitialized -Wsign-compare -Wstrict-overflow -Wduplicated-branches -Wduplicated-cond -Wtrigraphs -Waddress -Wlogical-op'
FLAGS="$WARNINGS -O3"
fi
+FLAGS="$FLAGS -DENABLE_DEBUG_INFO"
+
if [ ! -z ${ONYX_RUNTIME_LIBRARY+x} ]; then
FLAGS="$FLAGS -DENABLE_RUN_WITH_WASMER"
C_FILES="${C_FILES}wasm_runtime "
- LIBS="-l$ONYX_RUNTIME_LIBRARY $LIBS"
+ case "${ONYX_RUNTIME_LIBRARY}" in
+ ovmwasm)
+ LIBS="../shared/lib/$ONYX_ARCH/lib/libovmwasm.a $LIBS"
+ FLAGS="$FLAGS -DUSE_OVM_DEBUGGER"
+ ;;
+
+ wasmer)
+ LIBS="$(wasmer config --libdir)/libwasmer.a $LIBS"
+ ;;
+
+ *)
+ echo "Unknown WebAssembly runtime '$ONYX_RUNTIME_LIBRARY'. Aborting.";
+ exit 1
+ ;;
+ esac
fi
-if [ "$ONYX_RUNTIME_LIBRARY" = "ovmwasm" ]; then
- FLAGS="$FLAGS -DUSE_OVM_DEBUGGER"
-fi
-
-FLAGS="$FLAGS -DENABLE_DEBUG_INFO"
+case "$ONYX_ARCH" in
+ *darwin*)
+ LIBS="$LIBS -lffi -lSystem -framework CoreFoundation -framework SystemConfiguration"
+ ;;
+esac
if [ "$ONYX_USE_DYNCALL" = "1" ] && [ "$ONYX_RUNTIME_LIBRARY" = "ovmwasm" ]; then
- LIBS="$LIBS ../shared/lib/linux_$ONYX_ARCH/lib/libdyncall_s.a ../shared/lib/linux_$ONYX_ARCH/lib/libdyncallback_s.a"
+ LIBS="$LIBS ../shared/lib/$ONYX_ARCH/lib/libdyncall_s.a ../shared/lib/$ONYX_ARCH/lib/libdyncallback_s.a"
FLAGS="$FLAGS -DUSE_DYNCALL"
fi
# FLAGS="-g3 -DOVM_VERBOSE=1"
FLAGS="-Ofast -fno-stack-protector"
LIBS="-pthread"
-TARGET="../shared/lib/linux_$(uname -m)/lib/libovmwasm.a"
+TARGET="../shared/lib/$ONYX_ARCH/lib/libovmwasm.a"
C_FILES="src/ovmwasm.c src/vm/*.c src/wasm/*.c src/debug/*.c"
INCLUDES="-I../shared/include -Iinclude"
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/un.h>
- #include <linux/futex.h>
#include <sys/syscall.h>
#include <poll.h>
#include <termios.h>
#include <unistd.h>
#endif
+#if defined(_BH_LINUX)
+ #include <linux/futex.h>
+#endif
+
#include "types.h" // For POINTER_SIZE
#include "src/ort_files.h"
// Networking
//
-#include <byteswap.h>
-
#define SOCKET_ERROR_NONE 0
#define SOCKET_ERROR_BAD_SETTINGS 1
#define SOCKET_ERROR_CONNECT_FAILED 1
export ONYX_CC='gcc'
# The architecture of your system. If your not sure, leave this alone.
-export ONYX_ARCH="$(uname -m)"
+export ONYX_ARCH="$(uname | tr '[:upper:]' '[:lower:]')_$(uname -m)"
export ONYX_RUNTIME_LIBRARY="ovmwasm"
-# export ONYX_RUNTIME_LIBRARY=":libwasmer.a"
-
-export ONYX_INCLUDE_DIR="$(pwd)/shared/include"
-export ONYX_LIBRARY_DIR="$(pwd)/shared/lib/linux_$ONYX_ARCH/lib"
-# export ONYX_LIBRARY_DIR="$(wasmer config --libdir)"
+# export ONYX_RUNTIME_LIBRARY="wasmer"
# Enable Dynamic call
export ONYX_USE_DYNCALL=1