ci: less verbose, more robust build

This commit is contained in:
Daniele Varrazzo 2025-10-09 01:33:27 +02:00
parent 865ef7e6c7
commit e0507a891c
2 changed files with 25 additions and 21 deletions

View File

@ -100,18 +100,18 @@ else
make_configure_standard_flags=( \
--prefix=${LIBPQ_BUILD_PREFIX} \
CPPFLAGS=-I${LIBPQ_BUILD_PREFIX}/include/ \
LDFLAGS=-L${LIBPQ_BUILD_PREFIX}/lib \
"LDFLAGS=-L${LIBPQ_BUILD_PREFIX}/lib -L${LIBPQ_BUILD_PREFIX}/lib64" \
)
fi
if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
if [[ ! -f "${LIBPQ_BUILD_PREFIX}/openssl.cnf" ]]; then
# Build openssl if needed
openssl_tag="openssl-${openssl_version}"
openssl_dir="openssl-${openssl_tag}"
if [ ! -d "${openssl_dir}" ]; then
curl -sL \
curl -fsSL \
https://github.com/openssl/openssl/archive/${openssl_tag}.tar.gz \
| tar xzf -
@ -125,8 +125,8 @@ if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
./configure "darwin64-$MACOSX_ARCHITECTURE-cc" $options
fi
make depend
make
make -s depend
make -s
else
pushd "${openssl_dir}"
fi
@ -135,6 +135,7 @@ if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
make install_sw
popd
fi
fi
@ -143,12 +144,12 @@ if [ "$ID" == "macos" ]; then
# Build kerberos if needed
krb5_dir="krb5-${krb5_version}/src"
if [ ! -d "${krb5_dir}" ]; then
curl -sL "https://kerberos.org/dist/krb5/${krb5_version%.*}/krb5-${krb5_version}.tar.gz" \
curl -fsSL "https://kerberos.org/dist/krb5/${krb5_version%.*}/krb5-${krb5_version}.tar.gz" \
| tar xzf -
pushd "${krb5_dir}"
./configure "${make_configure_standard_flags[@]}"
make
make -s
else
pushd "${krb5_dir}"
fi
@ -160,6 +161,7 @@ fi
if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
if [[ ! -f "${LIBPQ_BUILD_PREFIX}/lib/libsasl2.${library_suffix}" ]]; then
# Build libsasl2 if needed
# The system package (cyrus-sasl-devel) causes an amazing error on i686:
@ -168,7 +170,7 @@ if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
sasl_tag="cyrus-sasl-${sasl_version}"
sasl_dir="cyrus-sasl-${sasl_tag}"
if [ ! -d "${sasl_dir}" ]; then
curl -sL \
curl -fsSL \
https://github.com/cyrusimap/cyrus-sasl/archive/${sasl_tag}.tar.gz \
| tar xzf -
@ -176,7 +178,7 @@ if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
autoreconf -i
./configure "${make_configure_standard_flags[@]}" --disable-macos-framework
make
make -s
else
pushd "${sasl_dir}"
fi
@ -187,16 +189,18 @@ if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
make install
popd
fi
fi
if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
if [[ ! -f "${LIBPQ_BUILD_PREFIX}/lib/libldap.${library_suffix}" ]]; then
# Build openldap if needed
ldap_tag="${ldap_version}"
ldap_dir="openldap-${ldap_tag}"
if [ ! -d "${ldap_dir}" ]; then
curl -sL \
curl -fsSL \
https://www.openldap.org/software/download/OpenLDAP/openldap-release/openldap-${ldap_tag}.tgz \
| tar xzf -
@ -204,10 +208,10 @@ if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
./configure "${make_configure_standard_flags[@]}" --enable-backends=no --enable-null
make depend
make -C libraries/liblutil/
make -C libraries/liblber/
make -C libraries/libldap/
make -s depend
make -s -C libraries/liblutil/
make -s -C libraries/liblber/
make -s -C libraries/libldap/
else
pushd "${ldap_dir}"
fi
@ -219,6 +223,7 @@ if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
chmod +x ${LIBPQ_BUILD_PREFIX}/lib/{libldap,liblber}*.${library_suffix}*
popd
fi
fi
@ -226,7 +231,7 @@ fi
postgres_tag="REL_${postgres_version//./_}"
postgres_dir="postgres-${postgres_tag}"
if [ ! -d "${postgres_dir}" ]; then
curl -sL \
curl -fsSL \
https://github.com/postgres/postgres/archive/${postgres_tag}.tar.gz \
| tar xzf -
@ -240,15 +245,14 @@ if [ ! -d "${postgres_dir}" ]; then
src/include/pg_config_manual.h
fi
# Often needed, but currently set by the workflow
# export LD_LIBRARY_PATH="${LIBPQ_BUILD_PREFIX}/lib"
export LD_LIBRARY_PATH="${LIBPQ_BUILD_PREFIX}/lib:${LIBPQ_BUILD_PREFIX}/lib64"
./configure "${make_configure_standard_flags[@]}" --sysconfdir=/etc/postgresql-common \
--with-gssapi --with-openssl --with-pam --with-ldap \
--without-readline --without-icu
make -C src/interfaces/libpq
make -C src/bin/pg_config
make -C src/include
make -s -C src/interfaces/libpq
make -s -C src/bin/pg_config
make -s -C src/include
else
pushd "${postgres_dir}"
fi

View File

@ -12,7 +12,7 @@ dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
prjdir="$( cd "${dir}/../.." && pwd )"
# Build dependency libraries
"${prjdir}/scripts/build/build_libpq.sh"
"${prjdir}/scripts/build/build_libpq.sh" > /dev/null
# Show dependency tree
otool -L /tmp/libpq.build/lib/*.dylib