From 2c8ca36b5f87ccfc039c0b669c80f21205769758 Mon Sep 17 00:00:00 2001
From: Martchus <martchus@gmx.net>
Date: Sun, 9 Dec 2018 14:28:07 +0100
Subject: [PATCH 1/4] Fix clang/libc++ build under Android

---
 mkspecs/android-clang/qmake.conf | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/mkspecs/android-clang/qmake.conf b/mkspecs/android-clang/qmake.conf
index 05b7979142..83d030793b 100644
--- a/mkspecs/android-clang/qmake.conf
+++ b/mkspecs/android-clang/qmake.conf
@@ -30,11 +30,12 @@ QMAKE_CFLAGS += -gcc-toolchain $$NDK_TOOLCHAIN_PATH -fno-limit-debug-info
 QMAKE_LINK    = $$QMAKE_CXX $$QMAKE_CFLAGS -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a -nostdlib++
 equals(ANDROID_TARGET_ARCH, armeabi-v7a): QMAKE_LINK += -Wl,--exclude-libs,libunwind.a
 
-QMAKE_CFLAGS += -DANDROID_HAS_WSTRING --sysroot=$$NDK_ROOT/sysroot \
+QMAKE_CFLAGS += -DANDROID_HAS_WSTRING --sysroot=$$ANDROID_PLATFORM_ROOT_PATH \
                 -isystem $$NDK_ROOT/sysroot/usr/include/$$NDK_TOOLS_PREFIX \
                 -isystem $$NDK_ROOT/sources/cxx-stl/llvm-libc++/include \
                 -isystem $$NDK_ROOT/sources/android/support/include \
-                -isystem $$NDK_ROOT/sources/cxx-stl/llvm-libc++abi/include
+                -isystem $$NDK_ROOT/sources/cxx-stl/llvm-libc++abi/include \
+                -isystem $$NDK_ROOT/sysroot/usr/include
 
 ANDROID_SOURCES_CXX_STL_LIBDIR = $$NDK_ROOT/sources/cxx-stl/llvm-libc++/libs/$$ANDROID_TARGET_ARCH
 
@@ -44,6 +45,8 @@ ANDROID_USE_LLVM = true
 
 exists($$ANDROID_SOURCES_CXX_STL_LIBDIR/libc++.so): \
     ANDROID_CXX_STL_LIBS = -lc++
+else: exists($$ANDROID_SOURCES_CXX_STL_LIBDIR/libc++_shared.so): \
+    ANDROID_CXX_STL_LIBS = -lc++_shared
 else: \
     ANDROID_CXX_STL_LIBS = $$ANDROID_SOURCES_CXX_STL_LIBDIR/libc++.so.$$replace(ANDROID_PLATFORM, "android-", "")
 
-- 
2.23.0

