diff --git a/README.rst b/README.rst index 6e48720..f88567d 100644 --- a/README.rst +++ b/README.rst @@ -91,6 +91,44 @@ The documents will be generated under ``doc/manual/html/``. The generated documents will not be installed with ``make install``. +Building Android binary +------------------------ + +In this section, we briefly describe how to build Android binary using +`Android NDK `_ +cross-compiler on Debian Linux. + +We offer ``android-config`` and ``android-make`` scripts to make the +build easier. To make these script work, NDK toolchain must be +installed in the following way. First, let introduce ``ANDROID_HOME`` +environment variable. We need to install toolchain under +``$ANDROID_HOME/toolchain``. An user can freely choose the path for +``ANDROID_HOME``. For example, to install toolchain under +``$ANDROID_HOME/toolchain``, do this in the the directory where NDK is +unpacked:: + + $ build/tools/make-standalone-toolchain.sh --platform=android-9 --install-dir=$ANDROID_HOME/toolchain + +The platform level is not important here because we don't use Android +specific C/C++ API. + +The dependent libraries, such as OpenSSL and libevent should be built +with the toolchain and installed under ``$ANDROID_HOME/usr/local``. +We recommend to build these libraries as static library to make the +deployment easier. libxml2 support is currently disabled. + +We use zlib which comes with Android NDK, so we don't have to build it +by ourselves. + +Before running ``android-config`` and ``android-make``, +``ANDOIRD_HOME`` environment variable must be set to point to the +correct path. + +After ``android-config``, run ``android-make`` to compile sources. +``android-make`` is just include path to cross compiler in ``PATH`` +and run make. So if you include path to corss compiler by yourself, +you can just run make to build spdylay and tools as usual. + API --- diff --git a/android-config b/android-config new file mode 100755 index 0000000..7158302 --- /dev/null +++ b/android-config @@ -0,0 +1,41 @@ +#!/bin/sh +# +# Spdylay - SPDY Library +# +# Copyright (c) 2013 Tatsuhiro Tsujikawa +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +if [ -z "$ANDROID_HOME" ]; then + echo 'No $ANDROID_HOME specified.' + exit 1 +fi +PREFIX=$ANDROID_HOME/usr/local +TOOLCHAIN=$ANDROID_HOME/toolchain +PATH=$TOOLCHAIN/bin:$PATH + +./configure \ + --disable-shared \ + --host=arm-linux-androideabi \ + --build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \ + --without-libxml2 \ + CPPFLAGS="-I$PREFIX/include" \ + PKG_CONFIG_LIBDIR="$PREFIX/lib/pkgconfig" \ + LDFLAGS="-L$PREFIX/lib" diff --git a/android-make b/android-make new file mode 100755 index 0000000..a08b7f0 --- /dev/null +++ b/android-make @@ -0,0 +1,33 @@ +#!/bin/sh +# +# Spdylay - SPDY Library +# +# Copyright (c) 2013 Tatsuhiro Tsujikawa +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +if [ -z "$ANDROID_HOME" ]; then + echo 'No $ANDROID_HOME specified.' + exit 1 +fi +TOOLCHAIN=$ANDROID_HOME/toolchain +PATH=$TOOLCHAIN/bin:$PATH + +make "$@"