MSYS2-packages/python/900-msysize.patch
2022-06-06 15:12:23 +02:00

199 lines
6.7 KiB
Diff

--- Python-3.8.7.cygwin/configure.ac 2021-05-11 21:07:52.839122100 +0200
+++ Python-3.8.7/configure.ac 2021-05-11 21:10:48.366063600 +0200
@@ -401,7 +401,7 @@
case $MACHDEP in
aix*) MACHDEP="aix";;
linux*) MACHDEP="linux";;
- cygwin*) MACHDEP="cygwin";;
+ cygwin*|msys*) MACHDEP="cygwin";;
darwin*) MACHDEP="darwin";;
'') MACHDEP="unknown";;
esac
@@ -845,6 +845,14 @@
darwin
#elif defined(__VXWORKS__)
vxworks
+#elif defined(__MSYS__)
+# if defined(__x86_64__)
+ x86_64-msys
+# elif defined(__i386__)
+ i386-msys
+# else
+# error unknown platform triplet
+# endif
#elif defined(__CYGWIN__)
# if defined(__x86_64__)
x86_64-cygwin
@@ -1064,7 +1072,7 @@
if test -z "$enable_shared"
then
case $ac_sys_system in
- CYGWIN*)
+ CYGWIN*|MSYS*)
enable_shared="yes";;
*)
enable_shared="no";;
@@ -1118,6 +1126,10 @@
LDLIBRARY='libpython$(LDVERSION).dll.a'
DLLLIBRARY='libpython$(LDVERSION).dll'
;;
+ MSYS*)
+ LDLIBRARY='libpython$(LDVERSION).dll.a'
+ DLLLIBRARY='msys-python$(LDVERSION).dll'
+ ;;
SunOS*)
LDLIBRARY='libpython$(LDVERSION).so'
BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(LDVERSION)'
@@ -1164,7 +1176,7 @@
else # shared is disabled
PY_ENABLE_SHARED=0
case $ac_sys_system in
- CYGWIN*)
+ CYGWIN*|MSYS*)
BLDLIBRARY='$(LIBRARY)'
LDLIBRARY='libpython$(LDVERSION).dll.a'
;;
@@ -1213,7 +1225,7 @@
AC_SUBST(LN)
if test -z "$LN" ; then
case $ac_sys_system in
- CYGWIN*) LN="ln -s";;
+ CYGWIN*|MSYS*) LN="ln -s";;
*) LN=ln;;
esac
fi
@@ -2514,7 +2526,7 @@
*) SHLIB_SUFFIX=.sl;;
esac
;;
- CYGWIN*) SHLIB_SUFFIX=.dll;;
+ CYGWIN*|MSYS*) SHLIB_SUFFIX=.dll;;
*) SHLIB_SUFFIX=.so;;
esac
fi
@@ -2648,7 +2660,7 @@
SCO_SV*)
LDSHARED='$(CC) -Wl,-G,-Bexport'
LDCXXSHARED='$(CXX) -Wl,-G,-Bexport';;
- CYGWIN*)
+ CYGWIN*|MSYS*)
LDSHARED="gcc -shared -Wl,--enable-auto-image-base"
LDCXXSHARED="g++ -shared -Wl,--enable-auto-image-base";;
*) LDSHARED="ld";;
@@ -2734,7 +2746,7 @@
LINKFORSHARED="-Xlinker --export-dynamic"
fi;;
esac;;
- CYGWIN*)
+ CYGWIN*|MSYS*)
if test $enable_shared = "no"
then
LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
@@ -2758,7 +2770,7 @@
if test ! "$LIBRARY" = "$LDLIBRARY"
then
case $ac_sys_system in
- CYGWIN*)
+ CYGWIN*|MSYS*)
# Cygwin needs CCSHARED when building extension DLLs
# but not when building the interpreter DLL.
CFLAGSFORSHARED='';;
@@ -3228,7 +3240,7 @@
fi
AC_CHECK_FUNCS(pthread_sigmask,
[case $ac_sys_system in
- CYGWIN*)
+ CYGWIN*|MSYS*)
AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1,
[Define if pthread_sigmask() does not work on your system.])
;;
--- Python-3.8.7.orig/Lib/ctypes/__init__.py 2020-12-21 17:25:24.000000000 +0100
+++ Python-3.8.7/Lib/ctypes/__init__.py 2021-05-11 22:26:25.866873900 +0200
@@ -456,7 +456,7 @@
if _os.name == "nt":
pythonapi = PyDLL("python dll", None, _sys.dllhandle)
elif _sys.platform == "cygwin":
- pythonapi = PyDLL("libpython%d.%d.dll" % _sys.version_info[:2])
+ pythonapi = PyDLL("msys-python%d.%d.dll" % _sys.version_info[:2])
else:
pythonapi = PyDLL(None)
--- Python-3.8.7.orig/Lib/ctypes/test/test_loading.py 2020-12-21 17:25:24.000000000 +0100
+++ Python-3.8.7/Lib/ctypes/test/test_loading.py 2021-05-11 22:27:51.108283400 +0200
@@ -15,7 +15,7 @@
if os.name == "nt":
libc_name = find_library("c")
elif sys.platform == "cygwin":
- libc_name = "cygwin1.dll"
+ libc_name = "msys-2.0.dll"
else:
libc_name = find_library("c")
--- Python-3.8.7/Lib/ctypes/util.py.orig 2021-05-11 22:31:37.409285900 +0200
+++ Python-3.8.7/Lib/ctypes/util.py 2021-05-11 22:33:22.371550100 +0200
@@ -387,8 +387,8 @@
print(f"crypto\t:: {find_library('crypto')}")
print(f"crypto\t:: {cdll.LoadLibrary(find_library('crypto'))}")
elif sys.platform == "cygwin":
- print(cdll.LoadLibrary("cygbz2-1.dll"))
- print(cdll.LoadLibrary("cygcrypt-0.dll"))
+ print(cdll.LoadLibrary("msys-bz2-1.dll"))
+ print(cdll.LoadLibrary("msys-crypt-0.dll"))
print(find_library("crypt"))
else:
print(cdll.LoadLibrary("libm.so"))
diff -Naur Python-3.8.2-orig/Lib/distutils/cygwinccompiler.py Python-3.8.2/Lib/distutils/cygwinccompiler.py
--- Python-3.8.2-orig/Lib/distutils/cygwinccompiler.py 2020-04-16 11:05:52.457414700 +0300
+++ Python-3.8.2/Lib/distutils/cygwinccompiler.py 2020-04-16 11:24:20.464492200 +0300
@@ -400,4 +400,4 @@
def is_cygwingcc():
'''Try to determine if the gcc that would be used is from cygwin.'''
out_string = check_output(['gcc', '-dumpmachine'])
- return out_string.strip().endswith(b'cygwin')
+ return (out_string.strip().endswith(b'cygwin') or out_string.strip().endswith(b'msys'))
diff -Naur Python-3.8.2-orig/Lib/distutils/util.py Python-3.8.2/Lib/distutils/util.py
--- Python-3.8.2-orig/Lib/distutils/util.py 2020-02-25 00:36:25.000000000 +0300
+++ Python-3.8.2/Lib/distutils/util.py 2020-04-16 11:24:20.569211200 +0300
@@ -86,6 +86,12 @@
m = rel_re.match(release)
if m:
release = m.group()
+ elif osname[:4] == "msys":
+ osname = "msys"
+ rel_re = re.compile (r'[\d.]+', re.ASCII)
+ m = rel_re.match(release)
+ if m:
+ release = m.group()
elif osname[:6] == "darwin":
import _osx_support, distutils.sysconfig
osname, release, machine = _osx_support.get_platform_osx(
diff -Naur Python-3.8.2-orig/Lib/sysconfig.py Python-3.8.2/Lib/sysconfig.py
--- Python-3.8.2-orig/Lib/sysconfig.py 2020-02-25 00:36:25.000000000 +0300
+++ Python-3.8.2/Lib/sysconfig.py 2020-04-16 11:24:20.643039800 +0300
@@ -673,6 +673,13 @@
m = rel_re.match(release)
if m:
release = m.group()
+ elif osname[:4] == "msys":
+ osname = "msys"
+ import re
+ rel_re = re.compile (r'[\d.]+')
+ m = rel_re.match(release)
+ if m:
+ release = m.group()
elif osname[:6] == "darwin":
import _osx_support
osname, release, machine = _osx_support.get_platform_osx(
diff -Naur Python-3.8.2-orig/Modules/makesetup Python-3.8.2/Modules/makesetup
--- Python-3.8.2-orig/Modules/makesetup 2020-02-25 00:36:25.000000000 +0300
+++ Python-3.8.2/Modules/makesetup 2020-04-16 11:24:20.926282900 +0300
@@ -88,7 +88,7 @@
# Setup to link with extra libraries when making shared extensions.
# Currently, only Cygwin needs this baggage.
case `uname -s` in
-CYGWIN*) if test $libdir = .
+CYGWIN*|MSYS*) if test $libdir = .
then
ExtraLibDir=.
else