Skip to content

Commit

Permalink
3.1.72.0pre
Browse files Browse the repository at this point in the history
  • Loading branch information
pmp-p committed Nov 18, 2024
1 parent a60a2c9 commit 445963c
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
build:
runs-on: ubuntu-22.04
env:
BUILDS: 3.12
EMFLAVOUR: latest
BUILDS: 3.12 3.13
EMFLAVOUR: tot

steps:
- uses: actions/[email protected]
Expand Down
14 changes: 7 additions & 7 deletions scripts/wasisdk-fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pushd ${SDKROOT}

$HPIP install cmake wasmtime

mkdir -p ${SDKROOT}/wasisdk/share/cmake/Modules/Platform/
mkdir -p ${WASISDK}/share/cmake/Modules/Platform/

cat > ${CMAKE_TOOLCHAIN_FILE} <<END
# Cmake toolchain description file for the Makefile
Expand Down Expand Up @@ -140,12 +140,12 @@ END

pushd ${WASI_SYSROOT}
VMLABS="https://github.com/vmware-labs/webassembly-language-runtimes/releases/download"
wget "${VMLABS}/libs%2Flibpng%2F1.6.39%2B20230629-ccb4cb0/libpng-1.6.39-wasi-sdk-20.0.tar.gz" -O-| tar xfz -
wget "${VMLABS}/libs%2Fzlib%2F1.2.13%2B20230623-2993864/libz-1.2.13-wasi-sdk-20.0.tar.gz" -O-| tar xfz -
wget "${VMLABS}/libs%2Fsqlite%2F3.42.0%2B20230623-2993864/libsqlite-3.42.0-wasi-sdk-20.0.tar.gz" -O-| tar xfz -
wget "${VMLABS}/libs%2Flibxml2%2F2.11.4%2B20230623-2993864/libxml2-2.11.4-wasi-sdk-20.0.tar.gz" -O-| tar xfz -
wget "${VMLABS}/libs%2Fbzip2%2F1.0.8%2B20230623-2993864/libbzip2-1.0.8-wasi-sdk-20.0.tar.gz" -O-| tar xfz -
wget "${VMLABS}/libs%2Flibuuid%2F1.0.3%2B20230623-2993864/libuuid-1.0.3-wasi-sdk-20.0.tar.gz" -O-| tar xfz -
wget -q "${VMLABS}/libs%2Flibpng%2F1.6.39%2B20230629-ccb4cb0/libpng-1.6.39-wasi-sdk-20.0.tar.gz" -O-| tar xfz -
wget -q "${VMLABS}/libs%2Fzlib%2F1.2.13%2B20230623-2993864/libz-1.2.13-wasi-sdk-20.0.tar.gz" -O-| tar xfz -
wget -q "${VMLABS}/libs%2Fsqlite%2F3.42.0%2B20230623-2993864/libsqlite-3.42.0-wasi-sdk-20.0.tar.gz" -O-| tar xfz -
wget -q "${VMLABS}/libs%2Flibxml2%2F2.11.4%2B20230623-2993864/libxml2-2.11.4-wasi-sdk-20.0.tar.gz" -O-| tar xfz -
wget -q "${VMLABS}/libs%2Fbzip2%2F1.0.8%2B20230623-2993864/libbzip2-1.0.8-wasi-sdk-20.0.tar.gz" -O-| tar xfz -
wget -q "${VMLABS}/libs%2Flibuuid%2F1.0.3%2B20230623-2993864/libuuid-1.0.3-wasi-sdk-20.0.tar.gz" -O-| tar xfz -
popd

popd
72 changes: 71 additions & 1 deletion wasisdk/bin/wasi
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/bin/bash
#!/usr/bin/python3

# https://stackoverflow.com/questions/20530105/how-to-specify-a-custom-stdlib-directory-for-llvm
# https://stackoverflow.com/questions/60712261/how-to-prevent-osx-gcc-to-always-search-usr-local-include

"""
if ${CONFIGURE:-false}
then
CXX_LIBS=
Expand Down Expand Up @@ -56,4 +57,73 @@ else
$CC "${@}" ${WASI_LNK} -Wno-unused-function
fi
fi
"""


import sys
import os
from pathlib import Path


def dbg(*argv, **kw):
kw.setdefault("file", sys.stderr)
return print(*argv, **kw)

SDKROOT = Path(os.environ.get("SDKROOT", "/opt/python-wasm-sdk"))
WASISDK = Path(os.environ.get("WASISDK", "/opt/python-wasm-sdk/emsdk"))
WASI_SDK_PREFIX=Path(os.environ.get("WASI_SDK_PREFIX", "/opt/python-wasm-sdk/wasisdk/upstream"))
PREFIX = Path(os.environ.get("PREFIX", "/opt/python-wasm-sdk/devices/wasisdk/usr"))

dbg(sys.argv)
exe = sys.argv.pop(0)


if exe.endswith('c++'):
mode = "++"
args= ["clang++"]
fixargs = True
elif exe.endswith('cpp'):
mode = "-cpp"
args = ["clang-cpp"]
args.extend(sys.argv)
fixargs = False
else:
mode = ""
args = ["clang"]
fixargs = True


if fixargs:
args.extend( "-fPIC -fno-rtti -fno-exceptions -z stack-size=131072".split(' ') )

for arg in sys.argv:

if arg in ("-v", "--version"):
dbg(*sys.argv)
args=[exe]
args.extend(sys.argv)
break

if arg == '-Wl,--start-group':
continue
if arg == '-Wl,--end-group':
continue

args.append(arg)
else:

if 0:
dbg("="*80)
dbg(*sys.argv)
dbg("="*80)
dbg(*args)
dbg("_"*80)

args.extend("-lwasi-emulated-getpid -lwasi-emulated-mman -lwasi-emulated-signal -lwasi-emulated-process-clocks".split(' '))
args.extend("-D_GNU_SOURCE -D_WASI_EMULATED_MMAN -D_WASI_EMULATED_SIGNAL -D_WASI_EMULATED_PROCESS_CLOCKS -D_WASI_EMULATED_GETPID".split(' '))
args.extend("-Wno-unknown-pragmas -Wno-unused-but-set-variable -Wno-unused-command-line-argument -Wno-unsupported-floating-point-opt -Wno-nullability-completeness".split(' '))

exe = f"{WASI_SDK_PREFIX}/bin/clang{mode}"
#dbg(exe,len(args),*args)
os.execv(exe, args)

5 changes: 4 additions & 1 deletion wasisdk/bin/wasi-cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ if . $SDKROOT/wasisdk/wasisdk_env.sh
then
CMAKE=$1
shift
$CMAKE -DCMAKE_INSTALL_PREFIX=$PREFIX "$@"
$CMAKE \
-DCMAKE_SYSTEM_NAME=WASI \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
"$@"
fi

2 changes: 2 additions & 0 deletions wasisdk/wasisdk_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ then
export WASI_SYSROOT="${WASI_SDK_PREFIX}/share/wasi-sysroot"

export CMAKE_TOOLCHAIN_FILE=${WASISDK}/share/cmake/Modules/Platform/WASI.cmake
#export CMAKE_TOOLCHAIN_FILE=${WASI_SDK_DIR}/share/cmake/Platform/WASI.cmake

export CMAKE_INSTALL_PREFIX="${SDKROOT}/devices/${ARCH}/usr"
export PREFIX=$CMAKE_INSTALL_PREFIX

Expand Down

0 comments on commit 445963c

Please sign in to comment.