diff options
| -rwxr-xr-x | build.sh | 5 | ||||
| -rwxr-xr-x | utils/container-run.sh | 60 |
2 files changed, 42 insertions, 23 deletions
| @@ -148,11 +148,10 @@ CPPFLAGS="-std=c++20 $(maybe_pthread)" | |||
| 148 | # The options below have to be adjusted when native WASM_SIMD is implemented. | 148 | # The options below have to be adjusted when native WASM_SIMD is implemented. |
| 149 | 149 | ||
| 150 | # Build flags for emscripten (WASM target) | 150 | # Build flags for emscripten (WASM target) |
| 151 | WASMCFLAGS="-std=c11 -fPIC -D_POSIX_C_SOURCE=199309L $(maybe_pthread) | 151 | WASMCFLAGS="-std=c11 -fPIC -D_POSIX_C_SOURCE=199309L $(maybe_pthread)" |
| 152 | -mfpu=neon -mrelaxed-simd" | ||
| 153 | WASMCPPFLAGS="-std=c++20 $(maybe_pthread)" | 152 | WASMCPPFLAGS="-std=c++20 $(maybe_pthread)" |
| 154 | WASMDBGFLAGS="-sASSERTIONS" | 153 | WASMDBGFLAGS="-sASSERTIONS" |
| 155 | WASMMFLAGS="-DTHREADS=$THREADS -DNEON" | 154 | WASMMFLAGS="-DTHREADS=$THREADS -DPORTABLE" |
| 156 | WASMLINKFLAGS="--no-entry -sEXPORT_NAME='Nissy' -sMODULARIZE | 155 | WASMLINKFLAGS="--no-entry -sEXPORT_NAME='Nissy' -sMODULARIZE |
| 157 | -sEXPORTED_RUNTIME_METHODS=addFunction,UTF8ToString | 156 | -sEXPORTED_RUNTIME_METHODS=addFunction,UTF8ToString |
| 158 | -sALLOW_TABLE_GROWTH | 157 | -sALLOW_TABLE_GROWTH |
diff --git a/utils/container-run.sh b/utils/container-run.sh index 6090e1c..df17b74 100755 --- a/utils/container-run.sh +++ b/utils/container-run.sh | |||
| @@ -24,8 +24,9 @@ usage() { | |||
| 24 | echo "If COMMAND is unspecified, an interactive shell will be opened." | 24 | echo "If COMMAND is unspecified, an interactive shell will be opened." |
| 25 | echo "" | 25 | echo "" |
| 26 | echo "Available platforms:" | 26 | echo "Available platforms:" |
| 27 | echo "x86 (equivalent to: x86_64, amd64)" | 27 | echo "x86 (equivalent to: x86_64, amd64)" |
| 28 | echo "arm (equivalent to: arm64)" | 28 | echo "arm (equivalent to: arm64)" |
| 29 | echo "emscripten" | ||
| 29 | echo "" | 30 | echo "" |
| 30 | echo "Examples:" | 31 | echo "Examples:" |
| 31 | echo "$0 ram ./build.sh test # Run unit tests in arm container" | 32 | echo "$0 ram ./build.sh test # Run unit tests in arm container" |
| @@ -36,13 +37,48 @@ if [ -z "$1" ]; then | |||
| 36 | usage "No platform given." | 37 | usage "No platform given." |
| 37 | fi | 38 | fi |
| 38 | 39 | ||
| 40 | config_standard() { | ||
| 41 | image="localhost/nissy/alpine-$1" | ||
| 42 | platform="--platform=linux/$1" | ||
| 43 | mount="--mount type=bind,src=./,dst=/nissy-core" | ||
| 44 | flags="--rm --privileged" | ||
| 45 | |||
| 46 | dockerfile="$(mktemp)" | ||
| 47 | cat > "$dockerfile" << EOF | ||
| 48 | FROM alpine:3.22 | ||
| 49 | RUN apk update | ||
| 50 | RUN apk add gcc g++ clang python3 python3-dev | ||
| 51 | RUN mkdir /nissy-core | ||
| 52 | WORKDIR /nissy-core | ||
| 53 | USER 1000:1000 | ||
| 54 | EOF | ||
| 55 | } | ||
| 56 | |||
| 57 | config_emscripten() { | ||
| 58 | image="localhost/nissy/emscripten" | ||
| 59 | platform="--platform=linux/amd64" | ||
| 60 | mount="--mount type=bind,src=./,dst=/nissy-core" | ||
| 61 | flags="--rm --privileged" | ||
| 62 | |||
| 63 | dockerfile="$(mktemp)" | ||
| 64 | cat > "$dockerfile" << EOF | ||
| 65 | FROM emscripten/emsdk | ||
| 66 | WORKDIR /nissy-core | ||
| 67 | USER 1000:1000 | ||
| 68 | EOF | ||
| 69 | } | ||
| 70 | |||
| 39 | case "$1" in | 71 | case "$1" in |
| 40 | x86|x86_64|amd64) | 72 | x86|x86_64|amd64) |
| 41 | p=amd64 | 73 | config_standard amd64 |
| 42 | shift | 74 | shift |
| 43 | ;; | 75 | ;; |
| 44 | arm|arm64) | 76 | arm|arm64) |
| 45 | p=arm64 | 77 | config_standard arm64 |
| 78 | shift | ||
| 79 | ;; | ||
| 80 | emscripten) | ||
| 81 | config_emscripten | ||
| 46 | shift | 82 | shift |
| 47 | ;; | 83 | ;; |
| 48 | *) | 84 | *) |
| @@ -50,22 +86,6 @@ arm|arm64) | |||
| 50 | ;; | 86 | ;; |
| 51 | esac | 87 | esac |
| 52 | 88 | ||
| 53 | image="localhost/nissy/alpine-$p" | ||
| 54 | platform="--platform=linux/$p" | ||
| 55 | mount="--mount type=bind,src=./,dst=/nissy-core" | ||
| 56 | flags="--rm --privileged" | ||
| 57 | |||
| 58 | dockerfile="$(mktemp)" | ||
| 59 | cat > "$dockerfile" << EOF | ||
| 60 | FROM alpine:3.22.1 | ||
| 61 | RUN apk update | ||
| 62 | RUN apk add gcc g++ clang python3 python3-dev | ||
| 63 | #COPY . ./nissy-core | ||
| 64 | RUN mkdir /nissy-core | ||
| 65 | WORKDIR /nissy-core | ||
| 66 | USER 1000:1000 | ||
| 67 | EOF | ||
| 68 | |||
| 69 | docker build "$platform" -f "$dockerfile" -t "$image" . | 89 | docker build "$platform" -f "$dockerfile" -t "$image" . |
| 70 | rm "$dockerfile" | 90 | rm "$dockerfile" |
| 71 | 91 | ||
