2 # Dockerfile to build nghttp2 android binary
4 # $ sudo docker build -t nghttp2-android - < Dockerfile.android
6 # After successful build, android binaries are located under
7 # /root/build/nghttp2. You can copy the binary using docker cp. For
8 # example, to copy nghttpx binary to host file system location
9 # /path/to/dest, do this:
11 # $ sudo docker run -v /path/to/dest:/out nghttp2-android cp /root/build/nghttp2/src/nghttpx /out
15 MAINTAINER Tatsuhiro Tsujikawa
17 ENV ANDROID_HOME /root/android
18 ENV PREFIX $ANDROID_HOME/usr/local
19 ENV TOOLCHAIN $ANDROID_HOME/toolchain
20 ENV PATH $TOOLCHAIN/bin:$PATH
22 # It would be better to use nearest ubuntu archive mirror for faster
24 # RUN sed -ie 's/archive\.ubuntu/jp.archive.ubuntu/g' /etc/apt/sources.list
27 # genisoimage, libc6-i386 and lib32stdc++6 are required to decompress ndk.
28 RUN apt-get install -y make binutils autoconf automake autotools-dev libtool \
29 pkg-config git curl dpkg-dev libxml2-dev \
30 genisoimage libc6-i386 lib32stdc++6
33 RUN curl -L -O http://dl.google.com/android/ndk/android-ndk-r10c-linux-x86_64.bin && \
34 chmod a+x android-ndk-r10c-linux-x86_64.bin && \
35 ./android-ndk-r10c-linux-x86_64.bin && \
36 rm android-ndk-r10c-linux-x86_64.bin
38 WORKDIR /root/build/android-ndk-r10c
39 RUN /bin/bash build/tools/make-standalone-toolchain.sh \
40 --install-dir=$ANDROID_HOME/toolchain \
41 --toolchain=arm-linux-androideabi-4.9 --llvm-version=3.5 \
45 RUN git clone https://github.com/tatsuhiro-t/spdylay
46 WORKDIR /root/build/spdylay
47 RUN autoreconf -i && \
50 --host=arm-linux-androideabi \
51 --build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \
56 CPPFLAGS="-I$PREFIX/include" \
57 PKG_CONFIG_LIBDIR="$PREFIX/lib/pkgconfig" \
58 LDFLAGS="-L$PREFIX/lib" && \
62 RUN curl -L -O https://www.openssl.org/source/openssl-1.0.2a.tar.gz && \
63 tar xf openssl-1.0.2a.tar.gz && \
64 rm openssl-1.0.2a.tar.gz
66 WORKDIR /root/build/openssl-1.0.2a
67 RUN export CROSS_COMPILE=$TOOLCHAIN/bin/arm-linux-androideabi- && \
68 ./Configure --prefix=$PREFIX android && \
69 make && make install_sw
72 RUN curl -L -O http://dist.schmorp.de/libev/libev-4.19.tar.gz && \
73 curl -L -O https://gist.github.com/tatsuhiro-t/48c45f08950f587180ed/raw/80a8f003b5d1091eae497c5995bbaa68096e739b/libev-4.19-android.patch && \
74 tar xf libev-4.19.tar.gz && \
77 WORKDIR /root/build/libev-4.19
78 RUN patch -p1 < ../libev-4.19-android.patch && \
80 --host=arm-linux-androideabi \
81 --build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \
85 CPPFLAGS=-I$PREFIX/include \
86 LDFLAGS=-L$PREFIX/lib && \
90 RUN git clone https://github.com/tatsuhiro-t/nghttp2
91 WORKDIR /root/build/nghttp2
92 RUN autoreconf -i && \
95 --host=arm-linux-androideabi \
96 --build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \
97 --with-xml-prefix="$PREFIX" \
99 --disable-python-bindings \
102 LIBSPDYLAY_CFLAGS=-I$PREFIX/usr/local/include \
103 LIBSPDYLAY_LIBS="-L$PREFIX/usr/local/lib -lspdylay" \
104 CPPFLAGS="-fPIE -I$PREFIX/include" \
105 CXXFLAGS="-fno-strict-aliasing" \
106 PKG_CONFIG_LIBDIR="$PREFIX/lib/pkgconfig" \
107 LDFLAGS="-fPIE -pie -L$PREFIX/lib" && \
109 arm-linux-androideabi-strip src/nghttpx src/nghttpd src/nghttp