diff options
author | atomlong | 2021-10-23 17:55:22 +0800 |
---|---|---|
committer | atomlong | 2021-10-23 18:06:15 +0800 |
commit | 80096c8de4b34ec1ed8f30bb428918cd592b2424 (patch) | |
tree | b48dd1e73de9ea35a4709fb6b93deb16331ec514 /0082-Fix-extension-suffix-for-c-extensions-on-mingw.patch | |
parent | 89a67c05174951d172252b1db96ff93cc4ec4bcd (diff) | |
download | aur-80096c8de4b34ec1ed8f30bb428918cd592b2424.tar.gz |
update to 3.9.7
Diffstat (limited to '0082-Fix-extension-suffix-for-c-extensions-on-mingw.patch')
-rw-r--r-- | 0082-Fix-extension-suffix-for-c-extensions-on-mingw.patch | 182 |
1 files changed, 182 insertions, 0 deletions
diff --git a/0082-Fix-extension-suffix-for-c-extensions-on-mingw.patch b/0082-Fix-extension-suffix-for-c-extensions-on-mingw.patch new file mode 100644 index 000000000000..95d3aefab861 --- /dev/null +++ b/0082-Fix-extension-suffix-for-c-extensions-on-mingw.patch @@ -0,0 +1,182 @@ +From cda85af5ff314ebd772e1000b48eefaddb0914b7 Mon Sep 17 00:00:00 2001 +From: Naveen M K <naveen521kk@gmail.com> +Date: Wed, 23 Jun 2021 18:12:12 +0530 +Subject: [PATCH 082/N] Fix extension suffix for c-extensions on mingw + +Python is compiled with various compilers which previously +had same platform tags or extension suffix. This can be error +prone while loading c-extensions, so now each compiler or +runtime has a different extension suffix. + +Also, changed all extension to end with .pyd rather than +.dll file. + +Fixes https://github.com/msys2/MINGW-packages/issues/8843 + +Signed-off-by: Naveen M K <naveen521kk@gmail.com> +--- + Makefile.pre.in | 6 ++-- + Python/dynload_win.c | 6 ---- + configure.ac | 77 +++++++++++++++++++++++++++++++++++++++----- + 3 files changed, 72 insertions(+), 17 deletions(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 2018514..a8aecc2 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -165,6 +165,7 @@ CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(LDVERSION) + # Symbols used for using shared libraries + SHLIB_SUFFIX= @SHLIB_SUFFIX@ + EXT_SUFFIX= @EXT_SUFFIX@ ++PYD_PLATFORM_TAG = @PYD_PLATFORM_TAG@ + LDSHARED= @LDSHARED@ $(PY_LDFLAGS) + BLDSHARED= @BLDSHARED@ $(PY_CORE_LDFLAGS) + LDCXXSHARED= @LDCXXSHARED@ +@@ -848,8 +849,7 @@ Python/dynload_hpux.o: $(srcdir)/Python/dynload_hpux.c Makefile + + Python/dynload_win.o: $(srcdir)/Python/dynload_win.c Makefile + $(CC) -c $(PY_CORE_CFLAGS) \ +- -DSHLIB_SUFFIX='"$(SHLIB_SUFFIX)"' \ +- -DEXT_SUFFIX='"$(EXT_SUFFIX)"' \ ++ -DPYD_PLATFORM_TAG='"$(PYD_PLATFORM_TAG)"' \ + -o $@ $(srcdir)/Python/dynload_win.c + + Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile $(srcdir)/Include/pydtrace.h +@@ -1688,7 +1688,7 @@ libainstall: @DEF_MAKE_RULE@ python-config + done + @if test -d $(LIBRARY); then :; else \ + if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \ +- if test "$(SHLIB_SUFFIX)" = .dll; then \ ++ if test "$(SHLIB_SUFFIX)" = .dll -o "$(SHLIB_SUFFIX)" = .pyd; then \ + $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \ + else \ + $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \ +diff --git a/Python/dynload_win.c b/Python/dynload_win.c +index bd34310..60fb603 100644 +--- a/Python/dynload_win.c ++++ b/Python/dynload_win.c +@@ -27,12 +27,6 @@ + #define PYD_UNTAGGED_SUFFIX PYD_DEBUG_SUFFIX ".pyd" + + const char *_PyImport_DynLoadFiletab[] = { +-#ifdef EXT_SUFFIX +- EXT_SUFFIX, /* include SOABI flags where is encoded debug */ +-#endif +-#ifdef SHLIB_SUFFIX +- "-abi" PYTHON_ABI_STRING SHLIB_SUFFIX, +-#endif + PYD_TAGGED_SUFFIX, + PYD_UNTAGGED_SUFFIX, + NULL +diff --git a/configure.ac b/configure.ac +index 5b41066..69cb8fb 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -2825,7 +2825,7 @@ if test -z "$SHLIB_SUFFIX"; then + *) SHLIB_SUFFIX=.so;; + esac + case $host_os in +- mingw*) SHLIB_SUFFIX=.dll;; ++ mingw*) SHLIB_SUFFIX=.pyd;; + esac + fi + AC_MSG_RESULT($SHLIB_SUFFIX) +@@ -5115,6 +5115,68 @@ esac + # check for endianness + AC_C_BIGENDIAN + ++AC_SUBST(PYD_PLATFORM_TAG) ++# Special case of PYD_PLATFORM_TAG with python build with mingw. ++# Python can with compiled with clang or gcc and linked ++# to msvcrt or ucrt. To avoid conflicts between them ++# we are selecting the extension as based on the compiler ++# and the runtime they link to ++# gcc + x86_64 + msvcrt = cp{version number}-x86_64 ++# gcc + i686 + msvcrt = cp{version number}-i686 ++# gcc + x86_64 + ucrt = cp{version number}-x86_64-ucrt ++# clang + x86_64 + ucrt = cp{version number}-x86_64-clang ++# clang + i686 + ucrt = cp{version number}-i686-clang ++ ++PYD_PLATFORM_TAG="" ++case $host in ++ *-*-mingw*) ++ # check if we are linking to ucrt ++ AC_MSG_CHECKING(whether linking to ucrt) ++ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ ++ #include <stdio.h> ++ #ifndef _UCRT ++ #error no ucrt ++ #endif ++ int main(){ return 0; } ++ ]])],[linking_to_ucrt=yes],[linking_to_ucrt=no]) ++ AC_MSG_RESULT($linking_to_ucrt) ++ ;; ++esac ++case $host_os in ++ mingw*) ++ AC_MSG_CHECKING(PYD_PLATFORM_TAG) ++ case $host in ++ i686-*-mingw*) ++ if test -n "${cc_is_clang}"; then ++ # it is CLANG32 ++ PYD_PLATFORM_TAG="mingw_i686_clang" ++ else ++ if test $linking_to_ucrt = no; then ++ PYD_PLATFORM_TAG="mingw_i686" ++ else ++ PYD_PLATFORM_TAG="mingw_i686_ucrt" ++ fi ++ fi ++ ;; ++ x86_64-*-mingw*) ++ if test -n "${cc_is_clang}"; then ++ # it is CLANG64 ++ PYD_PLATFORM_TAG="mingw_x86_64_clang" ++ else ++ if test $linking_to_ucrt = no; then ++ PYD_PLATFORM_TAG="mingw_x86_64" ++ else ++ PYD_PLATFORM_TAG="mingw_x86_64_ucrt" ++ fi ++ fi ++ ;; ++ aarch64-*-mingw*) ++ PYD_PLATFORM_TAG+="mingw_aarch64" ++ ;; ++ esac ++ AC_MSG_RESULT($PYD_PLATFORM_TAG) ++esac ++ + # ABI version string for Python extension modules. This appears between the + # periods in shared library file names, e.g. foo.<SOABI>.so. It is calculated + # from the following attributes which affect the ABI of this Python build (in +@@ -5147,7 +5209,12 @@ if test "$Py_DEBUG" = 'true' -a "$with_trace_refs" != "yes"; then + fi + + AC_SUBST(EXT_SUFFIX) +-EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX} ++VERSION_NO_DOTS=$(echo $LDVERSION | tr -d .) ++if test -n "${PYD_PLATFORM_TAG}"; then ++ EXT_SUFFIX=".cp${VERSION_NO_DOTS}-${PYD_PLATFORM_TAG}${SHLIB_SUFFIX}" ++else ++ EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX} ++fi + + AC_MSG_CHECKING(LDVERSION) + LDVERSION='$(VERSION)$(ABIFLAGS)' +@@ -5819,12 +5886,6 @@ case "$ac_cv_computed_gotos" in yes*) + AC_DEFINE(HAVE_COMPUTED_GOTOS, 1, + [Define if the C compiler supports computed gotos.]) + esac +-case $host_os in +- mingw*) +- dnl Synchronized with _PyImport_DynLoadFiletab (dynload_win.c) +- dnl Do not use more then one dot on this platform ! +- EXT_SUFFIX=-$SOABI$SHLIB_SUFFIX;; +-esac + + case $ac_sys_system in + AIX*) +-- +2.33.0 + |