mirror of
https://github.com/servo/servo.git
synced 2025-10-02 09:39:14 +01:00
Auto merge of #14530 - mmatyas:android_injectedglue, r=larsbergstrom
Use `android-rs-injected-glue` on Android <!-- Please describe your changes on the following line: --> Due to changes in `android-rs-glue`, currently the Android build fails to start. As discussed [here](https://github.com/servo/servo/issues/13154), other than the `android-glue`, we now also have to inject some additional code too. This task is usually done by a helper program of `android-glue`, `cargo-apk`, but since Servo's build system is somewhat more complex than a regular small application, at the moment it'd be more clean to move the required internal `injected-glue` lib to a new repository, and add it as a dependency. This patch adds a new dependency, `android-rs-injected-glue`, and integrates it into Servo. After applying this commit and #14528, Servo can be launched on Android. (It doesn't *work* yet as expected, though.) Part of #13154. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14530) <!-- Reviewable:end -->
This commit is contained in:
commit
477a9827b8
3 changed files with 17 additions and 6 deletions
|
@ -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"}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue