diff --git a/.gitmodules b/.gitmodules index 7510d1a707b74..9051680962f18 100644 --- a/.gitmodules +++ b/.gitmodules @@ -29,3 +29,6 @@ [submodule "pglite/other_extensions/pgmq"] path = pglite/other_extensions/pgmq url = https://github.com/pgmq/pgmq +[submodule "pglite/other_extensions/plpgsql_check"] + path = pglite/other_extensions/plpgsql_check + url = https://github.com/okbob/plpgsql_check.git diff --git a/build-pglite.sh b/build-pglite.sh index 16f9ed3d46121..7b887f6071138 100755 --- a/build-pglite.sh +++ b/build-pglite.sh @@ -84,7 +84,8 @@ PGLITE_LDFLAGS_EX="\ -sINVOKE_RUN=0 \ -sEXPORTED_FUNCTIONS=_main,_fgets,_fputs,_pclose,_fopen,_fclose,_fflush,___errno_location,_strerror \ $(pwd)/pglite/src/pglitec/pglitec.o \ --lproxyfs.js" +-lproxyfs.js \ +--post-js $(pwd)/pglite/scripts/doNotSetExitCode.js" # --with-blocksize=16 # --disable-largefile @@ -92,7 +93,7 @@ $(pwd)/pglite/src/pglitec/pglitec.o \ CONFIGURE_PARAMS="\ ac_cv_exeext=.js \ ---host wasm32-unknown-linux-gnu \ +--host wasm32-unknown-emscripten \ --disable-spinlocks \ --without-llvm \ --without-pam \ diff --git a/pglite/other_extensions/Makefile b/pglite/other_extensions/Makefile index 601f0ffb12545..31d7e8dbd2c95 100644 --- a/pglite/other_extensions/Makefile +++ b/pglite/other_extensions/Makefile @@ -9,7 +9,8 @@ SUBDIRS = \ pg_uuidv7 \ pg_hashids \ pg_textsearch \ - pgmq/pgmq-extension + pgmq/pgmq-extension \ + plpgsql_check prefix ?= /pglite EXTENSIONS_BUILD_ROOT := /tmp/extensions/build @@ -33,6 +34,21 @@ dist: $(addsuffix .tar.gz,$(EXTENSIONS)) files=$$(find . -type f -o -type l | sed 's|^\./||') && \ tar -czf $(ARCHIVE_DIR)/$$(basename $*)\.tar.gz $$files +# plpgsql_check's upstream Makefile hardcodes -g; strip the debug info at +# packaging time (instead of patching the submodule) to keep the .so small +# and avoid shipping DWARF sections. +plpgsql_check.tar.gz: + @echo "=== Staging plpgsql_check ===" + rm -rf $(EXTENSIONS_BUILD_ROOT)/plpgsql_check + bash -c 'mkdir -p $(EXTENSIONS_BUILD_ROOT)/plpgsql_check/$(prefix)/{bin,lib,share/extension,share/doc,share/postgresql/extension,share/postgresql/tsearch_data,include}' + $(MAKE) -C plpgsql_check install DESTDIR=$(EXTENSIONS_BUILD_ROOT)/plpgsql_check + emstrip --strip-debug $(EXTENSIONS_BUILD_ROOT)/plpgsql_check/$(prefix)/lib/postgresql/plpgsql_check.so + @echo "=== Packaging plpgsql_check ===" + mkdir -p $(ARCHIVE_DIR) + cd $(EXTENSIONS_BUILD_ROOT)/plpgsql_check/$(prefix) && \ + files=$$(find . -type f -o -type l | sed 's|^\./||') && \ + tar -czf $(ARCHIVE_DIR)/plpgsql_check.tar.gz $$files + # AGE requires SIZEOF_DATUM=4 for 32-bit WASM compatibility (strips PASSEDBYVALUE from graphid) age.tar.gz: @echo "=== Staging age (with 32-bit support) ===" diff --git a/pglite/other_extensions/plpgsql_check b/pglite/other_extensions/plpgsql_check new file mode 160000 index 0000000000000..c882056fac655 --- /dev/null +++ b/pglite/other_extensions/plpgsql_check @@ -0,0 +1 @@ +Subproject commit c882056fac65532dee95fc174c4fdc0cc0965293 diff --git a/pglite/scripts/doNotSetExitCode.js b/pglite/scripts/doNotSetExitCode.js new file mode 100644 index 0000000000000..1266bf3e2c3e2 --- /dev/null +++ b/pglite/scripts/doNotSetExitCode.js @@ -0,0 +1,2 @@ +// post.js +quit_ = (status, toThrow) => { throw toThrow; }; \ No newline at end of file