-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile.android-v
104 lines (88 loc) · 3.45 KB
/
Dockerfile.android-v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
## base image
FROM abeimler/simple-cppbuilder:base AS base
ARG extra_libraries
ARG vcpkg_host_triplet="x64-linux"
ARG processor="x86_64"
ARG vcpkg_target_triplet="arm-android"
ARG android_abi="armeabi-v7a"
ARG android_target="30"
ARG android_ndk_version=""
ARG cmake="android-${android_abi}-cmake"
ARG cmake_generator="Ninja Multi-Config"
ARG make="ninja"
ARG cc="clang"
ARG cxx="clang++"
# Install packages available from standard repos
RUN pacman-db-upgrade && \
pacman -S --noconfirm \
${extra_libraries} \
clang llvm \
alsa-lib libxrender libxtst \
cmake make ninja && \
pacman -Scc --noconfirm
# install android stuff
RUN echo '' >> /etc/pacman.conf && echo '[multilib]' >> /etc/pacman.conf && echo 'Include = /etc/pacman.d/mirrorlist' >> /etc/pacman.conf
ARG android_extra_libraries=""
USER yay
RUN yay -Syu --noconfirm && yay -S --noconfirm \
jdk-openjdk ${android_extra_libraries} && \
yay -Scc --noconfirm && \
rm -rf /home/yay/.cache/*
RUN yay -Syu --noconfirm && yay -S --noconfirm \
jdk-openjdk android-platform-${android_target} android-sdk-build-tools-${android_target} \
android-pkg-config android-cmake android-environment android-ndk${android_ndk_version} ${android_extra_libraries} && \
yay -Scc --noconfirm && \
rm -rf /home/yay/.cache/*
USER root
RUN ln -s /opt/android-ndk /opt/android-sdk/ndk-bundle
ENV ANDROID_HOME "/opt/android-sdk"
ENV ANDROID_NDK "/opt/android-ndk"
ENV ANDROID_NDK_HOME "/opt/android-ndk"
ENV ANDROID_SDK_ROOT "/opt/android-sdk"
ENV ANDROID_TOOLCHAIN "${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64"
ENV ANDROID_TOOLCHAIN_FILE "${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake"
ENV ANDROID_PLATFORM_TOOLS "${ANDROID_HOME}/platform-tools"
ARG cmake_toolchain_file="${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake"
ENV CROSS_TOOLCHAIN "${ANDROID_TOOLCHAIN_FILE}"
ARG setup_env_script="android-env"
ARG setup_env_script_args="$android_abi"
ENV SETUP_ENV_SCRIPT $setup_env_script
ENV SETUP_ENV_SCRIPT_ARGS $setup_env_script_args
RUN echo "source \"$SETUP_ENV_SCRIPT $SETUP_ENV_SCRIPT_ARGS\"" >> /root/.bash_profile && \
. $setup_env_script $setup_env_script_args
#RUN . /etc/profile.d/android-ndk-${android_target}.sh
# cross compiler settings
ENV CC $cc
ENV CXX $cxx
ENV PROCESSOR $processor
ENV ANDROID_ABI $android_abi
ENV TARGET_TRIPLET $vcpkg_target_triplet
ENV CROSS_CMAKE $cmake
ENV CROSS_MAKE $make
ENV CMAKE $CROSS_CMAKE
ENV MAKE $CROSS_MAKE
# install vcpkg
## https://github.com/microsoft/vcpkg/blob/master/docs/users/android.md
ENV VCPKG_DEFAULT_HOST_TRIPLET $vcpkg_host_triplet
ENV VCPKG_DEFAULT_TRIPLET $vcpkg_target_triplet
ENV VCPKG_DISABLE_METRICS 1
RUN git clone --depth 1 https://github.com/Microsoft/vcpkg.git && \
./vcpkg/bootstrap-vcpkg.sh -disableMetrics
ENV VCPKG_ROOT "/home/project/vcpkg"
# build script settings
ENV TARGET "all"
ENV BUILD_TYPE "Release"
ENV CMAKE_GENERATOR $cmake_generator
ENV VCPKG_TOOLCHAIN_FILE "/home/project/vcpkg/scripts/buildsystems/vcpkg.cmake"
ENV TOOLCHAIN_FILE "/home/project/vcpkg/scripts/buildsystems/vcpkg.cmake"
ENV CHAINLOAD_TOOLCHAIN_FILE $ANDROID_TOOLCHAIN_FILE
ENV CROSS_CMAKE_ARGS -DANDROID_ABI="$ANDROID_ABI"
ENV CMAKE_ARGS ""
# setup project env
WORKDIR /home/project
COPY ./scripts/docker-build.android.sh ./docker-build.sh
COPY ./taskfiles/*.yml /home/taskfiles/
COPY ./taskfiles/TaskfileCross.yml /home/taskfiles/Taskfile.yml
ENV PROJECT_DIR /home/project
WORKDIR /home/project
RUN mkdir build