Merge branch 'update-android-build-dep'

pull/1469/head
Tatsuhiro Tsujikawa 2019-09-15 16:40:32 +09:00
commit 23f3c4d8eb
10 changed files with 44 additions and 85 deletions

View File

@ -42,11 +42,11 @@ aria2c executable was generated using android-ndk-r14b.
The following libraries were statically linked. The following libraries were statically linked.
* openssl 1.0.2o * openssl 1.1.1c
* expat 2.2.5 * expat 2.2.7
* zlib 1.2.11 * zlib 1.2.11
* c-ares 1.14.0 * c-ares 1.15.0
* libssh2 1.8.0 * libssh2 1.9.0
Since Android does not have ``/etc/resolv.conf``, c-ares (asynchronous Since Android does not have ``/etc/resolv.conf``, c-ares (asynchronous
DNS resolver) is disabled by default. But name resolution is sometimes 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 In this section, we describe how to build Android binary using Android
NDK cross-compiler on Debian Linux. 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. without errors.
``android-config`` script is a configure script wrapper for Android ``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 library and enable only static library. We are going to link those
libraries statically. libraries statically.
We use zlib which comes with Android NDK, so we don't have to build it ``android-config`` assumes that ``$ANDROID_HOME`` and ``$NDK``
by ourselves. environment variables are defined.
``android-config`` assumes the existence of ``$ANDROID_HOME`` We currently use Android NDK r20. ``$NDK`` should point to the
environment variable which must fulfill the following conditions: 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 All the dependent libraries must be 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.
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``. ``$ANDROID_HOME/usr/local``.
Before running ``android-config`` and ``android-make``, After ``android-config``, run ``make`` to compile sources.
``$ANDROID_HOME`` environment variable must be set to point to the
correct path.
After ``android-config``, run ``android-make`` to compile sources.
Building documentation Building documentation
---------------------- ----------------------

View File

@ -35,12 +35,15 @@ if [ -z "$ANDROID_HOME" ]; then
echo 'No $ANDROID_HOME specified.' echo 'No $ANDROID_HOME specified.'
exit 1 exit 1
fi fi
if [ -z "$NDK" ]; then
echo 'No $NDK specified.'
exit 1
fi
PREFIX=$ANDROID_HOME/usr/local PREFIX=$ANDROID_HOME/usr/local
TOOLCHAIN=$ANDROID_HOME/toolchain TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64
PATH=$TOOLCHAIN/bin:$PATH
./configure \ ./configure \
--host=arm-linux-androideabi \ --host=aarch64-linux-android \
--build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \ --build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \
--disable-nls \ --disable-nls \
--without-gnutls \ --without-gnutls \
@ -51,10 +54,15 @@ PATH=$TOOLCHAIN/bin:$PATH
--with-libcares \ --with-libcares \
--with-libz \ --with-libz \
--with-libssh2 \ --with-libssh2 \
CC="$TOOLCHAIN"/bin/arm-linux-androideabi-clang \ AR=$TOOLCHAIN/bin/aarch64-linux-android-ar \
CXX="$TOOLCHAIN"/bin/arm-linux-androideabi-clang++ \ 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" \ CXXFLAGS="-Os -g" \
CFLAGS="-Os -g" \ CFLAGS="-Os -g" \
CPPFLAGS="-fPIE" \ CPPFLAGS="-fPIE" \
LDFLAGS="-fPIE -pie -L$PREFIX/lib" \ LDFLAGS="-fPIE -pie -L$PREFIX/lib -static-libstdc++" \
PKG_CONFIG_LIBDIR="$PREFIX/lib/pkgconfig" 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 # version. If you delete this exception statement from all source
# files in the program, then also delete it here. # files in the program, then also delete it here.
if [ -z "$ANDROID_HOME" ]; then if [ -z "$NDK" ]; then
echo 'No $ANDROID_HOME specified.' echo 'No $NDK specified.'
exit 1 exit 1
fi fi
TOOLCHAIN=$ANDROID_HOME/toolchain
TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64
PATH=$TOOLCHAIN/bin:$PATH PATH=$TOOLCHAIN/bin:$PATH
# cd to the directory where this script exists. # cd to the directory where this script exists.
@ -49,8 +50,8 @@ if [ -z "$VERSION" ]; then
exit 1 exit 1
fi fi
DIST_DIR=aria2-$VERSION-android-arm-build1 DIST_DIR=aria2-$VERSION-aarch64-linux-android-build1
arm-linux-androideabi-strip src/aria2c aarch64-linux-android-strip src/aria2c
mkdir $DIST_DIR mkdir $DIST_DIR
cp AUTHORS COPYING ChangeLog LICENSE.OpenSSL NEWS README.html README.android \ cp AUTHORS COPYING ChangeLog LICENSE.OpenSSL NEWS README.html README.android \
src/aria2c $DIST_DIR src/aria2c $DIST_DIR

View File

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

View File

@ -59,7 +59,7 @@ DHTPeerAnnounceStorage::DHTPeerAnnounceStorage()
bool DHTPeerAnnounceStorage::InfoHashLess:: bool DHTPeerAnnounceStorage::InfoHashLess::
operator()(const std::shared_ptr<DHTPeerAnnounceEntry>& lhs, operator()(const std::shared_ptr<DHTPeerAnnounceEntry>& lhs,
const std::shared_ptr<DHTPeerAnnounceEntry>& rhs) const std::shared_ptr<DHTPeerAnnounceEntry>& rhs) const
{ {
return memcmp(lhs->getInfoHash(), rhs->getInfoHash(), DHT_ID_LENGTH) < 0; return memcmp(lhs->getInfoHash(), rhs->getInfoHash(), DHT_ID_LENGTH) < 0;
} }

View File

@ -54,7 +54,7 @@ private:
class InfoHashLess { class InfoHashLess {
public: public:
bool operator()(const std::shared_ptr<DHTPeerAnnounceEntry>& lhs, bool operator()(const std::shared_ptr<DHTPeerAnnounceEntry>& lhs,
const std::shared_ptr<DHTPeerAnnounceEntry>& rhs); const std::shared_ptr<DHTPeerAnnounceEntry>& rhs) const;
}; };
typedef std::set<std::shared_ptr<DHTPeerAnnounceEntry>, InfoHashLess> typedef std::set<std::shared_ptr<DHTPeerAnnounceEntry>, InfoHashLess>
DHTPeerAnnounceEntrySet; DHTPeerAnnounceEntrySet;

View File

@ -143,7 +143,10 @@ namespace {
template <typename T> class Unique { template <typename T> class Unique {
typedef T type; typedef T type;
struct PointerCmp { struct PointerCmp {
inline bool operator()(const type* x, const type* y) { return *x < *y; } inline bool operator()(const type* x, const type* y) const
{
return *x < *y;
}
}; };
std::set<const type*, PointerCmp> known; std::set<const type*, PointerCmp> known;

View File

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