From: Daniele Varrazzo Date: Mon, 13 Jun 2022 01:15:31 +0000 (+0200) Subject: build: build libpq 14 for musllinux packages X-Git-Tag: 3.1~57^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3593297f5222e5457d9e256a75efc5c85a58adad;p=thirdparty%2Fpsycopg.git build: build libpq 14 for musllinux packages Currently Alpine ships with libpq 12, which wouldn't allow to use the pipeline mode. Use the system packages for the other libraries, for the moment. --- diff --git a/docs/news.rst b/docs/news.rst index 917c86e0a..f8d43bf53 100644 --- a/docs/news.rst +++ b/docs/news.rst @@ -38,6 +38,7 @@ Psycopg 3.0.15 (unreleased) - Restore the connection to usable state after an error in `~Cursor.stream()`. - Raise `DataError` instead of `OverflowError` loading binary intervals out-of-range. +- Distribute ``manylinux2014`` wheel packages (:ticket:`#124`). Current release diff --git a/tools/build/build_libpq.sh b/tools/build/build_libpq.sh index 06360117b..5f3188150 100755 --- a/tools/build/build_libpq.sh +++ b/tools/build/build_libpq.sh @@ -10,83 +10,109 @@ ldap_version="2.6.2" sasl_version="2.1.28" postgres_version="14.3" -yum install -y zlib-devel krb5-devel pam-devel +source /etc/os-release + +case "$ID" in + centos) + yum install -y zlib-devel krb5-devel pam-devel + ;; + + alpine) + apk add --no-cache zlib-dev krb5-dev linux-pam-dev openldap-dev + ;; + + *) + echo "$0: unexpected Linux distribution: '$ID'" >&2 + exit 1 + ;; +esac + +if [ "$ID" == "centos" ]; then + + # Build openssl if needed + openssl_tag="OpenSSL_${openssl_version//./_}" + openssl_dir="openssl-${openssl_tag}" + if [ ! -d "${openssl_dir}" ]; then curl -sL \ + https://github.com/openssl/openssl/archive/${openssl_tag}.tar.gz \ + | tar xzf - + + cd "${openssl_dir}" + + ./config --prefix=/usr/local/ --openssldir=/usr/local/ \ + zlib -fPIC shared + make depend + make + else + cd "${openssl_dir}" + fi + # Install openssl + make install_sw + cd .. -# Build openssl if needed -openssl_tag="OpenSSL_${openssl_version//./_}" -openssl_dir="openssl-${openssl_tag}" -if [ ! -d "${openssl_dir}" ]; then curl -sL \ - https://github.com/openssl/openssl/archive/${openssl_tag}.tar.gz \ - | tar xzf - +fi - cd "${openssl_dir}" - ./config --prefix=/usr/local/ --openssldir=/usr/local/ \ - zlib -fPIC shared - make depend - make -else - cd "${openssl_dir}" -fi +if [ "$ID" == "centos" ]; then -# Install openssl -make install_sw -cd .. + # Build libsasl2 if needed + # The system package (cyrus-sasl-devel) causes an amazing error on i686: + # "unsupported version 0 of Verneed record" + # https://github.com/pypa/manylinux/issues/376 + sasl_tag="cyrus-sasl-${sasl_version}" + sasl_dir="cyrus-sasl-${sasl_tag}" + if [ ! -d "${sasl_dir}" ]; then + curl -sL \ + https://github.com/cyrusimap/cyrus-sasl/archive/${sasl_tag}.tar.gz \ + | tar xzf - + cd "${sasl_dir}" -# Build libsasl2 if needed -# The system package (cyrus-sasl-devel) causes an amazing error on i686: -# "unsupported version 0 of Verneed record" -# https://github.com/pypa/manylinux/issues/376 -sasl_tag="cyrus-sasl-${sasl_version}" -sasl_dir="cyrus-sasl-${sasl_tag}" -if [ ! -d "${sasl_dir}" ]; then - curl -sL \ - https://github.com/cyrusimap/cyrus-sasl/archive/${sasl_tag}.tar.gz \ - | tar xzf - + autoreconf -i + ./configure + make + else + cd "${sasl_dir}" + fi - cd "${sasl_dir}" + # Install libsasl2 + # requires missing nroff to build + touch saslauthd/saslauthd.8 + make install + cd .. - autoreconf -i - ./configure - make -else - cd "${sasl_dir}" fi -# Install libsasl2 -# requires missing nroff to build -touch saslauthd/saslauthd.8 -make install -cd .. +if [ "$ID" == "centos" ]; then -# Build openldap if needed -ldap_tag="${ldap_version}" -ldap_dir="openldap-${ldap_tag}" -if [ ! -d "${ldap_dir}" ]; then - curl -sL \ - https://www.openldap.org/software/download/OpenLDAP/openldap-release/openldap-${ldap_tag}.tgz \ - | tar xzf - + # Build openldap if needed + ldap_tag="${ldap_version}" + ldap_dir="openldap-${ldap_tag}" + if [ ! -d "${ldap_dir}" ]; then + curl -sL \ + https://www.openldap.org/software/download/OpenLDAP/openldap-release/openldap-${ldap_tag}.tgz \ + | tar xzf - - cd "${ldap_dir}" + cd "${ldap_dir}" - ./configure --enable-backends=no --enable-null - make depend - make -C libraries/liblutil/ - make -C libraries/liblber/ - make -C libraries/libldap/ -else - cd "${ldap_dir}" -fi + ./configure --enable-backends=no --enable-null + make depend + make -C libraries/liblutil/ + make -C libraries/liblber/ + make -C libraries/libldap/ + else + cd "${ldap_dir}" + fi -# Install openldap -make -C libraries/liblber/ install -make -C libraries/libldap/ install -make -C include/ install -chmod +x /usr/local/lib/{libldap,liblber}*.so* -cd .. + # Install openldap + make -C libraries/liblber/ install + make -C libraries/libldap/ install + make -C include/ install + chmod +x /usr/local/lib/{libldap,liblber}*.so* + cd .. + +fi # Build libpq if needed @@ -106,7 +132,7 @@ if [ ! -d "${postgres_dir}" ]; then src/include/pg_config_manual.h # Without this, libpq ./configure fails on i686 - if [[ "$(uname -m)" == "i686" ]]; then + if [[ "$(uname -m)" != "x86_64" ]]; then export LD_LIBRARY_PATH=/usr/local/lib fi diff --git a/tools/build/wheel_linux_before_all.sh b/tools/build/wheel_linux_before_all.sh index 3426fa31f..663e3efd8 100755 --- a/tools/build/wheel_linux_before_all.sh +++ b/tools/build/wheel_linux_before_all.sh @@ -15,7 +15,8 @@ case "$ID" in alpine) # tzdata is required for datetime tests. apk update - apk add --no-cache postgresql-dev tzdata + apk add --no-cache tzdata + "${dir}/build_libpq.sh" > /dev/null ;; debian)