From 37b143ce9ef761f4f0648bae447617f019fc34e1 Mon Sep 17 00:00:00 2001 From: stijn Date: Mon, 25 Jul 2016 14:45:57 +0200 Subject: [PATCH] mpy-cross: Fix mingw and msys2 compilation When compiling with msys2's gcc there's no need to apply the binary fmode so adjust the Makefile to reflect that. When compiling with mingw we need to include malloc.h since there is no alloca.h, and the 64bit detection in mpconfigport.h needs some adjustment. --- mpy-cross/Makefile | 4 +++- mpy-cross/mpconfigport.h | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/mpy-cross/Makefile b/mpy-cross/Makefile index ecf26ee317..3f99566209 100644 --- a/mpy-cross/Makefile +++ b/mpy-cross/Makefile @@ -50,7 +50,9 @@ SRC_C = \ gccollect.c \ ifeq ($(OS),Windows_NT) -SRC_C += windows/fmode.c + ifeq (,$(findstring MSYS,$(UNAME_S))) + SRC_C += windows/fmode.c + endif endif OBJ = $(PY_O) diff --git a/mpy-cross/mpconfigport.h b/mpy-cross/mpconfigport.h index 031c350116..b3f7d9c3cd 100644 --- a/mpy-cross/mpconfigport.h +++ b/mpy-cross/mpconfigport.h @@ -87,6 +87,10 @@ #ifdef __LP64__ typedef long mp_int_t; // must be pointer size typedef unsigned long mp_uint_t; // must be pointer size +#elif defined ( __MINGW32__ ) && defined( _WIN64 ) +#include +typedef __int64 mp_int_t; +typedef unsigned __int64 mp_uint_t; #else // These are definitions for machines where sizeof(int) == sizeof(void*), // regardless for actual size. @@ -115,6 +119,8 @@ typedef const void *machine_const_ptr_t; // must be of pointer size // We need to provide a declaration/definition of alloca() #ifdef __FreeBSD__ #include +#elif defined( _WIN32 ) +#include #else #include #endif