commit abc3f9b55fe418f5f6615ac075c2f9f5222b0712
Author: dprunier <dominique.prunier@watch4net.com>
Date:   Tue Jan 17 16:11:28 2012

    Few fixes to cross compile Windows FastBit using MinGW64 (GCC 4.5.3).

diff --git a/src/part.cpp b/src/part.cpp
index 87edc6f..60257a9 100755
--- a/src/part.cpp
+++ b/src/part.cpp
@@ -5864,7 +5864,7 @@ int ibis::part::buildIndexes(const char* iopt, int nthr) {
 	    if (j != 0) {
 		logWarning("buildIndexes", "thread # %i returned a "
 			   "nonzero code %ld", i,
-			   reinterpret_cast<long int>(j));
+			   reinterpret_cast<intptr_t>(j));
 	    }
 	}
 	++ nthr; // restore the original value
@@ -6235,7 +6235,7 @@ long ibis::part::selfTest(int nth, const char* pref) const {
 		if (j != 0)
 		    logWarning("selfTest", "thread # %d returned "
 			       "a nonzero code %ld", i,
-			       reinterpret_cast<long int>(j));
+			       reinterpret_cast<intptr_t>(j));
 	    }
 
 	    if (nerr == 0 && columns.size() > 1) {
@@ -6261,8 +6261,8 @@ long ibis::part::selfTest(int nth, const char* pref) const {
 				   i, strerror(ierr));
 		    }
 		}
-		ierr = (long) ibis_part_threadedTestFun2((void*)&arg);
-		if (ierr != 0)
+		intptr_t pterr = (intptr_t) ibis_part_threadedTestFun2((void*)&arg);
+		if (pterr != 0)
 		    ++ nerr;
 		for (int i = 0; i < nth; ++ i) {
 		    void *j;
@@ -6270,7 +6270,7 @@ long ibis::part::selfTest(int nth, const char* pref) const {
 		    if (j != 0)
 			logWarning("selfTest", "thread # %d returned "
 				   "a nonzero code %ld", i,
-				   reinterpret_cast<long int>(j));
+				   reinterpret_cast<intptr_t>(j));
 		}
 		checkQueryList(arg);
 	    }
diff --git a/win/MinGW.mak b/win/MinGW.mak
index f270893..5ba397a 100755
--- a/win/MinGW.mak
+++ b/win/MinGW.mak
@@ -1,12 +1,17 @@
 # $Id$
 # Makefile for mingw32-make on windows using MinGW g++ port
 #
-CXX=g++.exe
+CHOST=x86_64-w64-mingw32
+CXX=$(CHOST)-g++
+AR=$(CHOST)-ar
+DLLTOOL=$(CHOST)-dlltool
+RANLIB=$(CHOST)-ranlib
+MAKE=make
 OPT=-g -O0
 #OPT=-O5
-INC=-I "C:/MinGW/include" -I "C:/MinGW/msys/1.0/include" -I . -I ../src -I "pthreads-w32-2-8-0-release"
+INC=-I . -I ../src -I pthreads/$(CHOST)/include
 DEF=-DFASTBIT_MAX_WAIT_TIME=3 -DWITHOUT_FASTBIT_CONFIG_H
-LIB=-Lpthreads-w32-2-8-0-release -lpthreadGC2 -lm
+LIB=-Lpthreads/$(CHOST)/lib -lpthread -lm
 TESTDIR=tmp
 
 CCFLAGS=$(DEF) $(INC) $(OPT)
@@ -88,7 +93,8 @@ ARDEAEXE=./ardea.exe
 
 lib: libfastbit.a
 libfastbit.a: $(OBJ)
-	ar ruv libfastbit.a $(OBJ)
+	$(AR) ruv libfastbit.a $(OBJ)
+	$(RANLIB) libfastbit.a
 
 ibis: ibis.exe
 ibis.exe: ibis.o libfastbit.a
@@ -109,10 +115,10 @@ ardea.exe: ardea.o libfastbit.a
 dll: fastbit.dll
 fastbit.a: fastbit.dll
 fastbit.dll: $(FRC)
-	make -f MinGW.mak DEF="$(DEF) -DCXX_USE_DLL -DDLL_EXPORT" $(OBJ)
+	$(MAKE) -f MinGW.mak DEF="$(DEF) -DCXX_USE_DLL -DDLL_EXPORT" $(OBJ)
 	$(CXX) -shared -o $@ $(OBJ) $(LIB)
-	dlltool -z fastbit.def $(OBJ)
-	dlltool -k --dllname fastbit.dll --output-lib fastbit.a --def fastbit.def
+	$(DLLTOOL) -z fastbit.def $(OBJ)
+	$(DLLTOOL) -k --dllname fastbit.dll --output-lib fastbit.a --def fastbit.def
 # -Wl,-soname,$@
 trydll: trydll.cpp fastbit.dll
 	$(CXX) $(INC) $(OPT) -DCXX_USE_DLL -o $@ trydll.cpp fastbit.a $(LIB)
