diff --git a/config b/config index a6c70a0..34b4891 100644 --- a/config +++ b/config @@ -42,6 +42,25 @@ else fi fi +# base wasm features pure is "mvp" , "bi" is bigint + +if [ -f /mvp ] +then + export WASM_FLAVOUR=mvp + export WASM_EXTRA="-sMIN_SAFARI_VERSION=120000" + export WASM_PURE=true +else + export WASM_FLAVOUR=bi + + # extra features. Safari 14 is expected to have BIGINT, ignore the emsdk warnings. + export WASM_EXTRA="-sWASM_BIGINT -sMIN_SAFARI_VERSION=140100" + + # tell to not normalize modules. + export WASM_PURE=false +fi + + + # ============ emscripten ============== # stable @@ -54,6 +73,12 @@ fi #export EMFLAVOUR=${EMFLAVOUR:latest} export EMFLAVOUR=${EMFLAVOUR:-tot} +#temp fix for oom on CI (Error: Process completed with exit code 143.) +export EMSDK_NUM_CORES=1 + +# for shared modules +export PYDK_PYTHON_HOST_PLATFORM=wasm32-${WASM_FLAVOUR}-emscripten + # ============== wasi sdk =============== # stable @@ -76,64 +101,40 @@ NIM_URL=https://github.com/nim-lang/Nim NIMSDK=${NIMSDK:-"${SDKROOT}/nimsdk"} -# base wasm features pure is "mvp" , "bi" is bigint -if [ -f /mvp ] -then - export WASM_FLAVOUR=mvp - export WASM_EXTRA="-sMIN_SAFARI_VERSION=120000" - export WASM_PURE=true -else - export WASM_FLAVOUR=bi - # extra features. Safari 14 is expected to have BIGINT, ignore the emsdk warnings. - export WASM_EXTRA="-sWASM_BIGINT -sMIN_SAFARI_VERSION=140100" - # tell to not normalize modules. - export WASM_PURE=false -fi +#OLDPATH=${PATH} -#temp fix for oom on CI (Error: Process completed with exit code 143.) -export EMSDK_NUM_CORES=1 +PATH=/usr/bin:/bin +for extrabin in /usr/local/bin /opt/bin +do + if echo $PATH|grep -q ":$extrabin" + then + continue + fi -export PYDK_PYTHON_HOST_PLATFORM=wasm32-${WASM_FLAVOUR}-emscripten + if [ -d $extrabin ] + then + PATH=$extrabin:$PATH + fi +done + + +# this is python used for emsdk : ${SYS_PYTHON} -> ${EMSDK_PYTHON} +for py in 10 9 8 7 +do + if command -v python${PYMAJOR}.${py} >/dev/null + then + export SYS_PYTHON=$(command -v python${PYMAJOR}.${py}) + break + else + # sane default + export SYS_PYTHON=$(command -v python${PYMAJOR}) + fi +done + +export GITGET="git clone --recursive --no-tags --depth 1 --single-branch --branch" +export LD_LIBRARY_PATH="${HOST_PREFIX}/lib:$LD_LIBRARY_PATH" +export PATH="${HOST_PREFIX}/bin:$PATH" -if echo $LD_LIBRARY_PATH |grep -q ${HOST_PREFIX}/lib -then - # config already set - echo -n -else - OLDPATH=${PATH} - - PATH=/usr/bin:/bin - for extrabin in /usr/local/bin /opt/bin - do - if echo $PATH|grep -q ":$extrabin" - then - continue - fi - - if [ -d $extrabin ] - then - PATH=$extrabin:$PATH - fi - done - - - # this is python used for emsdk : ${SYS_PYTHON} -> ${EMSDK_PYTHON} - for py in 10 9 8 7 - do - if command -v python${PYMAJOR}.${py} >/dev/null - then - export SYS_PYTHON=$(command -v python${PYMAJOR}.${py}) - break - else - # sane default - export SYS_PYTHON=$(command -v python${PYMAJOR}) - fi - done - - export GITGET="git clone --recursive --no-tags --depth 1 --single-branch --branch" - export LD_LIBRARY_PATH="${HOST_PREFIX}/lib:$LD_LIBRARY_PATH" - export PATH="${HOST_PREFIX}/bin:$PATH:$OLDPATH" -fi diff --git a/python-nim-sdk.sh b/python-nim-sdk.sh index cbba50b..6f8562e 100755 --- a/python-nim-sdk.sh +++ b/python-nim-sdk.sh @@ -40,6 +40,7 @@ pushd ${NIMSDK} pushd $NIM_VERSION chmod +x *sh CC=clang CXX=clang++ ./build_all.sh + rm -rf build csources_v2 nimcache popd fi fi @@ -62,13 +63,15 @@ echo fmt" ==== Panda3D: generic config {ARCH=} from {SDKROOT=} ====" --cc:clang --os:linux ---define:usemalloc ---noCppExceptions ---define:noCppExceptions +#--noCppExceptions + --exceptions:quirky +--define:noCppExceptions +#--define:usemalloc + # gc : bohem => need libgc.so.1 ---gc:orc +--mm:orc --define:noSignalHandler # @@ -99,7 +102,7 @@ when defined(wasi): switch("passC", fmt"-m32 -Djmp_buf=int") - switch("passC", "-Os -g3 -mllvm -inline-threshold=1") + switch("passC", "-O0 -g3 -mllvm -inline-threshold=1") switch("passL","-lstdc++ ") @@ -138,8 +141,6 @@ switch("cincludes", fmt"{SDKROOT}/devices/{ARCH}/usr/include/panda3d") switch("out", fmt"out.{ARCH}") - - END cat > nimsdk_env.sh <> $ROOT/wasm32-wasi-shell.sh < /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' +} + export PS1="[PyDK:wasi] \[\e[32m\]\w \[\e[91m\]\$(parse_git_branch)\[\e[00m\]\$ " -export PS1="[PyDK:wasisdk] \w $ " END @@ -202,5 +206,10 @@ END fi done + +wget https://github.com/bytecodealliance/wasmtime/releases/download/v17.0.1/wasmtime-v17.0.1-x86_64-linux.tar.xz -O- xzcat | tar xfv - +mv -vf $(find wasmtime*|grep /wasmtime$) ${WASISDK}/bin/ + + exit 0