[Bug 256558] lang/python3[89]: fix build WITH_DEBUG

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 17 Aug 2021 07:56:03 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=256558

Fukang Chen <loader@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |loader@FreeBSD.org

--- Comment #7 from Fukang Chen <loader@FreeBSD.org> ---
(In reply to Kubilay Kocak from comment #1)

It was introduced by this commit on the 3.8 branch, EXT_SUFFIX now contains
${SOABI} on FreeBSD:
https://github.com/python/cpython/commit/b01091a3e71e6636d2df4db45920e820cdf7df3b
commit a44ce6c9f725d336aea51a946b42769f29fed613
Author: Matti Picus <matti.picus@gmail.com>
Date:   Sun Dec 20 04:56:57 2020 +0200

    bpo-42604: always set EXT_SUFFIX=${SOABI}${SHLIB_SUFFIX} when using
configure (GH-23708)

    Now all platforms use a value for the "EXT_SUFFIX" build variable derived
    from SOABI (for instance in FreeBSD, "EXT_SUFFIX" is now ".cpython-310d.so"
    instead of ".so"). Previously only Linux, Mac and VxWorks were using a
value
    for "EXT_SUFFIX" that included "SOABI".

    Co-authored-by: Pablo Galindo <pablogsal@gmail.com>

diff --git a/configure.ac b/configure.ac
index 445dae1..ee5573c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4786,12 +4786,7 @@ if test "$Py_DEBUG" = 'true' -a "$with_trace_refs" !=
"yes"; then
 fi

 AC_SUBST(EXT_SUFFIX)
-case $ac_sys_system in
-    Linux*|GNU*|Darwin|VxWorks)
-       EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX};;
-    *)
-       EXT_SUFFIX=${SHLIB_SUFFIX};;
-esac
+EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX}

 AC_MSG_CHECKING(LDVERSION)
 LDVERSION='$(VERSION)$(ABIFLAGS)'


SOABI is "cpython-38d" and configure argument "--with-pydebug" adds "d" to the
ABIFLAGS:

https://github.com/python/cpython/blob/v3.8.11/configure.ac#L4693
4693 SOABI='cpython-'`echo $VERSION | tr -d
.`${ABIFLAGS}${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET}

https://github.com/python/cpython/blob/v3.8.11/configure.ac#L1231-L1249
  1231  # For calculating the .so ABI tag.
  1232  AC_SUBST(ABIFLAGS)
  1233  ABIFLAGS=""
  1234  
  1235  # Check for --with-pydebug
  1236  AC_MSG_CHECKING(for --with-pydebug)
  1237  AC_ARG_WITH(pydebug,
  1238              AS_HELP_STRING([--with-pydebug], [build with Py_DEBUG
defined]),
  1239  [
  1240  if test "$withval" != no
  1241  then
  1242    AC_DEFINE(Py_DEBUG, 1,
  1243    [Define if you want to build an interpreter with many run-time
checks.])
  1244    AC_MSG_RESULT(yes);
  1245    Py_DEBUG='true'
  1246    ABIFLAGS="${ABIFLAGS}d"
  1247  else AC_MSG_RESULT(no); Py_DEBUG='false'
  1248  fi],
  1249  [AC_MSG_RESULT(no)])


disttuiles build_ext.py gets the extension filename ext_suffix from EXT_SUFFIX:

https://github.com/python/cpython/blob/v3.8.11/Lib/distutils/command/build_ext.py#L675-683
   675      def get_ext_filename(self, ext_name):
   676          r"""Convert the name of an extension (eg. "foo.bar") into the
name
   677          of the file from which it will be loaded (eg. "foo/bar.so", or
   678          "foo\bar.pyd").
   679          """
   680          from distutils.sysconfig import get_config_var
   681          ext_path = ext_name.split('.')
   682          ext_suffix = get_config_var('EXT_SUFFIX')
   683          return os.path.join(*ext_path) + ext_suffix

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.