diff --git a/build.sh b/build.sh
index 628cbfaa042254903237aa8d3005489f318f4af6..7398dd94bf63cb132da2c79de561a60f40b24ef8 100755
--- a/build.sh
+++ b/build.sh
@@ -36,7 +36,7 @@ LOGFILE=$ROOT/build.log
 TARGET=0
 TARGET_LINUX=1
 TARGET_MAC=2
-TARGET_WIN32=3
+TARGET_WIN=3
 TARGET_DOC=4
 
 BUILDSTATE=0
@@ -150,7 +150,7 @@ check_prerequisites()
     echo "Checking prerequisites..." | tee -a $LOGFILE
 
     # required toolchain
-    TOOLS="automake autoconf m4 cmake wget svn cvs tar patch gcc g++ ld libtool ar lex yacc pkg-config hg"
+    TOOLS="automake autoconf m4 cmake wget svn tar patch gcc g++ ld libtool libtoolize ar lex yacc pkg-config hg"
 
     for tool in $TOOLS; do
         if ! ( type $tool >/dev/null 2>&1 ); then
@@ -209,38 +209,6 @@ prepare_version_header()
 }
 
 
-prepare_mingw()
-{
-    if [ $BUILDSTATE -ge $BS_PREPARE_MINGW ]; then
-        return 0
-    fi
-
-    cd $ROOT || failure
-
-    echo "Preparing MinGW source tree..." | tee -a $LOGFILE
-    mkdir -p 3rdparty/mingw/xscripts >> $LOGFILE || failure
-    cd 3rdparty/mingw/xscripts || failure
-
-    if [ -d CVS ]; then
-        echo "Updating MinGW build script..." | tee -a $LOGFILE
-        cvs update -C >> $LOGFILE 2>&1 || failure
-    else
-        cd .. || failure
-        echo "Retrieving MinGW build script (this may take a while)..." | tee -a $LOGFILE
-        cvs -z3 -d:pserver:anonymous@mingw.cvs.sourceforge.net:/cvsroot/mingw checkout -P xscripts >> $LOGFILE 2>&1 || failure
-    fi
-
-    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
-
-    store_build_state $BS_PREPARE_MINGW
-    return 0
-}
-
-
 prepare_sdl()
 {
     echo "Preparing SDL..." | tee -a $LOGFILE
@@ -494,31 +462,12 @@ build_boinc()
 }
 
 
-build_mingw()
-{
-    if [ $BUILDSTATE -ge $BS_BUILD_MINGW ]; then
-        return 0
-    fi
-    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
-
-    store_build_state $BS_BUILD_MINGW
-    return 0
-}
-
-
 set_mingw()
 {
     # general config
     PREFIX=$ROOT/install
-    # the following target host spec is Debian specific!
-    # use "i586-pc-mingw32" when building MinGW automatically
-    export TARGET_HOST=i586-mingw32msvc
-    BUILD_HOST=i386-linux
+    export TARGET_HOST=x86_64-w64-mingw32
+    BUILD_HOST=x86_64-linux
     PATH_MINGW="$PREFIX/bin:$PREFIX/$TARGET_HOST/bin:$PATH"
     PATH="$PATH_MINGW"
     export PATH
@@ -526,7 +475,7 @@ set_mingw()
     export CC=`which ${TARGET_HOST}-gcc`
     export CXX=`which ${TARGET_HOST}-g++`
 
-    export CPPFLAGS="-D_WIN32_WINDOWS=0x0410 -DMINGW_WIN32 $CPPFLAGS"
+    export CPPFLAGS="-static -m64 $CPPFLAGS"
 }
 
 
@@ -539,9 +488,9 @@ build_sdl_mingw()
     prepare_sdl || failure
 
     echo "Patching SDL..." | tee -a $LOGFILE
-    cd $ROOT/3rdparty/sdl/src/video/wincommon || failure
+    cd $ROOT/3rdparty/sdl/src/video/windows || failure
     # patch: amend window class name (required by BOINC v6 screensaver!)
-    patch < $ROOT/patches/SDL_sysevents.c.patch >> $LOGFILE 2>&1 || failure
+    patch < $ROOT/patches/SDL_windowsevents.c.patch >> $LOGFILE 2>&1 || failure
     echo "Building SDL (this may take a while)..." | tee -a $LOGFILE
     cd $ROOT/3rdparty/sdl || failure
     chmod +x autogen.sh >> $LOGFILE 2>&1 || failure
@@ -573,21 +522,15 @@ build_freetype_mingw()
 
     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: deactivating invocation of apinames (would run windows 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
     ./autogen.sh >> $LOGFILE 2>&1 || failure
     chmod +x configure >> $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 --without-png --without-zlib --without-bzip2 >> $LOGFILE 2>&1 || failure
+    $ROOT/3rdparty/freetype2/configure --host=$TARGET_HOST --build=$BUILD_HOST --prefix=$PREFIX --enable-freetype-config --enable-shared=no --enable-static=yes --without-png --without-zlib --without-bzip2 >> $LOGFILE 2>&1 || failure
     make >> $LOGFILE 2>&1 || failure
     make install >> $LOGFILE 2>&1 || failure
     echo "Successfully built and installed Freetype2!" | tee -a $LOGFILE
@@ -691,7 +634,7 @@ build_starsphere()
     export ORC_INSTALL=$ROOT/install || failure
     cd $ROOT/build/orc || failure
     cp $ROOT/src/orc/Makefile . >> $LOGFILE 2>&1 || failure
-    if [ "$1" == "$TARGET_WIN32" ]; then
+    if [ "$1" == "$TARGET_WIN" ]; then
         # backup MinGW compiler settings
         CC_MINGW=$CC
         CXX_MINGW=$CXX
@@ -700,7 +643,7 @@ build_starsphere()
         export CXX=`which g++`
     fi
     make $2 >> $LOGFILE 2>&1 || failure
-    if [ "$1" == "$TARGET_WIN32" ]; then
+    if [ "$1" == "$TARGET_WIN" ]; then
         # restore MinGW compiler settings
         export CC=$CC_MINGW
         export CXX=$CXX_MINGW
@@ -709,7 +652,7 @@ build_starsphere()
     echo "Successfully built and installed Starsphere [ORC]!" | tee -a $LOGFILE
 
     # set main include directory
-    if [ "$1" == "$TARGET_WIN32" ]; then
+    if [ "$1" == "$TARGET_WIN" ]; then
         export PATH=$PATH_MINGW
     else
         export PATH=$PATH_ORG
@@ -719,7 +662,7 @@ build_starsphere()
     export FRAMEWORK_SRC=$ROOT/src/framework || failure
     export FRAMEWORK_INSTALL=$ROOT/install || failure
     cd $ROOT/build/framework || failure
-    if [ "$1" == "$TARGET_WIN32" ]; then
+    if [ "$1" == "$TARGET_WIN" ]; then
         cp -f $ROOT/src/framework/Makefile.mingw Makefile >> $LOGFILE 2>&1 || failure
     else
         cp -f $ROOT/src/framework/Makefile . >> $LOGFILE 2>&1 || failure
@@ -735,7 +678,7 @@ build_starsphere()
     cp $ROOT/src/starsphere/*.res . >> $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
+    elif [ "$1" == "$TARGET_WIN" ]; then
         cp -f $ROOT/src/starsphere/Makefile.mingw Makefile >> $LOGFILE 2>&1 || failure
     else
         cp -f $ROOT/src/starsphere/Makefile . >> $LOGFILE 2>&1 || failure
@@ -775,10 +718,9 @@ build_mac()
 }
 
 
-build_win32()
+build_win()
 {
-    # no more prepare/build steps for MinGW
-    # we use Debian's MinGW with GCC 4.4 support
+    # we use Debian's mingw-w64
     set_mingw || failure
 
     build_sdl_mingw || failure
@@ -786,7 +728,7 @@ build_win32()
     build_libxml_mingw || failure
     build_oglft_mingw || failure
     build_boinc_mingw || failure
-    build_starsphere $TARGET_WIN32 || failure
+    build_starsphere $TARGET_WIN || failure
 
     return 0
 }
@@ -802,7 +744,7 @@ print_usage()
     echo "Available targets:"
     echo "  --linux"
     echo "  --mac"
-    echo "  --win32"
+    echo "  --win"
     echo "  --doc"
     echo "*************************"
 
@@ -839,10 +781,10 @@ case "$1" in
         echo "Building mac (Intel) version:" | tee -a $LOGFILE
         check_build_state || failure
         ;;
-    "--win32")
-        TARGET=$TARGET_WIN32
+    "--win")
+        TARGET=$TARGET_WIN
         check_last_build "$1" || failure
-        echo "Building win32 version:" | tee -a $LOGFILE
+        echo "Building windoze version:" | tee -a $LOGFILE
         check_build_state || failure
         ;;
     "--doc")
@@ -890,10 +832,10 @@ case $TARGET in
         prepare_tree || failure
         build_mac $TARGET_MAC || failure
         ;;
-    $TARGET_WIN32)
+    $TARGET_WIN)
         check_prerequisites || failure
         prepare_tree || failure
-        build_win32 || failure
+        build_win || failure
         ;;
     $TARGET_DOC)
         doxygen Doxyfile >> $LOGFILE 2>&1 || failure
diff --git a/patches/SDL_sysevents.c.patch b/patches/SDL_sysevents.c.patch
deleted file mode 100644
index 3840748d99cfea135a0835f07db15c45ac4f8737..0000000000000000000000000000000000000000
--- a/patches/SDL_sysevents.c.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- SDL_sysevents.c	2009-04-17 17:18:07.000000000 +0200
-+++ SDL_sysevents.c.new	2009-04-17 17:14:41.000000000 +0200
-@@ -799,7 +799,7 @@
- #define CS_BYTEALIGNCLIENT	0
- #endif
- 	if ( ! name && ! SDL_Appname ) {
--		name = "SDL_app";
-+		name = "BOINC_app";
- 		SDL_Appstyle = CS_BYTEALIGNCLIENT;
- 		SDL_Instance = hInst ? hInst : SDL_GetModuleHandle();
- 	}
diff --git a/patches/SDL_windowsevents.c.patch b/patches/SDL_windowsevents.c.patch
new file mode 100644
index 0000000000000000000000000000000000000000..89e1a6f1d0c5bb24f6072fffd41563c4c8602f89
--- /dev/null
+++ b/patches/SDL_windowsevents.c.patch
@@ -0,0 +1,11 @@
+--- SDL_windowsevents.c	2020-03-05 10:46:34.201154000 +0000
++++ SDL_windowsevents.c	2020-03-05 10:54:16.394363000 +0000
+@@ -1211,7 +1211,7 @@
+         return (0);
+     }
+     if (!name && !SDL_Appname) {
+-        name = "SDL_app";
++        name = "BOINC_app";
+ #if defined(CS_BYTEALIGNCLIENT) || defined(CS_OWNDC)
+         SDL_Appstyle = (CS_BYTEALIGNCLIENT | CS_OWNDC);
+ #endif
diff --git a/patches/x86-mingw32-build.sh.conf.patch b/patches/x86-mingw32-build.sh.conf.patch
deleted file mode 100644
index 00061f56b1658cdb187183fe8fef628ce7f736bc..0000000000000000000000000000000000000000
--- a/patches/x86-mingw32-build.sh.conf.patch
+++ /dev/null
@@ -1,39 +0,0 @@
---- x86-mingw32-build.sh.conf
-+++ x86-mingw32-build.sh.conf	2009-03-13 12:08:40.000000000 +0100
-@@ -35,16 +35,16 @@
- #    the `x86-mingw32-build.sh.hosts' file for the `mirror' field
- #    in the following URL, to establish a default download host.
- #
--     assume DOWNLOAD_HOST     http://mirror.dl.sourceforge.net/mingw
-+     assume DOWNLOAD_HOST     http://mesh.dl.sourceforge.net/mingw
- #
- # 3) Directories to use for temporary working space, package storage,
- #    and ultimate compiler installation.  You should adjust these to
- #    match your own host configuration; note that you MUST have WRITE
- #    permission for each directory specified.
- #
--     assume WORKING_DIR                   $HOME/tmp/mingw-3.4.5
--     assume PACKAGE_DIR                   $HOME/packages/mingw-3.4.5
--     assume INSTALL_DIR                   $HOME/mingw32
-+     assume WORKING_DIR                   `pwd`/../../../build/mingw
-+     assume PACKAGE_DIR                   `pwd`/../packages
-+     assume INSTALL_DIR                   `pwd`/../../../install
- #
- # 4) Package versions, from which the compiler will be built.
- #
-@@ -92,11 +92,11 @@
- #    the corresponding package is available in the PACKAGE_DIR, or
- #    if it is selected for download.
- #
--     option GCC_LANGUAGE_OPTIONS          ada
-+#    option GCC_LANGUAGE_OPTIONS          ada
-      option GCC_LANGUAGE_OPTIONS          c++
--     option GCC_LANGUAGE_OPTIONS          f77
--     option GCC_LANGUAGE_OPTIONS          java
--     option GCC_LANGUAGE_OPTIONS          objc
-+#    option GCC_LANGUAGE_OPTIONS          f77
-+#    option GCC_LANGUAGE_OPTIONS          java
-+#    option GCC_LANGUAGE_OPTIONS          objc
- #
- # 8) User preferences for configuration options.  These have been
- #    preconfigured to match the setup of the prebuilt compiler suite,
diff --git a/src/framework/Makefile.mingw b/src/framework/Makefile.mingw
index d9bd874a11dcd915217cf010a79bf10a49fe189c..9a2d88405497b23622f6680b34bd4046ee868ab8 100644
--- a/src/framework/Makefile.mingw
+++ b/src/framework/Makefile.mingw
@@ -1,5 +1,5 @@
 ###########################################################################
-#   Copyright (C) 2008 by Oliver Bock                                     #
+#   Copyright (C) 2008-2020 by Oliver Bock                                #
 #   oliver.bock[AT]aei.mpg.de                                             #
 #                                                                         #
 #   This file is part of Einstein@Home.                                   #
@@ -24,14 +24,13 @@ FRAMEWORK_INSTALL?=$(PWD)
 
 # config values
 CXX?=g++
-TARGET_HOST?=i586-pc-mingw32
+TARGET_HOST?=x86_64-w64-mingw32
 
 # variables
 CPPFLAGS += $(shell $(FRAMEWORK_INSTALL)/bin/sdl2-config --cflags)
 CPPFLAGS += $(shell $(FRAMEWORK_INSTALL)/bin/freetype-config --cflags)
 CPPFLAGS += $(shell $(FRAMEWORK_INSTALL)/bin/xml2-config --cflags)
 CPPFLAGS += -I$(FRAMEWORK_INSTALL)/include/boinc -I$(FRAMEWORK_INSTALL)/include
-CPPFLAGS += -D_WIN32_WINDOWS=0x0410
 
 DEPS = Makefile
 OBJS = AbstractGraphicsEngine.o GraphicsEngineFactory.o WindowManager.o Resource.o ResourceFactory.o BOINCClientAdapter.o Libxml2Adapter.o
diff --git a/src/starsphere/Makefile.mingw b/src/starsphere/Makefile.mingw
index 05842e8c52bc6081886ab51cdcecdd3c7b9e717d..eb2098626010557e32104e682e7854f2032a5ee4 100644
--- a/src/starsphere/Makefile.mingw
+++ b/src/starsphere/Makefile.mingw
@@ -1,5 +1,5 @@
 ###########################################################################
-#   Copyright (C) 2008 by Oliver Bock                                     #
+#   Copyright (C) 2008-2020 by Oliver Bock                                #
 #   oliver.bock[AT]aei.mpg.de                                             #
 #                                                                         #
 #   This file is part of Einstein@Home.                                   #
@@ -24,14 +24,13 @@ STARSPHERE_INSTALL?=$(PWD)
 
 # config values
 CXX ?= g++
-TARGET_HOST ?= i586-pc-mingw32
+TARGET_HOST ?= x86_64-w64-mingw32
 
 # variables
 LIBS += -Wl,-Bstatic
 LIBS += -lframework -loglft -L$(STARSPHERE_INSTALL)/lib
 LIBS += $(shell $(STARSPHERE_INSTALL)/bin/freetype-config --libs)
 LIBS += $(shell $(STARSPHERE_INSTALL)/bin/xml2-config --libs)
-LIBS += -lws2_32 # required by libxml2
 LIBS += -lboinc_graphics2 -lboinc_api -lboinc
 LIBS += -Wl,-Bdynamic
 LIBS += $(shell $(STARSPHERE_INSTALL)/bin/sdl2-config --static-libs)
@@ -44,7 +43,6 @@ CPPFLAGS += $(shell $(STARSPHERE_INSTALL)/bin/sdl2-config --cflags)
 CPPFLAGS += $(shell $(STARSPHERE_INSTALL)/bin/freetype-config --cflags)
 CPPFLAGS += $(shell $(STARSPHERE_INSTALL)/bin/xml2-config --cflags)
 CPPFLAGS += -I$(STARSPHERE_INSTALL)/include/boinc
-CPPFLAGS += -D_WIN32_WINDOWS=0x0410
 
 DEPS = Makefile
 OBJS = Starsphere.o StarsphereS5R3.o StarsphereRadio.o EinsteinS5R3Adapter.o EinsteinRadioAdapter.o starlist.o snr_list.o pulsar_list.o $(RESOURCESPEC).o $(RESOURCESPEC)_mingw.o
@@ -71,10 +69,10 @@ callgrind: CPPFLAGS += $(DEBUGFLAGSCPP) -D DEBUG_VALGRIND
 
 # file based targets
 starsphere_Einstein_LVC: $(DEPS) $(STARSPHERE_SRC)/main.cpp $(OBJS)
-	$(CXX) -g $(CPPFLAGS) $(LDFLAGS) $(STARSPHERE_SRC)/main.cpp -o "graphics_app=einstein_RUNLABEL_VERSION_graphics_windows_intelx86.exe" $(OBJS) $(LIBS)
+	$(CXX) -g $(CPPFLAGS) $(LDFLAGS) $(STARSPHERE_SRC)/main.cpp -o "graphics_app=einstein_RUNLABEL_VERSION_graphics_windows_intelx86_64.exe" $(OBJS) $(LIBS)
 
 starsphere_Einstein_ABP: $(DEPS) $(STARSPHERE_SRC)/main.cpp $(OBJS)
-	$(CXX) -g $(CPPFLAGS) $(LDFLAGS) $(STARSPHERE_SRC)/main.cpp -o "graphics_app=einsteinbinary_RUNLABEL_VERSION_graphics_windows_intelx86.exe" $(OBJS) $(LIBS)
+	$(CXX) -g $(CPPFLAGS) $(LDFLAGS) $(STARSPHERE_SRC)/main.cpp -o "graphics_app=einsteinbinary_RUNLABEL_VERSION_graphics_windows_intelx86_64.exe" $(OBJS) $(LIBS)
 
 Starsphere.o: $(DEPS) $(STARSPHERE_SRC)/Starsphere.cpp $(STARSPHERE_SRC)/Starsphere.h
 	$(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/Starsphere.cpp