From 4bca7987f38b24867d93efc4a11a1ef661734056 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Sat, 20 Feb 2021 13:07:14 +0000 Subject: win32: fixes to build on Windows/MSYS2/mingw-w64 To investigate GitHub issue #200 it was necessary to perform build on Window using the MSYS2/mingw-w64 toolchain. This threw up some issues: - The settings for _WIN32_WINNT and __USE_MINGW_ANSI_STDIO differ from those in Fedora resulting in compiler errors and warnings. Force the defaults I'm used to. - The workaround to allow native compilation of mconf.c was broken by a subsequent upstream change. Make it work again. --- include/libbb.h | 3 --- include/platform.h | 5 +++++ scripts/kconfig/mconf.c | 2 ++ win32/poll.c | 4 +--- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/libbb.h b/include/libbb.h index c4734e86d..5e1d1fc5b 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -144,9 +144,6 @@ #elif defined __APPLE__ # include #elif ENABLE_PLATFORM_MINGW32 -# ifndef WINVER -# define WINVER 0x0501 -# endif # include # include #else diff --git a/include/platform.h b/include/platform.h index ea97d2682..0fc270fab 100644 --- a/include/platform.h +++ b/include/platform.h @@ -10,6 +10,11 @@ #if ENABLE_PLATFORM_MINGW32 # if !defined(__MINGW32__) /* HOSTCC is called */ # undef ENABLE_PLATFORM_MINGW32 +# else +# undef __USE_MINGW_ANSI_STDIO +# define __USE_MINGW_ANSI_STDIO 0 +# undef _WIN32_WINNT +# define _WIN32_WINNT 0x502 # endif #else # if defined(__MINGW32__) diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index cda0473ac..d945f2cd5 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c @@ -31,9 +31,11 @@ #include #include +#ifndef __MINGW32__ #ifndef SIGWINCH #define SIGWINCH 28 #endif +#endif #define LKC_DIRECT_LINK #include "lkc.h" diff --git a/win32/poll.c b/win32/poll.c index 3294fdc96..8f16d93e9 100644 --- a/win32/poll.c +++ b/win32/poll.c @@ -23,6 +23,7 @@ # pragma GCC diagnostic ignored "-Wtype-limits" #endif +#include "libbb.h" #include #include @@ -37,9 +38,6 @@ #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ # define WINDOWS_NATIVE # define WIN32_NATIVE -# if defined (_MSC_VER) -# define _WIN32_WINNT 0x0502 -# endif # include # include # include -- cgit v1.2.3-55-g6feb