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

View File

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