mirror of https://github.com/status-im/nimplay.git
Add second optional arg support.
This commit is contained in:
parent
7456da9d64
commit
881eb3452b
|
@ -1,18 +1,31 @@
|
|||
#!/bin/bash
|
||||
# For use inside Nimplay Docker image.
|
||||
NIM_FILE=$1
|
||||
WASM_FILE="${NIM_FILE%.*}.wasm"
|
||||
if [[ $# -eq 2 ]];
|
||||
then
|
||||
WASM_FILE="$2"
|
||||
else
|
||||
WASM_FILE="${NIM_FILE%.*}.wasm"
|
||||
fi
|
||||
|
||||
PANIC_PATH="$(dirname ${NIM_FILE})"
|
||||
|
||||
set -ex
|
||||
PATH_PARAMS="-p:/nimplay/ -p:/nimplay/vendor/nimcrypto -p:/nimplay/vendor/stint -p:/nimplay/vendor/nim-stew/"
|
||||
NIM_CLANG_C_FLAGS="--passC:\""--target=wasm32-unknown-unknown-wasm\"" --passC:\""-I./include\"""
|
||||
NIM_CLANG_LINKER_FLAGS="--clang.options.linker:\"-nostdlib -Wl,--no-entry,--allow-undefined,--strip-all,--export-dynamic\" --passL:\"--target=wasm32-unknown-unknown-wasm\""
|
||||
NIM_CLANG_ALL_FLAGS="${NIM_CLANG_C_FLAGS} ${NIM_CLANG_LINKER_FLAGS} --os:standalone --cpu:i386 --cc:clang --gc:none --nomain -d:release"
|
||||
NIM_CLANG_WASM32_C="nim c -d:osk256_sig ${PATH_PARAMS} ${NIM_CLANG_ALL_FLAGS}"
|
||||
FULL_CMD="${NIM_CLANG_WASM32_C} --out:${WASM_FILE} ${NIM_FILE}"
|
||||
|
||||
|
||||
cp /nimplay/examples/panicoverride.nim $PANIC_PATH/
|
||||
eval "${NIM_CLANG_WASM32_C} --out:${WASM_FILE} ${NIM_FILE}"
|
||||
echo $FULL_CMD
|
||||
eval $FULL_CMD
|
||||
if [ $? -ne 0 ]; then
|
||||
rm $PANIC_PATH/panicoverride.nim
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# Postprocess produced wasm file
|
||||
wasm2wat="wasm2wat"
|
||||
|
|
Loading…
Reference in New Issue