# HG changeset patch # User Matti Hamalainen # Date 1339028199 -10800 # Node ID 52c56ada381623e40053ee92f55332f493430098 # Parent cfab338d3c9e959a360316c13775c6f3c3080674 Fix Win32/MinGW cross-compilation target to work with Debian's gcc-mingw-w64 package, thus upgrading to a new version of MinGW and GCC. Yay. diff -r cfab338d3c9e -r 52c56ada3816 Makefile --- a/Makefile Wed Jun 06 18:55:17 2012 +0300 +++ b/Makefile Thu Jun 07 03:16:39 2012 +0300 @@ -5,6 +5,9 @@ # C-compiler, flags and linker flags CC=gcc +AR=ar +RANLIB=ranlib + CFLAGS=-DHAVE_STRING_H -DHAVE_STDINT_H LDFLAGS=-lncurses diff -r cfab338d3c9e -r 52c56ada3816 Makefile.gen --- a/Makefile.gen Wed Jun 06 18:55:17 2012 +0300 +++ b/Makefile.gen Thu Jun 07 03:16:39 2012 +0300 @@ -39,6 +39,7 @@ $(THLIBS_A): $(addprefix $(OBJPATH),$(THLIBS_OBJ)) $(AR) cru $@ $+ + $(RANLIB) $@ main.c: VERSION diff -r cfab338d3c9e -r 52c56ada3816 Makefile.w32 --- a/Makefile.w32 Wed Jun 06 18:55:17 2012 +0300 +++ b/Makefile.w32 Thu Jun 07 03:16:39 2012 +0300 @@ -1,30 +1,19 @@ # # For win32 version cross-compilation with MinGW suite @ Linux # -SDL=y - -# Set PATH to include MinGW cross compiler path FIRST! -PATH=/usr/local/i386-mingw32/bin:/usr/bin:/bin:/usr/local/bin # C-compiler, flags and linker flags -CC=gcc -CFLAGS=-DHAVE_STRING_H -Ipdcurses -mwindows - -# Library path must be defined correctly here -LDFLAGS=-L/usr/local/i386-mingw32/lib/ -liberty -lws2_32 -lole32 -s -mwindows +CC=i686-w64-mingw32-gcc +AR=i686-w64-mingw32-ar +RANLIB=i686-w64-mingw32-ranlib -# Link PDCurses static library here .. you will want to change this -ifeq ($(SDL),y) -LDFLAGS+=pdcurses/libpdcurses-sdl.a -lSDL -else -LDFLAGS+=pdcurses/libpdcurses.a -endif +CFLAGS=-DHAVE_STRING_H -Ipdcurses -mwindows +LDFLAGS= -lws2_32 -lole32 -mwindows pdcurses/libpdcurses.a -lSDL -s # Miscellaneous EXEEXT=.exe OBJPATH=./win32/ BINPATH=./installer/ -#BINPATH=/misc/wine_c/ NONBUILD=$(OBJPATH) EXTRAOBJS= resource.o diff -r cfab338d3c9e -r 52c56ada3816 main.c --- a/main.c Wed Jun 06 18:55:17 2012 +0300 +++ b/main.c Thu Jun 07 03:16:39 2012 +0300 @@ -12,6 +12,9 @@ #include #ifdef __WIN32 #include +#include +#define srandom srand +#define random rand #else #include #endif diff -r cfab338d3c9e -r 52c56ada3816 network.h --- a/network.h Wed Jun 06 18:55:17 2012 +0300 +++ b/network.h Thu Jun 07 03:16:39 2012 +0300 @@ -12,6 +12,7 @@ #include "th_string.h" #ifdef __WIN32 +#define __OBJC__ // A nasty hack #include #include typedef uint16_t in_port_t;