This repository has been archived by the owner on Nov 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tweaks and add a Dockerfile for Android
- Loading branch information
Showing
8 changed files
with
353 additions
and
17 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
FROM ubuntu:xenial | ||
LABEL maintainer="Parity Technologies <[email protected]>" | ||
|
||
RUN apt-get update && \ | ||
apt-get install -yq sudo curl file build-essential wget git g++ cmake pkg-config bison flex \ | ||
unzip lib32stdc++6 lib32z1 python autotools-dev automake autoconf libtool \ | ||
gperf xsltproc docbook-xsl | ||
|
||
# Rust & Cargo | ||
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y | ||
ENV PATH /root/.cargo/bin:$PATH | ||
RUN rustup toolchain install stable | ||
RUN rustup target add --toolchain stable arm-linux-androideabi | ||
RUN rustup target add --toolchain stable armv7-linux-androideabi | ||
|
||
# Android NDK and toolchain | ||
RUN cd /usr/local && \ | ||
wget -q https://dl.google.com/android/repository/android-ndk-r16b-linux-x86_64.zip && \ | ||
unzip -q android-ndk-r16b-linux-x86_64.zip && \ | ||
rm android-ndk-r16b-linux-x86_64.zip | ||
ENV NDK_HOME /usr/local/android-ndk-r16b | ||
RUN /usr/local/android-ndk-r16b/build/tools/make-standalone-toolchain.sh \ | ||
--arch=arm --install-dir=/opt/ndk-standalone --stl=libc++ --platform=android-26 | ||
ENV PATH $PATH:/opt/ndk-standalone/bin | ||
|
||
# Compiling OpenSSL for Android | ||
RUN cd /root && \ | ||
git clone git://git.openssl.org/openssl.git && \ | ||
cd openssl && \ | ||
git checkout OpenSSL_1_1_0-stable | ||
ENV CROSS_SYSROOT /opt/ndk-standalone/sysroot | ||
RUN cd /root/openssl && \ | ||
./Configure android-armeabi --cross-compile-prefix=arm-linux-androideabi- \ | ||
-static no-stdio no-ui \ | ||
-I/usr/local/android-ndk-r16b/sysroot/usr/include \ | ||
-I/usr/local/android-ndk-r16b/sysroot/usr/include/arm-linux-androideabi \ | ||
-L/usr/local/android-ndk-r16b/sysroot/usr/lib \ | ||
--prefix=/opt/ndk-standalone/sysroot/usr | ||
RUN cd /root/openssl && \ | ||
make build_libs && \ | ||
make install_dev | ||
RUN rm -rf /root/openssl | ||
|
||
# Compiling libudev for Android | ||
# This is the most hacky part of the process, as we need to apply a patch and pass specific | ||
# options that the compiler environment doesn't define. | ||
RUN cd /root && \ | ||
git clone https://github.com/gentoo/eudev.git | ||
ADD libudev.patch /root | ||
RUN cd /root/eudev && \ | ||
git checkout 83d918449f22720d84a341a05e24b6d109e6d3ae && \ | ||
./autogen.sh && \ | ||
./configure --disable-introspection --disable-programs --disable-hwdb \ | ||
--host=arm-linux-androideabi --prefix=/opt/ndk-standalone/sysroot/usr/ \ | ||
--enable-shared=false CC=arm-linux-androideabi-clang \ | ||
CFLAGS="-D LINE_MAX=2048 -D RLIMIT_NLIMITS=15 -D IPTOS_LOWCOST=2 -std=gnu99" \ | ||
CXX=arm-linux-androideabi-clang++ && \ | ||
git apply - < /root/libudev.patch && \ | ||
make && \ | ||
make install | ||
RUN rm -rf /root/eudev | ||
RUN rm /root/libudev.patch | ||
|
||
# Rust-related configuration | ||
ADD cargo-config.toml /root/.cargo/config | ||
ENV ARM_LINUX_ANDROIDEABI_OPENSSL_DIR /opt/ndk-standalone/sysroot/usr | ||
ENV ARMV7_LINUX_ANDROIDEABI_OPENSSL_DIR /opt/ndk-standalone/sysroot/usr | ||
ENV CC_arm_linux_androideabi arm-linux-androideabi-clang | ||
ENV CC_armv7_linux_androideabi arm-linux-androideabi-clang | ||
ENV CXX_arm_linux_androideabi arm-linux-androideabi-clang++ | ||
ENV CXX_armv7_linux_androideabi arm-linux-androideabi-clang++ | ||
ENV AR_arm_linux_androideabi arm-linux-androideabi-ar | ||
ENV AR_armv7_linux_androideabi arm-linux-androideabi-ar | ||
ENV CFLAGS_arm_linux_androideabi -std=gnu11 -fPIC -D OS_ANDROID | ||
ENV CFLAGS_armv7_linux_androideabi -std=gnu11 -fPIC -D OS_ANDROID | ||
ENV CXXFLAGS_arm_linux_androideabi -std=gnu++11 -fPIC -fexceptions -frtti -static-libstdc++ -D OS_ANDROID | ||
ENV CXXFLAGS_armv7_linux_androideabi -std=gnu++11 -fPIC -fexceptions -frtti -static-libstdc++ -D OS_ANDROID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[target.armv7-linux-androideabi] | ||
linker = "arm-linux-androideabi-clang" | ||
ar = "arm-linux-androideabi-ar" | ||
rustflags = ["-C", "link-arg=-lc++_static", "-C", "link-arg=-lc++abi", "-C", "link-arg=-landroid_support"] | ||
|
||
[target.arm-linux-androideabi] | ||
linker = "arm-linux-androideabi-clang" | ||
ar = "arm-linux-androideabi-ar" | ||
rustflags = ["-C", "link-arg=-lc++_static", "-C", "link-arg=-lc++abi", "-C", "link-arg=-landroid_support"] |
Oops, something went wrong.