From: Daniele Varrazzo Date: Sun, 23 Jun 2024 21:46:24 +0000 (+0200) Subject: ci: more robust libpq build script X-Git-Tag: 3.2.0~4^2~3 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=1ef8271fad9d50e007029f0be8355decc5080557;p=thirdparty%2Fpsycopg.git ci: more robust libpq build script --- diff --git a/tools/build/build_libpq.sh b/tools/build/build_libpq.sh index 52bd0e1e4..2a14e23b4 100755 --- a/tools/build/build_libpq.sh +++ b/tools/build/build_libpq.sh @@ -46,32 +46,36 @@ case "$ID" in esac if [ "$ID" == "centos" ]; 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 \ + if [ ! -d "${openssl_dir}" ]; then + curl -fsSL \ https://github.com/openssl/openssl/archive/${openssl_tag}.tar.gz \ | tar xzf - - cd "${openssl_dir}" + pushd "${openssl_dir}" ./config --prefix=${LIBPQ_BUILD_PREFIX} --openssldir=${LIBPQ_BUILD_PREFIX} \ zlib -fPIC shared make depend make else - cd "${openssl_dir}" + pushd "${openssl_dir}" fi # Install openssl make install_sw - cd .. + popd + fi fi if [ "$ID" == "centos" ]; then + if [[ ! -f "${LIBPQ_BUILD_PREFIX}/lib/libsasl2.so" ]]; then # Build libsasl2 if needed # The system package (cyrus-sasl-devel) causes an amazing error on i686: @@ -80,40 +84,42 @@ if [ "$ID" == "centos" ]; 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 - - cd "${sasl_dir}" + pushd "${sasl_dir}" autoreconf -i ./configure --prefix=${LIBPQ_BUILD_PREFIX} \ CPPFLAGS=-I${LIBPQ_BUILD_PREFIX}/include/ LDFLAGS=-L${LIBPQ_BUILD_PREFIX}/lib make else - cd "${sasl_dir}" + pushd "${sasl_dir}" fi # Install libsasl2 # requires missing nroff to build touch saslauthd/saslauthd.8 make install - cd .. + popd + fi fi if [ "$ID" == "centos" ]; then + if [[ ! -f "${LIBPQ_BUILD_PREFIX}/lib/libldap.so" ]]; 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 - - cd "${ldap_dir}" + pushd "${ldap_dir}" ./configure --prefix=${LIBPQ_BUILD_PREFIX} --enable-backends=no --enable-null \ CPPFLAGS=-I${LIBPQ_BUILD_PREFIX}/include/ LDFLAGS=-L${LIBPQ_BUILD_PREFIX}/lib @@ -123,7 +129,7 @@ if [ "$ID" == "centos" ]; then make -C libraries/liblber/ make -C libraries/libldap/ else - cd "${ldap_dir}" + pushd "${ldap_dir}" fi # Install openldap @@ -131,8 +137,9 @@ if [ "$ID" == "centos" ]; then make -C libraries/libldap/ install make -C include/ install chmod +x ${LIBPQ_BUILD_PREFIX}/lib/{libldap,liblber}*.so* - cd .. + popd + fi fi @@ -140,11 +147,11 @@ 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 - - cd "${postgres_dir}" + pushd "${postgres_dir}" # Match the default unix socket dir default with what defined on Ubuntu and # Red Hat, which seems the most common location @@ -163,13 +170,13 @@ if [ ! -d "${postgres_dir}" ]; then make -C src/bin/pg_config make -C src/include else - cd "${postgres_dir}" + pushd "${postgres_dir}" fi # Install libpq make -C src/interfaces/libpq install make -C src/bin/pg_config install make -C src/include install -cd .. +popd find ${LIBPQ_BUILD_PREFIX} -name \*.so.\* -type f -exec strip --strip-unneeded {} \; diff --git a/tools/build/wheel_linux_before_all.sh b/tools/build/wheel_linux_before_all.sh index ac5469aae..5fe6b0727 100755 --- a/tools/build/wheel_linux_before_all.sh +++ b/tools/build/wheel_linux_before_all.sh @@ -27,7 +27,7 @@ case "$ID" in # TODO: On 2021-11-09 curl fails on 'ppc64le' with: # curl: (60) SSL certificate problem: certificate has expired # Test again later if -k can be removed. - curl -skf https://www.postgresql.org/media/keys/ACCC4CF8.asc \ + curl -fsSLk https://www.postgresql.org/media/keys/ACCC4CF8.asc \ > /etc/apt/trusted.gpg.d/postgresql.asc fi