diff --git a/.buildconfig b/.buildconfig index d364fdcd5..6e888f1d9 100644 --- a/.buildconfig +++ b/.buildconfig @@ -1,4 +1,6 @@ -PG_VERSION=16.4 +PG_VERSION=REL_16_STABLE SDK_VERSION=3.1.74.2bi WASI_SDK_VERSION=24.0.5 SDKROOT=/opt/python-wasm-sdk +PG_GIT_COMMIT=8e6af359aabdf0b687dfdb8e42b489fb7d27ce0a +COPTS="-O2 -g0" diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 6ed238e68..013c6ec0f 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -207,7 +207,7 @@ jobs: - name: Build demo site run: | - NO_SDK_CHECK=true SDKROOT=/opt/python-wasm-sdk bash ./cibuild.sh demo-site + bash ./cibuild/demo-site.sh - name: Build docs working-directory: ./docs diff --git a/.github/workflows/build_wasm_postgres.yml b/.github/workflows/build_wasm_postgres.yml index 2739f8660..295b5c03e 100644 --- a/.github/workflows/build_wasm_postgres.yml +++ b/.github/workflows/build_wasm_postgres.yml @@ -19,13 +19,13 @@ jobs: SDKROOT: /opt/python-wasm-sdk SYS_PYTHON: /usr/bin/python3 PGROOT: /tmp/pglite - TOTAL_MEMORY: 128MB + TOTAL_MEMORY: 192MB CMA_MB: 16 - DEBUG: false OBJDUMP: true contrib: contrib extra: extra EXTRA_EXT: vector + DEBUG: false steps: - uses: actions/checkout@v4 @@ -84,6 +84,11 @@ jobs: run: | bash ./cibuild.sh linkweb + - name: Build and Link postgres WASI for wasi/native + if: steps.cache-restore.outputs.cache-hit != 'true' + run: | + bash ./extra/native/wip.sh + - name: Copy release for PGlite build run: | bash ./cibuild.sh pglite-prep diff --git a/cibuild.sh b/cibuild.sh index aca25ef9a..695e421dc 100755 --- a/cibuild.sh +++ b/cibuild.sh @@ -1,5 +1,8 @@ #!/bin/bash +#set -x; +#set -e; + # data transfer zone this is == (wire query size + result size ) + 2 # expressed in EMSDK MB export CMA_MB=${CMA_MB:-64} @@ -10,9 +13,8 @@ chmod +x ./extra/*.sh cibuild/*.sh . .buildconfig -export PG_VERSION SDK_VERSION WASI_SDK_VERSION SDKROOT +export PG_VERSION SDK_VERSION WASI_SDK_VERSION SDKROOT COPTS -export PG_VERSION=${PG_VERSION:-16.4} export WORKSPACE=${GITHUB_WORKSPACE:-$(pwd)} export PGROOT=${PGROOT:-/tmp/pglite} export WEBROOT=${WEBROOT:-/tmp/web} @@ -30,10 +32,10 @@ EOE=false if ./cibuild/sdk.sh then - echo "sdk check passed (emscripten)" + echo "sdk check passed (emscripten+wasi)" else echo sdk failed - exit 44 + exit 39 fi @@ -82,8 +84,39 @@ System node/pnpm ( may interfer) : if ${WASI:-false} then echo "Wasi build (experimental)" - . /opt/python-wasm-sdk/wasm32-wasi-shell.sh + export WASI_SDK=24.0 + export WASI_SDK_PREFIX=/opt/python-wasm-sdk/wasisdk/wasi-sdk-${WASI_SDK}-x86_64-linux + export WASI_SYSROOT=${WASI_SDK_PREFIX}/share/wasi-sysroot + if [ -f ${WASI_SYSROOT}/extra ] + then + echo -n + else + pushd ${WASI_SYSROOT} + VMLABS="https://github.com/vmware-labs/webassembly-language-runtimes/releases/download" + 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 + touch ${WASI_SYSROOT}/extra + fi + + + if false + then + . /opt/python-wasm-sdk/wasisdk/wasisdk_env.sh + env|grep WASI + export CC=${WASI_SDK_DIR}/bin/clang + export CPP=${WASI_SDK_DIR}/bin/clang-cpp + export CXX=${WASI_SDK_DIR}/bin/clang++ + export CFLAGS="-D_WASI_EMULATED_SIGNAL" + export LDFLAGS="-lwasi-emulated-signal" + else + . ${SDKROOT}/wasm32-wasi-shell.sh + fi else if which emcc then @@ -173,6 +206,8 @@ if $OBJDUMP then mkdir -p patches/imports patches/imports.pgcore else + mkdir -p patches/imports + touch patches/imports/plpgsql echo " WARNING: wasm-objdump not found or OBJDUMP disabled, some extensions may not load properly @@ -231,9 +266,10 @@ END fi mkdir -p ${PGROOT}/include/postgresql/server - cp ${PG_DEBUG_HEADER} ${PGROOT}/include/ - cp ${PG_DEBUG_HEADER} ${PGROOT}/include/postgresql - cp ${PG_DEBUG_HEADER} ${PGROOT}/include/postgresql/server + for dest in ${PGROOT}/include ${PGROOT}/include/postgresql ${PGROOT}/include/postgresql/server + do + [ -f $dest/pg_debug.h ] || cp ${PG_DEBUG_HEADER} $dest/ + done # store all pg options that have impact on cmd line initdb/boot cat > ${PGROOT}/pgopts.sh <