- name: Set up QEMU for multi-arch build
uses: docker/setup-qemu-action@v1
+ - name: Cache libpq build
+ uses: actions/cache@v3
+ with:
+ path: /tmp/libpq.build
+ key: libpq-14.3-${{ matrix.platform }}-${{ matrix.arch }}-1
+
- name: Create the binary package source tree
run: python3 ./tools/build/copy_to_binary.py
PSYCOPG_IMPL=binary
PSYCOPG_TEST_DSN='host=172.17.0.1 user=postgres'
PGPASSWORD=password
+ LIBPQ_BUILD_PREFIX=/host/tmp/libpq.build
+ PATH="$LIBPQ_BUILD_PREFIX/bin:$PATH"
+ LD_LIBRARY_PATH="$LIBPQ_BUILD_PREFIX/lib"
- uses: actions/upload-artifact@v2
with:
set -euo pipefail
set -x
+# IMPORTANT! Change the cache key in packages.yml when upgrading libraries
+postgres_version="14.3"
openssl_version="1.1.1o"
ldap_version="2.6.2"
sasl_version="2.1.28"
-postgres_version="14.3"
+
+export LIBPQ_BUILD_PREFIX=${LIBPQ_BUILD_PREFIX:-/tmp/libpq.build}
+
+if [[ -f "${LIBPQ_BUILD_PREFIX}/lib/libpq.so" ]]; then
+ echo "libpq already available: build skipped" >&2
+ exit 0
+fi
source /etc/os-release
cd "${openssl_dir}"
- ./config --prefix=/usr/local/ --openssldir=/usr/local/ \
+ ./config --prefix=${LIBPQ_BUILD_PREFIX} --openssldir=${LIBPQ_BUILD_PREFIX} \
zlib -fPIC shared
make depend
make
cd "${sasl_dir}"
autoreconf -i
- ./configure
+ ./configure --prefix=${LIBPQ_BUILD_PREFIX}
make
else
cd "${sasl_dir}"
cd "${ldap_dir}"
- ./configure --enable-backends=no --enable-null
+ ./configure --prefix=${LIBPQ_BUILD_PREFIX} --enable-backends=no --enable-null
make depend
make -C libraries/liblutil/
make -C libraries/liblber/
make -C libraries/liblber/ install
make -C libraries/libldap/ install
make -C include/ install
- chmod +x /usr/local/lib/{libldap,liblber}*.so*
+ chmod +x ${LIBPQ_BUILD_PREFIX}/lib/{libldap,liblber}*.so*
cd ..
fi
'|#define DEFAULT_PGSOCKET_DIR "/var/run/postgresql"|' \
src/include/pg_config_manual.h
- # Without this, libpq ./configure fails on i686
- if [[ "$(uname -m)" != "x86_64" ]]; then
- export LD_LIBRARY_PATH=/usr/local/lib
- fi
+ # Often needed, but currently set by the workflow
+ # export LD_LIBRARY_PATH="${LIBPQ_BUILD_PREFIX}/lib"
- ./configure --prefix=/usr/local --sysconfdir=/etc/postgresql-common \
- --without-readline --with-gssapi --with-openssl --with-pam --with-ldap
+ ./configure --prefix=${LIBPQ_BUILD_PREFIX} --sysconfdir=/etc/postgresql-common \
+ --without-readline --with-gssapi --with-openssl --with-pam --with-ldap \
+ CPPFLAGS=-I${LIBPQ_BUILD_PREFIX}/include/ LDFLAGS=-L${LIBPQ_BUILD_PREFIX}/lib
make -C src/interfaces/libpq
make -C src/bin/pg_config
make -C src/include
make -C src/include install
cd ..
-find /usr/local/ -name \*.so.\* -type f -exec strip --strip-unneeded {} \;
+find ${LIBPQ_BUILD_PREFIX} -name \*.so.\* -type f -exec strip --strip-unneeded {} \;