Use android-rs-injected-glue on Android

This commit is contained in:
Mátyás Mustoha 2016-12-09 13:49:38 +01:00
parent c3c086e521
commit 868ca2a3b0
3 changed files with 17 additions and 6 deletions

7
Cargo.lock generated
View file

@ -39,6 +39,11 @@ name = "android_glue"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "android_injected_glue"
version = "0.2.1"
source = "git+https://github.com/mmatyas/android-rs-injected-glue#d3223d1273d0dafcf06d6a6405fedfffbf257300"
[[package]]
name = "angle"
version = "0.1.2"
@ -2377,6 +2382,7 @@ name = "servo"
version = "0.0.1"
dependencies = [
"android_glue 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"android_injected_glue 0.2.1 (git+https://github.com/mmatyas/android-rs-injected-glue)",
"backtrace 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"browserhtml 0.1.17 (git+https://github.com/browserhtml/browserhtml?branch=crate)",
"compiletest_helper 0.0.1",
@ -3206,6 +3212,7 @@ dependencies = [
"checksum aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ca972c2ea5f742bfce5687b9aef75506a764f61d37f8f649047846a9686ddb66"
"checksum alloc-no-stdlib 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b21f6ad9c9957eb5d70c3dee16d31c092b3cab339628f821766b05e6833d72b8"
"checksum android_glue 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e2b80445d331077679dfc6f3014f3e9ab7083e588423d35041d3fc017198189"
"checksum android_injected_glue 0.2.1 (git+https://github.com/mmatyas/android-rs-injected-glue)" = "<none>"
"checksum angle 0.1.2 (git+https://github.com/servo/angle?branch=servo)" = "<none>"
"checksum app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "636ee56f12e31dbc11dc0a1ac6004f08b04e6e6595963716fc8130e90d4e04cf"
"checksum arrayvec 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "80a137392e2e92ce7387c063d98a11f0d47115426c5f8759657af3c7b385c860"

View file

@ -54,3 +54,4 @@ sig = "0.1"
[target.'cfg(target_os = "android")'.dependencies]
libc = "0.2"
android_glue = "0.2"
android_injected_glue = {git = "https://github.com/mmatyas/android-rs-injected-glue"}

View file

@ -20,6 +20,8 @@
#[cfg(target_os = "android")]
#[macro_use]
extern crate android_glue;
#[cfg(target_os = "android")]
extern crate android_injected_glue;
extern crate backtrace;
// The window backed by glutin
extern crate glutin_app as app;
@ -247,18 +249,19 @@ fn args() -> Vec<String> {
}
// This extern definition ensures that the linker will not discard
// the static native lib bits, which are brought in from the NDK libraries
// we link in from build.rs.
#[cfg(target_os = "android")]
extern {
fn app_dummy() -> libc::c_void;
#[no_mangle]
#[inline(never)]
#[allow(non_snake_case)]
pub extern "C" fn android_main(app: *mut ()) {
android_injected_glue::android_main2(app as *mut _, move |_, _| { main() });
}
#[cfg(target_os = "android")]
mod android {
extern crate android_glue;
extern crate android_injected_glue;
extern crate libc;
use self::libc::c_int;
@ -272,7 +275,7 @@ mod android {
redirect_output(STDERR_FILENO);
redirect_output(STDOUT_FILENO);
unsafe { super::app_dummy(); }
unsafe { android_injected_glue::ffi::app_dummy() };
}
struct FilePtr(*mut self::libc::FILE);