@@ -29,8 +29,8 @@ RUN apk add --no-cache --virtual .postgis-fetch-deps \
2929 proj-dev \
3030 proj-util \
3131 sfcgal-dev \
32- llvm-dev \
3332 clang \
33+ llvm \
3434 autoconf \
3535 automake \
3636 cunit-dev \
@@ -57,9 +57,13 @@ RUN apk add --no-cache --virtual .postgis-fetch-deps \
5757 protobuf-c \
5858 ca-certificates
5959
60- # Symlink clang and llvm-lto to ensure compatibility with PostGIS build scripts
61- RUN ln -s /usr/bin/clang /usr/bin/clang-19 \
62- && mkdir -p /usr/lib/llvm19/bin && ln -s /usr/bin/llvm-lto /usr/lib/llvm19/bin/llvm-lto
60+ # Create symlinks matching the LLVM paths hardcoded in PostgreSQL's PGXS build system
61+ RUN PGXS_CLANG=$(grep '^CLANG' /usr/local/lib/postgresql/pgxs/src/Makefile.global | sed 's/.*= *//' ) \
62+ && PGXS_LLVM_BINPATH=$(grep '^LLVM_BINPATH' /usr/local/lib/postgresql/pgxs/src/Makefile.global | sed 's/.*= *//' ) \
63+ && echo "PGXS expects CLANG=${PGXS_CLANG}, LLVM_BINPATH=${PGXS_LLVM_BINPATH}" \
64+ && ln -sf /usr/bin/clang "/usr/bin/${PGXS_CLANG}" \
65+ && mkdir -p "${PGXS_LLVM_BINPATH}" \
66+ && ln -sf /usr/bin/llvm-lto "${PGXS_LLVM_BINPATH}/llvm-lto"
6367
6468# Download, verify and extract PostGIS source code
6569RUN wget -O postgis.tar.gz "https://github.com/postgis/postgis/archive/${POSTGIS_VERSION}.tar.gz" \
@@ -72,14 +76,13 @@ RUN wget -O postgis.tar.gz "https://github.com/postgis/postgis/archive/${POSTGIS
7276 --strip-components 1 \
7377 && rm postgis.tar.gz
7478
75- # Build PostGIS - with Link Time Optimization (LTO) enabled
79+ # Build PostGIS
7680RUN cd /usr/src/postgis \
7781 && gettextize \
7882 && ./autogen.sh \
7983 && ./configure \
80- --enable-lto \
8184 && make -j$(nproc) \
82- && make install
85+ && make install
8386
8487# Cleanup
8588RUN rm -rf /usr/src/postgis \
@@ -94,6 +97,7 @@ RUN apk add --no-cache --virtual .timescaledb-fetch-deps \
9497 git \
9598 && apk add --no-cache --virtual .timescaledb-build-deps \
9699 openssl-dev \
100+ icu-dev \
97101 clang \
98102 gcc \
99103 cmake \
0 commit comments