]> sigrok.org Git - sigrok-util.git/blob - cross-compile/mingw/pyconfig.patch
sigrok-cross-mingw: Also build PV manual
[sigrok-util.git] / cross-compile / mingw / pyconfig.patch
1 Fix for bug #1195.
2
3 Patch taken from the MSYS2 MINGW-packages repo, filename
4 0110-MINGW-translate-gcc-internal-defines-to-python-platf.patch,
5 but applied to pyconfig.h instead of pyport.h.
6
7 Without this, Py_ssize_t ends up being 4 on 64bit Windows (where it
8 should be 8) and all kinds of weird issues happen as a result,
9 including 4GB allocations for no apparent reason, and none of the
10 protocol decoders working (at all).
11
12 The respective Py_ssize_t related code is in pyport.h.
13
14 --- pyconfig.h.orig     2018-09-29 18:06:33.625204450 +0200
15 +++ pyconfig.h  2018-09-29 18:34:09.165488139 +0200
16 @@ -1,6 +1,21 @@
17  #ifndef Py_CONFIG_H\r
18  #define Py_CONFIG_H\r
19  \r
20 +#ifdef __MINGW32__\r
21 +/* Translate GCC[mingw*] platform specific defines to those\r
22 + * used in python code.\r
23 + */\r
24 +#if !defined(MS_WIN64) && defined(_WIN64)\r
25 +#  define MS_WIN64\r
26 +#endif\r
27 +#if !defined(MS_WIN32) && defined(_WIN32)\r
28 +#  define MS_WIN32\r
29 +#endif\r
30 +#if !defined(MS_WINDOWS) && defined(MS_WIN32)\r
31 +#  define MS_WINDOWS\r
32 +#endif\r
33 +#endif /* __MINGW32__*/\r
34 +\r
35  /* pyconfig.h.  NOT Generated automatically by configure.\r
36  \r
37  This is a manually maintained version used for the Watcom,\r