From 437f5662d37ec2334e16b51e8d4543025e36d929 Mon Sep 17 00:00:00 2001
From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Date: Wed, 9 Mar 2016 18:27:50 +0100
Subject: [PATCH] Allow overriding Android NDK host on Windows

The -android-ndk-host argument to configure existed in the shell
script, but not in the Windows version. When using a 64-bit NDK
but a 32-bit host compiler (which is what we bundle with our
SDK), we would not detect the correct NDK host, making it impossible
to build Qt with this combo.

[ChangeLog][Android] Added -android-ndk-host configure option on
Windows.

Change-Id: Ie6a92b66e6875ed53f46fe41ecced70c3ec67585
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
---
 tools/configure/configureapp.cpp | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index 298e27244e2..f63892b6cc8 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -1370,6 +1370,14 @@ void Configure::parseCmdLine()
             dictionary[ "ANDROID_PLATFORM" ] = configCmdLine.at(i);
         }
 
+        else if (configCmdLine.at(i) == "-android-ndk-host") {
+            ++i;
+            if (i == argCount)
+                break;
+
+            dictionary[ "ANDROID_HOST" ] = configCmdLine.at(i);
+        }
+
         else if (configCmdLine.at(i) == "-android-arch") {
             ++i;
             if (i == argCount)
@@ -3464,7 +3472,9 @@ void Configure::generateQDevicePri()
         deviceStream << "android_install {" << endl;
         deviceStream << "    DEFAULT_ANDROID_SDK_ROOT = " << formatPath(dictionary["ANDROID_SDK_ROOT"]) << endl;
         deviceStream << "    DEFAULT_ANDROID_NDK_ROOT = " << formatPath(dictionary["ANDROID_NDK_ROOT"]) << endl;
-        if (QSysInfo::WordSize == 64)
+        if (dictionary.contains("ANDROID_HOST"))
+            deviceStream << "    DEFAULT_ANDROID_NDK_HOST = " << dictionary["ANDROID_HOST"] << endl;
+        else if (QSysInfo::WordSize == 64)
             deviceStream << "    DEFAULT_ANDROID_NDK_HOST = windows-x86_64" << endl;
         else
             deviceStream << "    DEFAULT_ANDROID_NDK_HOST = windows" << endl;
-- 
GitLab