Skip to content

Commit 6d27950

Browse files
committed
Add extra code to configure with --with-openssl which is supported by CPython 3.7+
1 parent 0708c6c commit 6d27950

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

‎plugins/python-build/bin/python-build‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,9 +1502,15 @@ use_homebrew_openssl() {
15021502
local ssldir="$(brew --prefix "${openssl}" || true)"
15031503
if [ -d "$ssldir" ]; then
15041504
echo "python-build: use ${openssl} from homebrew"
1505+
if [[ -n "${PYTHON_BUILD_CONFIGURE_WITH_OPENSSL:-}" ]]; then
1506+
# configure scriopt of newer CPython versions support `--with-openssl`
1507+
# https://bugs.python.org/issue21541
1508+
package_option python configure --with-openssl="${ssldir}"
1509+
else
1510+
export CPPFLAGS="-I$ssldir/include ${CPPFLAGS}"
1511+
export LDFLAGS="-L$ssldir/lib ${LDFLAGS}"
1512+
fi
15051513
export PKG_CONFIG_PATH="$ssldir/lib/pkgconfig/:${PKG_CONFIG_PATH}"
1506-
export CPPFLAGS="-I$ssldir/include ${CPPFLAGS}"
1507-
export LDFLAGS="-L$ssldir/lib ${LDFLAGS}"
15081514
return
15091515
fi
15101516
done
@@ -1519,8 +1525,14 @@ build_package_mac_openssl() {
15191525
OPENSSLDIR="${OPENSSLDIR:-$OPENSSL_PREFIX_PATH/ssl}"
15201526

15211527
# Tell Python to use this openssl for its extension.
1522-
export CPPFLAGS="-I${OPENSSL_PREFIX_PATH}/include ${CPPFLAGS}"
1523-
export LDFLAGS="-L${OPENSSL_PREFIX_PATH}/lib ${LDFLAGS}"
1528+
if [[ -n "${PYTHON_BUILD_CONFIGURE_WITH_OPENSSL:-}" ]]; then
1529+
# configure scriopt of newer CPython versions support `--with-openssl`
1530+
# https://bugs.python.org/issue21541
1531+
package_option python configure --with-openssl="${OPENSSL_PREFIX_PATH}"
1532+
else
1533+
export CPPFLAGS="-I${OPENSSL_PREFIX_PATH}/include ${CPPFLAGS}"
1534+
export LDFLAGS="-L${OPENSSL_PREFIX_PATH}/lib ${LDFLAGS}"
1535+
fi
15241536

15251537
# Make sure pkg-config finds our build first.
15261538
export PKG_CONFIG_PATH="${OPENSSL_PREFIX_PATH}/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"

0 commit comments

Comments
 (0)