diff --git a/build.sh b/build.sh
index 65ce50bc0bbf88441c608d832e0bc71204d13083..be78a927a5ab5741759567611248535dad469d96 100755
--- a/build.sh
+++ b/build.sh
@@ -465,7 +465,7 @@ set_mingw()
 {
     # general config
     PREFIX=$ROOT/install
-    TARGET_HOST=i586-mingw32msvc
+    export TARGET_HOST=i586-mingw32msvc
     BUILD_HOST=i386-linux
     PATH_MINGW="$PREFIX/bin:$PREFIX/$TARGET_HOST/bin:$PATH"
     PATH="$PATH_MINGW"
@@ -652,7 +652,7 @@ build_boinc_mingw()
     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
     # invoke MinGW's (Debian Squeeze) ranlib as the archive lacks an index
-    /usr/i586-mingw32msvc/bin/ranlib $ROOT/install/lib/libboinc.a
+    ${TARGET_HOST}-ranlib $ROOT/install/lib/libboinc.a
     echo "Successfully built and installed BOINC!" | tee -a $LOGFILE
 
     store_build_state $BS_BUILD_BOINC_MINGW || failure
@@ -674,7 +674,20 @@ 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
+        # backup MinGW compiler settings
+        CC_MINGW=$CC
+        CXX_MINGW=$CXX
+        # set the native compilers (ORC will be run on host, not on target)
+        export CC=`which gcc`
+        export CXX=`which g++`
+    fi
     make $2 >> $LOGFILE 2>&1 || failure
+    if [ "$1" == "$TARGET_WIN32" ]; then
+        # restore MinGW compiler settings
+        export CC=$CC_MINGW
+        export CXX=$CXX_MINGW
+    fi
     make install >> $LOGFILE 2>&1 || failure
     echo "Successfully built and installed Starsphere [ORC]!" | tee -a $LOGFILE
 
diff --git a/src/framework/Makefile.mingw b/src/framework/Makefile.mingw
index f1d6516ade0d53e2a4d76ec2345a6906a52803d7..0ee35cad2f42572f62dce171d4d563d4bc5bcd27 100644
--- a/src/framework/Makefile.mingw
+++ b/src/framework/Makefile.mingw
@@ -24,6 +24,7 @@ FRAMEWORK_INSTALL?=$(PWD)
 
 # config values
 CXX?=g++
+TARGET_HOST?=i586-pc-mingw32
 
 # variables
 CPPFLAGS += $(shell $(FRAMEWORK_INSTALL)/bin/sdl-config --cflags)
@@ -52,6 +53,7 @@ release: CPPFLAGS += -DNDEBUG -gstabs3 -O3 -Wall -Wno-switch-enum
 # file based targets
 libframework.a: $(OBJS)
 	ar rcs libframework.a $(OBJS)
+	$(TARGET_HOST)-ranlib libframework.a
 
 AbstractGraphicsEngine.o: $(DEPS) $(FRAMEWORK_SRC)/AbstractGraphicsEngine.cpp $(FRAMEWORK_SRC)/AbstractGraphicsEngine.h
 	$(CXX) -g ${CPPFLAGS} -c $(FRAMEWORK_SRC)/AbstractGraphicsEngine.cpp
diff --git a/src/starsphere/Makefile.mingw b/src/starsphere/Makefile.mingw
index 0c5130810183129a5373d5515cd7a3da1487860a..a47949a4be6dc7d4493d0d61d0518c5148c34815 100644
--- a/src/starsphere/Makefile.mingw
+++ b/src/starsphere/Makefile.mingw
@@ -24,6 +24,7 @@ STARSPHERE_INSTALL?=$(PWD)
 
 # config values
 CXX ?= g++
+TARGET_HOST ?= i586-pc-mingw32
 
 # variables
 LIBS += -Wl,-Bstatic
@@ -106,7 +107,7 @@ $(RESOURCESPEC).o: $(STARSPHERE_SRC)/$(RESOURCESPEC).orc
 
 $(RESOURCESPEC)_mingw.o: $(STARSPHERE_SRC)/$(RESOURCESPEC).rc
 	cp $(STARSPHERE_SRC)/*.ico .
-	$(STARSPHERE_INSTALL)/bin/i586-pc-mingw32-windres -O coff -o $(RESOURCESPEC)_mingw.o $(STARSPHERE_SRC)/$(RESOURCESPEC).rc
+	$(TARGET_HOST)-windres -O coff -o $(RESOURCESPEC)_mingw.o $(STARSPHERE_SRC)/$(RESOURCESPEC).rc
 
 # tools
 install: