third_party_nghttp2/Dockerfile.android

122 lines
3.7 KiB
Docker
Raw Permalink Normal View History

# vim: ft=dockerfile:
2014-10-19 12:51:43 +00:00
# Dockerfile to build nghttp2 android binary
#
# $ sudo docker build -t nghttp2-android - < Dockerfile.android
#
# After successful build, android binaries are located under
# /root/build/nghttp2. You can copy the binary using docker cp. For
# example, to copy nghttpx binary to host file system location
# /path/to/dest, do this:
#
# $ sudo docker run -v /path/to/dest:/out nghttp2-android cp /root/build/nghttp2/src/nghttpx /out
2017-08-26 04:54:03 +00:00
# Only use standalone-toolchain for reduce size
FROM ubuntu:22.04
2014-10-19 12:51:43 +00:00
MAINTAINER Tatsuhiro Tsujikawa
ENV NDK_VERSION r25b
ENV NDK /root/android-ndk-$NDK_VERSION
ENV TOOLCHAIN $NDK/toolchains/llvm/prebuilt/linux-x86_64
ENV TARGET aarch64-linux-android
ENV API 33
ENV AR $TOOLCHAIN/bin/llvm-ar
ENV CC $TOOLCHAIN/bin/$TARGET$API-clang
ENV CXX $TOOLCHAIN/bin/$TARGET$API-clang++
ENV LD $TOOLCHAIN/bin/ld
ENV RANDLIB $TOOLCHAIN/bin/llvm-ranlib
ENV STRIP $TOOLCHAIN/bin/llvm-strip
ENV PREFIX /root/usr/local
2014-10-19 12:51:43 +00:00
2017-08-26 04:54:03 +00:00
WORKDIR /root
RUN apt-get update && \
apt-get install -y unzip make binutils autoconf \
automake autotools-dev libtool pkg-config git \
curl dpkg-dev libxml2-dev genisoimage libc6-i386 \
2022-12-24 09:23:18 +00:00
lib32stdc++6 && \
rm -rf /var/cache/apt/*
2014-10-19 12:51:43 +00:00
# Download NDK
RUN curl -L -O https://dl.google.com/android/repository/android-ndk-$NDK_VERSION-linux.zip && \
unzip -q android-ndk-$NDK_VERSION-linux.zip && \
rm android-ndk-$NDK_VERSION-linux.zip
2014-10-19 12:51:43 +00:00
2017-08-26 04:54:03 +00:00
# Setup version of libraries
ENV OPENSSL_VERSION 1.1.1q
ENV LIBEV_VERSION 4.33
2022-12-26 10:39:23 +00:00
ENV ZLIB_VERSION 1.2.13
ENV CARES_VERSION 1.18.1
ENV NGHTTP2_VERSION master
2014-10-19 12:51:43 +00:00
WORKDIR /root/build
2017-08-26 04:54:03 +00:00
RUN curl -L -O https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz && \
tar xf openssl-$OPENSSL_VERSION.tar.gz && \
rm openssl-$OPENSSL_VERSION.tar.gz
2017-08-26 04:54:03 +00:00
WORKDIR /root/build/openssl-$OPENSSL_VERSION
2022-09-26 06:50:53 +00:00
RUN export ANDROID_NDK_HOME=$NDK PATH=$TOOLCHAIN/bin:$PATH && \
2022-09-26 07:09:15 +00:00
./Configure no-shared --prefix=$PREFIX android-arm64 && \
2014-10-19 12:51:43 +00:00
make && make install_sw
WORKDIR /root/build
2017-08-26 04:54:03 +00:00
RUN curl -L -O http://dist.schmorp.de/libev/Attic/libev-$LIBEV_VERSION.tar.gz && \
tar xf libev-$LIBEV_VERSION.tar.gz && \
rm libev-$LIBEV_VERSION.tar.gz
2017-08-26 04:54:03 +00:00
WORKDIR /root/build/libev-$LIBEV_VERSION
RUN ./configure \
--host=$TARGET \
2014-10-19 12:51:43 +00:00
--build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \
--prefix=$PREFIX \
--disable-shared \
--enable-static \
CPPFLAGS=-I$PREFIX/include \
LDFLAGS=-L$PREFIX/lib && \
make install
WORKDIR /root/build
RUN curl -L -O https://zlib.net/zlib-$ZLIB_VERSION.tar.gz && \
2017-08-26 04:54:03 +00:00
tar xf zlib-$ZLIB_VERSION.tar.gz && \
rm zlib-$ZLIB_VERSION.tar.gz
2017-08-26 04:54:03 +00:00
WORKDIR /root/build/zlib-$ZLIB_VERSION
RUN HOST=$TARGET \
./configure \
--prefix=$PREFIX \
--libdir=$PREFIX/lib \
--includedir=$PREFIX/include \
--static && \
make install
2017-08-26 04:54:03 +00:00
2014-10-19 12:51:43 +00:00
WORKDIR /root/build
2017-08-26 04:54:03 +00:00
RUN curl -L -O https://c-ares.haxx.se/download/c-ares-$CARES_VERSION.tar.gz && \
tar xf c-ares-$CARES_VERSION.tar.gz && \
rm c-ares-$CARES_VERSION.tar.gz
WORKDIR /root/build/c-ares-$CARES_VERSION
RUN ./configure \
--host=$TARGET \
2017-08-26 04:54:03 +00:00
--build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \
--prefix=$PREFIX \
--disable-shared && \
make install
WORKDIR /root/build
RUN git clone https://github.com/nghttp2/nghttp2 -b $NGHTTP2_VERSION --depth 1
2014-10-19 12:51:43 +00:00
WORKDIR /root/build/nghttp2
RUN autoreconf -i && \
./configure \
2017-08-26 04:54:03 +00:00
--enable-app \
2014-10-19 12:51:43 +00:00
--disable-shared \
--host=$TARGET \
2014-10-19 12:51:43 +00:00
--build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \
--without-libxml2 \
--disable-examples \
--disable-threads \
2017-08-26 04:54:03 +00:00
CPPFLAGS="-fPIE -I$PREFIX/include" \
PKG_CONFIG_LIBDIR="$PREFIX/lib/pkgconfig" \
LDFLAGS="-fPIE -pie -L$PREFIX/lib" && \
2014-10-19 12:51:43 +00:00
make && \
$STRIP src/nghttpx src/nghttpd src/nghttp