From ca6883f759d9ed14885bc2dc6a7f8a37a301692a Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Fri, 29 Oct 2021 09:27:33 -0500 Subject: [PATCH] now copy the libraries to the install directory --- CHANGELOG | 2 ++ build.sh | 21 ++++++++++++++++--- lib/{linux => linux_x86_64}/README.md | 0 lib/{linux => linux_x86_64}/include/wasm.h | 0 lib/{linux => linux_x86_64}/include/wasmer.h | 0 lib/{linux => linux_x86_64}/lib/libwasmer.a | Bin lib/{linux => linux_x86_64}/lib/libwasmer.so | Bin 7 files changed, 20 insertions(+), 3 deletions(-) rename lib/{linux => linux_x86_64}/README.md (100%) rename lib/{linux => linux_x86_64}/include/wasm.h (100%) rename lib/{linux => linux_x86_64}/include/wasmer.h (100%) rename lib/{linux => linux_x86_64}/lib/libwasmer.a (100%) rename lib/{linux => linux_x86_64}/lib/libwasmer.so (100%) diff --git a/CHANGELOG b/CHANGELOG index 461a6399..8b6e71de 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -9,6 +9,8 @@ version out there in a packaged format. Additions: * Multi-threading for the JS backend (--use-multi-threading) +* Running Onyx directly from the compiler using 'onyx run' + - This internally links with libwasmer to provide the WASM runtime. * threading primitives (mutex, semaphore, etc.) * atomic intrinsics * Quick-Functions diff --git a/build.sh b/build.sh index aeddb15b..447e1291 100755 --- a/build.sh +++ b/build.sh @@ -6,12 +6,28 @@ CORE_DIR='/usr/share/onyx' # Where the onyx executable will be placed. BIN_DIR='/usr/bin' +# 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/linux_x86_64/include" +WASMER_LIBRARY_DIR="$(pwd)/lib/linux_x86_64/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 +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/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= @@ -30,11 +46,10 @@ fi if true; then C_FILES="$C_FILES wasm_runtime" FLAGS="$FLAGS -DENABLE_RUN_WITH_WASMER" - LIBS="-L$(pwd)/lib/linux/lib -lwasmer -Wl,-rpath=$(pwd)/lib/linux/lib" - INCLUDES="-I$(pwd)/lib/linux/include" + LIBS="-L$CORE_DIR/lib -lwasmer -Wl,-rpath=$CORE_DIR/lib" + INCLUDES="-I$WASMER_INCLUDE_DIR" fi -BUILD_DIR='./build' mkdir -p "$BUILD_DIR" for file in $C_FILES ; do diff --git a/lib/linux/README.md b/lib/linux_x86_64/README.md similarity index 100% rename from lib/linux/README.md rename to lib/linux_x86_64/README.md diff --git a/lib/linux/include/wasm.h b/lib/linux_x86_64/include/wasm.h similarity index 100% rename from lib/linux/include/wasm.h rename to lib/linux_x86_64/include/wasm.h diff --git a/lib/linux/include/wasmer.h b/lib/linux_x86_64/include/wasmer.h similarity index 100% rename from lib/linux/include/wasmer.h rename to lib/linux_x86_64/include/wasmer.h diff --git a/lib/linux/lib/libwasmer.a b/lib/linux_x86_64/lib/libwasmer.a similarity index 100% rename from lib/linux/lib/libwasmer.a rename to lib/linux_x86_64/lib/libwasmer.a diff --git a/lib/linux/lib/libwasmer.so b/lib/linux_x86_64/lib/libwasmer.so similarity index 100% rename from lib/linux/lib/libwasmer.so rename to lib/linux_x86_64/lib/libwasmer.so -- 2.25.1