From 4b4b4893a40d7441db2dd2fa7e51f1ac1d9e8df8 Mon Sep 17 00:00:00 2001 From: Martchus Date: Sat, 20 Jul 2019 22:45:10 +0200 Subject: [PATCH] Add android-x86-64 version of some Android packages Not tested yet --- cppunit/android-x86-64/PKGBUILD | 111 ++++++++ kirigami2/android-x86-64/PKGBUILD | 61 +++++ libiconv/android-x86-64/PKGBUILD | 89 +++++++ openssl/android-x86-64/PKGBUILD | 92 +++++++ openssl/android-x86-64/setenv-android.sh | 243 ++++++++++++++++++ .../0001-Disable-mapboxgl.patch | 29 +++ ...1-Fix-clang-libc-build-under-Android.patch | 40 +++ ...002-Fix-androiddeployqt-search-paths.patch | 34 +++ ...003-Support-pkg-config-under-Android.patch | 24 ++ .../0004-Android-Fix-build-with-NDKr20.patch | 35 +++ qt5/android-x86-64/PKGBUILD | 182 +++++++++++++ qt5/android-x86-64/android-env.sh | 97 +++++++ 12 files changed, 1037 insertions(+) create mode 100644 cppunit/android-x86-64/PKGBUILD create mode 100644 kirigami2/android-x86-64/PKGBUILD create mode 100644 libiconv/android-x86-64/PKGBUILD create mode 100644 openssl/android-x86-64/PKGBUILD create mode 100644 openssl/android-x86-64/setenv-android.sh create mode 100644 qt5/android-x86-64/0001-Disable-mapboxgl.patch create mode 100644 qt5/android-x86-64/0001-Fix-clang-libc-build-under-Android.patch create mode 100644 qt5/android-x86-64/0002-Fix-androiddeployqt-search-paths.patch create mode 100644 qt5/android-x86-64/0003-Support-pkg-config-under-Android.patch create mode 100644 qt5/android-x86-64/0004-Android-Fix-build-with-NDKr20.patch create mode 100644 qt5/android-x86-64/PKGBUILD create mode 100755 qt5/android-x86-64/android-env.sh diff --git a/cppunit/android-x86-64/PKGBUILD b/cppunit/android-x86-64/PKGBUILD new file mode 100644 index 00000000..fb630bef --- /dev/null +++ b/cppunit/android-x86-64/PKGBUILD @@ -0,0 +1,111 @@ +# Maintainer: Martchus +# Contributor: Stéphane Gaudreault +# Contributor: Jeff 'codemac' Mickey + +# All my PKGBUILDs are managed at https://github.com/Martchus/PKGBUILDs where +# you also find the URL of a binary repository. + +_pkgname=cppunit +_pkg_arch=x86-64 +_android_arch=x86_64 +_android_toolchain=arm-linux-androideabi +_android_ndk_path=/opt/android-ndk +_android_api_level=28 +_android_platform_arch=arch-x86_64 +_android_platform_dir=android-$_android_api_level/${_android_platform_arch} +_android_prefix=${_android_ndk_path}/toolchains/${_android_toolchain}-4.9/prebuilt/linux-x86_64 +_android_sysroot=${_android_ndk_path}/platforms/android-$_android_api_level/${_android_platform_arch} +_android_gcc_toolchain_path=$_android_ndk_path/toolchains/$_android_toolchain-4.9/prebuilt/linux-x86_64 +_android_gcc_tool_prefix=${_android_gcc_toolchain_path}/bin/${_android_toolchain} +_android_clang_toolchain_path=$_android_ndk_path/toolchains/llvm/prebuilt/linux-x86_64/bin +_install_prefix=/opt/android-libs/$_pkg_arch + +pkgname=android-$_pkg_arch-$_pkgname +pkgver=1.14.0 +pkgrel=1 +pkgdesc="A C++ unit testing framework (Android, $_android_arch)" +arch=('any') +url="http://www.freedesktop.org/wiki/Software/cppunit" +license=('LGPL') +depends=('android-ndk') +conflicts=("android-$_pkgname-$_android_arch") +replaces=("android-$_pkgname-$_android_arch") +options=(!strip !buildflags !libtool staticlibs !emptydirs) +source=("https://dev-www.libreoffice.org/src/${_pkgname}-${pkgver}.tar.gz") +sha256sums=('3d569869d27b48860210c758c4f313082103a5e58219a7669b52bfd29d674780') + +build() { + # configure flags + local target_flags=" \ + --target=$_android_toolchain \ + --gcc-toolchain=$_android_gcc_toolchain_path \ + --sysroot=$_android_sysroot/usr" + local common_flags=" \ + $target_flags \ + -isystem $_android_ndk_path/sources/android/support/include \ + -isystem $_android_ndk_path/sources/cxx-stl/llvm-libc++/include \ + -isystem $_android_ndk_path/sources/cxx-stl/llvm-libc++abi/include \ + -isystem $_android_ndk_path/sysroot/usr/include \ + -isystem $_android_ndk_path/sysroot/usr/include/$_android_toolchain \ + -funwind-tables \ + -no-canonical-prefixes \ + -D__ANDROID_API__=$_android_api_level \ + -O3 \ + -fPIC \ + -DCPPUNIT_HAVE_LIBDL=1 \ + -Wno-unused-command-line-argument" + local ld_flags=" \ + $_android_ndk_path/sources/cxx-stl/llvm-libc++/libs/$_android_arch/libc++_shared.so \ + -nostdlib++" + export CPPFLAGS="$common_flags" + export CFLAGS="$common_flags $ld_flags" + export CXXFLAGS="$common_flags -fexceptions -frtti -std=c++14 $ld_flags" + export LDFLAGS="$target_flags $ld_flags" + + # configure tools + export AR=${_android_gcc_tool_prefix}-ar + export AS=${_android_gcc_tool_prefix}-as + export NM=${_android_gcc_tool_prefix}-nm + export CC=${_android_clang_toolchain_path}/clang + export CXX=${_android_clang_toolchain_path}/clang++ + export LD=${_android_gcc_tool_prefix}-ld + export RANLIB=${_android_gcc_tool_prefix}-ranlib + export STRIP=${_android_gcc_tool_prefix}-strip + + mkdir -p "${srcdir}/${_pkgname}-${pkgver}/build-${_android_toolchain}" + cd "${srcdir}/${_pkgname}-${pkgver}/build-${_android_toolchain}" + + ../configure \ + --host=$_android_toolchain \ + --target=$_android_toolchain \ + --build="$CHOST" \ + --with-sysroot="$_android_sysroot" \ + --prefix="$_install_prefix" \ + --libdir="$_install_prefix/lib" \ + --includedir="$_install_prefix/include" \ + --enable-shared=yes \ + --enable-static=yes + + # make sure the LDFLAGS are actually used and no unsuitable ones are added + sed -i "s:-shared -nostdlib:-shared $LDFLAGS:g" libtool + sed -i 's:\\$predep_objects \\$libobjs \\$deplibs \\$postdep_objects \\$compiler_flags:\\$libobjs:g' libtool + + # make only the actual cppunit library (DllPlugInTester does not build but I also don't need it) + cd src/cppunit + make V=1 +} + +package() { + mkdir -p "${srcdir}/${_pkgname}-${pkgver}/build-${_android_toolchain}" + cd "${srcdir}/${_pkgname}-${pkgver}/build-${_android_toolchain}" + + cd src/cppunit + make DESTDIR="${pkgdir}" install + cd ../.. + make DESTDIR="${pkgdir}" install-data + rm -rf "${pkgdir}/$_install_prefix/share/" + + # strip binaries + find "$pkgdir" -name 'lib*.so' -type f -exec "${_android_gcc_tool_prefix}-strip" --strip-unneeded {} \; + find "$pkgdir" -name 'lib*.a' -type f -exec "${_android_gcc_tool_prefix}-strip" -g {} \; +} diff --git a/kirigami2/android-x86-64/PKGBUILD b/kirigami2/android-x86-64/PKGBUILD new file mode 100644 index 00000000..be2f70e7 --- /dev/null +++ b/kirigami2/android-x86-64/PKGBUILD @@ -0,0 +1,61 @@ +# Maintainer: Martchus +# Contributor (maintains regular package): Antonio Rojas + +# All my PKGBUILDs are managed at https://github.com/Martchus/PKGBUILDs where +# you also find the URL of a binary repository. + +_pkgname=kirigami2 +_android_arch=x86_64 +_pkg_arch=x86-64 +_android_toolchain=$_pkg_arch-linux-android +_android_platform=22 +_prefix=/opt/android-libs/$_pkg_arch + +pkgname=android-$_pkg_arch-$_pkgname +pkgver=5.60.0 +pkgrel=1 +pkgdesc="A QtQuick based components set (Android, $_pkg_arch)" +arch=('any') +url='https://community.kde.org/Frameworks' +license=(LGPL) +depends=("android-$_pkg_arch-qt5") +makedepends=('cmake' 'android-ndk' 'android-sdk' 'extra-cmake-modules') +conflicts=("android-$_pkgname-$_android_arch") +replaces=("android-$_pkgname-$_android_arch") +source=("https://download.kde.org/stable/frameworks/${pkgver%.*}/$_pkgname-$pkgver.tar.xz"{,.sig}) +sha256sums=('f016481d393041513dda11345e9ee84723587fa4be9f17391ed1a5868477e153' + 'SKIP') +validpgpkeys=('53E6B47B45CEA3E0D5B7457758D0EE648A48B3BB') # David Faure +options=(!buildflags staticlibs !strip !emptydirs) + +prepare() { + mkdir -p build +} + +build() { + cd build + + # note: needs workaround for https://gitlab.kitware.com/cmake/cmake/issues/18739 (currently provided outside of the PKGBUILD itself) + + cmake ../$_pkgname-$pkgver \ + -DCMAKE_SYSTEM_NAME=Android \ + -DCMAKE_SYSTEM_VERSION=$_android_platform \ + -DCMAKE_ANDROID_ARCH_ABI=$_android_arch \ + -DCMAKE_ANDROID_NDK=/opt/android-ndk \ + -DCMAKE_ANDROID_SDK=/opt/android-sdk \ + -DCMAKE_ANDROID_STL_TYPE=c++_shared \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="$_prefix" \ + -DCMAKE_EXE_LINKER_FLAGS="-Wl,-rpath-link,$_prefix/lib" \ + -DCMAKE_FIND_ROOT_PATH="/opt/android-ndk/sysroot;$_prefix" \ + -DECM_DIR=/usr/share/ECM/cmake \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF \ + -DBUILD_QCH=OFF + make VERBOSE=1 +} + +package() { + cd build + make DESTDIR="$pkgdir" install +} diff --git a/libiconv/android-x86-64/PKGBUILD b/libiconv/android-x86-64/PKGBUILD new file mode 100644 index 00000000..4a5d1575 --- /dev/null +++ b/libiconv/android-x86-64/PKGBUILD @@ -0,0 +1,89 @@ +# Maintainer: Martchus +# Contributor: Arthur Darcet +# Contributor: Techlive Zheng + +_pkgname=libiconv +_pkg_arch=x86-64 +_android_arch=x86_64 +_android_toolchain=$_pkg_arch-linux-android +_android_platform=22 +_android_platform_arch=arch-x86_64 +_prefix=/opt/android-libs/$_pkg_arch +_android_ndk_path=/opt/android-ndk +_android_gcc_toolchain_path=$_android_ndk_path/toolchains/$_android_toolchain-4.9/prebuilt/linux-x86_64 +_android_gcc_tool_prefix=${_android_gcc_toolchain_path}/bin/${_android_toolchain} +_android_clang_toolchain_path=$_android_ndk_path/toolchains/llvm/prebuilt/linux-x86_64/bin +_android_sysroot=${_android_ndk_path}/platforms/android-$_android_platform/${_android_platform_arch} + +pkgname=android-$_pkg_arch-$_pkgname +pkgver=1.15 +pkgrel=1 +pkgdesc="Provides libiconv.so and libcharset.so (Android $_pkg_arch)" +arch=('any') +url='http://www.gnu.org/software/libiconv/' +license=('LGPL') +makedepends=('android-ndk') +conflicts=("android-$_pkgname-$_android_arch") +replaces=("android-$_pkgname-$_android_arch") +source=("http://ftp.gnu.org/pub/gnu/${_pkgname}/${_pkgname}-${pkgver}.tar.gz") +md5sums=('ace8b5f2db42f7b3b3057585e80d9808') +options=(!libtool !buildflags staticlibs !strip !emptydirs) + +build() { + cd $srcdir/${_pkgname}-${pkgver} + sed '/LD_RUN_PATH/d' -i Makefile.in + + # configure tools + export CPP=${PWD}/cpp.sh + export AR=${_android_gcc_tool_prefix}-ar + export AS=${_android_gcc_tool_prefix}-as + export NM=${_android_gcc_tool_prefix}-nm + export CC=${_android_clang_toolchain_path}/clang + export CXX=${_android_clang_toolchain_path}/clang++ + export LD=${_android_gcc_tool_prefix}-ld + export RANLIB=${_android_gcc_tool_prefix}-ranlib + export STRIP=${_android_gcc_tool_prefix}-strip + + # configure flags + export CFLAGS="${CFLAGS} --target=${_android_toolchain} --gcc-toolchain=${_android_gcc_toolchain_path} --sysroot=${_android_sysroot} -I${_android_ndk_path}/sysroot/usr/include -I${_android_ndk_path}/sysroot/usr/include/${_android_toolchain} -I${_android_sysroot}/usr/include -I${_android_gcc_toolchain_path}/include -fexceptions -frtti" + export CPPFLAGS="${CFLAGS}" + export LDFLAGS="${LDFLAGS} -L${_android_sysroot}/usr/lib" + + # setup preprocessor (because the NDK doesn't provide a wrapper like for gcc and g++) + printf "#!/bin/bash\nexec \"$CXX\" -target ${_android_toolchain} -E \"\$@\"" > "$CPP" + chmod +x "$CPP" + + ./configure \ + --host=$_android_toolchain \ + --target=$_android_toolchain \ + --build="$CHOST" \ + --with-sysroot="${_android_sysroot}" \ + --prefix="$_prefix" \ + --libdir="$_prefix/lib" \ + --includedir="$_prefix/include" \ + --enable-shared=yes \ + --enable-static=yes + + # make sure the LDFLAGS are actually used (LDFLAGS are not passed otherwise) + local libtool_subst="s:\\\$CC -shared:\\\$CC -shared --target=${_android_toolchain} --gcc-toolchain=${_android_gcc_toolchain_path} --sysroot=${_android_sysroot} $LDFLAGS:g" + sed -i "$libtool_subst" libtool + sed -i "$libtool_subst" libcharset/libtool + + # build target lib/localcharset.h and directory lib to experience less brokenness + make lib/localcharset.h + cd lib + make +} + +package() { + cd $srcdir/${_pkgname}-${pkgver}/lib + make DESTDIR="$pkgdir" LIBDIR="$_prefix/lib" install + cp libcharset.a "$pkgdir/$_prefix/lib/libcharset.a" + cp libcharset.so "$pkgdir/$_prefix/lib/libcharset.so" + cd .. + mkdir -p "$pkgdir/$_prefix"/include + mv include/iconv.h "$pkgdir/$_prefix"/include + cd libcharset + mv include/libcharset.h "$pkgdir/$_prefix"/include + mv include/localcharset.h "$pkgdir/$_prefix"/include +} diff --git a/openssl/android-x86-64/PKGBUILD b/openssl/android-x86-64/PKGBUILD new file mode 100644 index 00000000..86f69e16 --- /dev/null +++ b/openssl/android-x86-64/PKGBUILD @@ -0,0 +1,92 @@ +# $Id$ +# Maintainer: Martchus + +_pkg_arch=x86-64 +_android_arch=x86_64 +_android_toolchain=$_pkg_arch-linux-android +_android_platform=22 # https://developer.android.com/about/dashboards/ +_android_platform_arch=arch-x86_64 +_android_platform_dir=android-$_android_platform/${_android_platform_arch} +_pkgname=openssl +_ver=1.1.1c +_pref=/opt/android-libs/$_pkg_arch + +# export Android configuration +export ANDROID_MINIMUM_PLATFORM=$_android_platform +export ANDROID_NDK_ROOT=${ANDROID_NDK_ROOT:-/opt/android-ndk} +export ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT:-/opt/android-sdk} +export ANDROID_EABI=llvm +export ANDROID_ARCH=${_android_platform_arch} + +pkgname=android-$_pkg_arch-$_pkgname +# use a pacman compatible version scheme +pkgver=${_ver/[a-z]/.${_ver//[0-9.]/}} +pkgrel=1 +pkgdesc="The Open Source toolkit for Secure Sockets Layer and Transport Layer Security (Android, $_pkg_arch)" +arch=('any') +url='https://www.openssl.org' +license=('custom:BSD') +options=('!strip' '!buildflags' 'staticlibs' '!emptydirs') +depends=('android-sdk' 'android-ndk') +conflicts=("android-$_pkgname-$_android_arch") +replaces=("android-$_pkgname-$_android_arch") +source=("https://www.openssl.org/source/${_pkgname}-${_ver}.tar.gz" + "https://www.openssl.org/source/${_pkgname}-${_ver}.tar.gz.asc" + 'setenv-android.sh') +sha256sums=('f6fb3079ad15076154eda9413fed42877d668e7069d9b87396d0804fdb3f4c90' + 'SKIP' + 'SKIP') +validpgpkeys=('8657ABB260F056B1E5190839D9C4D26D0E604491' + '7953AC1FBC3DC8B3B292393ED5E9E43F7DF9EE8C') + +build() { + cd "$srcdir/$_pkgname-$_ver" + + # don't use -mandroid flag (Clang as provided by the NDK does not like it) + sed -i -e 's/-mandroid//' Configurations/15-android.conf + + source "$srcdir/setenv-android.sh" + + ./Configure \ + --prefix="$_pref" \ + --openssldir="$_pref" \ + --gcc-toolchain=$ANDROID_NDK_ROOT/toolchains/$_android_toolchain-4.9/prebuilt/linux-x86_64 \ + --sysroot=$ANDROID_NDK_ROOT/platforms/$_android_platform_dir/usr \ + -isystem"$ANDROID_NDK_ROOT/sysroot/usr/include" \ + -isystem"$ANDROID_NDK_ROOT/sysroot/usr/include/${_ANDROID_EABI%-*}" \ + -Wl,--no-allow-shlib-undefined \ + -Wl,--no-undefined \ + no-stdio \ + no-ui \ + threads \ + shared \ + android-${ANDROID_ARCH##arch-} + + # ensure the libraries are not versioned (setting CALC_VERSIONS doesn't work for some reason) + sed -i -e 's/\.\$(SHLIB_MAJOR)\.\$(SHLIB_MINOR)//g' Makefile + sed -i -e 's/\.\$(SHLIB_VERSION_NUMBER)//g' Makefile + + # get rid of debug printing so the library doesn't depend on stdio (no-stdio and no-ui are not entirely sufficient) + sed -i -e 's/\#define TEST_ENG_OPENSSL_RC4_P_INIT//' crypto/engine/eng_openssl.c + + # build only libraries + make CALC_VERSIONS="SHLIB_COMPAT=; SHLIB_SOVER=" build_libs +} + +package() { + cd "$srcdir/$_pkgname-$_ver" + source "$srcdir/setenv-android.sh" + + # install header files, libraries and license + for lib in libcrypto.{a,so} libssl.{a,so}; do + install -D -m0644 $lib "$pkgdir/$_pref/lib/$lib" + done + mkdir -p "$pkgdir/$_pref/include" + cp -r include/openssl "$pkgdir/$_pref/include" + install -D -m644 LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE + + # strip binaries + local strip_path=$ANDROID_TOOLCHAIN/${CROSS_COMPILE}strip + find "$pkgdir" -name 'lib*.so' -type f -exec "$strip_path" --strip-unneeded {} \; + find "$pkgdir" -name 'lib*.a' -type f -exec "$strip_path" -g {} \; +} diff --git a/openssl/android-x86-64/setenv-android.sh b/openssl/android-x86-64/setenv-android.sh new file mode 100644 index 00000000..f1fa4103 --- /dev/null +++ b/openssl/android-x86-64/setenv-android.sh @@ -0,0 +1,243 @@ +#!/bin/bash +# Cross-compile environment for Android on ARMv7 and x86 +# +# Contents licensed under the terms of the OpenSSL license +# http://www.openssl.org/source/license.html +# +# See http://wiki.openssl.org/index.php/FIPS_Library_and_Android +# and http://wiki.openssl.org/index.php/Android + +##################################################################### + +# Set ANDROID_NDK_ROOT to you NDK location. For example, +# /opt/android-ndk-r8e or /opt/android-ndk-r9. This can be done in a +# login script. If ANDROID_NDK_ROOT is not specified, the script will +# try to pick it up with the value of _ANDROID_NDK_ROOT below. If +# ANDROID_NDK_ROOT is set, then the value is ignored. +# _ANDROID_NDK="android-ndk-r8e" +_ANDROID_NDK="android-ndk-r9" +# _ANDROID_NDK="android-ndk-r10" + +# Set _ANDROID_EABI to the EABI you want to use. You can find the +# list in $ANDROID_NDK_ROOT/toolchains. This value is always used. +# _ANDROID_EABI="x86-4.6" +# _ANDROID_EABI="arm-linux-androideabi-4.6" +_ANDROID_EABI="${ANDROID_EABI:-arm-linux-androideabi-4.9}" + +# Set _ANDROID_ARCH to the architecture you are building for. +# This value is always used. +# _ANDROID_ARCH=arch-x86 +_ANDROID_ARCH=${ANDROID_ARCH:-arch-arm} + +# Set _ANDROID_API to the API you want to use. You should set it +# to one of: android-14, android-9, android-8, android-14, android-5 +# android-4, or android-3. You can't set it to the latest (for +# example, API-17) because the NDK does not supply the platform. At +# Android 5.0, there will likely be another platform added (android-22?). +# This value is always used. +_ANDROID_API="android-${ANDROID_MINIMUM_PLATFORM:-21}" + +##################################################################### + +# If the user did not specify the NDK location, try and pick it up. +# We expect something like ANDROID_NDK_ROOT=/opt/android-ndk-r8e +# or ANDROID_NDK_ROOT=/usr/local/android-ndk-r8e. + +if [ -z "$ANDROID_NDK_ROOT" ]; then + + _ANDROID_NDK_ROOT="" + if [ -z "$_ANDROID_NDK_ROOT" ] && [ -d "/usr/local/$_ANDROID_NDK" ]; then + _ANDROID_NDK_ROOT="/usr/local/$_ANDROID_NDK" + fi + + if [ -z "$_ANDROID_NDK_ROOT" ] && [ -d "/opt/$_ANDROID_NDK" ]; then + _ANDROID_NDK_ROOT="/opt/$_ANDROID_NDK" + fi + + if [ -z "$_ANDROID_NDK_ROOT" ] && [ -d "$HOME/$_ANDROID_NDK" ]; then + _ANDROID_NDK_ROOT="$HOME/$_ANDROID_NDK" + fi + + if [ -z "$_ANDROID_NDK_ROOT" ] && [ -d "$PWD/$_ANDROID_NDK" ]; then + _ANDROID_NDK_ROOT="$PWD/$_ANDROID_NDK" + fi + + # If a path was set, then export it + if [ ! -z "$_ANDROID_NDK_ROOT" ] && [ -d "$_ANDROID_NDK_ROOT" ]; then + export ANDROID_NDK_ROOT="$_ANDROID_NDK_ROOT" + fi +fi + +# Error checking +# ANDROID_NDK_ROOT should always be set by the user (even when not running this script) +# http://groups.google.com/group/android-ndk/browse_thread/thread/a998e139aca71d77 +if [ -z "$ANDROID_NDK_ROOT" ] || [ ! -d "$ANDROID_NDK_ROOT" ]; then + echo "Error: ANDROID_NDK_ROOT is not a valid path. Please edit this script." + # echo "$ANDROID_NDK_ROOT" + # exit 1 +fi + +# Error checking +if [ ! -d "$ANDROID_NDK_ROOT/toolchains" ]; then + echo "Error: ANDROID_NDK_ROOT/toolchains is not a valid path. Please edit this script." + # echo "$ANDROID_NDK_ROOT/toolchains" + # exit 1 +fi + +# Error checking +if [ ! -d "$ANDROID_NDK_ROOT/toolchains/$_ANDROID_EABI" ]; then + echo "Error: ANDROID_EABI is not a valid path. Please edit this script." + # echo "$ANDROID_NDK_ROOT/toolchains/$_ANDROID_EABI" + # exit 1 +fi + +##################################################################### + +# Based on ANDROID_NDK_ROOT, try and pick up the required toolchain. We expect something like: +# /opt/android-ndk-r83/toolchains/arm-linux-androideabi-4.7/prebuilt/linux-x86_64/bin +# Once we locate the toolchain, we add it to the PATH. Note: this is the 'hard way' of +# doing things according to the NDK documentation for Ice Cream Sandwich. +# https://android.googlesource.com/platform/ndk/+/ics-mr0/docs/STANDALONE-TOOLCHAIN.html + +ANDROID_TOOLCHAIN="" +for host in "linux-x86_64" "linux-x86" "darwin-x86_64" "darwin-x86" +do + if [ -d "$ANDROID_NDK_ROOT/toolchains/$_ANDROID_EABI/prebuilt/$host/bin" ]; then + ANDROID_TOOLCHAIN="$ANDROID_NDK_ROOT/toolchains/$_ANDROID_EABI/prebuilt/$host/bin" + break + fi +done + +# Error checking +if [ -z "$ANDROID_TOOLCHAIN" ] || [ ! -d "$ANDROID_TOOLCHAIN" ]; then + echo "Error: ANDROID_TOOLCHAIN is not valid. Please edit this script." + # echo "$ANDROID_TOOLCHAIN" + # exit 1 +fi + +case $_ANDROID_ARCH in + arch-arm) + ANDROID_TOOLS="arm-linux-androideabi-clang arm-linux-androideabi-ranlib arm-linux-androideabi-ld" + ;; + arch-arm64) + ANDROID_TOOLS="aarch64-linux-android-clang aarch64-linux-android-ranlib aarch64-linux-android-ld" + ;; + arch-x86) + ANDROID_TOOLS="i686-linux-android-clang i686-linux-android-ranlib i686-linux-android-ld" + ;; + *) + echo "ERROR ERROR ERROR" + ;; +esac + +for tool in $ANDROID_TOOLS +do + # Error checking + if [ ! -e "$ANDROID_TOOLCHAIN/$tool" ]; then + echo "Error: Failed to find $tool. Please edit this script." + # echo "$ANDROID_TOOLCHAIN/$tool" + # exit 1 + fi +done + +# Only modify/export PATH if ANDROID_TOOLCHAIN good +if [ ! -z "$ANDROID_TOOLCHAIN" ]; then + export ANDROID_TOOLCHAIN="$ANDROID_TOOLCHAIN" + export PATH="$ANDROID_TOOLCHAIN":"$PATH" +fi + +##################################################################### + +# For the Android SYSROOT. Can be used on the command line with --sysroot +# https://android.googlesource.com/platform/ndk/+/ics-mr0/docs/STANDALONE-TOOLCHAIN.html +export ANDROID_SYSROOT="$ANDROID_NDK_ROOT/platforms/$_ANDROID_API/$_ANDROID_ARCH" +#export ANDROID_SYSROOT="$ANDROID_NDK_ROOT/sysroot" +export CROSS_SYSROOT="$ANDROID_SYSROOT" +export NDK_SYSROOT="$ANDROID_SYSROOT" + +# Error checking +if [ -z "$ANDROID_SYSROOT" ] || [ ! -d "$ANDROID_SYSROOT" ]; then + echo "Error: ANDROID_SYSROOT is not valid. Please edit this script." + # echo "$ANDROID_SYSROOT" + # exit 1 +fi + +##################################################################### + +# If the user did not specify the FIPS_SIG location, try and pick it up +# If the user specified a bad location, then try and pick it up too. +if [ -z "$FIPS_SIG" ] || [ ! -e "$FIPS_SIG" ]; then + + # Try and locate it + _FIPS_SIG="" + if [ -d "/usr/local/ssl/$_ANDROID_API" ]; then + _FIPS_SIG=`find "/usr/local/ssl/$_ANDROID_API" -name incore` + fi + + if [ ! -e "$_FIPS_SIG" ]; then + _FIPS_SIG=`find $PWD -name incore` + fi + + # If a path was set, then export it + if [ ! -z "$_FIPS_SIG" ] && [ -e "$_FIPS_SIG" ]; then + export FIPS_SIG="$_FIPS_SIG" + fi +fi + +# Error checking. Its OK to ignore this if you are *not* building for FIPS +if [ -z "$FIPS_SIG" ] || [ ! -e "$FIPS_SIG" ]; then + echo "Error: FIPS_SIG does not specify incore module. Please edit this script." + # echo "$FIPS_SIG" + # exit 1 +fi + +##################################################################### + +# Most of these should be OK (MACHINE, SYSTEM, ARCH). RELEASE is ignored. +export MACHINE=armv7 +export RELEASE=2.6.37 +export SYSTEM=android +export ARCH=arm +export CROSS_COMPILE="arm-linux-androideabi-" + +if [ "$_ANDROID_ARCH" == "arch-x86" ]; then + export MACHINE=i686 + export RELEASE=2.6.37 + export SYSTEM=android + export ARCH=x86 + export CROSS_COMPILE="i686-linux-android-" +fi + +if [ "$_ANDROID_ARCH" == "arch-arm64" ]; then + export MACHINE=armv8 + export RELEASE=2.6.37 + export SYSTEM=android64 + export ARCH=arm + export CROSS_COMPILE="aarch64-linux-android-" +fi + +# For the Android toolchain +# https://android.googlesource.com/platform/ndk/+/ics-mr0/docs/STANDALONE-TOOLCHAIN.html +export ANDROID_SYSROOT="$ANDROID_NDK_ROOT/platforms/$_ANDROID_API/$_ANDROID_ARCH" +export SYSROOT="$ANDROID_SYSROOT" +export NDK_SYSROOT="$ANDROID_SYSROOT" +export ANDROID_NDK_SYSROOT="$ANDROID_SYSROOT" +export ANDROID_API="$_ANDROID_API" + +# CROSS_COMPILE and ANDROID_DEV are DFW (Don't Fiddle With). Its used by OpenSSL build system. +# export CROSS_COMPILE="arm-linux-androideabi-" +export ANDROID_DEV="$ANDROID_NDK_ROOT/platforms/$_ANDROID_API/$_ANDROID_ARCH/usr" +export HOSTCC=gcc + +VERBOSE=1 +if [ ! -z "$VERBOSE" ] && [ "$VERBOSE" != "0" ]; then + echo "ANDROID_NDK_ROOT: $ANDROID_NDK_ROOT" + echo "ANDROID_ARCH: $_ANDROID_ARCH" + echo "ANDROID_EABI: $_ANDROID_EABI" + echo "ANDROID_API: $ANDROID_API" + echo "ANDROID_SYSROOT: $ANDROID_SYSROOT" + echo "ANDROID_TOOLCHAIN: $ANDROID_TOOLCHAIN" + echo "FIPS_SIG: $FIPS_SIG" + echo "CROSS_COMPILE: $CROSS_COMPILE" + echo "ANDROID_DEV: $ANDROID_DEV" +fi diff --git a/qt5/android-x86-64/0001-Disable-mapboxgl.patch b/qt5/android-x86-64/0001-Disable-mapboxgl.patch new file mode 100644 index 00000000..dc11162e --- /dev/null +++ b/qt5/android-x86-64/0001-Disable-mapboxgl.patch @@ -0,0 +1,29 @@ +From 398cf8a783a1886d998e91253080fdafd1b79e38 Mon Sep 17 00:00:00 2001 +From: Martchus +Date: Sun, 9 Dec 2018 14:29:59 +0100 +Subject: [PATCH] Disable mapboxgl + +--- + src/plugins/geoservices/geoservices.pro | 9 --------- + 1 file changed, 9 deletions(-) + +diff --git a/src/plugins/geoservices/geoservices.pro b/src/plugins/geoservices/geoservices.pro +index b81ad34a..98308c97 100644 +--- a/src/plugins/geoservices/geoservices.pro ++++ b/src/plugins/geoservices/geoservices.pro +@@ -7,12 +7,3 @@ qtConfig(geoservices_mapbox): SUBDIRS += mapbox + qtConfig(geoservices_esri): SUBDIRS += esri + qtConfig(geoservices_itemsoverlay): SUBDIRS += itemsoverlay + qtConfig(geoservices_osm): SUBDIRS += osm +- +-qtConfig(geoservices_mapboxgl) { +- !exists(../../3rdparty/mapbox-gl-native/mapbox-gl-native.pro) { +- warning("Submodule mapbox-gl-native does not exist. Run 'git submodule update --init' on qtlocation.") +- } else { +- SUBDIRS += mapboxgl ../../3rdparty/mapbox-gl-native +- mapboxgl.depends = ../../3rdparty/mapbox-gl-native +- } +-} +-- +2.22.0 + diff --git a/qt5/android-x86-64/0001-Fix-clang-libc-build-under-Android.patch b/qt5/android-x86-64/0001-Fix-clang-libc-build-under-Android.patch new file mode 100644 index 00000000..780f0b24 --- /dev/null +++ b/qt5/android-x86-64/0001-Fix-clang-libc-build-under-Android.patch @@ -0,0 +1,40 @@ +From 5db5bdabc2587048072f3dbd98e9041905943d84 Mon Sep 17 00:00:00 2001 +From: Martchus +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 20c6efee16..4ccde62cf0 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 + 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.22.0 + diff --git a/qt5/android-x86-64/0002-Fix-androiddeployqt-search-paths.patch b/qt5/android-x86-64/0002-Fix-androiddeployqt-search-paths.patch new file mode 100644 index 00000000..794127e9 --- /dev/null +++ b/qt5/android-x86-64/0002-Fix-androiddeployqt-search-paths.patch @@ -0,0 +1,34 @@ +From 0c8762606483fc8ad571ebdd38e8b6c8f39ee0b4 Mon Sep 17 00:00:00 2001 +From: Martchus +Date: Sun, 9 Dec 2018 14:31:30 +0100 +Subject: [PATCH 2/4] Fix androiddeployqt search paths + +--- + src/tools/androiddeployqt/main.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp +index 01c392f8f9..9600d657cb 100644 +--- a/src/tools/androiddeployqt/main.cpp ++++ b/src/tools/androiddeployqt/main.cpp +@@ -1721,7 +1721,7 @@ bool scanImports(Options *options, QSet *usedDependencies) + rootPath += QLatin1Char('/'); + + QStringList importPaths; +- importPaths += shellQuote(options->qtInstallDirectory + QLatin1String("/qml")); ++ importPaths += shellQuote(options->qtInstallDirectory + QLatin1String("/lib/qt/qml")); + importPaths += shellQuote(rootPath); + for (const QString &qmlImportPath : qAsConst(options->qmlImportPaths)) + importPaths += shellQuote(qmlImportPath); +@@ -1857,7 +1857,7 @@ bool readDependencies(Options *options) + return false; + + // Jam in the dependencies of the platform plugin, since the application will crash without it +- if (!readDependenciesFromElf(options, options->qtInstallDirectory + QLatin1String("/plugins/platforms/android/libqtforandroid.so"), &usedDependencies, &remainingDependencies)) ++ if (!readDependenciesFromElf(options, options->qtInstallDirectory + QLatin1String("/lib/qt/plugins/platforms/android/libqtforandroid.so"), &usedDependencies, &remainingDependencies)) + return false; + + while (!remainingDependencies.isEmpty()) { +-- +2.22.0 + diff --git a/qt5/android-x86-64/0003-Support-pkg-config-under-Android.patch b/qt5/android-x86-64/0003-Support-pkg-config-under-Android.patch new file mode 100644 index 00000000..f8a51887 --- /dev/null +++ b/qt5/android-x86-64/0003-Support-pkg-config-under-Android.patch @@ -0,0 +1,24 @@ +From 0b61b7828c156b0621342f0f4dd855b561b9f6f0 Mon Sep 17 00:00:00 2001 +From: Martchus +Date: Sun, 7 Apr 2019 09:54:49 +0200 +Subject: [PATCH 3/4] Support pkg-config under Android + +from https://aur.archlinux.org/cgit/aur.git/commit/?h=android-aarch64-qt5&id=d901da324b2ceea2ac99b48137cb82b2bd920c77 +--- + mkspecs/android-clang/qmake.conf | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/mkspecs/android-clang/qmake.conf b/mkspecs/android-clang/qmake.conf +index 4ccde62cf0..d448291fe8 100644 +--- a/mkspecs/android-clang/qmake.conf ++++ b/mkspecs/android-clang/qmake.conf +@@ -53,3 +53,6 @@ else: \ + QMAKE_CFLAGS_OPTIMIZE_SIZE = -Oz + + include(../common/android-base-tail.conf) ++ ++QMAKE_PKG_CONFIG = $$[QT_INSTALL_PREFIX] ++QMAKE_PKG_CONFIG = android-$$section(QMAKE_PKG_CONFIG, /, 3, 3)-pkg-config +-- +2.22.0 + diff --git a/qt5/android-x86-64/0004-Android-Fix-build-with-NDKr20.patch b/qt5/android-x86-64/0004-Android-Fix-build-with-NDKr20.patch new file mode 100644 index 00000000..af693c5d --- /dev/null +++ b/qt5/android-x86-64/0004-Android-Fix-build-with-NDKr20.patch @@ -0,0 +1,35 @@ +From 43bba0798fb7367a67a7802832012d1a6b1662bd Mon Sep 17 00:00:00 2001 +From: BogDan Vatra +Date: Thu, 13 Jun 2019 09:38:48 +0300 +Subject: [PATCH 4/4] Android: Fix build with NDKr20 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +In NDK r20 clang adds -lc++ library automatically which leads to link fails. + +[ChangeLog][Android] Fix NDK r20 linking. + +Task-number: QTBUG-76293 +Change-Id: I6675180a3555d1ad9047d7a9ce1c03333cf0ab35 +Reviewed-by: Jörg Bornemann +--- + mkspecs/android-clang/qmake.conf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mkspecs/android-clang/qmake.conf b/mkspecs/android-clang/qmake.conf +index d448291fe8..8f145a2bb7 100644 +--- a/mkspecs/android-clang/qmake.conf ++++ b/mkspecs/android-clang/qmake.conf +@@ -27,7 +27,7 @@ else: equals(ANDROID_TARGET_ARCH, x86_64): \ + + 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 ++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=$$ANDROID_PLATFORM_ROOT_PATH \ +-- +2.22.0 + diff --git a/qt5/android-x86-64/PKGBUILD b/qt5/android-x86-64/PKGBUILD new file mode 100644 index 00000000..09a46670 --- /dev/null +++ b/qt5/android-x86-64/PKGBUILD @@ -0,0 +1,182 @@ +# PKGCONFIG for android-qt5 +# Maintainer in the AUR: Gonzalo Exequiel Pedone +# Contributor: Jiaxi Hu +# Contributor: jimmy00784 +# Contributor: Ricardo (XenGi) Band +# Contributor: Martchus + +_pkg_arch=x86-64 +_android_arch=x86_64 +_android_platform=22 + +pkgname=android-$_pkg_arch-qt5 +pkgver=5.13.0 +pkgrel=2 +pkgdesc="Qt 5 for Android" +arch=('x86_64') +url='https://www.qt.io' +license=('GPL3' 'LGPL') +makedepends=('libgl' + 'sqlite' + 'zlib' + 'python2' + 'python' # Qt Qml requires Python 3 + 'ruby' + 'gperf' + 'libxslt' + 'fontconfig' + 'java-environment-openjdk<=8' + 'android-pkg-config' + "android-$_pkg_arch-openssl") +depends=('java-runtime-headless-openjdk<=8' + 'apache-ant' + 'android-ndk' + "android-platform-$_android_platform" + 'android-sdk' + 'android-sdk-build-tools' + 'android-sdk-platform-tools') +groups=('android-qt5') +conflicts=("android-qt5-${_android_arch}") +replaces=("android-qt5-${_android_arch}") + +case "$_pkg_arch" in + aarch64) + optdepends=('android-google-apis-aarch64: AVD support' + 'android-aarch64-system-image: AVD support') + ;; + armv7a-eabi) + optdepends=('android-google-apis-armv7a-eabi: AVD support' + 'android-armv7a-eabi-system-image: AVD support') + ;; + x86) + optdepends=('android-google-apis-x86: AVD support' + 'android-x86-system-image: AVD support') + ;; + x86-64) + optdepends=('android-google-apis-x86-64: AVD support' + 'android-x86-64-system-image: AVD support') + ;; + *) + ;; +esac +optdepends+=("android-$_pkg_arch-openssl: SSL support for Qt Network") + +options=(!strip !buildflags staticlibs !emptydirs) +_pkgfqn="qt-everywhere-src-${pkgver}" +source=("http://download.qt-project.org/official_releases/qt/${pkgver:0:4}/${pkgver}/single/${_pkgfqn}.tar.xz" + '0001-Fix-clang-libc-build-under-Android.patch' + '0002-Fix-androiddeployqt-search-paths.patch' + '0003-Support-pkg-config-under-Android.patch' + '0004-Android-Fix-build-with-NDKr20.patch' + '0001-Disable-mapboxgl.patch' + 'android-env.sh') +sha256sums=('2cba31e410e169bd5cdae159f839640e672532a4687ea0f265f686421e0e86d6' + 'f38adf77126c692bf61bb90f31742539b942edc45975a375b87ff3a86a058adf' + '3f018a24adfc6567fff35605731f7c34fde456db071221941d1a3c6330601741' + 'a79934eb95c131eba9b776c387339c8bf1b20ad3ac0eea629b3ee3470679ee61' + 'c1c732f65fcb97c57969f76e1257caa6f6c2872b65b438447a92cc7a43b4182f' + 'b4755f99e6f9ab1df2650e13fa395b9706ee248d21309fed4270e69d201521c1' + 'c4bffe85aa675c1c1a76dda36c154154eccfcee353db6cafe2318c3848e23fb1') + +prepare() { + export ANDROID_MINIMUM_PLATFORM=${_android_platform} + source android-env.sh ${_pkg_arch} ${_android_arch} + + cd ${_pkgfqn} + + pushd qtbase + patch -Np1 -i "../../0001-Fix-clang-libc-build-under-Android.patch" + #patch -Np1 -i "../../0002-Fix-androiddeployqt-search-paths.patch" + patch -Np1 -i "../../0003-Support-pkg-config-under-Android.patch" + patch -Np1 -i "../../0004-Android-Fix-build-with-NDKr20.patch" + popd + + pushd qtlocation + # 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: + patch -Np1 -i "../../0001-Disable-mapboxgl.patch" + popd + + sed -i "s/android-16/android-$ANDROID_MINIMUM_PLATFORM/g" qtbase/mkspecs/features/android/sdk.prf + sed -i "s/android-16/android-$ANDROID_MINIMUM_PLATFORM/g" qtbase/src/android/jar/jar.pro + sed -i "s/android-16/android-$ANDROID_MINIMUM_PLATFORM/g" qtgamepad/src/plugins/gamepads/android/jar/jar.pro + sed -i "s/android-16/android-$ANDROID_MINIMUM_PLATFORM/g" qtbase/configure.pri +} + +build() { + export ANDROID_MINIMUM_PLATFORM=${_android_platform} + source android-env.sh ${_pkg_arch} ${_android_arch} + + unset CC CXX CFLAGS CXXFLAGS LDFLAGS CHOST QMAKESPEC QTDIR CARCH + + export PKG_CONFIG=$ANDROID_PKGCONFIG + export PYTHON=/usr/bin/python2 + + cd ${_pkgfqn} + + configue_opts=" + -confirm-license + -opensource + -silent + -prefix ${ANDROID_LIBS} + -examplesdir ${ANDROID_LIBS}/share/qt5/examples + -testsdir ${ANDROID_LIBS}/share/qt5/tests + -xplatform android-clang + -nomake tests + -nomake examples + -android-ndk ${ANDROID_NDK_HOME} + -android-sdk ${ANDROID_HOME} + -android-ndk-host linux-x86_64 + -android-toolchain-version 4.9 + -skip qtserialport + -no-warnings-are-errors + -no-pkg-config + -qt-zlib + -qt-freetype + -openssl-runtime + -android-arch ${_android_arch} + -android-ndk-platform ${ANDROID_NDK_PLATFORM} + -I${ANDROID_LIBS}/include" + + [[ $ANDROID_DEBUG_BUILD ]] \ + && configue_opts+=' -debug-and-release' \ + || configue_opts+=' -release' + + # add architecture specific options + case "$_pkg_arch" in + x86*) + configue_opts+=" + -no-sql-mysql + -no-sql-psql" + ;; + *) + ;; + esac + + ./configure ${configue_opts} + + make $MAKEFLAGS +} + +package() { + export ANDROID_MINIMUM_PLATFORM=${_android_platform} + source android-env.sh ${_pkg_arch} ${_android_arch} + + cd ${_pkgfqn} + + make INSTALL_ROOT=${pkgdir} install + + find ${pkgdir}/${ANDROID_LIBS}/bin -type f ! -name '*.pl' -exec strip {} \; + find ${pkgdir}/${ANDROID_LIBS}/lib -type f -name 'lib*.so' -exec ${ANDROID_STRIP} {} \; + find ${pkgdir}/${ANDROID_LIBS}/lib -type f \( -name 'lib*.a' ! -name 'libQt5Bootstrap.a' ! -name 'libQt5QmlDevTools.a' \) -exec ${ANDROID_STRIP} {} \; + find ${pkgdir}/${ANDROID_LIBS}/plugins -type f -name 'lib*.so' -exec ${ANDROID_STRIP} {} \; + find ${pkgdir}/${ANDROID_LIBS}/qml -type f -name 'lib*.so' -exec ${ANDROID_STRIP} {} \; + + # fix plugin path in Android-specific dependency file + sed -i 's/\"plugins\//\"lib\/qt\/plugins\//g' ${pkgdir}/${ANDROID_LIBS}/lib/*-android-dependencies.xml + + # 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' {} \; +} diff --git a/qt5/android-x86-64/android-env.sh b/qt5/android-x86-64/android-env.sh new file mode 100755 index 00000000..c5c63175 --- /dev/null +++ b/qt5/android-x86-64/android-env.sh @@ -0,0 +1,97 @@ +#!/bin/sh + +# Useful link to keep track of latest API changes: +# +# https://developer.android.com/ndk/downloads/revision_history + +_pkg_arch=$1 +_android_arch=$2 + +# Minimum Android platform based on: +# +# https://developer.android.com/about/dashboards/ +if [ -z "${ANDROID_MINIMUM_PLATFORM}" ]; then + export ANDROID_MINIMUM_PLATFORM=22 +fi + +if [ -z "${ANDROID_NDK_HOME}" ]; then + export ANDROID_NDK_HOME=/opt/android-ndk +fi + +if [ -z "${ANDROID_HOME}" ]; then + export ANDROID_HOME=/opt/android-sdk +fi + +get_last() { + ls $1 | sort -V | tail -n 1 +} + +if [ -z "${ANDROID_BUILD_TOOLS_REVISION}" ]; then + export ANDROID_BUILD_TOOLS_REVISION=$(get_last ${ANDROID_HOME}/build-tools) +fi + +if [ -z "${ANDROID_API_VERSION}" ]; then + export ANDROID_API_VERSION=android-$ANDROID_MINIMUM_PLATFORM +fi + +if [ -z "${ANDROID_NDK_PLATFORM}" ]; then + export ANDROID_NDK_PLATFORM=android-$ANDROID_MINIMUM_PLATFORM +fi + +export ANDROID_PLATFORM=${ANDROID_NDK_HOME}/platforms/$ANDROID_NDK_PLATFORM +export ANDROID_TOOLCHAIN=${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64 +export ANDROID_SYSROOT=${ANDROID_TOOLCHAIN}/sysroot +export ANDROID_CROSS_PREFIX=$ANDROID_TOOLCHAIN/bin/ +export ANDROID_PKGCONFIG=android-${_pkg_arch}-pkg-config + +case "$_pkg_arch" in + aarch64) + export ANDROID_TOOLS_COMPILER_PREFIX=${ANDROID_CROSS_PREFIX}aarch64-linux-android${ANDROID_MINIMUM_PLATFORM}- + export ANDROID_TOOLS_PREFIX=${ANDROID_CROSS_PREFIX}aarch64-linux-android- + ;; + armv7a-eabi) + export ANDROID_TOOLS_COMPILER_PREFIX=${ANDROID_CROSS_PREFIX}armv7a-linux-androideabi${ANDROID_MINIMUM_PLATFORM}- + export ANDROID_TOOLS_PREFIX=${ANDROID_CROSS_PREFIX}arm-linux-androideabi- + ;; + x86) + export ANDROID_TOOLS_COMPILER_PREFIX=${ANDROID_CROSS_PREFIX}i686-linux-android${ANDROID_MINIMUM_PLATFORM}- + export ANDROID_TOOLS_PREFIX=${ANDROID_CROSS_PREFIX}i686-linux-android- + ;; + x86-64) + export ANDROID_TOOLS_COMPILER_PREFIX=${ANDROID_CROSS_PREFIX}x86_64-linux-android${ANDROID_MINIMUM_PLATFORM}- + export ANDROID_TOOLS_PREFIX=${ANDROID_CROSS_PREFIX}x86_64-linux-android- + ;; +esac + +export ANDROID_CC=${ANDROID_TOOLS_COMPILER_PREFIX}clang +export ANDROID_CXX=${ANDROID_TOOLS_COMPILER_PREFIX}clang++ +export ANDROID_AR=${ANDROID_TOOLS_PREFIX}ar +export ANDROID_NM=${ANDROID_TOOLS_PREFIX}nm +export ANDROID_RANLIB=${ANDROID_TOOLS_PREFIX}ranlib +export ANDROID_STRIP=${ANDROID_TOOLS_PREFIX}strip +export ANDROID_LIBS=/opt/android-libs/${_pkg_arch} +export PKG_CONFIG_SYSROOT_DIR=${ANDROID_LIBS} +export PKG_CONFIG_LIBDIR=${PKG_CONFIG_SYSROOT_DIR}/lib/pkgconfig:${PKG_CONFIG_SYSROOT_DIR}/share/pkgconfig + +ndk_version() { + grep 'Pkg.Revision' ${ANDROID_NDK_HOME}/source.properties | awk '{print $3}' +} + +check_ndk_version_ge_than() { + version=$1 + ndk_ver=$(ndk_version) + + if [ "${version}" = "${ndk_ver}" ]; then + return 0 + fi + + older_ver=$(printf "${version}\n${ndk_ver}" | sort -V | head -n 1) + + if [ "${older_ver}" = "${ndk_ver}" ]; then + echo "ERROR: NDK version >= $version required." + + return 1 + fi + + return 0 +}