summarylogtreecommitdiffstats
path: root/0005-MINGW-configure-MACHDEP-and-platform-for-build.patch
blob: 1d90fd3be10624985171a567ac30b1f6a2b88bfc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
From fa68425708485de2cea225d6c3ff58bff6965ab5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9?=
 <alexey.pawlow@gmail.com>
Date: Thu, 17 Jun 2021 18:51:14 +0530
Subject: [PATCH 005/N] MINGW configure MACHDEP and platform for build
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Co-authored-by: Алексей <alexey.pawlow@gmail.com>
---
 Python/getplatform.c |  6 ++++++
 configure.ac         | 22 ++++++++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/Python/getplatform.c b/Python/getplatform.c
index 81a0f7a..636b0a8 100644
--- a/Python/getplatform.c
+++ b/Python/getplatform.c
@@ -1,6 +1,12 @@
 
 #include "Python.h"
 
+#ifdef __MINGW32__
+#  undef PLATFORM
+/* see PC/pyconfig.h */
+#  define PLATFORM "win32"
+#endif
+
 #ifndef PLATFORM
 #define PLATFORM "unknown"
 #endif
diff --git a/configure.ac b/configure.ac
index 005fc8f..ecdf22d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -383,6 +383,17 @@ AC_DEFINE_UNQUOTED(_PYTHONFRAMEWORK, "${PYTHONFRAMEWORK}", [framework name])
 # Set name for machine-dependent library files
 AC_ARG_VAR([MACHDEP], [name for machine-dependent library files])
 AC_MSG_CHECKING(MACHDEP)
+case $host in
+  *-*-mingw*)
+    # On those hosts MACHDEP is 'win', as platform specific files
+    # go in plat-$(MACHDEP), but runtime platform is 'win32'
+    test -z "$MACHDEP" && MACHDEP=win
+
+    dnl Configuration will be based only on "host triplet" as build
+    dnl must not depend from posix compatible environement.
+    ac_sys_system=ignore
+    ;;
+esac
 if test -z "$MACHDEP"
 then
     # avoid using uname for cross builds
@@ -452,12 +463,23 @@ if test "$cross_compiling" = yes; then
 	*-*-vxworks*)
 		_host_cpu=$host_cpu
 		;;
+	*-*-mingw*)
+		_host_cpu=
+		;;
 	*)
 		# for now, limit cross builds to known configurations
 		MACHDEP="unknown"
 		AC_MSG_ERROR([cross build not supported for $host])
 	esac
 	_PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}"
+
+	case "$host_os" in
+	mingw*)
+	# As sys.platform() return 'win32' to build python and extantions
+	# we will use 'mingw' (in setup.py and etc.)
+	_PYTHON_HOST_PLATFORM=mingw
+	;;
+	esac
 fi
 
 # Some systems cannot stand _XOPEN_SOURCE being defined at all; they
-- 
2.32.0