Skip to content

Commit

Permalink
Add x86_64-linux-android target
Browse files Browse the repository at this point in the history
  • Loading branch information
malbarbo committed May 19, 2017
1 parent 9426dc0 commit 125db52
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 2 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ matrix:
- env: TARGET=arm-linux-androideabi CPP=1 STD=1 OPENSSL=0.5.5
- env: TARGET=armv7-linux-androideabi CPP=1 STD=1 OPENSSL=0.5.5
- env: TARGET=i686-linux-android CPP=1 STD=1 OPENSSL=0.5.5
- env: TARGET=x86_64-linux-android CPP=1 STD=1 OPENSSL=0.5.5

# OSX
- env: TARGET=i686-apple-darwin DYLIB=1 STD=1 RUN=1
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ worst, "hang" (never terminate).
| `thumbv7em-none-eabi` [3] | 2.2.0 | 5.3.1 | N/A | | N/A | |
| `thumbv7em-none-eabihf` [3] | 2.2.0 | 5.3.1 | N/A | | N/A | |
| `thumbv7m-none-eabi` [3] | 2.2.0 | 5.3.1 | N/A | | N/A | |
| `x86_64-linux-android` | N/A | 4.9 | 1.0.2k || N/A | |
| `x86_64-pc-windows-gnu`[1] | N/A | 5.3.1 | || N/A | |
| `x86_64-unknown-dragonfly` [1] [2] | 4.6.0 | 5.3.0 | 1.0.2k | | N/A ||
| `x86_64-unknown-freebsd` [1] | 10.2 | 5.3.0 | 1.0.2k | | N/A | |
Expand Down
1 change: 0 additions & 1 deletion ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ EOF
git clone --depth 1 https://github.com/rust-lang/cargo $td

pushd $td
cargo update -p libc
cross build --target $TARGET
popd

Expand Down
33 changes: 33 additions & 0 deletions docker/x86_64-linux-android/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM ubuntu:16.04

RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
cmake \
gcc \
libc6-dev \
make \
pkg-config

COPY xargo.sh /
RUN bash /xargo.sh

COPY android-ndk.sh /
RUN bash /android-ndk.sh x86_64 21
ENV PATH=$PATH:/android-ndk/bin

COPY openssl.sh /
RUN bash /openssl.sh linux-x86_64 x86_64-linux-android- -mandroid -fomit-frame-pointer

# Libz is distributed in the android ndk, but for some unknown reason it is not
# found in the build process of some crates, so we explicit set the DEP_Z_ROOT
ENV CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER=x86_64-linux-android-gcc \
CC_x86_64_linux_android=x86_64-linux-android-gcc \
CXX_x86_64_linux_android=x86_64-linux-android-g++ \
DEP_Z_ROOT=/android-ndk/sysroot/usr/ \
OPENSSL_STATIC=1 \
OPENSSL_DIR=/openssl \
OPENSSL_INCLUDE_DIR=/openssl/include \
OPENSSL_LIB_DIR=/openssl/lib \
RUST_TEST_THREADS=1 \
HOME=/tmp/
6 changes: 5 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ pub enum Target {
Armv7LinuxAndroideabi,
Aarch64LinuxAndroid,
I686LinuxAndroid,
X86_64LinuxAndroid,

// Linux
Aarch64UnknownLinuxGnu,
Expand Down Expand Up @@ -157,7 +158,8 @@ impl Target {
Target::ArmLinuxAndroideabi |
Target::Armv7LinuxAndroideabi |
Target::Aarch64LinuxAndroid |
Target::I686LinuxAndroid => true,
Target::I686LinuxAndroid |
Target::X86_64LinuxAndroid => true,
_ => false,
}
}
Expand Down Expand Up @@ -250,6 +252,7 @@ impl Target {
Thumbv7mNoneEabi => "thumbv7m-none-eabi",
X86_64AppleDarwin => "x86_64-apple-darwin",
X86_64PcWindowsGnu => "x86_64-pc-windows-gnu",
X86_64LinuxAndroid => "x86_64-linux-android",
X86_64UnknownDragonfly => "x86_64-unknown-dragonfly",
X86_64UnknownFreebsd => "x86_64-unknown-freebsd",
X86_64UnknownLinuxGnu => "x86_64-unknown-linux-gnu",
Expand Down Expand Up @@ -295,6 +298,7 @@ impl Target {
"thumbv7em-none-eabihf" => Thumbv7emNoneEabihf,
"thumbv7m-none-eabi" => Thumbv7mNoneEabi,
"x86_64-apple-darwin" => X86_64AppleDarwin,
"x86_64-linux-android" => X86_64LinuxAndroid,
"x86_64-pc-windows-gnu" => X86_64PcWindowsGnu,
"x86_64-unknown-dragonfly" => X86_64UnknownDragonfly,
"x86_64-unknown-freebsd" => X86_64UnknownFreebsd,
Expand Down

0 comments on commit 125db52

Please sign in to comment.