Skip to content

Commit

Permalink
try on latest master (upstream)
Browse files Browse the repository at this point in the history
Signed-off-by: Elias Van Ootegem <[email protected]>
  • Loading branch information
EVODelavega committed Oct 21, 2024
1 parent 9648aeb commit 819eef4
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 7 deletions.
34 changes: 32 additions & 2 deletions scripts/build-postgres-alpine.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,38 @@ set -ex
DOCKER_OPTS=
POSTGIS_VERSION=
LITE_OPT=false
WITH_TOOLKIT=true

while getopts "v:i:g:o:l" opt; do
while getopts "v:i:g:o:lt" opt; do
case $opt in
v) PG_VERSION=$OPTARG ;;
i) IMG_NAME=$OPTARG ;;
g) POSTGIS_VERSION=$OPTARG ;;
o) DOCKER_OPTS=$OPTARG ;;
l) LITE_OPT=true ;;
t) WITH_TOOLKIT=false ;;
\?) exit 1 ;;
esac
done

case "${PG_VERSION}" in
*12*)
pgrx_flag="pg12"
;;
*13*)
pgrx_flag="pg13"
;;
*14*)
pgrx_flag="pg14"
;;
*15*)
pgrx_flag="pg15"
;;
*16*)
pgrx_flag="pg16"
;;
esac

if [ -z "$PG_VERSION" ] ; then
echo "Postgres version parameter is required!" && exit 1;
fi
Expand All @@ -41,6 +61,8 @@ docker run -i --rm -v ${TRG_DIR}:/usr/local/pg-dist \
-e PROJ_DATUMGRID_VERSION=1.8 \
-e GEOS_VERSION=3.7.2 \
-e GDAL_VERSION=2.4.1 \
-e WITH_TOOLKIT=$WITH_TOOLKIT \
-e pgrx_flag=$pgrx_flag \
$DOCKER_OPTS $IMG_NAME /bin/sh -ex -c 'echo "Starting building postgres binaries" \
&& apk add --no-cache \
coreutils \
Expand Down Expand Up @@ -149,6 +171,14 @@ $DOCKER_OPTS $IMG_NAME /bin/sh -ex -c 'echo "Starting building postgres binaries
&& make install \
; fi \
\
&& if [ "$WITH_TOOLKIT" = true ]; then \
&& curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh \
&& cargo install --version "=0.10.2" --force cargo-pgrx \
&& cargo pgrx init --$pgrx_flag pg_config \
&& git clone https://github.com/timescale/timescaledb-toolkit && cd timescaledb-toolkit/extension \
&& cargo pgrx install --release && cargo run --manifest-path ../tools/post-install/Cargo.toml -- pg_config \
; fi \
\
&& cd /usr/local/pg-build \
&& cp /lib/libuuid.so.1 /lib/libz.so.1 /lib/libssl.so.1.0.0 /lib/libcrypto.so.1.0.0 /usr/lib/libxml2.so.2 /usr/lib/libxslt.so.1 ./lib \
&& if [ "$ICU_ENABLED" = true ]; then cp --no-dereference /usr/lib/libicudata.so* /usr/lib/libicuuc.so* /usr/lib/libicui18n.so* /usr/lib/libstdc++.so* /usr/lib/libgcc_s.so* ./lib; fi \
Expand All @@ -159,4 +189,4 @@ $DOCKER_OPTS $IMG_NAME /bin/sh -ex -c 'echo "Starting building postgres binaries
lib \
bin/initdb \
bin/pg_ctl \
bin/postgres'
bin/postgres'
34 changes: 33 additions & 1 deletion scripts/build-postgres-debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ set -ex
DOCKER_OPTS=
POSTGIS_VERSION=
LITE_OPT=false
WITH_TOOLKIT=true
pgrx_flag="pg14"

while getopts "v:i:g:o:l" opt; do
while getopts "v:i:g:o:lt" opt; do
case $opt in
v) PG_VERSION=$OPTARG ;;
i) IMG_NAME=$OPTARG ;;
g) POSTGIS_VERSION=$OPTARG ;;
o) DOCKER_OPTS=$OPTARG ;;
l) LITE_OPT=true ;;
t) WITH_TOOLKIT=false ;;
\?) exit 1 ;;
esac
done
Expand All @@ -26,6 +29,25 @@ if echo "$PG_VERSION" | grep -q '^9\.' && [ "$LITE_OPT" = true ] ; then
echo "Lite option is supported only for PostgreSQL 10 or later!" && exit 1;
fi


case "${PG_VERSION}" in
*12*)
pgrx_flag="pg12"
;;
*13*)
pgrx_flag="pg13"
;;
*14*)
pgrx_flag="pg14"
;;
*15*)
pgrx_flag="pg15"
;;
*16*)
pgrx_flag="pg16"
;;
esac

ICU_ENABLED=$(echo "$PG_VERSION" | grep -qv '^9\.' && [ "$LITE_OPT" != true ] && echo true || echo false);

TRG_DIR=$PWD/bundle
Expand All @@ -39,6 +61,8 @@ docker run -i --rm -v ${TRG_DIR}:/usr/local/pg-dist \
-e PROJ_DATUMGRID_VERSION=1.8 \
-e GEOS_VERSION=3.7.2 \
-e GDAL_VERSION=2.4.1 \
-e pgrx_flag=$pgrx_flag \
-e WITH_TOOLKIT=$WITH_TOOLKIT \
$DOCKER_OPTS $IMG_NAME /bin/bash -ex -c 'echo "Starting building postgres binaries" \
&& ln -snf /usr/share/zoneinfo/Etc/UTC /etc/localtime && echo "Etc/UTC" > /etc/timezone \
&& apt-get update && apt-get install -y --no-install-recommends \
Expand Down Expand Up @@ -141,6 +165,14 @@ $DOCKER_OPTS $IMG_NAME /bin/bash -ex -c 'echo "Starting building postgres binari
&& make install \
; fi \
\
&& if [ "$WITH_TOOLKIT" = true ]; then \
&& curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh \
&& cargo install --version "=0.10.2" --force cargo-pgrx \
&& cargo pgrx init --$pgrx_flag pg_config \
&& git clone https://github.com/timescale/timescaledb-toolkit && cd timescaledb-toolkit/extension \
&& cargo pgrx install --release && cargo run --manifest-path ../tools/post-install/Cargo.toml -- pg_config \
; fi \
\
&& cd /usr/local/pg-build \
&& cp /usr/lib/libossp-uuid.so.16 ./lib || cp /usr/lib/*/libossp-uuid.so.16 ./lib \
&& cp /lib/*/libz.so.1 /lib/*/liblzma.so.5 /usr/lib/*/libxml2.so.2 /usr/lib/*/libxslt.so.1 ./lib \
Expand Down
9 changes: 7 additions & 2 deletions scripts/test-postgres-alpine.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ set -ex

DOCKER_OPTS=
POSTGIS_VERSION=
WITH_TOOLKIT=true

while getopts "j:z:i:v:g:o:" opt; do
while getopts "j:z:i:v:g:o:l" opt; do
case $opt in
j) JAR_FILE=$OPTARG ;;
z) ZIP_FILE=$OPTARG ;;
i) IMG_NAME=$OPTARG ;;
v) PG_VERSION=$OPTARG ;;
g) POSTGIS_VERSION=$OPTARG ;;
o) DOCKER_OPTS=$OPTARG ;;
l) WITH_TOOLKIT=false ;;
\?) exit 1 ;;
esac
done
Expand All @@ -36,6 +38,7 @@ docker run -i --rm -v ${LIB_DIR}:/usr/local/pg-lib:ro \
-e ZIP_FILE=$ZIP_FILE \
-e PG_VERSION=$PG_VERSION \
-e POSTGIS_VERSION=$POSTGIS_VERSION \
-e WITH_TOOLKIT=$WITH_TOOLKIT \
$DOCKER_OPTS $IMG_NAME /bin/sh -ex -c 'echo "Starting building postgres binaries" \
&& apk add --no-cache \
postgresql-client \
Expand All @@ -62,4 +65,6 @@ $DOCKER_OPTS $IMG_NAME /bin/sh -ex -c 'echo "Starting building postgres binaries
\
&& if echo "$PG_VERSION" | grep -qvE '\''^(10|9)\.'\'' ; then test $(psql -qAtX -h localhost -p 65432 -U postgres -d postgres -c '\''SET jit_above_cost = 10; SELECT SUM(relpages) FROM pg_class;'\'') -gt 0 ; fi \
\
&& if [ -n "$POSTGIS_VERSION" ]; then test $(psql -qAtX -h localhost -p 65432 -U postgres -d postgres -c "CREATE EXTENSION postgis; SELECT PostGIS_Lib_Version();") = $POSTGIS_VERSION ; fi'
&& if [ "$WITH_TOOLKIT" = true ]; then test $(psql -qAtX -h localhost -p 65432 -U postgres -d postgres -c "CREATE EXTENSION timescaledb_toolkit;") = $POSTGIS_VERSION ; fi \
\
&& if [ -n "$POSTGIS_VERSION" ]; then test $(psql -qAtX -h localhost -p 65432 -U postgres -d postgres -c "CREATE EXTENSION postgis; SELECT PostGIS_Lib_Version();") = $POSTGIS_VERSION ; fi'
9 changes: 7 additions & 2 deletions scripts/test-postgres-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ set -ex

DOCKER_OPTS=
POSTGIS_VERSION=
WITH_TOOLKIT=true

while getopts "j:z:i:v:g:o:" opt; do
while getopts "j:z:i:v:g:o:l" opt; do
case $opt in
j) JAR_FILE=$OPTARG ;;
z) ZIP_FILE=$OPTARG ;;
i) IMG_NAME=$OPTARG ;;
v) PG_VERSION=$OPTARG ;;
g) POSTGIS_VERSION=$OPTARG ;;
o) DOCKER_OPTS=$OPTARG ;;
l) WITH_TOOLKIT=false ;;
\?) exit 1 ;;
esac
done
Expand All @@ -36,6 +38,7 @@ docker run -i --rm -v ${LIB_DIR}:/usr/local/pg-lib:ro \
-e ZIP_FILE=$ZIP_FILE \
-e PG_VERSION=$PG_VERSION \
-e POSTGIS_VERSION=$POSTGIS_VERSION \
-e WITH_TOOLKIT=$WITH_TOOLKIT \
$DOCKER_OPTS $IMG_NAME /bin/bash -ex -c 'echo "Starting testing postgres binaries" \
&& apt-get update && apt-get install -y --no-install-recommends \
postgresql-client \
Expand All @@ -61,4 +64,6 @@ $DOCKER_OPTS $IMG_NAME /bin/bash -ex -c 'echo "Starting testing postgres binarie
\
&& if echo "$PG_VERSION" | grep -qvE '\''^(10|9)\.'\'' ; then test $(psql -qAtX -h localhost -p 65432 -U postgres -d postgres -c '\''SET jit_above_cost = 10; SELECT SUM(relpages) FROM pg_class;'\'') -gt 0 ; fi \
\
&& if [ -n "$POSTGIS_VERSION" ]; then test $(psql -qAtX -h localhost -p 65432 -U postgres -d postgres -c "CREATE EXTENSION postgis; SELECT PostGIS_Lib_Version();") = $POSTGIS_VERSION ; fi'
&& if [ "$WITH_TOOLKIT" = true ]; then test $(psql -qAtX -h localhost -p 65432 -U postgres -d postgres -c "CREATE EXTENSION timescaledb_toolkit;") = $POSTGIS_VERSION ; fi \
\
&& if [ -n "$POSTGIS_VERSION" ]; then test $(psql -qAtX -h localhost -p 65432 -U postgres -d postgres -c "CREATE EXTENSION postgis; SELECT PostGIS_Lib_Version();") = $POSTGIS_VERSION ; fi'

0 comments on commit 819eef4

Please sign in to comment.