2023-07-14 04:38:32 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
if [[ -x /usr/local/opt/llvm/bin/clang ]]; then
|
|
|
|
CLANG=/usr/local/opt/llvm/bin/clang
|
|
|
|
elif [[ -x /opt/homebrew/opt/llvm/bin/clang ]]; then
|
|
|
|
CLANG=/opt/homebrew/opt/llvm/bin/clang
|
|
|
|
else
|
|
|
|
echo "Could not find Homebrew clang; this script will probably not work."
|
|
|
|
CLANG=clang
|
|
|
|
fi
|
|
|
|
|
2023-08-09 15:30:35 +00:00
|
|
|
ORCA_DIR=../..
|
2023-08-09 15:49:22 +00:00
|
|
|
STDLIB_DIR=../../cstdlib
|
|
|
|
ORCA_SDK_DIR=../../sdk
|
2023-08-09 15:30:35 +00:00
|
|
|
|
2023-07-14 04:38:32 +00:00
|
|
|
wasmFlags="--target=wasm32 \
|
2023-07-15 07:15:07 +00:00
|
|
|
--no-standard-libraries \
|
|
|
|
-fno-builtin \
|
|
|
|
-Wl,--no-entry \
|
|
|
|
-Wl,--export-dynamic \
|
|
|
|
-g \
|
|
|
|
-O2 \
|
|
|
|
-mbulk-memory \
|
|
|
|
-D__ORCA__ \
|
2023-08-09 15:30:35 +00:00
|
|
|
-I $ORCA_DIR/ext \
|
2023-08-09 15:49:22 +00:00
|
|
|
-I $STDLIB_DIR/include \
|
|
|
|
-I $ORCA_DIR/ext \
|
|
|
|
-I $ORCA_SDK_DIR \
|
|
|
|
-I $ORCA_DIR/src"
|
2023-07-14 04:38:32 +00:00
|
|
|
|
|
|
|
$CLANG $wasmFlags -o ./module.wasm ../../sdk/orca.c ../../cstdlib/src/*.c src/main.c
|
|
|
|
|
2023-08-08 09:38:43 +00:00
|
|
|
orca bundle --orca-dir ../.. --name UI --resource-dir data module.wasm
|