Use our prebuilt Mingw64 toolchain to build Win32 binaries.

This patch switches the build to always use our custom prebuilt
toolchain (based on GCC 4.8.3 these days) to build our Windows
binaries on Linux.

Note that this still only builds Win32 binaries only, support for
Win64 will appear in a future patch.

Change-Id: I1f7693550518c2c8a5a3ab7fe15261b9bebe61a0
diff --git a/android/build/common.sh b/android/build/common.sh
index 992b769..b859862 100644
--- a/android/build/common.sh
+++ b/android/build/common.sh
@@ -16,6 +16,7 @@
 # It contains common definitions.
 #
 PROGNAME=`basename $0`
+PROGDIR=`dirname $0`
 
 ## Logging support
 ##
@@ -203,27 +204,25 @@
         echo "Sorry, but mingw compilation is only supported on Linux !"
         exit 1
     fi
-    # Do we have the binaries installed
-    log "Mingw64    : Checking for mingw64 installation"
-    MINGW64_PREFIX=x86_64-w64-mingw32
-    find_program MINGW64_CC $MINGW64_PREFIX-gcc
-    if [ -n "$MINGW64_CC" ]; then
-        MINGW_CC=$MINGW64_CC
-        MINGW_PREFIX=$MINGW64_PREFIX
-    else
-    log "Mingw      : Checking for mingw32 installation"
-    MINGW32_PREFIX=i586-mingw32msvc
-    find_program MINGW32_CC $MINGW32_PREFIX-gcc
-    if [ -z "$MINGW32_CC" ] ; then
-            echo "ERROR: It looks like neither $MINGW64_PREFIX-cc nor $MINGW32_PREFIX-gcc"
-            echo "are in your path. Please install the mingw32 package !"
-        exit 1
-        fi
-        MINGW_CC=$MINGW32_CC
-        MINGW_PREFIX=$MINGW32_PREFIX
-        FORCE_32BIT=no
+    # Do we have our prebuilt mingw64 toolchain?
+    log "Mingw      : Looking for prebuilt mingw64 toolchain."
+    MINGW_DIR=$PROGDIR/../../prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8
+    MINGW_CC=
+    if [ -d "$MINGW_DIR" ]; then
+        MINGW_PREFIX=$MINGW_DIR/bin/x86_64-w64-mingw32
+        find_program MINGW_CC "$MINGW_PREFIX-gcc"
     fi
-    log2 "Mingw      : Found $MINGW32_CC"
+    if [ -z "$MINGW_CC" ]; then
+        log "Mingw      : Looking for mingw64 toolchain."
+        MINGW_PREFIX=x86_64-w64-mingw32
+        find_program MINGW_CC $MINGW_PREFIX-gcc
+    fi
+    if [ -z "$MINGW_CC" ]; then
+        echo "ERROR: It looks like no Mingw64 toolchain is available!"
+        echo "Please install x86_64-w64-mingw32 package !"
+        exit 1
+    fi
+    log2 "Mingw      : Found $MINGW_CC"
     CC=$MINGW_CC
     LD=$MINGW_CC
     AR=$MINGW_PREFIX-ar