# HG changeset patch # User =?UTF-8?q?Higor=20Eur=C3=ADpedes?= # Date 1437933581 25200 # Node ID bce97fc0bb8aa7277af062f71ab2fc05a8389fd1 # Parent e8b14d5a5b5a53b7b364f09d967e9126e4c291eb Fix mingw-w64 build and cross-compilation diff -r e8b14d5a5b5a -r bce97fc0bb8a Makefile --- a/Makefile Sat Jul 25 02:54:00 2015 -0700 +++ b/Makefile Sun Jul 26 10:59:41 2015 -0700 @@ -3,12 +3,18 @@ endif ifeq ($(OS),Windows) +ifndef SDL2_PREFIX +SDL2_PREFIX:="C:/MinGW/usr" +endif +ifndef GLEW32S_LIB +GLEW32S_LIB=glew32s.lib +endif MEM:=mem_win.o BLASTEM:=blastem.exe CC:=wine gcc.exe -CFLAGS:=-O2 -std=gnu99 -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration -I"C:/MinGW/usr/include/SDL2" -DGLEW_STATIC -LDFLAGS:= -L"C:/MinGW/usr/lib" -lm -lmingw32 -lSDL2main -lSDL2 -lopengl32 -lglu32 -mwindows +CFLAGS:=-O2 -std=gnu99 -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration -I"$(SDL2_PREFIX)/include/SDL2" -DGLEW_STATIC +LDFLAGS:= $(GLEW32S_LIB) -L"$(SDL2_PREFIX)/lib" -lm -lmingw32 -lSDL2main -lSDL2 -lopengl32 -lglu32 -mwindows CPU:=i686 else @@ -117,11 +123,7 @@ MAINOBJS+= $(Z80OBJS) endif -ifeq ($(OS),Windows) -MAINOBJS+= glew32s.lib -endif - -all : dis zdis stateview vgmplay blastem +all : dis zdis stateview vgmplay $(BLASTEM) $(BLASTEM) : $(MAINOBJS) $(CC) -o $(BLASTEM) $(MAINOBJS) $(LDFLAGS) diff -r e8b14d5a5b5a -r bce97fc0bb8a config.c --- a/config.c Sat Jul 25 02:54:00 2015 -0700 +++ b/config.c Sun Jul 26 10:59:41 2015 -0700 @@ -9,7 +9,13 @@ #include #include -#ifdef _WIN32 +#ifdef __MINGW64_VERSION_MAJOR +#define MINGW_W64_VERSION (__MINGW64_VERSION_MAJOR * 1000 + __MINGW64_VERSION_MINOR) +#else +#define MINGW_W64_VERSION 0 +#endif + +#if defined(_WIN32) && (MINGW_W64_VERSION < 3003) char * strtok_r(char * input, char * sep, char ** state) { if (input) { diff -r e8b14d5a5b5a -r bce97fc0bb8a mem_win.c --- a/mem_win.c Sat Jul 25 02:54:00 2015 -0700 +++ b/mem_win.c Sun Jul 26 10:59:41 2015 -0700 @@ -5,7 +5,7 @@ */ #include "mem.h" -#include +#include void * alloc_code(size_t *size) { diff -r e8b14d5a5b5a -r bce97fc0bb8a util.c --- a/util.c Sat Jul 25 02:54:00 2015 -0700 +++ b/util.c Sun Jul 26 10:59:41 2015 -0700 @@ -87,8 +87,8 @@ } #ifdef _WIN32 -#include "Shlobj.h" -#include "Windows.h" +#include +#include char * get_home_dir() {