Files
MINGW-packages/mingw-w64-python3/0400-MINGW-setup-msvcrt-and-_winapi-modules.patch

79 lines
2.7 KiB
Diff

diff -Naur Python-3.7.0-orig/Modules/_winapi.c Python-3.7.0/Modules/_winapi.c
--- Python-3.7.0-orig/Modules/_winapi.c 2018-06-27 06:07:35.000000000 +0300
+++ Python-3.7.0/Modules/_winapi.c 2018-07-12 10:21:21.496753800 +0300
@@ -39,7 +39,9 @@
#define WINDOWS_LEAN_AND_MEAN
#include "windows.h"
+#if defined(Py_DEBUG)
#include <crtdbg.h>
+#endif
#include "winreparse.h"
#if defined(MS_WIN32) && !defined(MS_WIN64)
diff -Naur Python-3.7.0-orig/Modules/main.c Python-3.7.0/Modules/main.c
--- Python-3.7.0-orig/Modules/main.c 2018-06-27 06:07:35.000000000 +0300
+++ Python-3.7.0/Modules/main.c 2018-07-12 10:21:21.496753800 +0300
@@ -18,7 +18,7 @@
# endif
#endif
-#ifdef _MSC_VER
+#if defined(_WIN32) && defined(Py_DEBUG)
# include <crtdbg.h>
#endif
diff -Naur Python-3.7.0-orig/PC/msvcrtmodule.c Python-3.7.0/PC/msvcrtmodule.c
--- Python-3.7.0-orig/PC/msvcrtmodule.c 2018-06-27 06:07:35.000000000 +0300
+++ Python-3.7.0/PC/msvcrtmodule.c 2018-07-12 10:21:21.512353900 +0300
@@ -21,7 +21,9 @@
#include <io.h>
#include <conio.h>
#include <sys/locking.h>
+#ifdef _DEBUG
#include <crtdbg.h>
+#endif
#include <windows.h>
#ifdef _MSC_VER
diff -Naur Python-3.7.0-orig/Python/dynamic_annotations.c Python-3.7.0/Python/dynamic_annotations.c
--- Python-3.7.0-orig/Python/dynamic_annotations.c 2018-06-27 06:07:35.000000000 +0300
+++ Python-3.7.0/Python/dynamic_annotations.c 2018-07-12 10:21:21.465553800 +0300
@@ -27,7 +27,7 @@
* Author: Kostya Serebryany
*/
-#ifdef _MSC_VER
+#ifdef MS_WINDOWS
# include <windows.h>
#endif
diff -Naur Python-3.7.0-orig/setup.py Python-3.7.0/setup.py
--- Python-3.7.0-orig/setup.py 2018-07-12 10:21:21.106753200 +0300
+++ Python-3.7.0/setup.py 2018-07-12 10:21:21.512353900 +0300
@@ -962,6 +962,24 @@
min_db_ver = (3, 3)
db_setup_debug = False # verbose debug prints from this script?
+ # Modules with some Windows dependencies:
+ if host_platform.startswith(('mingw', 'win')):
+ srcdir = sysconfig.get_config_var('srcdir')
+ pc_srcdir = os.path.abspath(os.path.join(srcdir, 'PC'))
+
+ exts.append( Extension('msvcrt', [os.path.join(pc_srcdir, p)
+ for p in ['msvcrtmodule.c']]) )
+
+ exts.append( Extension('_winapi', ['_winapi.c']) )
+
+ exts.append( Extension('_msi', [os.path.join(pc_srcdir, p)
+ for p in ['_msi.c']],
+ libraries=['msi','cabinet','rpcrt4']) ) # To link with lib(msi|cabinet|rpcrt4).a
+
+ exts.append( Extension('winsound', [os.path.join(pc_srcdir, p)
+ for p in ['winsound.c']],
+ libraries=['winmm']) )
+
def allow_db_ver(db_ver):
"""Returns a boolean if the given BerkeleyDB version is acceptable.