Use libc++ in android-qt5

Not tested yet
This commit is contained in:
Martchus 2018-10-07 22:26:11 +02:00
parent 98d9d51490
commit fcfc53d0fb
2 changed files with 45 additions and 42 deletions

View File

@ -0,0 +1,23 @@
--- a/qtbase/mkspecs/android-clang/qmake.conf 2018-09-13 01:25:10.000000000 -0300
+++ b/qtbase/mkspecs/android-clang/qmake.conf 2018-09-23 15:53:19.000000000 -0300
@@ -31,16 +31,17 @@
QMAKE_CFLAGS += -gcc-toolchain $$NDK_TOOLCHAIN_PATH
QMAKE_LINK = $$QMAKE_CXX $$QMAKE_CFLAGS -Wl,--exclude-libs,libgcc.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
ANDROID_STDCPP_PATH = $$ANDROID_SOURCES_CXX_STL_LIBDIR/libc++_shared.so
-ANDROID_CXX_STL_LIBS = -lc++
+ANDROID_CXX_STL_LIBS = -lc++_shared
QMAKE_CFLAGS_OPTIMIZE_SIZE = -Oz

View File

@ -6,18 +6,19 @@
# Contributor: Martchus <martchus@gmx.net>
# Useful link to keep track of latest API changes:
#
# https://developer.android.com/ndk/downloads/revision_history
android_arch=arm64-v8a
# Minimum Android platform based on:
#
# https://developer.android.com/about/dashboards/
ANDROID_MINIMUM_PLATFORM=21
export ANDROID_MINIMUM_PLATFORM
export ANDROID_MINIMUM_PLATFORM=${ANDROID_MINIMUM_PLATFORM:-21}
# Skip building mapboxgl as it increases compile time significantly and
export ANDROID_NDK_ROOT=${ANDROID_NDK_ROOT:-/opt/android-ndk}
export ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT:-/opt/android-sdk}
export OPENSSL_PREFIX=${OPENSSL_PREFIX:-/opt/android-libs/${android_arch}}
# skip building mapboxgl as it increases compile time significantly and
# likely not a lot of people actually using it; if you need it, just remove the
# following line:
_mapboxcfg='QT.global.disabled_features+=geoservices_mapboxgl'
@ -57,13 +58,15 @@ options=('!strip'
'staticlibs'
'!emptydirs')
_pkgfqn="qt-everywhere-src-${pkgver}"
source=("http://download.qt-project.org/official_releases/qt/${pkgver:0:4}/${pkgver}/single/${_pkgfqn}.tar.xz")
md5sums=('c6f0854d7de7bde80cfd8cc85bb7152b')
source=("http://download.qt-project.org/official_releases/qt/${pkgver:0:4}/${pkgver}/single/${_pkgfqn}.tar.xz"
'0001-Fix-clang-build.patch')
sha256sums=('c6f0854d7de7bde80cfd8cc85bb7152b'
'todo')
prepare() {
cd ${_pkgfqn}
# Platform specific patches.
patch -Np1 -i "../0001-Fix-clang-build.patch"
}
get_last() {
@ -73,50 +76,28 @@ get_last() {
build() {
cd ${_pkgfqn}
unset CC
unset CXX
unset CFLAGS
unset CXXFLAGS
unset LDFLAGS
unset CHOST
unset QMAKESPEC
unset QTDIR
unset CARCH
export ANDROID_NDK_ROOT=/opt/android-ndk
export ANDROID_SDK_ROOT=/opt/android-sdk
export OPENSSL_PREFIX=/opt/android-libs/${android_arch}
if [ -z "${ANDROID_BUILD_TOOLS_REVISION}" ]; then
export ANDROID_BUILD_TOOLS_REVISION=$(get_last ${ANDROID_SDK_ROOT}/build-tools)
fi
if [ -z "${ANDROID_API_VERSION}" ]; then
export ANDROID_API_VERSION=android-$ANDROID_MINIMUM_PLATFORM
fi
unset CC CXX CFLAGS CXXFLAGS LDFLAGS CHOST QMAKESPEC QTDIR CARCH
export ANDROID_BUILD_TOOLS_REVISION=${ANDROID_BUILD_TOOLS_REVISION:-$(get_last ${ANDROID_SDK_ROOT}/build-tools)}
export ANDROID_API_VERSION=${ANDROID_API_VERSION:-android-$ANDROID_MINIMUM_PLATFORM}
export ANDROID_NDK_PLATFORM=${ANDROID_NDK_PLATFORM:-android-$ANDROID_MINIMUM_PLATFORM}
export PYTHON=/usr/bin/python2
if [ -z "${ANDROID_NDK_PLATFORM}" ]; then
export ANDROID_NDK_PLATFORM=android-$ANDROID_MINIMUM_PLATFORM
fi
_pref=/opt/${_pkgname}/${pkgver}/${android_arch}
local prefix=/opt/${_pkgname}/${pkgver}/${android_arch}
configue_opts="
-confirm-license
-opensource
-silent
-prefix ${_pref}
-docdir ${_pref}/doc
-xplatform android-g++
-prefix ${prefix}
-docdir ${prefix}/doc
-xplatform android-clang
-nomake tests
-nomake examples
-android-ndk ${ANDROID_NDK_ROOT}
-android-sdk ${ANDROID_SDK_ROOT}
-android-ndk-host linux-x86_64
-android-toolchain-version 4.9
-skip qttranslations
-skip qtserialport
-no-warnings-are-errors
-no-pkg-config
@ -128,7 +109,7 @@ build() {
-I${OPENSSL_PREFIX}/include
${_mapboxcfg}"
# Platform specific patches
# add architecture specific options
case "$android_arch" in
x86*)
configue_opts+="
@ -168,13 +149,12 @@ package() {
;;
esac
export ANDROID_NDK_ROOT=/opt/android-ndk
STRIP=${ANDROID_NDK_ROOT}/toolchains/${toolchain}/prebuilt/linux-x86_64/${stripFolder}/bin/strip
local STRIP=${ANDROID_NDK_ROOT}/toolchains/${toolchain}/prebuilt/linux-x86_64/${stripFolder}/bin/strip
find ${pkgdir}/opt/${_pkgname}/${pkgver}/${android_arch}/lib -name 'lib*.so' -exec ${STRIP} {} \;
find ${pkgdir}/opt/${_pkgname}/${pkgver}/${android_arch}/lib \( -name 'lib*.a' ! -name 'libQt5Bootstrap.a' ! -name 'libQt5QmlDevTools.a' \) -exec ${STRIP} {} \;
find ${pkgdir}/opt/${_pkgname}/${pkgver}/${android_arch}/plugins -name 'lib*.so' -exec ${STRIP} {} \;
# Drop QMAKE_PRL_BUILD_DIR because reference the build dir
# drop QMAKE_PRL_BUILD_DIR because reference the build dir
find "${pkgdir}/" -type f -name '*.prl' \
-exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \;
}