forked from postgres/postgres
-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathbuild-postgis.sh
More file actions
executable file
·22 lines (21 loc) · 1.93 KB
/
build-postgis.sh
File metadata and controls
executable file
·22 lines (21 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/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 -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 ..