Add armv7a-eabi variants for all android packages

Not tested yet
This commit is contained in:
Martchus 2018-12-29 20:08:48 +01:00
parent a0813cd979
commit ef8077e8fb
12 changed files with 610 additions and 26 deletions

View File

@ -10,7 +10,8 @@ _android_toolchain=$_pkg_arch-linux-android
_android_platform=22
_android_prefix=/opt/android-libs/$_pkg_arch
_android_ndk_path=/opt/android-ndk
_android_platform_dir=android-$_android_platform/arch-arm64
_android_platform_arch=arch-arm64
_android_platform_dir=android-$_android_platform/${_android_platform_arch}
_boost_arch=arm
_boost_address_model=64

View File

@ -0,0 +1,157 @@
# Maintainer: Martchus <martchus@gmx.net>
# All my PKGBUILDs are managed at https://github.com/Martchus/PKGBUILDs where
# you also find the URL of a binary repository.
_pkgname=boost
_pkg_arch=armv7a-eabi
_android_arch=armeabi-v7a
_android_toolchain=$_pkg_arch-linux-android
_android_platform=21 # https://developer.android.com/about/dashboards/
_android_prefix=/opt/android-libs/$_pkg_arch
_android_ndk_path=/opt/android-ndk
_android_platform_arch=arch-arm
_android_platform_dir=android-$_android_platform/${_android_platform_arch}
_boost_arch=arm
_boost_address_model=32
pkgname=android-$_pkg_arch-$_pkgname
pkgver=1.68.0
_boostver=${pkgver//./_}
pkgrel=1
url='http://www.boost.org/'
arch=('any')
license=('custom')
pkgdesc="Free peer-reviewed portable C++ source libraries (Android, $_pkg_arch)"
depends=("android-$_pkg_arch-libiconv")
options=(!buildflags staticlibs !strip !emptydirs)
makedepends=('bzip2' 'zlib' 'android-ndk' 'android-sdk')
conflicts=("android-$_pkgname-$_android_arch")
replaces=("android-$_pkgname-$_android_arch")
source=(https://downloads.sourceforge.net/project/${_pkgname}/${_pkgname}/${pkgver}/${_pkgname}_${_boostver}.tar.bz2
no-versioned-shlibs.patch)
sha256sums=('7f6130bc3cf65f56a618888ce9d5ea704fa10b462be126ad053e80e553d6d8b7'
'd82d0f15064812dcabb3456a7bcb1db0e0f6145980e4728e638372e0fd35af23')
prepare() {
cd ${_pkgname}_${_boostver}
patch -i ../no-versioned-shlibs.patch
}
build() {
local _stagedir="${srcdir}/stagedir"
local jobs="$(sed -e 's/.*\(-j *[0-9]\+\).*/\1/' <<< ${MAKEFLAGS})"
local target_flags=" \
--target=$_android_toolchain \
--gcc-toolchain=$_android_ndk_path/toolchains/$_android_toolchain-4.9/prebuilt/linux-x86_64 \
--sysroot=$_android_ndk_path/platforms/$_android_platform_dir/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_platform \
-O3 \
-fPIC \
-DBOOST_ASIO_HAS_STD_STRING_VIEW=1"
local ld_flags=" \
$target_flags \
$_android_ndk_path/sources/cxx-stl/llvm-libc++/libs/$_android_arch/libc++_shared.so \
-nostdlib++"
cd ${_pkgname}_${_boostver}
./bootstrap.sh --with-toolset=gcc
_bindir="bin.linuxx86"
[[ "${CARCH}" = "x86_64" ]] && _bindir="bin.linuxx86_64"
install -Dm755 tools/build/src/engine/$_bindir/b2 "${_stagedir}"/bin/b2
# Support for OpenMPI
echo "using mpi ;" >> project-config.jam
# boostbook is needed by quickbook
install -dm755 "${_stagedir}"/share/boostbook
cp -a tools/boostbook/{xsl,dtd} "${_stagedir}"/share/boostbook/
export PATH=$_android_ndk_path/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
# default "minimal" install: "release link=shared,static
# runtime-link=shared threading=single,multi"
# --layout=tagged will add the "-mt" suffix for multithreaded libraries
# and installs includes in $_android_prefix/include/boost.
# --layout=system no longer adds the -mt suffix for multi-threaded libs.
# install to ${_stagedir} for consistency with regular boost package
"${_stagedir}"/bin/b2 \
--with-atomic \
--with-chrono \
--with-container \
--with-date_time \
--with-exception \
--with-fiber \
--with-filesystem \
--with-graph \
--with-graph_parallel \
--with-iostreams \
--with-locale \
--with-log \
--with-math \
--with-mpi \
--with-program_options \
--with-random \
--with-regex \
--with-serialization \
--with-signals \
--with-system \
--with-test \
--with-thread \
--with-timer \
--with-type_erasure \
--with-wave \
--with-stacktrace \
variant=release \
debug-symbols=off \
threading=multi \
runtime-link=shared \
link=shared,static \
target-os=android \
toolset=clang-android \
architecture=$_boost_arch \
address-model=$_boost_address_model \
-sICONV_PATH="/opt/android-libs/$_android_arch" \
cflags="$common_flags" \
cxxflags="$common_flags -fexceptions -frtti -std=c++14" \
linkflags="$ld_flags" \
--layout=system \
${jobs} \
\
--prefix="${_stagedir}" \
-d+2 \
install
}
package() {
local _stagedir="${srcdir}/stagedir"
install -dm755 "${pkgdir}"$_android_prefix
cp -a "${_stagedir}"/{include,share} "${pkgdir}"$_android_prefix
local libdir="${pkgdir}"$_android_prefix/lib
install -d "${libdir}"
cp -a "${_stagedir}"/lib/*.a "${libdir}"/
install -dm755 "${pkgdir}"$_android_prefix
cp -a "${_stagedir}"/lib "${pkgdir}"$_android_prefix
install -Dm644 "${srcdir}/"${_pkgname}_${_boostver}/LICENSE_1_0.txt \
"${pkgdir}"$_android_prefix/share/licenses/boost/LICENSE_1_0.txt
local strip=$_android_ndk_path/toolchains/$_android_toolchain-4.9/prebuilt/linux-x86_64/bin/$_android_toolchain-strip
find "${libdir}" -iname '*.a' -exec $strip -g {} \;
find "${libdir}" -iname '*.so' -exec $strip --strip-unneeded {} \;
}
# vim: ts=2 sw=2 et:

View File

@ -0,0 +1,11 @@
--- boostcpp.jam.old 2018-08-01 22:50:40.000000000 +0200
+++ boostcpp.jam 2018-10-07 01:48:30.175912524 +0200
@@ -154,7 +154,7 @@
# libFoo.1.2.3.dylib format. AIX linkers do not accept version suffixes
# either. Pgi compilers can not accept a library with version suffix.
if $(type) = SHARED_LIB &&
- ! [ $(property-set).get <target-os> ] in windows cygwin darwin aix &&
+ ! [ $(property-set).get <target-os> ] in windows cygwin darwin aix android &&
! [ $(property-set).get <toolset> ] in pgi
{
result = $(result).$(BOOST_VERSION) ;

View File

@ -6,14 +6,15 @@
# you also find the URL of a binary repository.
_pkgname=cppunit
_android_arch=arm64-v8a
_pkg_arch=aarch64
_android_arch=arm64-v8a
_android_toolchain=$_pkg_arch-linux-android
_android_ndk_path=/opt/android-ndk
_android_api_level=28
_android_platform=android-28/arch-arm64
_android_platform_arch=arch-arm64
_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-28/arch-arm64
_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
@ -38,7 +39,7 @@ build() {
local target_flags=" \
--target=$_android_toolchain \
--gcc-toolchain=$_android_gcc_toolchain_path \
--sysroot=$_android_ndk_path/platforms/$_android_platform/usr"
--sysroot=$_android_ndk_path/platforms/$_android_platform_dir/usr"
local common_flags=" \
$target_flags \
-isystem $_android_ndk_path/sources/android/support/include \

View File

@ -0,0 +1,111 @@
# Maintainer: Martchus <martchus@gmx.net>
# Contributor: Stéphane Gaudreault <stephane@archlinux.org>
# Contributor: Jeff 'codemac' Mickey <jeff@archlinux.org>
# 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=armv7a-eabi
_android_arch=armeabi-v7a
_android_toolchain=$_pkg_arch-linux-android
_android_ndk_path=/opt/android-ndk
_android_api_level=28
_android_platform_arch=arch-arm
_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_ndk_path/platforms/$_android_platform_dir/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 {} \;
}

View File

@ -60,22 +60,28 @@ for variant_dir in "${variant_dirs[@]}"; do
# ensure variant dir exists
if [[ ! -d $variant_dir ]]; then
warning "Creating $path/$variant_dir because it doesn't exist yet"
warning "Creating $path/$variant_dir because it doesn't exist yet; won't be able to preserve any variables"
mkdir "$variant_dir"
fi
# read values to preserve (use sed rather than just sourcing to preserve variables)
msg2 "Saving values to preserve"
declare -A values_to_preserve=()
for variable_to_preserve in "${variables_to_preserve[@]}"; do
value=$(sed -n -e "/^${variable_to_preserve}=.*$/p" "$variant_dir/PKGBUILD" | sed -E 's/([\:#$%&\-\])/\\\1/g')
values_to_preserve[$variable_to_preserve]=${value#${variable_to_preserve}=}
[[ $value ]] && plain " - $value"
# note: Last sed to escape special characters is required because the value is later passed again to sed as replacement value.
done
if [[ -f $variant_dir/PKGBUILD ]]; then
declare -A values_to_preserve=()
for variable_to_preserve in "${variables_to_preserve[@]}"; do
value=$(sed -n -e "/^${variable_to_preserve}=.*$/p" "$variant_dir/PKGBUILD" | sed -E 's/([\:#$%&\-\])/\\\1/g')
values_to_preserve[$variable_to_preserve]=${value#${variable_to_preserve}=}
[[ $value ]] && plain " - $value"
# note: Last sed to escape special characters is required because the value is later passed again to sed as replacement value.
done
else
warning "\"$path/$variant_dir/PKGBUILD\" does not exist; unable to preserve variables"
fi
msg2 "Replace files"
rm "$variant_dir/"* # clean existing files first (files might have been removed in master and we don't want any leftovers)
if [ "$variant_dir/"* ]; then
rm "$variant_dir/"* # clean existing files first (files might have been removed in master and we don't want any leftovers)
fi
cp "$master/"* "$variant_dir"
msg2 "Restore values to preserve"

View File

@ -3,8 +3,8 @@
# Contributor: Techlive Zheng <techlivezheng at gmail.com>
_pkgname=libiconv
_android_arch=arm64-v8a
_pkg_arch=aarch64
_android_arch=arm64-v8a
_android_toolchain=$_pkg_arch-linux-android
_android_platform=22
_prefix=/opt/android-libs/$_pkg_arch

View File

@ -0,0 +1,90 @@
# Maintainer: Martchus <martchus@gmx.net>
# Contributor: Arthur Darcet <arthur.darcet at m4x.org>
# Contributor: Techlive Zheng <techlivezheng at gmail.com>
_pkgname=libiconv
_pkg_arch=armv7a-eabi
_android_arch=armeabi-v7a
_android_toolchain=$_pkg_arch-linux-android
_android_platform=21
_prefix=/opt/android-libs/$_pkg_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 paths
export ANDROID_NDK=/opt/android-ndk
export CROSS_COMPILE=$_android_toolchain
export ANDROID_PREFIX=${ANDROID_NDK}/toolchains/$_android_toolchain-4.9/prebuilt/linux-x86_64
export ANDROID_SYSROOT=${ANDROID_NDK}/platforms/android-$_android_platform/arch-${_android_arch%-*}/usr
export CROSS_PATH=${ANDROID_PREFIX}/bin/$_android_toolchain
# configure tools
export CPP=${PWD}/cpp.sh
export AR=${CROSS_PATH}-ar
export AS=${CROSS_PATH}-as
export NM=${CROSS_PATH}-nm
export CC=${CROSS_PATH}-gcc
export CXX=${CROSS_PATH}-g++
export LD=${CROSS_PATH}-ld
export RANLIB=${CROSS_PATH}-ranlib
export STRIP=${CROSS_PATH}-strip
# configure flags
export CFLAGS="${CFLAGS} --gcc-toolchain=${ANDROID_PREFIX} --sysroot=${ANDROID_SYSROOT} -I${ANDROID_NDK}/sysroot/usr/include -I${ANDROID_NDK}/sysroot/usr/include/${CROSS_COMPILE} -I${ANDROID_SYSROOT}/usr/include -I${ANDROID_PREFIX}/include"
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 \"$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++\" -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 --gcc-toolchain=${ANDROID_PREFIX} --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
}

View File

@ -1,12 +1,12 @@
# $Id$
# Maintainer: Martchus <martchus@gmx.net>
_android_arch=arm64-v8a
_pkg_arch=aarch64
_android_arch=arch-arm64
_android_arch=arm64-v8a
_android_toolchain=$_pkg_arch-linux-android
_android_platform=22 # https://developer.android.com/about/dashboards/
_android_platform_dir=android-$_android_platform/$_android_arch
_android_platform_arch=arch-arm64
_android_platform_dir=android-$_android_platform/${_android_platform_arch}
_pkgname=openssl
_ver=1.1.1a
_pref=/opt/android-libs/$_pkg_arch
@ -16,7 +16,7 @@ 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=$_android_toolchain-4.9
export ANDROID_ARCH=$_android_arch
export ANDROID_ARCH=${_android_platform_arch}
pkgname=android-$_pkg_arch-$_pkgname
# use a pacman compatible version scheme

View File

@ -1,12 +1,12 @@
# $Id$
# Maintainer: Martchus <martchus@gmx.net>
_android_arch=arch-arm
_pkg_arch=armv7a-eabi
_android_arch=arch-arm
_android_arch=armeabi-v7a
_android_toolchain=$_pkg_arch-linux-android
_android_platform=21
_android_platform_dir=android-$_android_platform/$_android_arch
_android_platform=21 # https://developer.android.com/about/dashboards/
_android_platform_arch=arch-arm
_android_platform_dir=android-$_android_platform/${_android_platform_arch}
_pkgname=openssl
_ver=1.1.1a
_pref=/opt/android-libs/$_pkg_arch
@ -16,7 +16,7 @@ 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=$_android_toolchain-4.9
export ANDROID_ARCH=$_android_arch
export ANDROID_ARCH=${_android_platform_arch}
pkgname=android-$_pkg_arch-$_pkgname
# use a pacman compatible version scheme

View File

@ -8,12 +8,13 @@
# Useful link to keep track of latest API changes:
# https://developer.android.com/ndk/downloads/revision_history
_android_arch=arm64-v8a
_pkg_arch=aarch64
_android_arch=arm64-v8a
_android_platform=22
# Minimum Android platform based on:
# https://developer.android.com/about/dashboards/
export ANDROID_MINIMUM_PLATFORM=${ANDROID_MINIMUM_PLATFORM:-22}
export ANDROID_MINIMUM_PLATFORM=${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}

View File

@ -0,0 +1,206 @@
# PKGCONFIG for android-qt5
# Maintainer in the AUR: Gonzalo Exequiel Pedone <hipersayan DOT x AT gmail DOT com>
# Contributor: Jiaxi Hu <sftrytry _AT_ gmail _DOT_ com>
# Contributor: jimmy00784 <jimmy00784@gmail.com>
# Contributor: Ricardo (XenGi) Band <email@ricardo.band>
# Contributor: Martchus <martchus@gmx.net>
# Useful link to keep track of latest API changes:
# https://developer.android.com/ndk/downloads/revision_history
_pkg_arch=armv7a-eabi
_android_arch=armeabi-v7a
_android_platform=21
# Minimum Android platform based on:
# https://developer.android.com/about/dashboards/
export ANDROID_MINIMUM_PLATFORM=${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}
_pkgname=
pkgname=
pkgver=5.12.0
pkgrel=1
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'
"android-$_pkg_arch-openssl")
depends=('java-runtime-headless>=7'
'apache-ant'
'android-ndk'
"android-platform-$ANDROID_MINIMUM_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'
'0001-Disable-mapboxgl.patch')
sha256sums=('356f42d9087718f22f03d13d0c2cdfb308f91dc3cf0c6318bed33f2094cd9d6c'
'8a32e92dbaab5a371467903c89781a4e27f8c2403fe47b9a0ef0dca65c80be41'
'cfb3de9c62ed6956bb1fe9f7d13384de236e87ff949aa6a4bb8257078729c9e0'
'2ef1ddd8f84474b2dbe06c5e1a2db80a96ebd8cf529f1e1ce465fb6d406e366f')
_pref=/opt/android-libs/$_pkg_arch
prepare() {
cd ${_pkgfqn}
pushd qtbase
patch -Np1 -i "../../0001-Fix-clang-libc-build-under-Android.patch"
patch -Np1 -i "../../0002-Fix-androiddeployqt-search-paths.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
}
get_last() {
ls $1 | sort -V | tail -n 1
}
build() {
cd ${_pkgfqn}
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
configue_opts="
-confirm-license
-opensource
-silent
-prefix ${_pref}
-archdatadir ${_pref}/lib/qt
-datadir ${_pref}/share/qt
-examplesdir ${_pref}/share/qt/examples
-testsdir ${_pref}/share/qt/tests
-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 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/opt/android-libs/$_pkg_arch/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() {
cd ${_pkgfqn}
make INSTALL_ROOT=${pkgdir} install
case "$_pkg_arch" in
aarch64)
toolchain=aarch64-linux-android-4.9
stripFolder=aarch64-linux-android
;;
armv7a-eabi)
toolchain=arm-linux-androideabi-4.9
stripFolder=arm-linux-androideabi
;;
x86)
toolchain=x86-4.9
stripFolder=i686-linux-android
;;
x86-64)
toolchain=x86_64-4.9
stripFolder=x86_64-linux-android
;;
esac
local STRIP=${ANDROID_NDK_ROOT}/toolchains/${toolchain}/prebuilt/linux-x86_64/${stripFolder}/bin/strip
find ${pkgdir}/${_pref}/bin -type f ! -name '*.pl' -exec strip {} \;
find ${pkgdir}/${_pref}/lib -type f -name 'lib*.so' -exec ${STRIP} {} \;
find ${pkgdir}/${_pref}/lib \( -type f -name 'lib*.a' ! -name 'libQt5Bootstrap.a' ! -name 'libQt5QmlDevTools.a' \) -exec ${STRIP} {} \;
find ${pkgdir}/${_pref}/lib/qt/plugins -type f -name 'lib*.so' -exec ${STRIP} {} \;
# fix plugin path in Android-specific dependency file
sed -i 's/\"plugins\//\"lib\/qt\/plugins\//g' ${pkgdir}/${_pref}/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' {} \;
}