Update android build dependencies

Update android build dependencies.  Use android NDK r20 and build
aarch64 binary.
pull/1467/head
Tatsuhiro Tsujikawa 2019-09-15 11:15:29 +09:00
parent 7f6578aa7d
commit 9f5758570a
7 changed files with 38 additions and 82 deletions

View File

@ -42,11 +42,11 @@ aria2c executable was generated using android-ndk-r14b.
The following libraries were statically linked.
* openssl 1.0.2o
* expat 2.2.5
* openssl 1.1.1c
* expat 2.2.7
* zlib 1.2.11
* c-ares 1.14.0
* libssh2 1.8.0
* c-ares 1.15.0
* libssh2 1.9.0
Since Android does not have ``/etc/resolv.conf``, c-ares (asynchronous
DNS resolver) is disabled by default. But name resolution is sometimes

View File

@ -359,7 +359,7 @@ Cross-compiling Android binary
In this section, we describe how to build Android binary using Android
NDK cross-compiler on Debian Linux.
At the time of this writing, android-ndk-r14b should compile aria2
At the time of this writing, Android NDK r20 should compile aria2
without errors.
``android-config`` script is a configure script wrapper for Android
@ -376,33 +376,17 @@ When building the above libraries, make sure that disable shared
library and enable only static library. We are going to link those
libraries statically.
We use zlib which comes with Android NDK, so we don't have to build it
by ourselves.
``android-config`` assumes that ``$ANDROID_HOME`` and ``$NDK``
environment variables are defined.
``android-config`` assumes the existence of ``$ANDROID_HOME``
environment variable which must fulfill the following conditions:
We currently use Android NDK r20. ``$NDK`` should point to the
directory to Anroid NDK. The build tools will be found under
``$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/``.
* Android NDK toolchain is installed under
``$ANDROID_HOME/toolchain``. Refer to `Standalone Toolchain
<https://developer.android.com/ndk/guides/standalone_toolchain.html>`_
for more details, but it is a bit out of date.
All the dependent libraries must be installed under
``$ANDROID_HOME/usr/local``.
To install toolchain under ``$ANDROID_HOME/toolchain``, do this:
.. code-block:: text
$NDK/build/tools/make_standalone_toolchain.py \
--arch arm --api 16 --stl=gnustl \
--install-dir $ANDROID_HOME/toolchain
* The dependent libraries must be installed under
``$ANDROID_HOME/usr/local``.
Before running ``android-config`` and ``android-make``,
``$ANDROID_HOME`` environment variable must be set to point to the
correct path.
After ``android-config``, run ``android-make`` to compile sources.
After ``android-config``, run ``make`` to compile sources.
Building documentation
----------------------

View File

@ -35,12 +35,15 @@ if [ -z "$ANDROID_HOME" ]; then
echo 'No $ANDROID_HOME specified.'
exit 1
fi
if [ -z "$NDK" ]; then
echo 'No $NDK specified.'
exit 1
fi
PREFIX=$ANDROID_HOME/usr/local
TOOLCHAIN=$ANDROID_HOME/toolchain
PATH=$TOOLCHAIN/bin:$PATH
TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64
./configure \
--host=arm-linux-androideabi \
--host=aarch64-linux-android \
--build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \
--disable-nls \
--without-gnutls \
@ -51,10 +54,15 @@ PATH=$TOOLCHAIN/bin:$PATH
--with-libcares \
--with-libz \
--with-libssh2 \
CC="$TOOLCHAIN"/bin/arm-linux-androideabi-clang \
CXX="$TOOLCHAIN"/bin/arm-linux-androideabi-clang++ \
AR=$TOOLCHAIN/bin/aarch64-linux-android-ar \
AS=$TOOLCHAIN/bin/aarch64-linux-android-as \
CC=$TOOLCHAIN/bin/aarch64-linux-android29-clang \
CXX=$TOOLCHAIN/bin/aarch64-linux-android29-clang++ \
LD=$TOOLCHAIN/bin/aarch64-linux-android-ld \
RANLIB=$TOOLCHAIN/bin/aarch64-linux-android-ranlib \
STRIP=$TOOLCHAIN/bin/aarch64-linux-android-strip \
CXXFLAGS="-Os -g" \
CFLAGS="-Os -g" \
CPPFLAGS="-fPIE" \
LDFLAGS="-fPIE -pie -L$PREFIX/lib" \
LDFLAGS="-fPIE -pie -L$PREFIX/lib -static-libstdc++" \
PKG_CONFIG_LIBDIR="$PREFIX/lib/pkgconfig"

View File

@ -1,41 +0,0 @@
#!/bin/sh
# aria2 - The high speed download utility
#
# Copyright (C) 2012 Tatsuhiro Tsujikawa
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
# In addition, as a special exception, the copyright holders give
# permission to link the code of portions of this program with the
# OpenSSL library under certain conditions as described in each
# individual source file, and distribute linked combinations
# including the two.
# You must obey the GNU General Public License in all respects
# for all of the code used other than OpenSSL. If you modify
# file(s) with this exception, you may extend this exception to your
# version of the file(s), but you are not obligated to do so. If you
# do not wish to do so, delete this exception statement from your
# version. If you delete this exception statement from all source
# files in the program, then also delete it here.
if [ -z "$ANDROID_HOME" ]; then
echo 'No $ANDROID_HOME specified.'
exit 1
fi
TOOLCHAIN=$ANDROID_HOME/toolchain
PATH=$TOOLCHAIN/bin:$PATH
make "$@"

View File

@ -31,11 +31,12 @@
# version. If you delete this exception statement from all source
# files in the program, then also delete it here.
if [ -z "$ANDROID_HOME" ]; then
echo 'No $ANDROID_HOME specified.'
if [ -z "$NDK" ]; then
echo 'No $NDK specified.'
exit 1
fi
TOOLCHAIN=$ANDROID_HOME/toolchain
TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64
PATH=$TOOLCHAIN/bin:$PATH
# cd to the directory where this script exists.
@ -49,8 +50,8 @@ if [ -z "$VERSION" ]; then
exit 1
fi
DIST_DIR=aria2-$VERSION-android-arm-build1
arm-linux-androideabi-strip src/aria2c
DIST_DIR=aria2-$VERSION-aarch64-linux-android-build1
aarch64-linux-android-strip src/aria2c
mkdir $DIST_DIR
cp AUTHORS COPYING ChangeLog LICENSE.OpenSSL NEWS README.html README.android \
src/aria2c $DIST_DIR

View File

@ -4,6 +4,10 @@ if [ -z "$ANDROID_HOME" ]; then
echo 'No $ANDROID_HOME specified.'
exit 1
fi
if [ -z "$NDK" ]; then
echo 'No $NDK specified.'
exit 1
fi
VERSION=$1
PREV_VERSION=$2

View File

@ -147,7 +147,7 @@
// # define a2fseek(fp, offset, origin): No fseek64 and not used in aria2
# define a2fstat(fd, buf) fstat64(fd, buf)
// # define a2ftell(fd): No ftell64 and not used in aria2
# define a2_struct_stat struct stat
# define a2_struct_stat struct stat64
# define a2stat(path, buf) stat64(path, buf)
# define a2mkdir(path, openMode) mkdir(path, openMode)
# define a2utimbuf utimbuf