diff --git a/.gitignore b/.gitignore index f9d8874941d77..3c64be6c7d664 100644 --- a/.gitignore +++ b/.gitignore @@ -55,5 +55,8 @@ pglite.data pglite.js pglite.html *.map +*.defs.txt +*.undef.txt +excluded.pglite.exports pglite-wasm/excluded.imports -*.symbols \ No newline at end of file +*.symbols diff --git a/.gitmodules b/.gitmodules index a2b2f6b5a7287..99178c3ae7d7b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,6 +4,9 @@ [submodule "pglite/pgvector"] path = pglite/vector url = https://github.com/pgvector/pgvector.git +[submodule "pglite/postgis"] + path = pglite/postgis + url = https://github.com/postgis/postgis.git [submodule "pglite/pgtap"] path = pglite/pgtap url = https://github.com/theory/pgtap.git diff --git a/build-pglite.sh b/build-pglite.sh index 9e71fa772e4fe..56405b2630730 100755 --- a/build-pglite.sh +++ b/build-pglite.sh @@ -79,7 +79,10 @@ emmake make PORTNAME=emscripten -C contrib/ dist || { echo 'error: emmake make P SAVE_PATH=$PATH PATH=$PATH:$INSTALL_FOLDER/bin emmake make OPTFLAGS="" PORTNAME=emscripten -j -C pglite || { echo 'error: emmake make OPTFLAGS="" PORTNAME=emscripten -j -C pglite' ; exit 41; } -emmake make OPTFLAGS="" PORTNAME=emscripten -C pglite/ dist || { echo 'error: make OPTFLAGS="" PORTNAME=emscripten -C pglite/ dist ' ; exit 42; } +# postgis - special case +cd ./pglite/ && ./build-postgis.sh && cd ../ +emmake make OPTFLAGS="" PORTNAME=emscripten -C pglite/ dist || { echo 'emmake make OPTFLAGS="" PORTNAME=emscripten -C pglite/ dist ' ; exit 42; } +emmake make OPTFLAGS="" PORTNAME=emscripten -C pglite/ dist-postgis || { echo 'emmake make OPTFLAGS="" PORTNAME=emscripten -C pglite/ dist-postgis' ; exit 43; } PATH=$SAVE_PATH # Step 5: make and install pglite diff --git a/build-with-docker.sh b/build-with-docker.sh index 2e7bbddbe24a3..291ba9e56d871 100755 --- a/build-with-docker.sh +++ b/build-with-docker.sh @@ -1,6 +1,12 @@ # although we could use any path inside docker, using the same path as on the host # allows the DWARF info (when building in DEBUG) to contain the correct file paths DOCKER_WORKSPACE=$(pwd) +GITHUB_ACTIONS=${GITHUB_ACTIONS:-"false"} +if [ "$GITHUB_ACTIONS" = "true" ]; then + echo "Running inside GitHub Actions" +else + echo "Not running inside GitHub Actions" +fi docker run $@ \ --rm \ @@ -8,6 +14,6 @@ docker run $@ \ --workdir=${DOCKER_WORKSPACE} \ -v .:${DOCKER_WORKSPACE}:rw \ -v ./dist:/install/pglite:rw \ - electricsql/pglite-builder:3.1.74_4 \ + electricsql/pglite-builder:3.1.74-postgis_4 \ ./build-pglite.sh diff --git a/clean-pglite.sh b/clean-pglite.sh index 4f72e3fa60a8b..189ca0cef3eab 100755 --- a/clean-pglite.sh +++ b/clean-pglite.sh @@ -7,4 +7,4 @@ emmake make PORTNAME=emscripten -C pglite clean; emmake make PORTNAME=emscripten emmake make PORTNAME=emscripten clean; emmake make PORTNAME=emscripten uninstall; echo "removing config.status" -rm config.status \ No newline at end of file +rm config.status diff --git a/pglite-wasm/builder/Dockerfile b/pglite-wasm/builder/Dockerfile index 8bcf3c6bb6aa3..93bc5165092de 100644 --- a/pglite-wasm/builder/Dockerfile +++ b/pglite-wasm/builder/Dockerfile @@ -24,15 +24,19 @@ WORKDIR /src # ENV EMCC_COMMON_FLAGS="-fPIC -sWASM_BIGINT -sMIN_SAFARI_VERSION=150000 -O2 -m32 -D_FILE_OFFSET_BITS=64 -sSUPPORT_LONGJMP=emscripten -mno-bulk-memory -mnontrapping-fptoint -mno-reference-types -mno-sign-ext -mno-extended-const -mno-atomics -mno-tail-call -mno-multivalue -mno-relaxed-simd -mno-simd128 -mno-multimemory -mno-exception-handling -Wno-unused-command-line-argument -Wno-unreachable-code-fallthrough -Wno-unused-function -Wno-invalid-noreturn -Wno-declaration-after-statement -Wno-invalid-noreturn" ENV EMCC_COMMON_FLAGS="-O2 -fPIC -sWASM_BIGINT" +COPY ./prebuilts/ /src/ + WORKDIR /src -RUN curl -L https://www.zlib.net/zlib-1.3.1.tar.gz | tar -xz +# RUN curl -L https://www.zlib.net/zlib-1.3.1.tar.gz | tar -xz +RUN tar -xzf zlib-1.3.1.tar.gz WORKDIR /src/zlib-1.3.1 RUN CFLAGS="${EMCC_COMMON_FLAGS}" CXXFLAGS="${EMCC_COMMON_FLAGS}" emconfigure ./configure --static --prefix=/install/libs RUN emmake make -j && emmake make install RUN ${LLVM_NM} /install/libs/lib/libz.a | awk '$2 ~ /^[TDB]$/ {print $3}' | sed '/^$/d' | sort -u > /install/exports/libz.exports WORKDIR /src -RUN curl -L https://gitlab.gnome.org/GNOME/libxml2/-/archive/v2.14.5/libxml2-v2.14.5.tar.gz | tar -xz +# RUN curl -L https://gitlab.gnome.org/GNOME/libxml2/-/archive/v2.14.5/libxml2-v2.14.5.tar.gz | tar -xz +RUN tar -xvf libxml2-v2.14.5.tar.gz WORKDIR /src/libxml2-v2.14.5 RUN ./autogen.sh --with-python=no --with-threads=no RUN CFLAGS="${EMCC_COMMON_FLAGS}" CXXFLAGS="${EMCC_COMMON_FLAGS}" emconfigure ./configure --enable-shared=no --enable-static=yes --with-python=no --prefix=/install/libs @@ -41,16 +45,20 @@ RUN emmake make -j && emmake make install RUN ${LLVM_NM} /install/libs/lib/libxml2.a | awk '$2 ~ /^[TDB]$/ {print $3}' | sed '/^$/d' | sort -u > /install/exports/libxml2.exports WORKDIR /src -RUN curl -L https://gitlab.gnome.org/GNOME/libxslt/-/archive/v1.1.43/libxslt-v1.1.43.tar.gz | tar -xz +# RUN curl -L https://gitlab.gnome.org/GNOME/libxslt/-/archive/v1.1.43/libxslt-v1.1.43.tar.gz | tar -xz +RUN tar -xvf libxslt-v1.1.43.tar.gz WORKDIR /src/libxslt-v1.1.43 RUN ./autogen.sh --with-python=no -RUN CFLAGS="${EMCC_COMMON_FLAGS}" CXXFLAGS="${EMCC_COMMON_FLAGS}" emconfigure ./configure --enable-shared=no --enable-static=yes --with-python=no --prefix=/install/libs --with-libxml-src=/src/libxml2-v2.14.5/ --with-pic=yes +RUN CFLAGS="${EMCC_COMMON_FLAGS}" CXXFLAGS="${EMCC_COMMON_FLAGS}" \ +emconfigure ./configure \ +--enable-shared=no --enable-static=yes --with-python=no --prefix=/install/libs --with-libxml-src=/src/libxml2-v2.14.5/ --with-pic=yes RUN emmake make -j && emmake make install # extract exported symbols - useful for passing them to emscripten as EXPORTED_FUNCTIONS RUN ${LLVM_NM} /install/libs/lib/libxslt.a | awk '$2 ~ /^[TDB]$/ {print $3}' | sed '/^$/d' | sort -u > /install/exports/libxslt.exports WORKDIR /src -RUN curl -L https://github.com/openssl/openssl/releases/download/openssl-3.0.17/openssl-3.0.17.tar.gz | tar xz +# RUN curl -L https://github.com/openssl/openssl/releases/download/openssl-3.0.17/openssl-3.0.17.tar.gz | tar xz +RUN tar -xvf openssl-3.0.17.tar.gz WORKDIR /src/openssl-3.0.17 RUN CFLAGS="${EMCC_COMMON_FLAGS}" CXXFLAGS="${EMCC_COMMON_FLAGS}" emconfigure ./config no-sse2 no-hw no-asm no-tests no-threads no-shared linux-generic32 --prefix=/install/libs RUN sed -i 's|^CROSS_COMPILE.*$|CROSS_COMPILE=|g' Makefile # see https://github.com/emscripten-core/emscripten/issues/19597#issue-1754476454 @@ -60,9 +68,9 @@ RUN ${LLVM_NM} /install/libs/lib/libssl.a | awk '$2 ~ /^[TDB]$/ {print $3}' | se RUN ${LLVM_NM} /install/libs/lib/libcrypto.a | awk '$2 ~ /^[TDB]$/ {print $3}' | sed '/^$/d' | sort -u > /install/exports/libcrypto.exports WORKDIR /src -RUN curl -L ftp://ftp.ossp.org/pkg/lib/uuid/uuid-1.6.2.tar.gz | tar xz -# COPY . . -# RUN tar xvf uuid-1.6.2.tar.gz +# RUN curl -L ftp://ftp.ossp.org/pkg/lib/uuid/uuid-1.6.2.tar.gz | tar xz +# COPY ./prebuilts/uuid-1.6.2.tar.gz . +RUN tar xvf uuid-1.6.2.tar.gz WORKDIR /src/uuid-1.6.2 RUN CFLAGS="${EMCC_COMMON_FLAGS}" CXXFLAGS="${EMCC_COMMON_FLAGS}" emconfigure ./configure --build=aarch64-unknown-linux-gnu --enable-shared=no --enable-static=yes --with-perl=no --with-perl-compat=no --prefix=/install/libs --with-php=no --with-pic=yes RUN emmake make -j && emmake make install || true # install tries to strip the wasm, but it doesnt recognize the format, so ignore atm @@ -70,13 +78,114 @@ WORKDIR /install/libs/lib RUN ln -s libuuid.a libossp-uuid.a # contrib extensions use -lossp-uuid RUN ${LLVM_NM} /install/libs/lib/libossp-uuid.a | awk '$2 ~ /^[TDB]$/ {print $3}' | sed '/^$/d' | sort -u > /install/exports/libossp-uuid.exports +# for postgis +WORKDIR /src +RUN git clone --depth 1 --single-branch --branch=json-c-0.18-20240915 https://github.com/json-c/json-c.git +WORKDIR /src/json-c/build +RUN emcmake cmake \ +-DCMAKE_BUILD_TYPE=Release \ +-DCMAKE_POSITION_INDEPENDENT_CODE=ON \ +-DCMAKE_INSTALL_PREFIX=/install/libs \ +-DENABLE_THREADING=OFF -DBUILD_SHARED_LIBS=OFF -DDISABLE_EXTRA_LIBS=ON -DBUILD_APPS=OFF -DBUILD_TESTING=OFF .. +RUN cmake --build . -j && cmake --build . --target install +RUN ${LLVM_NM} /install/libs/lib/libjson-c.a | awk '$2 ~ /^[TDB]$/ {print $3}' | sed '/^$/d' | sort -u > /install/exports/libjson-c.exports + +WORKDIR /src +RUN git clone --depth 1 --single-branch --branch=v1.24 https://github.com/ebiggers/libdeflate.git +WORKDIR /src/libdeflate/build +RUN emcmake cmake \ +-DCMAKE_BUILD_TYPE=Release \ +-DCMAKE_POSITION_INDEPENDENT_CODE=ON \ +-DCMAKE_INSTALL_PREFIX=/install/libs \ +-DLIBDEFLATE_BUILD_SHARED_LIB=OFF -DLIBDEFLATE_BUILD_TESTS=OFF .. +RUN cmake --build . -j && cmake --build . --target install +RUN ${LLVM_NM} /install/libs/lib/libdeflate.a | awk '$2 ~ /^[TDB]$/ {print $3}' | sed '/^$/d' | sort -u > /install/exports/libdeflate.exports + +WORKDIR /src +# RUN curl -L https://gitlab.com/libtiff/libtiff/-/archive/v4.7.1/libtiff-v4.7.1.tar.gz | tar xz +RUN tar -xvf libtiff-v4.7.1.tar.gz +WORKDIR /src/libtiff-v4.7.1 +RUN ./autogen.sh +# we're disabling jpeg here but gdal uses jpeg (internal build if not specified - so it would make sense to enable it here as well) +RUN emconfigure ./configure \ +--with-pic --disable-webp --disable-zstd --disable-lzma --disable-jbig --disable-old-jpeg \ +--disable-jpeg --disable-pixarlog --disable-mdi --disable-opengl --disable-win32-io \ +--with-zlib-include-dir=/install/libs/include --with-zlib-lib-dir=/install/libs/lib \ +--with-libdeflate-include-dir=/install/libs/include --with-libdeflate-lib-dir=/install/libs/lib/ \ +--prefix=/install/libs --enable-shared=no +RUN emmake make -j && emmake make install +RUN ${LLVM_NM} /install/libs/lib/libtiff.a | awk '$2 ~ /^[TDB]$/ {print $3}' | sed '/^$/d' | sort -u > /install/exports/libtiff.exports + +WORKDIR /src +# RUN curl -L https://www.sqlite.org/2025/sqlite-src-3500400.zip | unzip +RUN unzip sqlite-src-3500400.zip +WORKDIR /src/sqlite-src-3500400 +RUN emconfigure ./configure --disable-shared --disable-threadsafe --prefix=/install/libs --with-emsdk +RUN emmake make -j && emmake make install +# we need a sqlite3 executable for the system on which we're building (needed by https://proj.org/en/stable/install.html#build-requirements) +RUN emmake make clean && ./configure --disable-shared && make -j && cp sqlite3 /tmp/sqlite3 +RUN ${LLVM_NM} /install/libs/lib/libsqlite3.a | awk '$2 ~ /^[TDB]$/ {print $3}' | sed '/^$/d' | sort -u > /install/exports/libsqlite3.exports + +WORKDIR /src +# RUN curl -L https://download.osgeo.org/proj/proj-9.7.0.tar.gz | tar xz +RUN tar -xvf proj-9.7.0.tar.gz +WORKDIR /src/proj-9.7.0 +RUN emcmake cmake \ +-DCMAKE_BUILD_TYPE=Release \ +-DCMAKE_POSITION_INDEPENDENT_CODE=ON \ +-DCMAKE_INSTALL_PREFIX:PATH=/install/libs \ +-DEMBED_RESOURCE_FILES=OFF \ +-DBUILD_SHARED_LIBS=OFF \ +-DSQLite3_INCLUDE_DIR=/install/libs/include/ -DSQLite3_LIBRARY=/install/libs/lib/libsqlite3.a -DEXE_SQLITE3=/tmp/sqlite3 \ +-DTIFF_LIBRARY=/install/libs/lib/libtiff.a -DTIFF_INCLUDE_DIR=/install/libs/include/ \ +-DENABLE_CURL=OFF -DBUILD_APPS=OFF -DBUILD_TESTING=OFF +RUN cmake --build . -j && cmake --build . --target install +RUN ${LLVM_NM} /install/libs/lib/libproj.a | awk '$2 ~ /^[TDB]$/ {print $3}' | sed '/^$/d' | sort -u > /install/exports/libproj.exports + +WORKDIR /src +# RUN curl -L https://download.osgeo.org/geos/geos-3.14.0.tar.bz2 | tar xz +RUN tar -xvf geos-3.14.0.tar.bz2 +WORKDIR /src/geos-3.14.0/build +RUN emcmake cmake \ +-DCMAKE_BUILD_TYPE=Release \ +-DCMAKE_POSITION_INDEPENDENT_CODE=ON \ +-DCMAKE_INSTALL_PREFIX=/install/libs \ +-DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_GEOSOP=OFF .. +RUN emmake make -j && emmake make install +RUN ${LLVM_NM} /install/libs/lib/libgeos.a | awk '$2 ~ /^[TDB]$/ {print $3}' | sed '/^$/d' | sort -u > /install/exports/libgeos.exports + +WORKDIR /src +# RUN curl -L https://github.com/OSGeo/gdal/releases/download/v3.11.4/gdal-3.11.4.tar.gz | tar xz +RUN tar -xvf gdal-3.11.4.tar.gz +WORKDIR /src/gdal-3.11.4/build +# Docs: https://gdal.org/en/stable/development/building_from_source.html +RUN emcmake cmake \ +-DCMAKE_BUILD_TYPE=Release \ +-DCMAKE_POSITION_INDEPENDENT_CODE=ON \ +-DCMAKE_INSTALL_PREFIX=/install/libs \ +-DLIBXML2_INCLUDE_DIR=/install/libs/include/libxml2 -DLIBXML2_LIBRARY=/install/libs/lib/libxml2.a \ +-DGEOS_INCLUDE_DIR=/install/libs/include/geos -DGEOS_LIBRARY=/install/libs/lib/libgeos.a \ +-DTIFF_INCLUDE_DIR=/install/libs/include/ -DTIFF_LIBRARY=/install/libs/lib/libtiff.a \ +-DSQLite3_INCLUDE_DIR=/install/libs/include/ -DSQLite3_LIBRARY=/install/libs/lib/libsqlite3.a -DEXE_SQLITE3=/tmp/sqlite3 \ +-DZLIB_LIBRARY=/install/libs/lib/libz.a -DZLIB_INCLUDE_DIR=/install/libs/include \ +-DOPENSSL_ROOT_DIR=/install/libs \ +-DPROJ_LIBRARY=/install/libs/lib/libproj.a -DPROJ_INCLUDE_DIR=/install/libs/include/ \ +-DJSONC_LIBRARY=/install/libs/lib/libjson-c.a -DJSONC_INCLUDE_DIR=/install/libs/include/json-c -DGDAL_USE_JSONC=ON -DGDAL_USE_JSONC_INTERNAL=OFF \ +-DBUILD_SHARED_LIBS=OFF -DBUILD_APPS=OFF -DGDAL_BUILD_OPTIONAL_DRIVERS=OFF -DOGR_BUILD_OPTIONAL_DRIVERS=OFF \ +-DGDAL_USE_HDFS=OFF \ +-DACCEPT_MISSING_SQLITE3_MUTEX_ALLOC:BOOL=ON \ +.. + +RUN cmake --build . -j && cmake --build . --target install +RUN ${LLVM_NM} /install/libs/lib/libgdal.a | awk '$2 ~ /^[TDB]$/ {print $3}' | sed '/^$/d' | sort -u > /install/exports/libgdal.exports + ARG TARGETARCH FROM emscripten/emsdk:${EMSDK_VER} AS base-amd64 FROM emscripten/emsdk:${EMSDK_VER}-arm64 AS base-arm64 FROM base-${TARGETARCH} AS runner RUN apt update && apt upgrade -y && apt install -y \ - xz-utils autoconf libtool automake pkgconf bison flex + xz-utils autoconf libtool automake pkgconf bison flex vim # this is where the libraries will be installed and subsequently where the LIBS and INCLUDES can be found ARG INSTALL_PREFIX=/install/libs diff --git a/pglite-wasm/builder/prebuilts/gdal-3.11.4.tar.gz b/pglite-wasm/builder/prebuilts/gdal-3.11.4.tar.gz new file mode 100644 index 0000000000000..66f6d29885582 Binary files /dev/null and b/pglite-wasm/builder/prebuilts/gdal-3.11.4.tar.gz differ diff --git a/pglite-wasm/builder/prebuilts/geos-3.14.0.tar.bz2 b/pglite-wasm/builder/prebuilts/geos-3.14.0.tar.bz2 new file mode 100644 index 0000000000000..453b4b7cfef62 Binary files /dev/null and b/pglite-wasm/builder/prebuilts/geos-3.14.0.tar.bz2 differ diff --git a/pglite-wasm/builder/prebuilts/libtiff-v4.7.1.tar.gz b/pglite-wasm/builder/prebuilts/libtiff-v4.7.1.tar.gz new file mode 100644 index 0000000000000..3f9162fb8acf6 Binary files /dev/null and b/pglite-wasm/builder/prebuilts/libtiff-v4.7.1.tar.gz differ diff --git a/pglite-wasm/builder/prebuilts/libxml2-v2.14.5.tar.gz b/pglite-wasm/builder/prebuilts/libxml2-v2.14.5.tar.gz new file mode 100644 index 0000000000000..b6fa3a377a637 Binary files /dev/null and b/pglite-wasm/builder/prebuilts/libxml2-v2.14.5.tar.gz differ diff --git a/pglite-wasm/builder/prebuilts/libxslt-v1.1.43.tar.gz b/pglite-wasm/builder/prebuilts/libxslt-v1.1.43.tar.gz new file mode 100644 index 0000000000000..0357738156ca2 Binary files /dev/null and b/pglite-wasm/builder/prebuilts/libxslt-v1.1.43.tar.gz differ diff --git a/pglite-wasm/builder/prebuilts/openssl-3.0.17.tar.gz b/pglite-wasm/builder/prebuilts/openssl-3.0.17.tar.gz new file mode 100644 index 0000000000000..83b58a0e8bb85 Binary files /dev/null and b/pglite-wasm/builder/prebuilts/openssl-3.0.17.tar.gz differ diff --git a/pglite-wasm/builder/prebuilts/proj-9.7.0.tar.gz b/pglite-wasm/builder/prebuilts/proj-9.7.0.tar.gz new file mode 100644 index 0000000000000..b3c4ffc86a3f4 Binary files /dev/null and b/pglite-wasm/builder/prebuilts/proj-9.7.0.tar.gz differ diff --git a/pglite-wasm/builder/prebuilts/sqlite-src-3500400.zip b/pglite-wasm/builder/prebuilts/sqlite-src-3500400.zip new file mode 100644 index 0000000000000..6963d42fc4826 Binary files /dev/null and b/pglite-wasm/builder/prebuilts/sqlite-src-3500400.zip differ diff --git a/pglite-wasm/builder/prebuilts/uuid-1.6.2.tar.gz b/pglite-wasm/builder/prebuilts/uuid-1.6.2.tar.gz new file mode 100644 index 0000000000000..fde88d4b81991 Binary files /dev/null and b/pglite-wasm/builder/prebuilts/uuid-1.6.2.tar.gz differ diff --git a/pglite-wasm/builder/prebuilts/zlib-1.3.1.tar.gz b/pglite-wasm/builder/prebuilts/zlib-1.3.1.tar.gz new file mode 100644 index 0000000000000..53fa48bf97f0e Binary files /dev/null and b/pglite-wasm/builder/prebuilts/zlib-1.3.1.tar.gz differ diff --git a/pglite-wasm/excluded.pglite.imports b/pglite-wasm/excluded.pglite.imports index e0d801f2348b5..a9f3ad9752451 100644 --- a/pglite-wasm/excluded.pglite.imports +++ b/pglite-wasm/excluded.pglite.imports @@ -24,7 +24,6 @@ invoke_viiidi invoke_viiii invoke_viiiii invoke_viiiiii -invoke_viiiiii invoke_viiiiiiii invoke_viiiiiiiii invoke_viiji diff --git a/pglite-wasm/included.pglite.imports b/pglite-wasm/included.pglite.imports index ad348a8178828..be12478560bc4 100644 --- a/pglite-wasm/included.pglite.imports +++ b/pglite-wasm/included.pglite.imports @@ -1,96 +1,657 @@ +__addtf3 +__ctype_get_mb_cur_max +__ctype_tolower_loc +__ctype_toupper_loc +__cxa_allocate_exception +__cxa_atexit +__cxa_bad_cast +__cxa_bad_typeid +__cxa_begin_catch +__cxa_current_primary_exception +__cxa_decrement_exception_refcount +__cxa_end_catch +__cxa_finalize +__cxa_find_matching_catch_2 +__cxa_find_matching_catch_3 +__cxa_free_exception +__cxa_get_exception_ptr +__cxa_increment_exception_refcount +__cxa_init_primary_exception +__cxa_pure_virtual +__cxa_rethrow +__cxa_rethrow_primary_exception +__cxa_throw +__cxa_uncaught_exceptions +__divtf3 +__divti3 +__dynamic_cast +__eqtf2 __errno_location +__extenddftf2 +__lshrti3 +__lttf2 +__multf3 +__multi3 +__resumeException +__small_fprintf +__small_printf +__subtf3 +__trunctfdf2 +_ZdlPv +_ZdlPvm +_ZNKSt10bad_typeid4whatEv +_ZNKSt11logic_error4whatEv +_ZNKSt13bad_exception4whatEv +_ZNKSt13runtime_error4whatEv +_ZNKSt20bad_array_new_length4whatEv +_ZNKSt8bad_cast4whatEv +_ZNKSt9bad_alloc4whatEv +_ZNKSt9exception4whatEv +_ZNSt10bad_typeidC1Ev +_ZNSt10bad_typeidC2Ev +_ZNSt10bad_typeidD0Ev +_ZNSt10bad_typeidD1Ev +_ZNSt10bad_typeidD2Ev +_ZNSt11logic_errorD0Ev +_ZNSt11logic_errorD1Ev +_ZNSt11logic_errorD2Ev +_ZNSt11range_errorD0Ev +_ZNSt11range_errorD1Ev +_ZNSt11range_errorD2Ev +_ZNSt12domain_errorD0Ev +_ZNSt12domain_errorD1Ev +_ZNSt12domain_errorD2Ev +_ZNSt12length_errorD0Ev +_ZNSt12length_errorD1Ev +_ZNSt12length_errorD2Ev +_ZNSt12out_of_rangeD0Ev +_ZNSt12out_of_rangeD1Ev +_ZNSt12out_of_rangeD2Ev +_ZNSt13bad_exceptionD0Ev +_ZNSt13bad_exceptionD1Ev +_ZNSt13bad_exceptionD2Ev +_ZNSt13runtime_errorD0Ev +_ZNSt13runtime_errorD1Ev +_ZNSt13runtime_errorD2Ev +_ZNSt14overflow_errorD0Ev +_ZNSt14overflow_errorD1Ev +_ZNSt14overflow_errorD2Ev +_ZNSt15underflow_errorD0Ev +_ZNSt15underflow_errorD1Ev +_ZNSt15underflow_errorD2Ev +_ZNSt16invalid_argumentD0Ev +_ZNSt16invalid_argumentD1Ev +_ZNSt16invalid_argumentD2Ev +_ZNSt20bad_array_new_lengthC1Ev +_ZNSt20bad_array_new_lengthC2Ev +_ZNSt20bad_array_new_lengthD0Ev +_ZNSt20bad_array_new_lengthD1Ev +_ZNSt20bad_array_new_lengthD2Ev +_ZNSt3__210__stdinbufIcEC2EP8_IO_FILEP11__mbstate_t +_ZNSt3__210__stdinbufIwEC2EP8_IO_FILEP11__mbstate_t +_ZNSt3__211__stdoutbufIcEC2EP8_IO_FILEP11__mbstate_t +_ZNSt3__211__stdoutbufIwEC2EP8_IO_FILEP11__mbstate_t +_ZNSt8bad_castC1Ev +_ZNSt8bad_castC2Ev +_ZNSt8bad_castD0Ev +_ZNSt8bad_castD1Ev +_ZNSt8bad_castD2Ev +_ZNSt9bad_allocC1Ev +_ZNSt9bad_allocC2Ev +_ZNSt9bad_allocD0Ev +_ZNSt9bad_allocD1Ev +_ZNSt9bad_allocD2Ev +_ZNSt9exceptionD0Ev +_ZNSt9exceptionD1Ev +_ZNSt9exceptionD2Ev +_ZNSt9type_infoD0Ev +_ZNSt9type_infoD1Ev +_ZNSt9type_infoD2Ev +_Znwm +_ZSt15get_new_handlerv +_ZSt9terminatev +_ZTIPKc +_ZTISt10bad_typeid +_ZTISt11logic_error +_ZTISt11range_error +_ZTISt12domain_error +_ZTISt12length_error +_ZTISt12out_of_range +_ZTISt13bad_exception +_ZTISt13runtime_error +_ZTISt14overflow_error +_ZTISt15underflow_error +_ZTISt16invalid_argument +_ZTISt20bad_array_new_length +_ZTISt8bad_cast +_ZTISt9bad_alloc +_ZTISt9exception +_ZTISt9type_info +_ZTSSt10bad_typeid +_ZTSSt11logic_error +_ZTSSt11range_error +_ZTSSt12domain_error +_ZTSSt12length_error +_ZTSSt12out_of_range +_ZTSSt13bad_exception +_ZTSSt13runtime_error +_ZTSSt14overflow_error +_ZTSSt15underflow_error +_ZTSSt16invalid_argument +_ZTSSt20bad_array_new_length +_ZTSSt8bad_cast +_ZTSSt9bad_alloc +_ZTSSt9exception +_ZTSSt9type_info +_ZTVN10__cxxabiv116__enum_type_infoE +_ZTVN10__cxxabiv116__shim_type_infoE +_ZTVN10__cxxabiv117__array_type_infoE +_ZTVN10__cxxabiv117__class_type_infoE +_ZTVN10__cxxabiv117__pbase_type_infoE +_ZTVN10__cxxabiv119__pointer_type_infoE +_ZTVN10__cxxabiv120__function_type_infoE +_ZTVN10__cxxabiv120__si_class_type_infoE +_ZTVN10__cxxabiv121__vmi_class_type_infoE +_ZTVN10__cxxabiv123__fundamental_type_infoE +_ZTVN10__cxxabiv129__pointer_to_member_type_infoE +_ZTVSt10bad_typeid +_ZTVSt11logic_error +_ZTVSt11range_error +_ZTVSt12domain_error +_ZTVSt12length_error +_ZTVSt12out_of_range +_ZTVSt13bad_exception +_ZTVSt13runtime_error +_ZTVSt14overflow_error +_ZTVSt15underflow_error +_ZTVSt16invalid_argument +_ZTVSt20bad_array_new_length +_ZTVSt8bad_cast +_ZTVSt9bad_alloc +_ZTVSt9exception +_ZTVSt9type_info +abort +access +acos +acosh +acosl +AggCheckCallContext +aligned_alloc +AllocSetContextCreateInternal appendStringInfo appendStringInfoChar appendStringInfoString +array_create_iterator +array_free_iterator +array_iterate +ArrayGetNItems +asin +asinh +atan +atan2 +atan2l +atanh atexit +atof atoi +BlessTupleDesc +bsearch +btowc BuildTupleFromCStrings +CacheMemoryContext +CallerFInfoFunctionCall1 +CallerFInfoFunctionCall2 +calloc +cbrt +chdir +check_stack_depth +clearerr +clock_gettime close +closedir +construct_array +construct_md_array +cos +cosh +cosl cstring_to_text cstring_to_text_with_len +CurrentMemoryContext +datumCopy +DecodeDateTime +deconstruct_array deconstruct_array_builtin +DecrTupleDescRefCount +DirectFunctionCall1Coll +DirectFunctionCall2Coll +DirectFunctionCall3Coll +DirectFunctionCall4Coll +DirectFunctionCall5Coll +dladdr +dlclose +dlerror +dlopen +dlsym downcase_truncate_identifier +dup +EncodeDateOnly +EncodeDateTime +EncodeSpecialDate +EncodeSpecialTimestamp +EncodeTimeOnly +end_MultiFuncCall enlargeStringInfo errcode +errdetail +errfinish +errhint +errmsg +errmsg_internal +errstart +errstart_cold +escape_json +exit +exp +exp2 +exprType +fchmod +fchmodat +fchown +fclose fcntl +fdatasync +fdopen +fdopendir +ferror +fflush +fileno +find_coercion_pathway +find_option +fiprintf +Float8GetDatum +fmax +fmin +fmod fopen +fputc +fputs +fputwc +fread free +free_attstatsslot +freelocale +frexp +fseek +fseeko +fstat +ftell +ftello +ftruncate +fwrite gai_strerror gen_random_uuid +get_attnum +get_attstatsslot get_call_result_type +get_commutator +get_element_type +get_extension_oid +get_fn_expr_argtype +get_func_name +get_func_namespace +get_namespace_name +get_opfamily_member +get_rel_name +get_restriction_variable +get_typbyval +get_typlen +get_typlenbyvalalign +GetAttributeByNum +getBaseType +getc +getcwd GetDatabaseEncoding getegid +getentropy getenv geteuid getgid +GetMemoryChunkContext +getmissingattr getpid +GetSysCacheOid +getTempRet0 gettimeofday +getTypeOutputInfo getuid +getwc gmtime +hash_bytes +hash_create +hash_search +heap_form_tuple +heap_freetuple +heap_getsysattr +HeapTupleHeaderGetDatum +hypot +iconv +iconv_close +iconv_open +index_close +index_open +init_MultiFuncCall initStringInfo +Int64GetDatum interactive_one +InterruptPending ioctl +iprintf +is_pseudo_constant_for_index isalnum +isalpha +isatty +isdigit_l +isgraph +isspace +IsValidJsonNumber +iswalpha_l +iswblank_l +iswcntrl_l +iswdigit_l +iswlower_l +iswprint_l +iswpunct_l +iswspace_l +iswupper_l +iswxdigit_l isxdigit +isxdigit_l +j2date +jsonb_in +lappend +ldexp +link +list_concat +list_make1_impl +list_make2_impl +llround +localeconv +localtime +localtime_r +log +log10 +log2 +logb +lookup_rowtype_tupdesc +LookupFuncName lowerstr +lround +lstat main +make_opclause +makeFuncExpr +makeString +makeStringInfo malloc +mbrlen +mbrtowc +mbsnrtowcs +mbsrtowcs +mbtowc memchr memcmp memcpy memmove MemoryContextAlloc MemoryContextAllocZero +MemoryContextRegisterResetCallback +MemoryContextStrdup +memrchr memset +mkdir +mmap +modf +munmap nanosleep +newlocale +nextafter +nextafterf +nocache_index_getattr +nocachegetattr +OidFunctionCall1Coll +OidOutputFunctionCall open +openat +opendir palloc palloc0 +ParseDateTime +pathconf +per_MultiFuncCall perror pfree pg_any_to_server +pg_detoast_datum +pg_detoast_datum_copy +pg_detoast_datum_packed +pg_detoast_datum_slice pg_do_encoding_conversion pg_is_ascii +pg_qsort +pg_snprintf +pg_sprintf pg_strcasecmp pg_strong_random +pg_vsnprintf pgl_backend pgl_initdb pgl_shutdown +pow +pread +ProcDiePending +ProcessInterrupts pstrdup +pthread_atfork +pthread_cond_broadcast +pthread_cond_destroy +pthread_cond_init +pthread_cond_signal +pthread_cond_timedwait +pthread_cond_wait +pthread_create +pthread_detach +pthread_getspecific +pthread_join +pthread_key_create +pthread_key_delete +pthread_mutex_destroy +pthread_mutex_init +pthread_mutex_lock +pthread_mutex_trylock +pthread_mutex_unlock +pthread_mutexattr_destroy +pthread_mutexattr_getprotocol +pthread_mutexattr_getpshared +pthread_mutexattr_getrobust +pthread_mutexattr_gettype +pthread_mutexattr_init +pthread_mutexattr_setprotocol +pthread_mutexattr_setpshared +pthread_mutexattr_settype +pthread_once +pthread_self +pthread_setspecific +putchar puts qsort +QueryCancelPending +quote_qualified_identifier rand read +ReadBuffer readdir +readlink readstoplist realloc +realpath +regclassin +RelationClose +RelationGetIndexList +RelationIdGetRelation +ReleaseBuffer +ReleaseSysCache +remainder +remove +remquo +rename repalloc ResourceOwnerEnlarge ResourceOwnerForget ResourceOwnerRemember +rmdir +round +roundf +scalbn +ScanKeyInit +sched_yield searchstoplist +SearchSysCache1 +SearchSysCache2 +SearchSysCache3 set_read_write_cbs +setlocale +sin +sinh +sinl +siprintf +snprintf socket +SPI_connect +SPI_exec +SPI_execute +SPI_execute_with_args +SPI_finish +SPI_fnumber +SPI_freetuptable +SPI_getbinval +SPI_gettype +SPI_getvalue +SPI_modifytuple +SPI_palloc +SPI_processed +SPI_tuptable +sqrt +sqrtl srand sscanf +stat +statvfs +std_typanalyze stderr +stdin +strcasecmp strcat strchr +strchrnul strcmp +strcoll_l strcpy strcspn strdup strerror strerror_r strftime +strftime_l strlcpy strlen +strncasecmp strncat strncmp +strncpy +strrchr +strspn strstr +strtod +strtod_l +strtof +strtof_l +strtok +strtol +strtold +strtold_l +strtoll +strtoll_l strtoul +strtoull +strtoull_l +strxfrm_l +swprintf +symlink +sysconf +systable_beginscan +systable_endscan +systable_getnext +table_close +table_open +tan +tanh +text_left text_to_cstring text_to_cstring_buffer time +timestamp2tm +tm2timestamp +toast_raw_datum_size tolower -TupleDescGetAttInMetadata \ No newline at end of file +tolower_l +toupper +toupper_l +towlower_l +towupper_l +trunc +truncate +TupleDescGetAttInMetadata +type_is_rowtype +TypenameGetTypid +ungetc +ungetwc +unlinkat +uselocale +usleep +utime +utimensat +uuid_cmp +uuid_create +uuid_error +uuid_export +uuid_import +uuid_in +uuid_load +uuid_make +uuid_out +vacuum_delay_point +vasprintf +vfprintf +vsnprintf +vsscanf +wcrtomb +wcscoll_l +wcslen +wcsnrtombs +wcstod +wcstof +wcstol +wcstold +wcstoll +wcstoul +wcstoull +wcsxfrm_l +wctob +WinGetCurrentPosition +WinGetFuncArgCurrent +WinGetFuncArgInPartition +WinGetPartitionLocalMemory +WinGetPartitionRowCount +wmemchr +wmemcmp +write diff --git a/pglite/Makefile b/pglite/Makefile index 3d7ad4d6ba209..ccaa9ae81c55b 100644 --- a/pglite/Makefile +++ b/pglite/Makefile @@ -13,24 +13,29 @@ SUBDIRS = \ prefix ?= /install/pglite EXTENSIONS_BUILD_ROOT := /tmp/extensions/build ARCHIVE_DIR := /install/pglite/extensions +POSTGIS_ARCHIVE_DIR := /install/pglite/extensions/postgis EXTENSIONS := $(SUBDIRS) +EXTENSIONS += postgis # Default target: build tarballs for all contribs dist: $(addsuffix .tar.gz,$(EXTENSIONS)) # Pattern rule: build $(EXT).tar.gz for each extra extension +# rm -rf $(EXTENSIONS_BUILD_ROOT)/$* %.tar.gz: @echo "=== Staging $* ===" - rm -rf $(EXTENSIONS_BUILD_ROOT)/$* - bash -c 'mkdir -p $(EXTENSIONS_BUILD_ROOT)/$*/$(prefix)/{bin,lib,share/extension,share/doc,share/postgresql/extension,share/postgresql/tsearch_data,include}' + bash -c 'mkdir -p $(EXTENSIONS_BUILD_ROOT)/$*/$(prefix)/{bin,lib,share/extension,share/doc,share/postgresql/extension,share/postgresql/tsearch_data,include,share/postgresql/contrib/postgis-3.6}' $(MAKE) -C $* install DESTDIR=$(EXTENSIONS_BUILD_ROOT)/$* @echo "=== Packaging $* ===" mkdir -p $(ARCHIVE_DIR) cd $(EXTENSIONS_BUILD_ROOT)/$*/$(prefix) && \ files=$$(find . -type f -o -type l | sed 's|^\./||') && \ tar -czf $(ARCHIVE_DIR)/$*.tar.gz $$files -# tar -C $(EXTENSIONS_BUILD_ROOT)/$*/$(prefix) -czf $(ARCHIVE_DIR)/$*.tar.gz . + +dist-postgis: + @echo "=== Moving postgis ===" + mkdir -p $(POSTGIS_ARCHIVE_DIR) && mv $(ARCHIVE_DIR)/postgis.tar.gz $(POSTGIS_ARCHIVE_DIR) .PHONY: dist diff --git a/pglite/build-postgis.sh b/pglite/build-postgis.sh new file mode 100755 index 0000000000000..5ff083c17d50d --- /dev/null +++ b/pglite/build-postgis.sh @@ -0,0 +1,20 @@ +#!/bin/sh +echo "=== Building postgis ===" +cd postgis +# hack - building loader/pgsql2shp.wasm fails, we don't need it anyway +sed -i 's/SUBDIRS += @RASTER@ loader/SUBDIRS += @RASTER@/' GNUmakefile.in +./autogen.sh +# LDFLAGS="-L/install/libs/lib" emconfigure ./configure --with-pic --with-xml2config=/install/libs/bin/xml2-config --with-geosconfig=/install/libs/bin/geos-config --with-projdir=/install/libs/ --with-jsondir=/install/libs/ --without-protobuf --with-gdalconfig=/install/libs/bin/gdal-config +# emconfigure ./configure --with-pic --with-geosconfig=/install/libs/bin/geos-config --with-projdir=/install/libs/ --with-xml2config=/install/libs/bin/xml2-config --with-jsondir=/install/libs/ --without-protobuf --without-raster --enable-static=no --enable-shared=yes +PROJ_VERSION=9.7.0 LDFLAGS="-L/install/libs/lib" CFLAGS="${PGLITE_CFLAGS}" CXXFLAGS="${PGLITE_CFLAGS}" emconfigure ./configure \ +--with-geosconfig=/install/libs/bin/geos-config \ +--with-pic --without-protobuf --without-raster --enable-static=no --enable-shared=yes --with-xml2config=/install/libs/bin/xml2-config --with-projdir=/install/libs/ --host=wasm32-unknown-none +# 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 PG_LDFLAGS="-L/install/libs/lib -lpgport -lpgcommon -sSIDE_MODULE=1" -j + +cd .. diff --git a/pglite/postgis b/pglite/postgis new file mode 160000 index 0000000000000..f533623505f73 --- /dev/null +++ b/pglite/postgis @@ -0,0 +1 @@ +Subproject commit f533623505f73939a2d25d66ff252fb6619c4ac7 diff --git a/src/backend/Makefile b/src/backend/Makefile index d4e40e4d410bb..0971d4087b52a 100644 --- a/src/backend/Makefile +++ b/src/backend/Makefile @@ -82,7 +82,7 @@ PGCORE = $(top_builddir)/src/common/libpgcommon_srv.a $(top_builddir)/src/port/l PGMAIN = main/main.o tcop/postgres.o PGLITE_MAIN = pglite-wasm/pg_main.c PGROOT=/install/pglite -PGPRELOAD=--preload-file ${PGROOT}/share/postgresql@/tmp/pglite/share/postgresql --preload-file ${PGROOT}/lib/postgresql@/tmp/pglite/lib/postgresql --preload-file $(top_builddir)/other/password@/tmp/pglite/password --preload-file $(top_builddir)/other/PGPASSFILE@/home/web_user/.pgpass --preload-file $(top_builddir)/other/empty@/tmp/pglite/bin/postgres --preload-file $(top_builddir)/other/empty@/tmp/pglite/bin/initdb +PGPRELOAD=--preload-file /install/libs/share/proj@/install/libs/share/proj --preload-file ${PGROOT}/share/postgresql@/tmp/pglite/share/postgresql --preload-file ${PGROOT}/lib/postgresql@/tmp/pglite/lib/postgresql --preload-file $(top_builddir)/other/password@/tmp/pglite/password --preload-file $(top_builddir)/other/PGPASSFILE@/home/web_user/.pgpass --preload-file $(top_builddir)/other/empty@/tmp/pglite/bin/postgres --preload-file $(top_builddir)/other/empty@/tmp/pglite/bin/initdb postgres: $(OBJS) $(AR) rcs $(LIBPGMAIN) $(PGMAIN) $(AR) rcs $(LIBPG) $(filter-out $(PGMAIN),$(call expand_subsys,$(ONLYOBJS))) @@ -92,10 +92,10 @@ postgres: $(OBJS) # Extensions use functions from the core PG. These need to be exported by the emscripten compiler. # The following target gathers all extension imports + the default ones (included.pglite.imports), -# excludes the one in excluded.pglite.imports and adds a leading _ to each. +# excludes the one in excluded.pglite.exports and adds a leading _ to each. pglite-exported-functions: $(MKDIR_P) '$(emscripten_imports_dir)' - cat $(top_builddir)/pglite-wasm/excluded.*.imports $(top_builddir)/src/interfaces/libpq/exports.list $(LIB_EXPORTS_DIR)/libossp-uuid.exports /install/exports/libcrypto.exports /install/exports/libssl.exports | sort -u > '$(top_builddir)/pglite-wasm/excluded.imports' + cat $(LIB_EXPORTS_DIR)/libproj.exports $(top_builddir)/pglite-wasm/excluded.*.imports $(top_builddir)/src/interfaces/libpq/exports.list $(LIB_EXPORTS_DIR)/libossp-uuid.exports | sort -u > '$(top_builddir)/pglite-wasm/excluded.imports' cat $(DESTDIR)$(emscripten_extension_imports_dir)/*.imports '$(top_builddir)/pglite-wasm/included.pglite.imports' | \ sort -u | \ grep -Fvx -f '$(top_builddir)/pglite-wasm/excluded.imports' | \ @@ -103,6 +103,9 @@ pglite-exported-functions: > '$(emscripten_imports_dir)/exported_functions.txt' # -sDYLINK_DEBUG=2 use this for debugging missing exported symbols (ex when an extension calls a pgcore function that hasn't been exported) +# -sEXPORTED_FUNCTIONS=@$(emscripten_imports_dir)/exported_functions.txt \ +# -sEXPORT_ALL=1 \ +# -lstdc++ \ # PGLITE_CFLAGS is something like "-O2" (aka release version) or "-g -gsource-map --no-wasm-opt" (aka debug version) # PGLITE_EMSCRIPTEN_FLAGS are the emscripten flags to be passed to the build. Ideally they would be completely transparent, such that we # could build a libpglite with or without those flags (to switch between native and wasm builds) @@ -121,6 +124,7 @@ pglite: pglite-exported-functions -Ldict_snowball \ -lxslt \ -lpgcore \ + -lossp-uuid \ -lnodefs.js -lidbfs.js -lxml2 -lz endif diff --git a/src/bin/pg_config/pg_config.c b/src/bin/pg_config/pg_config.c index 1fc3e6298d532..5115d13c0e909 100644 --- a/src/bin/pg_config/pg_config.c +++ b/src/bin/pg_config/pg_config.c @@ -149,13 +149,13 @@ main(int argc, char **argv) } } +#if !defined(__EMSCRIPTEN__) && !defined(__wasi__) if (find_my_exec(argv[0], my_exec_path) < 0) { fprintf(stderr, _("%s: could not find own program executable\n"), progname); -#if !defined(__EMSCRIPTEN__) && !defined(__wasi__) exit(1); -#endif } +#endif configdata = get_configdata(my_exec_path, &configdata_len); /* no arguments -> print everything */ diff --git a/src/makefiles/pgxs.mk b/src/makefiles/pgxs.mk index bf4916166cba1..6523de3357b4a 100644 --- a/src/makefiles/pgxs.mk +++ b/src/makefiles/pgxs.mk @@ -250,10 +250,9 @@ ifeq ($(with_llvm), yes) $(foreach mod, $(MODULES), $(call install_llvm_module,$(mod),$(mod).bc)) endif # with_llvm ifeq ($(PORTNAME), emscripten) - $(LLVM_NM) -u *.o | awk '{print $$2}' | sed '/^$$/d' | sort -u > undef.txt - $(LLVM_NM) *.o | awk '$$2 ~ /^[TDB]$$/ {print $$3}' | sed '/^$$/d' | sort -u > defs.txt - comm -23 undef.txt defs.txt > '$(emscripten_extension_imports_dir)/$(MODULES).imports' - rm -f undef.txt defs.txt + find . -name "*.o" -exec $(LLVM_NM) --undefined-only {} \; | awk '{print $$2}' | sed '/^$$/d' | sort -u > '$(MODULES).undef.txt' + find . -type f \( -name "*.o" -o -name "*.so" \) -exec $(LLVM_NM) --defined-only {} \; | awk '$$2 ~ /^[TDB]$$/ {print $$3}' | sed '/^$$/d' | sort -u > '$(MODULES).defs.txt' + comm -23 '$(MODULES).undef.txt' '$(MODULES).defs.txt' > '$(emscripten_extension_imports_dir)/$(MODULES).imports' endif # PORTNAME=emscripten endif # MODULES ifdef DOCS @@ -278,10 +277,9 @@ ifeq ($(with_llvm), yes) $(call install_llvm_module,$(MODULE_big),$(OBJS)) endif # with_llvm ifeq ($(PORTNAME), emscripten) - $(LLVM_NM) -u $(OBJS) | awk '{print $$2}' | sed '/^$$/d' | sort -u > undef.txt - $(LLVM_NM) $(OBJS) | awk '$$2 ~ /^[TDB]$$/ {print $$3}' | sed '/^$$/d' | sort -u > defs.txt - comm -23 undef.txt defs.txt > '$(emscripten_extension_imports_dir)/$(MODULE_big).imports' - rm -f undef.txt defs.txt + find . -name "*.o" -exec $(LLVM_NM) --undefined-only {} \; | awk '{print $$2}' | sed '/^$$/d' | sort -u > '$(MODULE_big).undef.txt' + find . -type f \( -name "*.o" -o -name "*.so" \) -exec $(LLVM_NM) --defined-only {} \; | awk '$$2 ~ /^[TDB]$$/ {print $$3}' | sed '/^$$/d' | sort -u > '$(MODULE_big).defs.txt' + comm -23 '$(MODULE_big).undef.txt' '$(MODULE_big).defs.txt' > '$(emscripten_extension_imports_dir)/$(MODULE_big).imports' endif # PORTNAME=emscripten install: install-lib