diff --git a/pglite/build-postgis.sh b/pglite/build-postgis.sh index 5ff083c17d50d..5e5c092175901 100755 --- a/pglite/build-postgis.sh +++ b/pglite/build-postgis.sh @@ -12,9 +12,11 @@ PROJ_VERSION=9.7.0 LDFLAGS="-L/install/libs/lib" CFLAGS="${PGLITE_CFLAGS}" CXXFL # touch ./loader/pgsql2shp.wasm emmake make raster-sql || true # these flags are used in pgxs.mk (postgresql extension makefile) and passed to the build process of that extension -emmake make LDFLAGS_SL="-sWASM_BIGINT -sSIDE_MODULE=1 -fexceptions -Wl,--whole-archive -lstdc++ -lsqlite3 -lgeos -Wl,--no-whole-archive" \ -CFLAGS_SL="-fexceptions -sWASM_BIGINT" \ -CXXFLAGS_SL="-fexceptions -sWASM_BIGINT" -j || { echo 'emmake make postgis failed' ; exit 442; } +emmake make LDFLAGS_SL="-sWASM_BIGINT -sSIDE_MODULE=1 -fexceptions -Wl,--whole-archive -lgeos_c -Wl,--no-whole-archive -lstdc++ -lsqlite3 -lgeos -flto" \ +CFLAGS_SL="-fexceptions -sWASM_BIGINT -Oz -flto -ffunction-sections -fdata-sections" \ +CXXFLAGS_SL="-fexceptions -sWASM_BIGINT -Oz -flto -ffunction-sections -fdata-sections" -j || { echo 'emmake make postgis failed' ; exit 442; } +/emsdk/upstream/bin/wasm-opt -Oz postgis/postgis-3.so -o postgis/postgis-3.opt.so || { echo 'wasm-opt postgis failed' ; exit 443; } +mv postgis/postgis-3.opt.so postgis/postgis-3.so # emmake make PG_LDFLAGS="-L/install/libs/lib -lpgport -lpgcommon -sSIDE_MODULE=1" -j cd ..