Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
pmp-p committed Aug 25, 2024
2 parents 4fcac13 + f9510ce commit 3281c27
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 33 deletions.
14 changes: 7 additions & 7 deletions cibuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# expressed in EMSDK MB
export CMA_MB=${CMA_MB:-64}

export PGVERSION=${PGVERSION:-16.3}
export PG_VERSION=${PG_VERSION:-16.4}
export CI=${CI:-false}
export WORKSPACE=${GITHUB_WORKSPACE:-$(pwd)}
export PGROOT=${PGROOT:-/tmp/pglite}
Expand Down Expand Up @@ -241,7 +241,7 @@ END
# to get same path for wasm-shared link tool in the path
# for extensions building.
# we always symlink in-tree build to "postgresql" folder
if echo $PGVERSION|grep -q ^16
if echo $PG_VERSION|grep -q ^16
then
. cibuild/pg-16.x.sh
else
Expand Down Expand Up @@ -397,7 +397,7 @@ then
rm ${PGROOT}/lib/lib*.so.? 2>/dev/null
if $CI
then
tar -cpRz ${PGROOT} > /tmp/sdk/postgres-${PGVERSION}.tar.gz
tar -cpRz ${PGROOT} > /tmp/sdk/postgres-${PG_VERSION}.tar.gz
fi
fi

Expand Down Expand Up @@ -450,7 +450,7 @@ do
pnpm pack || exit 31
packed=$(echo -n electric-sql-pglite-*.tgz)

mv $packed /tmp/sdk/pg${PGVERSION}-${packed}
mv $packed /tmp/sdk/pg${PG_VERSION}-${packed}

# for repl demo
mkdir -p /tmp/web/pglite
Expand Down Expand Up @@ -487,8 +487,8 @@ do

if $CI
then
tar -cpRz ${PGROOT} > /tmp/sdk/pglite-pg${PGVERSION}.tar.gz
cp /tmp/sdk/pglite-pg${PGVERSION}.tar.gz ${WEBROOT}/
tar -cpRz ${PGROOT} > /tmp/sdk/pglite-pg${PG_VERSION}.tar.gz
cp /tmp/sdk/pglite-pg${PG_VERSION}.tar.gz ${WEBROOT}/
fi

du -hs ${WEBROOT}/*
Expand Down Expand Up @@ -520,7 +520,7 @@ do
;;

pglite-bundle-interim) echo "================== pglite-bundle-interim ======================"
tar -cpRz ${PGLITE}/release > /tmp/sdk/pglite-interim-${PGVERSION}.tar.gz
tar -cpRz ${PGLITE}/release > /tmp/sdk/pglite-interim-${PG_VERSION}.tar.gz
;;

demo-site) echo "==================== demo-site =========================="
Expand Down
24 changes: 12 additions & 12 deletions cibuild/pg-16.x.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
ARCHIVE=postgresql-${PGVERSION}.tar.gz
ARCHIVE=postgresql-${PG_VERSION}.tar.gz

if echo ${PGVERSION} | grep -q 16.5
if echo ${PG_VERSION} | grep -q 16.5
then
PG_PREREL=true
ARCHIVE_URL=https://github.com/postgres/postgres/archive/refs/tags/REL_16_5.tar.gz
else
PG_PREREL=false
ARCHIVE_URL=https://ftp.postgresql.org/pub/source/v${PGVERSION}/${ARCHIVE}
ARCHIVE_URL=https://ftp.postgresql.org/pub/source/v${PG_VERSION}/${ARCHIVE}
fi


if [ -f postgresql/postgresql-${PGVERSION}.patched ]
if [ -f postgresql/postgresql-${PG_VERSION}.patched ]
then
echo "
Version ${PGVERSION} already selected and patch stage already done
Version ${PG_VERSION} already selected and patch stage already done
"
else
Expand All @@ -24,38 +24,38 @@ else

if $PG_PREREL
then
ln -sf $(pwd)/postgres-REL_16_? postgresql-${PGVERSION}
ln -sf $(pwd)/postgres-REL_16_? postgresql-${PG_VERSION}
fi

if pushd postgresql-${PGVERSION}
if pushd postgresql-${PG_VERSION}
then
echo
> ./src/template/emscripten
> ./src/include/port/emscripten.h
> ./src/makefiles/Makefile.emscripten
for patchdir in \
postgresql-emscripten \
postgresql-wasm postgresql-wasm-${PGVERSION} \
postgresql-pglite postgresql-pglite-${PGVERSION}
postgresql-wasm postgresql-wasm-${PG_VERSION} \
postgresql-pglite postgresql-pglite-${PG_VERSION}
do
if [ -d ../patches/$patchdir ]
then
cat ../patches/$patchdir/*.diff | patch -p1 || exit 24
fi
done
touch postgresql-${PGVERSION}.patched
touch postgresql-${PG_VERSION}.patched
popd
fi

# either a submodule dir or a symlink.
# release only use symlink

rm postgresql 2>/dev/null
ln -s postgresql-${PGVERSION} postgresql
ln -s postgresql-${PG_VERSION} postgresql

fi

export PGSRC=$(realpath postgresql-${PGVERSION})
export PGSRC=$(realpath postgresql-${PG_VERSION})

if [ -f ${PGROOT}/pg.installed ]
then
Expand Down
16 changes: 8 additions & 8 deletions cibuild/pg-git.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
if [ -f postgresql/postgresql-${PGVERSION}.patched ]
if [ -f postgresql/postgresql-${PG_VERSION}.patched ]
then
echo version already selected and patch stage already done
else
git clone --no-tags --depth 1 --single-branch --branch master https://github.com/postgres/postgres postgresql-${PGVERSION}
git clone --no-tags --depth 1 --single-branch --branch master https://github.com/postgres/postgres postgresql-${PG_VERSION}

if pushd postgresql-${PGVERSION}
if pushd postgresql-${PG_VERSION}
then
echo
> ./src/template/emscripten
Expand All @@ -13,27 +13,27 @@ else
> ./src/makefiles/Makefile.wasi
for patchdir in \
postgresql-debug postgresql-wasi \
postgresql-wasm postgresql-wasm-${PGVERSION} \
postgresql-pglite postgresql-pglite-${PGVERSION}
postgresql-wasm postgresql-wasm-${PG_VERSION} \
postgresql-pglite postgresql-pglite-${PG_VERSION}
do
if [ -d ../patches/$patchdir ]
then
cat ../patches/$patchdir/*.diff | patch -p1 || exit 24
fi
done
touch postgresql-${PGVERSION}.patched
touch postgresql-${PG_VERSION}.patched
popd
fi

# either a submodule dir or a symlink.
# release only use symlink

rm postgresql 2>/dev/null
ln -s postgresql-${PGVERSION} postgresql
ln -s postgresql-${PG_VERSION} postgresql

fi

export PGSRC=$(realpath postgresql-${PGVERSION})
export PGSRC=$(realpath postgresql-${PG_VERSION})

if [ -f ${PGROOT}/pg.installed ]
then
Expand Down
2 changes: 1 addition & 1 deletion cibuild/pgbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ CC_PGLITE=$CC_PGLITE
--disable-spinlocks \
--without-zlib --disable-largefile --without-llvm \
--without-pam --disable-largefile --without-zlib --with-openssl=no \
--without-readline --without-icu --with-libxml --with-uuid=ossp \
--without-readline --without-icu --with-libxml --with-libxslt --with-uuid=ossp \
${PGDEBUG}"

echo " ==== building wasm MVP:$MVP Debug=${PGDEBUG} with opts : $@ == "
Expand Down
4 changes: 3 additions & 1 deletion cibuild/postgis.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

mkdir -p build

pushd build
if [ -d postgis-3.4.2 ]
then
Expand All @@ -9,7 +11,7 @@ pushd build
fi
popd

if ${CI:-false}
if which emcc
then
echo -n
else
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- postgresql/src/include/port/emscripten.h
+++ postgresql-wasm/src/include/port/emscripten.h
@@ -0,0 +1,334 @@
@@ -0,0 +1,329 @@
+/* src/include/port/emscripten.h */
+
+#ifndef I_EMSCRIPTEN
Expand Down
2 changes: 1 addition & 1 deletion patches/postgresql-wasm/src-backend-catalog-index.c.diff
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- postgresql/src/backend/catalog/index.c
+++ postgresql-wasm/src/backend/catalog/index.c
@@ -2995,7 +2995,7 @@
@@ -2994,7 +2994,7 @@
indexInfo->ii_ParallelWorkers =
plan_create_index_workers(RelationGetRelid(heapRelation),
RelationGetRelid(indexRelation));
Expand Down
4 changes: 2 additions & 2 deletions patches/postgresql-wasm/src-backend-tcop-postgres.c.diff
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
--- postgresql/src/backend/tcop/postgres.c
+++ postgresql-wasm/src/backend/tcop/postgres.c
@@ -4052,7 +4052,11 @@
@@ -3988,7 +3988,11 @@
#endif
}

-
+#if defined(__EMSCRIPTEN__) || defined(__wasi__)
+#define PG_MAIN
Expand Down

0 comments on commit 3281c27

Please sign in to comment.