Allow overriding the preference of OpenSSL version per definition basis (#1302, #1325, #1326)

This commit is contained in:
Yamashita, Yuu 2019-04-08 11:18:31 +09:00
parent 78cecd2060
commit 62395cabb5

View file

@ -1484,6 +1484,12 @@ use_homebrew_readline() {
fi
}
prefer_openssl11() {
# Allow overriding the preference of OpenSSL version per definition basis (#1302, #1325, #1326)
PYTHON_BUILD_HOMEBRE_OPENSSL_FORMULA="${PYTHON_BUILD_HOMEBRE_OPENSSL_FORMULA:-openssl@1.1 openssl}"
export PYTHON_BUILD_HOMEBRE_OPENSSL_FORMULA
}
has_broken_mac_openssl() {
is_mac || return 1
local openssl_version="$(/usr/bin/openssl version 2>/dev/null || true)"
@ -1492,20 +1498,17 @@ has_broken_mac_openssl() {
}
use_homebrew_openssl() {
local ssl11dir="$(brew --prefix openssl@1.1 2>/dev/null || true)"
local ssl10dir="$(brew --prefix openssl 2>/dev/null || true)"
if [ -d "$ssl11dir" ]; then
echo "python-build: use openssl 1.1 from homebrew"
local ssldir=$ssl11dir
elif [ -d "$ssl10dir" ]; then
echo "python-build: use openssl 1.0 from homebrew"
local ssldir=$ssl10dir
else
return 1
fi
export PKG_CONFIG_PATH="$ssldir/lib/pkgconfig/:${PKG_CONFIG_PATH}"
export CPPFLAGS="-I$ssldir/include ${CPPFLAGS}"
export LDFLAGS="-L$ssldir/lib ${LDFLAGS}"
for openssl in ${PYTHON_BUILD_HOMEBRE_OPENSSL_FORMULA:-openssl}; do
local ssldir="$(brew --prefix "${openssl}" || true)"
if [ -d "$ssldir" ]; then
echo "python-build: use ${openssl} from homebrew"
export PKG_CONFIG_PATH="$ssldir/lib/pkgconfig/:${PKG_CONFIG_PATH}"
export CPPFLAGS="-I$ssldir/include ${CPPFLAGS}"
export LDFLAGS="-L$ssldir/lib ${LDFLAGS}"
return
fi
done
return 1
}
build_package_mac_openssl() {