Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 935043d

Browse files
committed
Closes #27976: Deprecate bundled full copy of libffi
Builds on non-OSX UNIX now default to using the system libffi, and warn if the bundled copy is used.
1 parent b7f3c94 commit 935043d

5 files changed

Lines changed: 57 additions & 8 deletions

File tree

Doc/whatsnew/3.6.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,16 @@ Build and C API Changes
10101010
Deprecated
10111011
==========
10121012

1013+
Deprecated Build Options
1014+
------------------------
1015+
1016+
The ``--with-system-ffi`` configure flag is now on by default on non-OSX UNIX
1017+
platforms. It may be disabled by using ``--without-system-ffi``, but using the
1018+
flag is deprecated and will not be accepted in Python 3.7. OSX is unaffected
1019+
by this change. Note that many OS distributors already use the
1020+
``--with-system-ffi`` flag when building their system Python.
1021+
1022+
10131023
New Keywords
10141024
------------
10151025

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,9 @@ Tests
311311
Build
312312
-----
313313

314+
- Issue #27976: Deprecate building _ctypes with the bundled copy of libffi on
315+
non-OSX UNIX platforms.
316+
314317
- Issue #27983: Cause lack of llvm-profdata tool when using clang as
315318
required for PGO linking to be a configure time error rather than
316319
make time when --with-optimizations is enabled. Also improve our

configure

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9851,11 +9851,27 @@ $as_echo_n "checking for --with-system-ffi... " >&6; }
98519851
# Check whether --with-system_ffi was given.
98529852
if test "${with_system_ffi+set}" = set; then :
98539853
withval=$with_system_ffi;
9854-
else
9855-
with_system_ffi="no"
98569854
fi
98579855

98589856

9857+
case "$with_system_ffi" in
9858+
"")
9859+
case $ac_sys_system in
9860+
Darwin)
9861+
with_system_ffi="no"
9862+
;;
9863+
*)
9864+
with_system_ffi="yes"
9865+
;;
9866+
esac
9867+
;;
9868+
yes|no)
9869+
;;
9870+
*)
9871+
as_fn_error $? "--with-system-ffi accepts no arguments" "$LINENO" 5
9872+
;;
9873+
esac
9874+
98599875
if test "$with_system_ffi" = "yes" && test -n "$PKG_CONFIG"; then
98609876
LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ *$//'`"
98619877
else

configure.ac

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2737,9 +2737,25 @@ AC_MSG_RESULT($with_system_expat)
27372737
# Check for use of the system libffi library
27382738
AC_MSG_CHECKING(for --with-system-ffi)
27392739
AC_ARG_WITH(system_ffi,
2740-
AS_HELP_STRING([--with-system-ffi], [build _ctypes module using an installed ffi library]),
2741-
[],
2742-
[with_system_ffi="no"])
2740+
AS_HELP_STRING([--with-system-ffi], [build _ctypes module using an installed ffi library]),,,)
2741+
2742+
case "$with_system_ffi" in
2743+
"")
2744+
case $ac_sys_system in
2745+
Darwin)
2746+
with_system_ffi="no"
2747+
;;
2748+
*)
2749+
with_system_ffi="yes"
2750+
;;
2751+
esac
2752+
;;
2753+
yes|no)
2754+
;;
2755+
*)
2756+
AC_MSG_ERROR([--with-system-ffi accepts no arguments])
2757+
;;
2758+
esac
27432759

27442760
if test "$with_system_ffi" = "yes" && test -n "$PKG_CONFIG"; then
27452761
LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ *$//'`"

setup.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1911,6 +1911,9 @@ def configure_ctypes(self, ext):
19111911
if host_platform == 'darwin':
19121912
return self.configure_ctypes_darwin(ext)
19131913

1914+
print('warning: building with the bundled copy of libffi is'
1915+
' deprecated on this platform. It will not be'
1916+
' distributed with Python 3.7')
19141917
srcdir = sysconfig.get_config_var('srcdir')
19151918
ffi_builddir = os.path.join(self.build_temp, 'libffi')
19161919
ffi_srcdir = os.path.abspath(os.path.join(srcdir, 'Modules',
@@ -2007,13 +2010,14 @@ def detect_ctypes(self, inc_dirs, lib_dirs):
20072010
libraries=math_libs)
20082011
self.extensions.extend([ext, ext_test])
20092012

2010-
if not '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS"):
2011-
return
2012-
20132013
if host_platform == 'darwin':
2014+
if '--with-system-ffi' not in sysconfig.get_config_var("CONFIG_ARGS"):
2015+
return
20142016
# OS X 10.5 comes with libffi.dylib; the include files are
20152017
# in /usr/include/ffi
20162018
inc_dirs.append('/usr/include/ffi')
2019+
elif '--without-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS"):
2020+
return
20172021

20182022
ffi_inc = [sysconfig.get_config_var("LIBFFI_INCLUDEDIR")]
20192023
if not ffi_inc or ffi_inc[0] == '':

0 commit comments

Comments
 (0)