Ticket #995: MinGWBuildFix.patch

File MinGWBuildFix.patch, 7.2 KB (added by MattArsenault, 13 years ago)

Updated build fix patch

  • api/Makefile.mingw

     
    1 BOINCDIR = ..
    2 DEBUG = -D__DEBUG__ -g3
    3 OBJ  = boinc_api.o util.o win_util.o app_ipc.o diagnostics.o diagnostics_win.o filesys.o hostinfo.o md5.o md5_file.o mem_usage.o mfile.o miofile.o parse.o prefs.o proxy_info.o str_util.o shmem.o stackwalker_win.o base64.o url.o coproc.o
    4 LINKOBJ  = $(OBJ)
    5 LDFLAGS = -lwinmm -march=i386
    6 INCS = -I"$(BOINCDIR)" -I"$(BOINCDIR)/db" -I"$(BOINCDIR)" -I"$(BOINCDIR)/lib" -I"$(BOINCDIR)/api"
    7 CXXINCS = $(INCS)
    8 BIN  = libboinc.a
    9 #
    10 CXXFLAGS = $(CXXINCS) $(DEBUG) --include $(BOINCDIR)/version.h -DWIN32 -D_WIN32 -D_WIN32_WINDOWS=0x0501 -D_MT -DNDEBUG -D_WINDOWS  -DBOINC -DCLIENT -DNODB -D_CONSOLE -Wall -mtune=pentium-m   -fexceptions -march=i386 -O1
    11 CFLAGS = $(INCS) $(DEBUG) --include $(BOINCDIR)/version.h -DWIN32 -D_WIN32 -D_WIN32_WINDOWS=0x0501 -D_MT -DNDEBUG -D_WINDOWS  -DBOINC -DCLIENT -DNODB -D_CONSOLE -Wall -mtune=pentium-m   -fexceptions -march=i386 -O1
    12 
    13 
    14 .PHONY: all all-before all-after clean clean-custom
    15 
    16 all: all-before $(BIN) all-after
    17 
    18 
    19 clean: clean-custom
    20         ${RM} $(OBJ) $(BIN)
    21 
    22 $(BIN): $(LINKOBJ)
    23         $(AR) rc $@ $(LINKOBJ)
    24         ranlib $@
    25 
    26 %.o: $(BOINCDIR)/api/%.cpp
    27         $(CXX) -c $< -o $@ $(CXXFLAGS)
    28 
    29 %.o: $(BOINCDIR)/lib/%.cpp
    30         $(CXX) -c $< -o $@ $(CXXFLAGS)
    31 
    32 md5.o: $(BOINCDIR)/lib/md5.c
    33         $(CXX) -c $(BOINCDIR)/lib/md5.c -o md5.o $(CXXFLAGS)
    34 
    35 stackwalker_win.o: $(BOINCDIR)/lib/stackwalker_win.cpp
    36         $(CXX) -c $(BOINCDIR)/lib/stackwalker_win.cpp -o stackwalker_win.o $(CXXFLAGS)
  • lib/boinc_win.h

     
    243243#define __attribute__(x)
    244244#endif
    245245
    246 #ifdef __MINGW32__
    247 #ifdef __cplusplus
    248 extern "C" {
    249 #endif
    250 void __cdecl _fpreset (void);
    251 void __cdecl fpreset (void);
    252 #if (__GNUC__ < 4) // breaks build on MinGW gcc-4
     246#if defined(__MINGW32__) && (__GNUC__ < 4)
     247// breaks build on MinGW gcc-4
    253248#define SetClassLongPtr SetClassLong
    254249#define GCLP_HICON GCL_HICON
    255250#define GCLP_HICONSM GCL_HICONSM
    256 #endif //GNUC
    257 #ifdef __cplusplus
    258 }
    259 #endif //cplusplus
    260 #endif //MINGW
     251#endif //MINGW32 && GNUC < 4
    261252
    262253// On the Win32 platform include file and line number information for each
    263254//   memory allocation/deallocation
  • lib/Makefile.mingw

     
    11# Makefile for building BOINC with MinGW (gcc and gnumake)
    22
    33# if you want to use install/uninstall targets, set this to the prefix
    4 BOINC_PREFIX ?= /usr/local/boinc
     4BOINC_PREFIX ?= /usr/local
    55
    66# set this for the BOINC sourc directory. This default should work for calling from within lib/ or api/
    77BOINC_SRC ?= ..
    88
    99
    1010# headers to install
    11 HEADERS = $(BOINC_SRC)/version.h $(BOINC_SRC)/api/boinc_api.h $(BOINC_SRC)/api/graphics2.h $(BOINC_SRC)/lib/app_ipc.h \
    12         $(BOINC_SRC)/lib/boinc_win.h $(BOINC_SRC)/lib/url.h $(BOINC_SRC)/lib/common_defs.h $(BOINC_SRC)/lib/diagnostics.h \
    13         $(BOINC_SRC)/lib/diagnostics_win.h $(BOINC_SRC)/lib/filesys.h $(BOINC_SRC)/lib/hostinfo.h $(BOINC_SRC)/lib/proxy_info.h \
    14         $(BOINC_SRC)/lib/prefs.h $(BOINC_SRC)/lib/miofile.h $(BOINC_SRC)/lib/mfile.h $(BOINC_SRC)/lib/parse.h \
    15         $(BOINC_SRC)/lib/util.h $(BOINC_SRC)/lib/coproc.h $(BOINC_SRC)/lib/cal_boinc.h $(BOINC_SRC)/lib/svn_version.h \
    16         $(BOINC_SRC)/win_build/config.h
     11HEADERS = $(BOINC_SRC)/version.h \
     12        $(BOINC_SRC)/api/boinc_api.h \
     13        $(BOINC_SRC)/api/graphics2.h \
     14        $(BOINC_SRC)/lib/app_ipc.h \
     15        $(BOINC_SRC)/lib/boinc_win.h \
     16        $(BOINC_SRC)/lib/url.h \
     17        $(BOINC_SRC)/lib/common_defs.h \
     18        $(BOINC_SRC)/lib/diagnostics.h \
     19        $(BOINC_SRC)/lib/diagnostics_win.h \
     20        $(BOINC_SRC)/lib/filesys.h \
     21        $(BOINC_SRC)/lib/hostinfo.h \
     22        $(BOINC_SRC)/lib/proxy_info.h \
     23        $(BOINC_SRC)/lib/prefs.h \
     24        $(BOINC_SRC)/lib/miofile.h \
     25        $(BOINC_SRC)/lib/mfile.h  \
     26        $(BOINC_SRC)/lib/parse.h \
     27        $(BOINC_SRC)/lib/util.h \
     28        $(BOINC_SRC)/lib/coproc.h \
     29        $(BOINC_SRC)/lib/cal_boinc.h \
     30        $(BOINC_SRC)/lib/cl.h \
     31        $(BOINC_SRC)/lib/cl_platform.h \
     32        $(BOINC_SRC)/lib/svn_version.h \
     33        $(BOINC_SRC)/win_build/config.h \
     34        $(BOINC_SRC)/lib/str_util.h
    1735
    1836ZIP_HEADERS = zip/boinc_zip.h
    1937
     
    4664BIN = $(API_BIN) $(LIB_BIN) $(GPH_BIN)
    4765
    4866# -gstabs is necessary for MinGWs backtrace to work
    49 DEBUG = -D__DEBUG__ -gstabs -g3
     67#DEBUG = -D__DEBUG__ -gstabs -g3
     68DEBUG = -DNDEBUG
    5069
    5170# where to find headers
    5271INCS = -I"$(BOINC_SRC)" -I"$(BOINC_SRC)/db" -I"$(BOINC_SRC)/lib" -I"$(BOINC_SRC)/api" -I"$(BOINC_SRC)/zip" -I"$(BOINC_SRC)/win_build"
    5372
    5473
     74OPTFLAGS = -O3
    5575# various cpp & gcc flags (for both C and C++ mode)
    5676# set NOCYGWIN=-mno-cygwin to build non-Cywin Windows libs under Cygwin
    5777# -D_WIN32_WINDOWS=0x0410 sets to use Win98 API
     78WINVERFLAGS = -D_WINDOWS -D_WIN32 -DWIN32 -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_MT
     79HAVEFLAGS = -DHAVE_STRCASECMP
    5880CCXXFLAGS = $(INCS) $(DEBUG) --include $(BOINC_SRC)/version.h -DEINSTEINATHOME_CROSS_BUILD -DMINGW_WIN32 \
    59         -DHAVE_STRCASECMP -DWIN32 -D_WIN32 -D_WIN32_WINDOWS=0x0410 -D_MT -DNDEBUG -D_WINDOWS -DBOINC \
    60         -DNODB -D_CONSOLE -mtune=pentium-m -fexceptions -march=i386 -O2 $(NOCYGWIN)
     81        $(HAVEFLAGS) $(WINVERFLAGS) -DBOINC \
     82        -DNODB -D_CONSOLE -fexceptions $(OPTFLAGS) $(NOCYGWIN)
    6183
    6284# flags for compiling boinc_zip
    63 ZIP_FLAGS = -DWIN32 -DNDEBUG -D_LIB -D_MBCS -DNO_MKTEMP $(INCS) -O2 -DDLL $(NOCYGWIN)
     85ZIP_FLAGS = -DWIN32 -D_LIB -D_MBCS -DNO_MKTEMP $(INCS) -O2 -DDLL $(NOCYGWIN)
    6486
    65 LDFLAGS = -lwinmm -march=i386
     87# LDFLAGS = -lwinmm
    6688
    6789CFLAGS = $(CCXXFLAGS)
    6890CXXFLAGS = $(CCXXFLAGS)
     
    120142# additional targets
    121143
    122144install: $(BIN) $(HEADERS)
    123         mkdir -p $(BOINC_PREFIX)/include/BOINC $(BOINC_PREFIX)/include/boinc $(BOINC_PREFIX)/lib
    124         cp $(HEADERS) $(BOINC_PREFIX)/include/BOINC
     145        mkdir -p $(BOINC_PREFIX)/include/boinc $(BOINC_PREFIX)/lib
    125146        cp $(HEADERS) $(BOINC_PREFIX)/include/boinc
    126147        $(RANLIB) $(BIN)
    127148        cp $(BIN) $(BOINC_PREFIX)/lib
    128149
    129150install-zip: $(ZIP_BIN) $(ZIP_HEADERS)
    130         mkdir -p $(BOINC_PREFIX)/include/BOINC $(BOINC_PREFIX)/lib
    131         cp $(ZIP_HEADERS) $(BOINC_PREFIX)/include/BOINC
     151        mkdir -p $(BOINC_PREFIX)/include/ $(BOINC_PREFIX)/lib
     152        cp $(ZIP_HEADERS) $(BOINC_PREFIX)/include/
    132153        $(RANLIB) $(ZIP_BIN)
    133154        cp $(ZIP_BIN) $(BOINC_PREFIX)/lib
    134155
    135 uninstall:
    136         rm -f $(BOINC_PREFIX)/include/BOINC/*.h
    137         rmdir -p $(BOINC_PREFIX)/include/BOINC
    138         rm -f $(BOINC_PREFIX)/include/boinc/*.h
    139         rmdir -p $(BOINC_PREFIX)/include/boinc
     156uninstall:
     157        ${RM} -rf $(BOINC_PREFIX)/include/boinc
     158        ${RM} $(BOINC_PREFIX)/lib/libboinc.a $(BOINC_PREFIX)/lib/libboinc_api.a $(BOINC_PREFIX)/lib/libboinc_graphics2.a
    140159        ( cd $(BOINC_PREFIX)/lib && rm -f $(BIN) || exit 0 )
    141160
    142161clean:
  • lib/stackwalker_imports.h

     
    2121#define gle (GetLastError())
    2222#define TTBUFLEN                8096 // for a temp buffer (2^13)
    2323
    24 #if defined(__MINGW32__) || defined(__CYGWIN32__)
     24#if (defined(__CYGWIN32__) || defined(__MINGW32__)) && !defined(__MINGW64__)
    2525
    2626#define MAX_SYM_NAME            2000
    2727