Skip to content

Commit 9f57585

Browse files
committed
Update android build dependencies
Update android build dependencies. Use android NDK r20 and build aarch64 binary.
1 parent 7f6578a commit 9f57585

7 files changed

+38
-82
lines changed

README.android

+4-4
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ aria2c executable was generated using android-ndk-r14b.
4242

4343
The following libraries were statically linked.
4444

45-
* openssl 1.0.2o
46-
* expat 2.2.5
45+
* openssl 1.1.1c
46+
* expat 2.2.7
4747
* zlib 1.2.11
48-
* c-ares 1.14.0
49-
* libssh2 1.8.0
48+
* c-ares 1.15.0
49+
* libssh2 1.9.0
5050

5151
Since Android does not have ``/etc/resolv.conf``, c-ares (asynchronous
5252
DNS resolver) is disabled by default. But name resolution is sometimes

README.rst

+9-25
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ Cross-compiling Android binary
359359
In this section, we describe how to build Android binary using Android
360360
NDK cross-compiler on Debian Linux.
361361

362-
At the time of this writing, android-ndk-r14b should compile aria2
362+
At the time of this writing, Android NDK r20 should compile aria2
363363
without errors.
364364

365365
``android-config`` script is a configure script wrapper for Android
@@ -376,33 +376,17 @@ When building the above libraries, make sure that disable shared
376376
library and enable only static library. We are going to link those
377377
libraries statically.
378378

379-
We use zlib which comes with Android NDK, so we don't have to build it
380-
by ourselves.
379+
``android-config`` assumes that ``$ANDROID_HOME`` and ``$NDK``
380+
environment variables are defined.
381381

382-
``android-config`` assumes the existence of ``$ANDROID_HOME``
383-
environment variable which must fulfill the following conditions:
382+
We currently use Android NDK r20. ``$NDK`` should point to the
383+
directory to Anroid NDK. The build tools will be found under
384+
``$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/``.
384385

385-
* Android NDK toolchain is installed under
386-
``$ANDROID_HOME/toolchain``. Refer to `Standalone Toolchain
387-
<https://developer.android.com/ndk/guides/standalone_toolchain.html>`_
388-
for more details, but it is a bit out of date.
386+
All the dependent libraries must be installed under
387+
``$ANDROID_HOME/usr/local``.
389388

390-
To install toolchain under ``$ANDROID_HOME/toolchain``, do this:
391-
392-
.. code-block:: text
393-
394-
$NDK/build/tools/make_standalone_toolchain.py \
395-
--arch arm --api 16 --stl=gnustl \
396-
--install-dir $ANDROID_HOME/toolchain
397-
398-
* The dependent libraries must be installed under
399-
``$ANDROID_HOME/usr/local``.
400-
401-
Before running ``android-config`` and ``android-make``,
402-
``$ANDROID_HOME`` environment variable must be set to point to the
403-
correct path.
404-
405-
After ``android-config``, run ``android-make`` to compile sources.
389+
After ``android-config``, run ``make`` to compile sources.
406390

407391
Building documentation
408392
----------------------

android-config

+14-6
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,15 @@ if [ -z "$ANDROID_HOME" ]; then
3535
echo 'No $ANDROID_HOME specified.'
3636
exit 1
3737
fi
38+
if [ -z "$NDK" ]; then
39+
echo 'No $NDK specified.'
40+
exit 1
41+
fi
3842
PREFIX=$ANDROID_HOME/usr/local
39-
TOOLCHAIN=$ANDROID_HOME/toolchain
40-
PATH=$TOOLCHAIN/bin:$PATH
43+
TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64
4144

4245
./configure \
43-
--host=arm-linux-androideabi \
46+
--host=aarch64-linux-android \
4447
--build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \
4548
--disable-nls \
4649
--without-gnutls \
@@ -51,10 +54,15 @@ PATH=$TOOLCHAIN/bin:$PATH
5154
--with-libcares \
5255
--with-libz \
5356
--with-libssh2 \
54-
CC="$TOOLCHAIN"/bin/arm-linux-androideabi-clang \
55-
CXX="$TOOLCHAIN"/bin/arm-linux-androideabi-clang++ \
57+
AR=$TOOLCHAIN/bin/aarch64-linux-android-ar \
58+
AS=$TOOLCHAIN/bin/aarch64-linux-android-as \
59+
CC=$TOOLCHAIN/bin/aarch64-linux-android29-clang \
60+
CXX=$TOOLCHAIN/bin/aarch64-linux-android29-clang++ \
61+
LD=$TOOLCHAIN/bin/aarch64-linux-android-ld \
62+
RANLIB=$TOOLCHAIN/bin/aarch64-linux-android-ranlib \
63+
STRIP=$TOOLCHAIN/bin/aarch64-linux-android-strip \
5664
CXXFLAGS="-Os -g" \
5765
CFLAGS="-Os -g" \
5866
CPPFLAGS="-fPIE" \
59-
LDFLAGS="-fPIE -pie -L$PREFIX/lib" \
67+
LDFLAGS="-fPIE -pie -L$PREFIX/lib -static-libstdc++" \
6068
PKG_CONFIG_LIBDIR="$PREFIX/lib/pkgconfig"

android-make

-41
This file was deleted.

android-release

+6-5
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@
3131
# version. If you delete this exception statement from all source
3232
# files in the program, then also delete it here.
3333

34-
if [ -z "$ANDROID_HOME" ]; then
35-
echo 'No $ANDROID_HOME specified.'
34+
if [ -z "$NDK" ]; then
35+
echo 'No $NDK specified.'
3636
exit 1
3737
fi
38-
TOOLCHAIN=$ANDROID_HOME/toolchain
38+
39+
TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64
3940
PATH=$TOOLCHAIN/bin:$PATH
4041

4142
# cd to the directory where this script exists.
@@ -49,8 +50,8 @@ if [ -z "$VERSION" ]; then
4950
exit 1
5051
fi
5152

52-
DIST_DIR=aria2-$VERSION-android-arm-build1
53-
arm-linux-androideabi-strip src/aria2c
53+
DIST_DIR=aria2-$VERSION-aarch64-linux-android-build1
54+
aarch64-linux-android-strip src/aria2c
5455
mkdir $DIST_DIR
5556
cp AUTHORS COPYING ChangeLog LICENSE.OpenSSL NEWS README.html README.android \
5657
src/aria2c $DIST_DIR

makerelease

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ if [ -z "$ANDROID_HOME" ]; then
44
echo 'No $ANDROID_HOME specified.'
55
exit 1
66
fi
7+
if [ -z "$NDK" ]; then
8+
echo 'No $NDK specified.'
9+
exit 1
10+
fi
711

812
VERSION=$1
913
PREV_VERSION=$2

src/a2io.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
// # define a2fseek(fp, offset, origin): No fseek64 and not used in aria2
148148
# define a2fstat(fd, buf) fstat64(fd, buf)
149149
// # define a2ftell(fd): No ftell64 and not used in aria2
150-
# define a2_struct_stat struct stat
150+
# define a2_struct_stat struct stat64
151151
# define a2stat(path, buf) stat64(path, buf)
152152
# define a2mkdir(path, openMode) mkdir(path, openMode)
153153
# define a2utimbuf utimbuf

0 commit comments

Comments
 (0)