1# Version: 1.0
2
3# Dockerfile for building libzip for android
4# https://github.com/dec1/libzip.git
5# creates docker container with all tools, libraries and sources required to build libzip for android.
6
7# Author: Declan Moran
8# www.silverglint.com
9
10
11# Usage:
12#---------
13# download the libzip repository
14# > git clone https://github.com/dec1/libzip.git
15# > cd libzip
16#
17# build docker image "my_img_zip" from the dockerfile in "docker" dir
18# > docker build -t my_img_zip ./android/docker
19#
20# run docker container "my_ctr_zip" from this image, mounting the current dir. (Need to pass absolute host paths to mount volume- hence "pwd")
21# > docker run  -v $(pwd):/home/docker-share/libzip -it --entrypoint=/bin/bash --name my_ctr_zip my_img_zip
22#
23# Now inside docker container
24# $ cd /home/docker-share/libzip/android
25#
26# Modify ./do.sh (on host), to match the boost and android ndk versions/paths in the "Configure here" section below
27# Build from running docker container.
28# $./do.sh
29#
30# "./build" dir contains required build, but owned by root. chown to your username/group
31# > sudo chown -R <userid>:<groupid> ./build
32# > sudo chown -R <userid>:<groupid> ./install
33#
34# Exit container, when build is finished.
35# $ exit
36#
37
38
39
40
41FROM ubuntu:18.04
42
43
44## --------------------------------------------------------------------
45##              Configure here
46# ---------------------------------------------------------------------
47# ---------------------------------------------------------------------
48# Here you can speciofy exactly what android ndk (and sdk) version you want to use.
49
50
51
52# (2) Android SDK
53# https://developer.android.com/studio#downloads
54ARG SDK_URL_BASE=https://dl.google.com/android/repository
55ARG SDK_FILE=sdk-tools-linux-4333796.zip
56
57# the sdk platform to use
58# https://developer.android.com/guide/topics/manifest/uses-sdk-element
59ARG ANDROID_SDK_PLATFORM_VERS="platforms;android-28"
60
61
62
63# (3) Android NDK
64# https://developer.android.com/ndk/downloads
65ARG NDK_URL_BASE=https://dl.google.com/android/repository
66ARG NDK_FILE=android-ndk-r19c-linux-x86_64.zip
67# ---------------------------------------------------------------------
68## --------------------------------------------------------------------
69
70RUN apt-get update
71RUN apt-get -y dist-upgrade
72
73
74# for downloading archives
75RUN apt-get -y install wget
76
77# for unzipping downloaded android archives
78RUN apt-get -y install zip
79RUN apt-get -y install cmake
80
81RUN apt-get -y install lib32z1
82
83
84# need this this to install some (32 bit) prerequisites for android builds
85RUN dpkg --add-architecture i386
86RUN apt-get update
87RUN apt-get -y dist-upgrade
88RUN apt-get install -y  libc6:i386 libncurses5:i386 libstdc++6:i386 libbz2-1.0:i386
89
90
91# need c compiler to set up create boost build system (before building boost with it and android toolchain)
92RUN apt-get -y install build-essential
93RUN apt-get -y install libc6-dev-i386
94RUN apt-get -y install clang
95
96RUN apt-get -y install openjdk-8-jdk
97#--------------------------------------
98
99ARG ANDROID_HOME=/home/android
100WORKDIR ${ANDROID_HOME}
101
102
103# SDK
104# ----
105# download android sdk command line tools
106RUN wget ${SDK_URL_BASE}/$SDK_FILE
107RUN unzip $SDK_FILE
108
109ENV PATH ${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools
110
111
112RUN yes | sdkmanager --licenses
113
114RUN sdkmanager "platform-tools" $ANDROID_SDK_PLATFORM_VERS
115#RUN sdkmanager "platform-tools" "platforms;android-28"
116
117
118# NDK
119# ----
120RUN wget ${NDK_URL_BASE}/$NDK_FILE
121RUN unzip $NDK_FILE
122
123