diff --git a/build.sh b/build.sh
index 5143a65b15ee1cf2764a42179e0bd585e95e763e..66d97de54ed562a533b095a1d4b17d8c56c1f3c9 100755
--- a/build.sh
+++ b/build.sh
@@ -27,6 +27,8 @@
 ### globals ###############################################################
 
 ROOT=`pwd`
+PATH_ORG="$PATH"
+PATH_MINGW="$PATH"
 LOGFILE=$ROOT/build.log
 TARGET=0
 
@@ -126,8 +128,8 @@ prepare_generic()
 		svn checkout http://svn.libsdl.org/branches/SDL-1.2 . >> $LOGFILE 2>&1 || failure
 	fi
 
-# 	cd $ROOT/3rdparty || failure
 # 	echo "Retrieving SDL (this may take a while)..." | tee -a $LOGFILE
+# 	cd $ROOT/3rdparty || failure
 # 	wget http://www.libsdl.org/release/SDL-1.2.14.tar.gz >> $LOGFILE 2>&1 || failure
 # 	tar -xzf SDL-1.2.14.tar.gz >> $LOGFILE 2>&1 || failure
 # 	rm SDL-1.2.14.tar.gz >> $LOGFILE 2>&1 || failure
@@ -135,8 +137,8 @@ prepare_generic()
 # 	rm -rf sdl >> $LOGFILE 2>&1 || failure
 # 	mv SDL-1.2.14 sdl >> $LOGFILE 2>&1 || failure
 	
-	cd $ROOT/3rdparty || failure
 	echo "Retrieving Freetype2 (this may take a while)..." | tee -a $LOGFILE
+	cd $ROOT/3rdparty || failure
 	wget http://mesh.dl.sourceforge.net/sourceforge/freetype/freetype-2.3.5.tar.bz2 >> $LOGFILE 2>&1 || failure
 	tar -xjf freetype-2.3.5.tar.bz2 >> $LOGFILE 2>&1 || failure
 	rm freetype-2.3.5.tar.bz2 >> $LOGFILE 2>&1 || failure
@@ -187,8 +189,8 @@ prepare_win32()
 		cvs -z3 -d:pserver:anonymous@mingw.cvs.sourceforge.net:/cvsroot/mingw checkout -P xscripts >> $LOGFILE 2>&1 || failure
 	fi
 	
-	cd $ROOT/3rdparty/mingw/xscripts || failure
 	echo "Preparing MinGW build script..." | tee -a $LOGFILE
+	cd $ROOT/3rdparty/mingw/xscripts || failure
 	# note: svn has no force/overwrite switch. the file might not be updated when patched
 	patch x86-mingw32-build.sh.conf < $ROOT/patches/x86-mingw32-build.sh.conf.patch >> $LOGFILE || failure
 	chmod +x x86-mingw32-build.sh >> $LOGFILE || failure
@@ -199,8 +201,8 @@ prepare_win32()
 
 build_generic()
 {
-	cd $ROOT/3rdparty/sdl || failure
 	echo "Building SDL (this may take a while)..." | tee -a $LOGFILE
+	cd $ROOT/3rdparty/sdl || failure
 	./autogen.sh >> $LOGFILE 2>&1 || failure
 	cd $ROOT/build/sdl || failure
 	$ROOT/3rdparty/sdl/configure --prefix=$ROOT/install --enable-shared=no --enable-static=yes >> $LOGFILE 2>&1 || failure
@@ -208,8 +210,8 @@ build_generic()
 	make install >> $LOGFILE 2>&1 || failure
 	echo "Successfully built and installed SDL!" | tee -a $LOGFILE
 
-	cd $ROOT/3rdparty/freetype2 || failure
 	echo "Building Freetype2 (this may take a while)..." | tee -a $LOGFILE
+	cd $ROOT/3rdparty/freetype2 || failure
 	chmod +x autogen.sh >> $LOGFILE 2>&1 || failure
 	chmod +x configure >> $LOGFILE 2>&1 || failure
 	./autogen.sh >> $LOGFILE 2>&1 || failure
@@ -220,8 +222,8 @@ build_generic()
 	make install >> $LOGFILE 2>&1 || failure
 	echo "Successfully built and installed Freetype2!" | tee -a $LOGFILE
 
-	cd $ROOT/3rdparty/oglft || failure
 	echo "Patching OGLFT..." | tee -a $LOGFILE
+	cd $ROOT/3rdparty/oglft || failure
 	# note: svn has no force/overwrite switch. patched files might not be updated
 	# patch: use fixed settings for freetype, deactivate FindFreetype
 	FREETYPE2_INCLUDE_DIR="$ROOT/install/include"
@@ -240,8 +242,8 @@ build_generic()
 	cp liboglft/liboglft.a $ROOT/install/lib >> $LOGFILE 2>&1 || failure
 	echo "Successfully built and installed OGLFT!" | tee -a $LOGFILE
 
-	cd $ROOT/3rdparty/boinc || failure
 	echo "Building BOINC (this may take a while)..." | tee -a $LOGFILE
+	cd $ROOT/3rdparty/boinc || failure
 	./_autosetup >> $LOGFILE 2>&1 || failure
 	cd $ROOT/build/boinc || failure
 	$ROOT/3rdparty/boinc/configure --prefix=$ROOT/install --enable-shared=no --enable-static=yes --disable-server --disable-client >> $LOGFILE 2>&1 || failure
@@ -253,9 +255,122 @@ build_generic()
 }
 
 
+build_generic_win32()
+{
+	# general config
+	PREFIX=$ROOT/install
+	TARGET_HOST=i586-pc-mingw32
+	BUILD_HOST=i386-linux
+	PATH_MINGW="$PREFIX/bin:$PREFIX/$TARGET_HOST/bin:$PATH"
+	PATH="$PATH_MINGW"
+	export PATH
+
+	echo "Building SDL (this may take a while)..." | tee -a $LOGFILE
+	cd $ROOT/3rdparty/sdl || failure
+	./autogen.sh >> $LOGFILE 2>&1 || failure
+	if [ -f "$PREFIX/$TARGET_HOST/bin/$TARGET_HOST-sdl-config" ]; then
+		SDL_CONFIG="$PREFIX/$TARGET_HOST/bin/$TARGET_HOST-sdl-config"
+		export SDL_CONFIG
+		echo "Cross-compile SDL_CONFIG: $SDL_CONFIG" >> $LOGFILE
+	fi
+	cd $ROOT/build/sdl || failure
+	$ROOT/3rdparty/sdl/configure --host=$TARGET_HOST --build=$BUILD_HOST --prefix=$PREFIX --enable-shared=no --enable-static=yes >> $LOGFILE 2>&1 || failure
+	make >> $LOGFILE 2>&1 || failure
+	make install >> $LOGFILE 2>&1 || failure
+	echo "Successfully built and installed SDL!" | tee -a $LOGFILE
+
+	echo "Patching Freetype2..." | tee -a $LOGFILE
+	cd $ROOT/3rdparty/freetype2/builds || failure
+	# patch: deactivating invocation of apinames (would run win32 binary on linux host)
+	patch < $ROOT/patches/freetype2.exports.mk.patch >> $LOGFILE 2>&1 || failure
+	echo "Building Freetype2 (this may take a while)..." | tee -a $LOGFILE
+	cd $ROOT/3rdparty/freetype2 || failure
+	chmod +x autogen.sh >> $LOGFILE 2>&1 || failure
+	chmod +x configure >> $LOGFILE 2>&1 || failure
+	./autogen.sh >> $LOGFILE 2>&1 || failure
+	if [ -f "$PREFIX/$TARGET_HOST/bin/$TARGET_HOST-freetype-config" ]; then
+		FT_CONFIG="$PREFIX/$TARGET_HOST/bin/$TARGET_HOST-freetype-config"
+		export FT_CONFIG
+		echo "Cross-compile FT_CONFIG: $FT_CONFIG" >> $LOGFILE
+	fi
+	cd $ROOT/build/freetype2 || failure
+	# note: freetype (or sdl?) probably doesn't need *no* configure when static -> ansi build, see readme!
+	$ROOT/3rdparty/freetype2/configure --host=$TARGET_HOST --build=$BUILD_HOST --prefix=$PREFIX --enable-shared=no --enable-static=yes >> $LOGFILE 2>&1 || failure
+	make >> $LOGFILE 2>&1 || failure
+	make install >> $LOGFILE 2>&1 || failure
+	echo "Successfully built and installed Freetype2!" | tee -a $LOGFILE
+
+	echo "Patching OGLFT..." | tee -a $LOGFILE
+	cd $ROOT/3rdparty/oglft || failure
+	# note: svn has no force/overwrite switch. patched files might not be updated
+	# patch: use fixed settings for freetype, deactivate FindFreetype
+	FREETYPE2_INCLUDE_DIR="$ROOT/install/include"
+	FREETYPE2_LIBRARIES="$ROOT/install/lib/libfreetype.a"
+	patch CMakeLists.txt < $ROOT/patches/CMakeLists.txt.oglft.patch >> $LOGFILE 2>&1 || failure
+	# patch: build static lib instead of shared
+	cd $ROOT/3rdparty/oglft/liboglft || failure
+	patch CMakeLists.txt < $ROOT/patches/CMakeLists.txt.liboglft.patch >> $LOGFILE 2>&1 || failure
+	## patch: include windows.h for all WIN32 builds (not only MSVC) -> already submitted upstream!!!!
+	#patch OGLFT.h.cmake < $ROOT/patches/OGLFT.h.cmake.patch >> $LOGFILE 2>&1 || failure
+	cp $ROOT/patches/toolchain-linux-mingw.oglft.cmake $ROOT/build/oglft >> $LOGFILE 2>&1 || failure
+	export OGLFT_INSTALL=$ROOT/install
+	echo "Building OGLFT..." | tee -a $LOGFILE
+	cd $ROOT/build/oglft || failure
+	cmake -DCMAKE_TOOLCHAIN_FILE="toolchain-linux-mingw.oglft.cmake" -DFREETYPE2_INCLUDE_DIR="$FREETYPE2_INCLUDE_DIR" -DFREETYPE2_LIBRARIES="$FREETYPE2_LIBRARIES" $ROOT/3rdparty/oglft >> $LOGFILE 2>&1 || failure
+	make >> $LOGFILE 2>&1 || failure
+	mkdir -p $ROOT/install/include/oglft >> $LOGFILE 2>&1 || failure
+	cp OGLFT.h $ROOT/install/include/oglft >> $LOGFILE 2>&1 || failure
+	cp liboglft/liboglft.a $ROOT/install/lib >> $LOGFILE 2>&1 || failure
+	echo "Successfully built and installed OGLFT!" | tee -a $LOGFILE
+
+	echo "Patching BOINC..." | tee -a $LOGFILE
+	cd $ROOT/3rdparty/boinc/lib || failure
+	# patch: fix a couple of BOINC vs. MinGW issues
+	patch boinc_win.h < $ROOT/patches/boinc.boinc_win.h.minggw.patch >> $LOGFILE 2>&1 || failure
+	patch stackwalker_win.cpp < $ROOT/patches/boinc.stackwalker_win.cpp.minggw.patch >> $LOGFILE 2>&1 || failure
+	patch filesys.C < $ROOT/patches/boinc.filesys.C.mingw.patch >> $LOGFILE 2>&1 || failure
+	# patch: add graphics2 and customize build path (see below)
+	echo "Building BOINC (this may take a while)..." | tee -a $LOGFILE
+	cd $ROOT/3rdparty/boinc || failure
+	./_autosetup >> $LOGFILE 2>&1 || failure
+	cd $ROOT/build/boinc || failure
+	$ROOT/3rdparty/boinc/configure --host=$TARGET_HOST --build=$BUILD_HOST --prefix=$ROOT/install --includedir=$ROOT/install/include --oldincludedir=$ROOT/install/include --enable-shared=no --enable-static=yes --disable-server --disable-client >> $LOGFILE 2>&1 || failure
+# # 	make >> $LOGFILE 2>&1 || failure
+	cd $ROOT/build/boinc/api || failure
+	cp $ROOT/3rdparty/boinc/api/Makefile.mingw . >> $LOGFILE 2>&1 || failure
+	patch Makefile.mingw < $ROOT/patches/boinc.Makefile.mingw.patch >> $LOGFILE 2>&1 || failure
+	export BOINC_SRC=$ROOT/3rdparty/boinc || failure
+	cd $ROOT/build/boinc || failure
+	make -f api/Makefile.mingw >> $LOGFILE 2>&1 || failure
+# 	make install >> $LOGFILE 2>&1 || failure
+# 	cp $ROOT/build/boinc/config.h $ROOT/install/include/BOINC >> $LOGFILE 2>&1 || failure
+# 	cp $ROOT/build/boinc/version.h $ROOT/install/include/BOINC >> $LOGFILE 2>&1 || failure
+	cp $ROOT/build/boinc/libboinc.a $ROOT/install/lib >> $LOGFILE 2>&1 || failure
+	mkdir -p $ROOT/install/include/BOINC >> $LOGFILE 2>&1 || failure
+	cp $ROOT/3rdparty/boinc/api/boinc_api.h $ROOT/install/include/BOINC >> $LOGFILE 2>&1 || failure
+	cp $ROOT/3rdparty/boinc/api/graphics2.h $ROOT/install/include/BOINC >> $LOGFILE 2>&1 || failure
+	cp $ROOT/3rdparty/boinc/lib/app_ipc.h $ROOT/install/include/BOINC >> $LOGFILE 2>&1 || failure
+	cp $ROOT/3rdparty/boinc/lib/boinc_win.h $ROOT/install/include/BOINC >> $LOGFILE 2>&1 || failure
+	cp $ROOT/3rdparty/boinc/lib/common_defs.h $ROOT/install/include/BOINC >> $LOGFILE 2>&1 || failure
+	cp $ROOT/3rdparty/boinc/lib/hostinfo.h $ROOT/install/include/BOINC >> $LOGFILE 2>&1 || failure
+	cp $ROOT/3rdparty/boinc/lib/proxy_info.h $ROOT/install/include/BOINC >> $LOGFILE 2>&1 || failure
+	cp $ROOT/3rdparty/boinc/lib/prefs.h $ROOT/install/include/BOINC >> $LOGFILE 2>&1 || failure
+	cp $ROOT/3rdparty/boinc/lib/miofile.h $ROOT/install/include/BOINC >> $LOGFILE 2>&1 || failure
+	cp $ROOT/3rdparty/boinc/lib/mfile.h $ROOT/install/include/BOINC >> $LOGFILE 2>&1 || failure
+	cp $ROOT/3rdparty/boinc/lib/parse.h $ROOT/install/include/BOINC >> $LOGFILE 2>&1 || failure
+	cp $ROOT/3rdparty/boinc/lib/util.h $ROOT/install/include/BOINC >> $LOGFILE 2>&1 || failure
+	echo "Successfully built and installed BOINC!" | tee -a $LOGFILE
+}
+
+
 build_mingw()
 {
-	echo "Not yet implemented: build_mingw()"
+	TARGET_HOST=i586-pc-mingw32
+
+	echo "Building MinGW (this will take quite a while)..." | tee -a $LOGFILE
+	# note: the script's current config for unattended setup expects it to be run from three levels below root!
+	cd $ROOT/3rdparty/mingw/xscripts || failure
+	./x86-mingw32-build.sh --unattended $TARGET_HOST >> $LOGFILE 2>&1 || failure
 
 	return 0
 }
@@ -263,6 +378,9 @@ build_mingw()
 
 build_starsphere()
 {
+	# make sure ORC is always compiled for host platform (it's exexuted during starsphere build!)
+	export PATH=$PATH_ORG
+
 	echo "Building Starsphere [ORC]..." | tee -a $LOGFILE
 	export ORC_SRC=$ROOT/src/orc || failure
 	export ORC_INSTALL=$ROOT/install || failure
@@ -272,11 +390,22 @@ build_starsphere()
 	make install >> $LOGFILE 2>&1 || failure
 	echo "Successfully built and installed Starsphere [ORC]!" | tee -a $LOGFILE
 
+	# set main include directory
+	if [ "$1" == "$TARGET_WIN32" ]; then
+		export PATH=$PATH_MINGW
+	else
+		export PATH=$PATH_ORG
+	fi
+
 	echo "Building Starsphere [Framework]..." | tee -a $LOGFILE
 	export FRAMEWORK_SRC=$ROOT/src/framework || failure
 	export FRAMEWORK_INSTALL=$ROOT/install || failure
 	cd $ROOT/build/framework || failure
-	cp $ROOT/src/framework/Makefile . >> $LOGFILE 2>&1 || failure
+	if [ "$1" == "$TARGET_WIN32" ]; then
+		cp -f $ROOT/src/framework/Makefile.mingw Makefile >> $LOGFILE 2>&1 || failure
+	else
+		cp -f $ROOT/src/framework/Makefile . >> $LOGFILE 2>&1 || failure
+	fi
 	make >> $LOGFILE 2>&1 || failure
 	make install >> $LOGFILE 2>&1 || failure
 	echo "Successfully built and installed Starsphere [Framework]!" | tee -a $LOGFILE
@@ -286,10 +415,12 @@ build_starsphere()
 	export STARSPHERE_INSTALL=$ROOT/install || failure
 	cd $ROOT/build/starsphere || failure
 	cp $ROOT/src/starsphere/*.res . >> $LOGFILE 2>&1 || failure
-	if [ "$1" != "$TARGET_MAC" ]; then
-		cp $ROOT/src/starsphere/Makefile . >> $LOGFILE 2>&1 || failure
+	if [ "$1" == "$TARGET_MAC" ]; then
+		cp -f $ROOT/src/starsphere/Makefile.macos Makefile >> $LOGFILE 2>&1 || failure
+	elif [ "$1" == "$TARGET_WIN32" ]; then
+		cp -f $ROOT/src/starsphere/Makefile.mingw Makefile >> $LOGFILE 2>&1 || failure
 	else
-		cp $ROOT/src/starsphere/Makefile.macos Makefile >> $LOGFILE 2>&1 || failure
+		cp -f $ROOT/src/starsphere/Makefile . >> $LOGFILE 2>&1 || failure
 	fi
 	make >> $LOGFILE 2>&1 || failure
 	make install >> $LOGFILE 2>&1 || failure
@@ -319,11 +450,10 @@ build_mac()
 
 build_win32()
 {
-	echo "Not yet implemented: build_win32()"
-
-# 	build_mingw
-# 	build_generic
-# 	build_starsphere
+	prepare_win32 || failure
+	build_mingw || failure
+	build_generic_win32 || failure
+	build_starsphere $TARGET_WIN32
 
 	return 0
 }
diff --git a/patches/boinc.Makefile.mingw.patch b/patches/boinc.Makefile.mingw.patch
new file mode 100644
index 0000000000000000000000000000000000000000..093339f2f118c2fb1c82db3df8f7e944ca4b3451
--- /dev/null
+++ b/patches/boinc.Makefile.mingw.patch
@@ -0,0 +1,11 @@
+--- Makefile.mingw
++++ Makefile.mingw.new	2008-06-11 15:08:56.000000000 +0200
+@@ -1,6 +1,6 @@
+-BOINCDIR = ./boinc
++BOINCDIR = $(BOINC_SRC)
+ DEBUG = -D__DEBUG__ -g3
+-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
++OBJ  = graphics2.o graphics2_util.o 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
+ LINKOBJ  = $(OBJ)
+ LDFLAGS = -lwinmm -march=i386
+ INCS = -I"$(BOINCDIR)" -I"$(BOINCDIR)/db" -I"$(BOINCDIR)" -I"$(BOINCDIR)/lib" -I"$(BOINCDIR)/api" 
diff --git a/patches/boinc.boinc_win.h.minggw.patch b/patches/boinc.boinc_win.h.minggw.patch
new file mode 100644
index 0000000000000000000000000000000000000000..e6b55255832f1ce779879b04de907bfa01a57f9f
--- /dev/null
+++ b/patches/boinc.boinc_win.h.minggw.patch
@@ -0,0 +1,33 @@
+--- boinc_win.h
++++ boinc_win.h	2008-06-03 17:35:38.000000000 +0200
+@@ -110,7 +110,7 @@
+ 
+ #include <commctrl.h>
+ #include <raserror.h>
+-#include <dbghelp.h>
++#include <imagehlp.h>
+ #include <tlhelp32.h>
+ 
+ #include <io.h>
+@@ -143,7 +143,7 @@
+ // C headers
+ #include <sys/stat.h>
+ #include <sys/types.h>
+-#include <fcntl.h>
++// #include <fcntl.h>
+ #include <malloc.h>
+ 
+ #if !defined(__MINGW32__) && !defined(__CYGWIN32__)
+@@ -238,9 +238,9 @@
+ #endif
+ void __cdecl _fpreset (void);
+ void __cdecl fpreset (void);
+-#define SetClassLongPtr SetClassLong
+-#define GCLP_HICON GCL_HICON
+-#define GCLP_HICONSM GCL_HICONSM
++// #define SetClassLongPtr SetClassLong
++// #define GCLP_HICON GCL_HICON
++// #define GCLP_HICONSM GCL_HICONSM
+ #ifdef __cplusplus
+ }
+ #endif
diff --git a/patches/boinc.filesys.C.mingw.patch b/patches/boinc.filesys.C.mingw.patch
new file mode 100644
index 0000000000000000000000000000000000000000..efc36ef4ca0b4991e21100ca21da9465bf63b87b
--- /dev/null
+++ b/patches/boinc.filesys.C.mingw.patch
@@ -0,0 +1,15 @@
+--- filesys.C
++++ filesys.C.new	2008-06-11 15:38:25.000000000 +0200
+@@ -21,10 +21,11 @@
+ #include "boinc_win.h"
+ #endif
+ 
++#include <fcntl.h>
++
+ #if !defined(_WIN32) || defined(__CYGWIN32__)
+ #include "config.h"
+ #include <cstdio>
+-#include <fcntl.h>
+ #include <cerrno>
+ #include <sys/stat.h>
+ #include <sys/file.h>
diff --git a/patches/boinc.stackwalker_win.cpp.minggw.patch b/patches/boinc.stackwalker_win.cpp.minggw.patch
new file mode 100644
index 0000000000000000000000000000000000000000..3c135a031684a84a8066372ced934fe0713c632a
--- /dev/null
+++ b/patches/boinc.stackwalker_win.cpp.minggw.patch
@@ -0,0 +1,20 @@
+--- stackwalker_win.cpp
++++ stackwalker_win.cpp	2008-06-03 17:37:38.000000000 +0200
+@@ -353,7 +353,7 @@
+     }
+     _ftprintf(stderr, _T("(%s Symbols Loaded)")                   , szSymbolType);
+     _ftprintf(stderr, _T("\n"));
+-    _ftprintf(stderr, _T("    Linked PDB Filename   : %s\n")      , Module.CVData);
++//     _ftprintf(stderr, _T("    Linked PDB Filename   : %s\n")      , Module.CVData);
+     if (bFileVersionSupported && bFileVersionRetrieved) {
+         _ftprintf(stderr, _T("    File Version          : %s\n")  , szFileVersion);
+         _ftprintf(stderr, _T("    Company Name          : %s\n")  , szCompanyName);
+@@ -657,7 +657,7 @@
+ // #################################################################################
+ // Here the Stackwalk-Part begins.
+ //   Some of the code is from an example from a book 
+-//   But I couldn�t find the reference anymore... sorry...
++//   But I couldn�t find the reference anymore... sorry...
+ //   If someone knowns, please let me know...
+ // #################################################################################
+ // #################################################################################
diff --git a/patches/freetype2.exports.mk.patch b/patches/freetype2.exports.mk.patch
new file mode 100644
index 0000000000000000000000000000000000000000..316a442bb8cad4c55d13f91bd15b9b831ce33023
--- /dev/null
+++ b/patches/freetype2.exports.mk.patch
@@ -0,0 +1,11 @@
+--- exports.mk
++++ exports.mk.new	2008-06-02 12:24:03.000000000 +0200
+@@ -61,7 +61,7 @@
+   # debuggers, to the EXPORTS_LIST.
+   #
+   $(EXPORTS_LIST): $(APINAMES_EXE) $(PUBLIC_HEADERS)
+-	  $(subst /,$(SEP),$(APINAMES_EXE)) -o$@ $(APINAMES_OPTIONS) $(PUBLIC_HEADERS)
++#	  $(subst /,$(SEP),$(APINAMES_EXE)) -o$@ $(APINAMES_OPTIONS) $(PUBLIC_HEADERS)
+ 	  @echo TT_New_Context >> $(EXPORTS_LIST)
+ 	  @echo TT_RunIns >> $(EXPORTS_LIST)
+ 
diff --git a/patches/toolchain-linux-mingw.oglft.cmake b/patches/toolchain-linux-mingw.oglft.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..7be34af99799f58a53530be94f60204e2744c709
--- /dev/null
+++ b/patches/toolchain-linux-mingw.oglft.cmake
@@ -0,0 +1,16 @@
+# the name of the target operating system
+SET(CMAKE_SYSTEM_NAME Windows)
+
+# which compilers to use for C and C++
+SET(CMAKE_C_COMPILER   i586-pc-mingw32-gcc)
+SET(CMAKE_CXX_COMPILER i586-pc-mingw32-g++)
+
+# here is the target environment located
+SET(CMAKE_FIND_ROOT_PATH  ${OGLFT_INSTALL})
+
+# adjust the default behaviour of the FIND_XXX() commands:
+# search headers and libraries in the target environment, search 
+# programs in the host environment
+SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
+SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
diff --git a/src/framework/Makefile.mingw b/src/framework/Makefile.mingw
new file mode 100644
index 0000000000000000000000000000000000000000..44a4769e1c51a1ea97b2a1ed4d615b997b87012c
--- /dev/null
+++ b/src/framework/Makefile.mingw
@@ -0,0 +1,79 @@
+###########################################################################
+#   Copyright (C) 2008 by Oliver Bock                                     #
+#   oliver.bock[AT]aei.mpg.de                                             #
+#                                                                         #
+#   This file is part of Einstein@Home.                                   #
+#                                                                         #
+#   Einstein@Home is free software: you can redistribute it and/or modify #
+#   it under the terms of the GNU General Public License as published     #
+#   by the Free Software Foundation, version 2 of the License.            #
+#                                                                         #
+#   Einstein@Home is distributed in the hope that it will be useful,      #
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of        #
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the          #
+#   GNU General Public License for more details.                          #
+#                                                                         #
+#   You should have received a copy of the GNU General Public License     #
+#   along with Einstein@Home. If not, see <http://www.gnu.org/licenses/>. #
+#                                                                         #
+###########################################################################
+
+# path settings
+FRAMEWORK_SRC?=$(PWD)
+FRAMEWORK_INSTALL?=$(PWD)
+
+# config values
+CXX?=g++
+
+# variables
+CPPFLAGS = $(shell $(FRAMEWORK_INSTALL)/bin/sdl-config --cflags)
+CPPFLAGS += $(shell $(FRAMEWORK_INSTALL)/bin/freetype-config --cflags)
+CPPFLAGS += -I$(FRAMEWORK_INSTALL)/include/BOINC -I$(FRAMEWORK_INSTALL)/include
+
+DEPS = Makefile
+OBJS = AbstractGraphicsEngine.o GraphicsEngineFactory.o WindowManager.o Resource.o ResourceFactory.o BOINCClientAdapter.o
+DEBUGFLAGSCPP = -pg -ggdb -O0
+
+# TODO: GraphicsEngineFactory obviously depends on the actual implementations (here starsphere)! need to change the structure! what about plugins?
+CPPFLAGS += -I$(FRAMEWORK_SRC) -I$(FRAMEWORK_SRC)/../starsphere
+
+# primary role based tagets
+default: release
+debug: libframework.a
+memcheck: clean debug
+callgrind: clean debug
+release: clean libframework.a
+
+# target specific options
+debug: CPPFLAGS += $(DEBUGFLAGSCPP)
+release: CPPFLAGS += -DNDEBUG -O3 -Wall -Wno-switch-enum
+release: LDFLAGS += -s
+
+# file based targets
+libframework.a: $(OBJS)
+	ar rcs libframework.a $(OBJS)
+
+AbstractGraphicsEngine.o: $(DEPS) $(FRAMEWORK_SRC)/AbstractGraphicsEngine.cpp $(FRAMEWORK_SRC)/AbstractGraphicsEngine.h
+	$(CXX) -g ${CPPFLAGS} -c $(FRAMEWORK_SRC)/AbstractGraphicsEngine.cpp
+	
+GraphicsEngineFactory.o: $(DEPS) $(FRAMEWORK_SRC)/GraphicsEngineFactory.cpp $(FRAMEWORK_SRC)/GraphicsEngineFactory.h
+	$(CXX) -g ${CPPFLAGS} -c $(FRAMEWORK_SRC)/GraphicsEngineFactory.cpp
+	
+WindowManager.o: $(DEPS) $(FRAMEWORK_SRC)/WindowManager.cpp $(FRAMEWORK_SRC)/WindowManager.h
+	$(CXX) -g ${CPPFLAGS} -c $(FRAMEWORK_SRC)/WindowManager.cpp
+	
+BOINCClientAdapter.o: $(DEPS) $(FRAMEWORK_SRC)/BOINCClientAdapter.cpp $(FRAMEWORK_SRC)/BOINCClientAdapter.h
+	$(CXX) -g ${CPPFLAGS} -c $(FRAMEWORK_SRC)/BOINCClientAdapter.cpp
+	
+ResourceFactory.o: $(DEPS) $(FRAMEWORK_SRC)/ResourceFactory.cpp $(FRAMEWORK_SRC)/ResourceFactory.h
+	$(CXX) -g ${CPPFLAGS} -c $(FRAMEWORK_SRC)/ResourceFactory.cpp
+	
+Resource.o: $(DEPS) $(FRAMEWORK_SRC)/Resource.cpp $(FRAMEWORK_SRC)/Resource.h
+	$(CXX) -g ${CPPFLAGS} -c $(FRAMEWORK_SRC)/Resource.cpp
+
+# tools
+install:
+	cp libframework.a $(ORC_INSTALL)/lib
+
+clean:
+	rm -f $(OBJS) libframework.a
diff --git a/src/starsphere/Makefile.mingw b/src/starsphere/Makefile.mingw
new file mode 100644
index 0000000000000000000000000000000000000000..717f689ceceb472bae9c55ebdd7236a962a5bd52
--- /dev/null
+++ b/src/starsphere/Makefile.mingw
@@ -0,0 +1,100 @@
+###########################################################################
+#   Copyright (C) 2008 by Oliver Bock                                     #
+#   oliver.bock[AT]aei.mpg.de                                             #
+#                                                                         #
+#   This file is part of Einstein@Home.                                   #
+#                                                                         #
+#   Einstein@Home is free software: you can redistribute it and/or modify #
+#   it under the terms of the GNU General Public License as published     #
+#   by the Free Software Foundation, version 2 of the License.            #
+#                                                                         #
+#   Einstein@Home is distributed in the hope that it will be useful,      #
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of        #
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the          #
+#   GNU General Public License for more details.                          #
+#                                                                         #
+#   You should have received a copy of the GNU General Public License     #
+#   along with Einstein@Home. If not, see <http://www.gnu.org/licenses/>. #
+#                                                                         #
+###########################################################################
+
+# path settings
+STARSPHERE_SRC?=$(PWD)
+STARSPHERE_INSTALL?=$(PWD)
+
+# config values
+CXX ?= g++
+
+# variables
+LIBS = -Wl,-Bstatic -lframework -loglft -L$(STARSPHERE_INSTALL)/lib
+LIBS += $(shell $(STARSPHERE_INSTALL)/bin/freetype-config --libs)
+LIBS += -lboinc -L/usr/lib
+LIBS += -Wl,-Bdynamic $(shell $(STARSPHERE_INSTALL)/bin/sdl-config --static-libs) -lopengl32 -lglu32
+
+CPPFLAGS = -I$(STARSPHERE_INSTALL)/include
+CPPFLAGS += $(shell $(STARSPHERE_INSTALL)/bin/sdl-config --cflags)
+CPPFLAGS += $(shell $(STARSPHERE_INSTALL)/bin/freetype-config --cflags)
+CPPFLAGS += -I$(STARSPHERE_INSTALL)/include/BOINC
+
+DEPS = Makefile
+OBJS = Starsphere.o StarsphereS5R3.o EinsteinS5R3Adapter.o starlist.o snr_list.o pulsar_list.o $(RESOURCESPEC).o
+DEBUGFLAGSCPP = -pg -ggdb -O0
+RESOURCESPEC = resources
+
+# TODO: GraphicsEngineFactory obviously depends on the actual implementations (here starsphere)! need to change the structure! what about plugins?
+CPPFLAGS += -I$(STARSPHERE_SRC) -I$(STARSPHERE_SRC)/../framework
+
+# primary role based tagets
+default: release
+debug: starsphere
+memcheck: clean debug starsphere
+callgrind: clean debug starsphere
+release: clean starsphere
+
+# target specific options
+debug: CPPFLAGS += $(DEBUGFLAGSCPP)
+memcheck: CPPFLAGS += $(DEBUGFLAGSCPP) -DDEBUG_VALGRIND
+callgrind: CPPFLAGS += $(DEBUGFLAGSCPP) -DDEBUG_VALGRIND
+release: CPPFLAGS += -DNDEBUG -O3 -Wall -Wno-switch-enum
+release: LDFLAGS += -s
+
+# file based targets
+starsphere: $(DEPS) $(STARSPHERE_SRC)/main.cpp $(OBJS)
+	$(CXX) -g $(CPPFLAGS) $(LDFLAGS) $(STARSPHERE_SRC)/main.cpp -o starsphere $(OBJS) $(LIBS)
+
+Starsphere.o: $(DEPS) $(STARSPHERE_SRC)/Starsphere.cpp $(STARSPHERE_SRC)/Starsphere.h
+	$(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/Starsphere.cpp
+	
+StarsphereS5R3.o: $(DEPS) $(STARSPHERE_SRC)/StarsphereS5R3.cpp $(STARSPHERE_SRC)/StarsphereS5R3.h
+	$(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/StarsphereS5R3.cpp
+
+EinsteinS5R3Adapter.o: Makefile $(STARSPHERE_SRC)/EinsteinS5R3Adapter.cpp $(STARSPHERE_SRC)/EinsteinS5R3Adapter.h
+	$(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/EinsteinS5R3Adapter.cpp
+
+starlist.o: $(DEPS) $(STARSPHERE_SRC)/starlist.C
+	$(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/starlist.C
+
+snr_list.o: $(DEPS) $(STARSPHERE_SRC)/snr_list.C
+	$(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/snr_list.C
+
+pulsar_list.o: $(DEPS) $(STARSPHERE_SRC)/pulsar_list.C
+	$(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/pulsar_list.C
+
+# resource compiler
+$(RESOURCESPEC).o: $(STARSPHERE_SRC)/$(RESOURCESPEC).orc
+	$(STARSPHERE_INSTALL)/bin/orc $(STARSPHERE_SRC)/$(RESOURCESPEC).orc $(RESOURCESPEC).cpp
+	$(CXX) -g $(CPPFLAGS) -c $(RESOURCESPEC).cpp -o $(RESOURCESPEC).o
+
+
+# tools
+memcheck:
+	valgrind --tool=memcheck --track-fds=yes --time-stamp=yes --log-file=$(PWD)/memcheck.out.%p --leak-check=full $(PWD)/starsphere
+
+callgrind:
+	valgrind --tool=callgrind --track-fds=yes --time-stamp=yes $(PWD)/starsphere
+
+install:
+	cp starsphere $(STARSPHERE_INSTALL)/bin
+
+clean:
+	rm -f $(RESOURCESPEC).cpp $(OBJS) starsphere