From e98a0b489f62f22204cbd13fdac03aca79d98623 Mon Sep 17 00:00:00 2001 From: native-api Date: Thu, 9 Jan 2025 02:16:06 +0300 Subject: [PATCH] Fix "Unsupported options" error building bundled OpenSSL <3.2.0 (#3164) --- plugins/python-build/bin/python-build | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/plugins/python-build/bin/python-build b/plugins/python-build/bin/python-build index 34fd0d27..f39225f6 100755 --- a/plugins/python-build/bin/python-build +++ b/plugins/python-build/bin/python-build @@ -1600,9 +1600,13 @@ build_package_mac_openssl() { local nokerberos [[ "$1" != openssl-1.0.* ]] || nokerberos=1 + + # switches introduced in OpenSSL 3.2 + local extra_no_features + [[ $(openssl_version $1) -ge 30200 ]] && extra_no_features=1 # Compile a shared lib with zlib dynamically linked. - package_option openssl configure --openssldir="$OPENSSLDIR" zlib-dynamic no-ssl3 shared ${nokerberos:+no-ssl2 no-krb5} no-docs no-apps no-tests + package_option openssl configure --openssldir="$OPENSSLDIR" zlib-dynamic no-ssl3 shared ${nokerberos:+no-ssl2 no-krb5} ${extra_no_features:+no-docs no-apps} no-tests build_package_standard "$@" @@ -1612,6 +1616,16 @@ build_package_mac_openssl() { security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain >> "$pem_file" } +# openssl-1.0.1k -> 10001 +# openssl-3.2.1 -> 30201 +openssl_version() { + local -a ver + IFS=- ver=( ${1:?} ) + IFS=. ver=( ${ver[0]} ) + [[ ${ver[2]} =~ '^([[:digit:]]+)[[:alpha:]]$' ]] && ver[2]="${BASH_REMATCH[1]}" + echo $(( ${ver[0]}*10000 + ${ver[1]}*100 + ${ver[2]} )) +} + # Post-install check that the openssl extension was built. build_package_verify_openssl() { "$RUBY_BIN" -e '