Skip to content

Commit 05e8401

Browse files
author
bors-servo
authored
Auto merge of #139 - servo:cross-android, r=asajeffrey
Fix macOS/Android cross-compile. These changes allow my local Servo android build to complete. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/mozjs/139) <!-- Reviewable:end -->
2 parents d2513df + f4b3871 commit 05e8401

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "mozjs_sys"
33
description = "System crate for the Mozilla SpiderMonkey JavaScript engine."
44
repository = "https://github.com/servo/mozjs/"
5-
version = "0.51.1"
5+
version = "0.51.2"
66
authors = ["Mozilla"]
77
links = "mozjs"
88
build = "build.rs"
@@ -29,3 +29,6 @@ libz-sys = "1.0"
2929
[build-dependencies]
3030
bindgen = "0.36.1"
3131
cc = "1.0"
32+
33+
[patch.crates-io]
34+
libloading = { git = "https://github.com/servo/rust_libloading", branch = "mac-crash-revert" }

build.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,14 @@ fn build_jsglue() {
122122
build.flag_if_supported(flag);
123123
}
124124

125+
let config = format!("{}/js/src/js-confdefs.h", out.display());
126+
if cfg!(windows) {
127+
build.flag("-FI");
128+
} else {
129+
build.flag("-include");
130+
}
131+
build.flag(&config);
132+
125133
build.file("src/jsglue.cpp");
126134
build.include(out.join("dist/include"));
127135
build.compile("jsglue");
@@ -161,14 +169,19 @@ fn build_jsapi_bindings() {
161169

162170
if let Ok(flags) = env::var("CXXFLAGS") {
163171
for flag in flags.split_whitespace() {
164-
builder = builder.clang_arg(flag);
172+
if !flag.starts_with("--sysroot") {
173+
builder = builder.clang_arg(flag);
174+
}
165175
}
166176
}
167177

168178
for flag in cc_flags() {
169179
builder = builder.clang_arg(flag);
170180
}
171181

182+
builder = builder.clang_arg("-include");
183+
builder = builder.clang_arg(out.join("js/src/js-confdefs.h").to_str().expect("UTF-8"));
184+
172185
println!("Generting bindings {:?}.", builder.command_line_flags());
173186

174187
for ty in UNSAFE_IMPL_SYNC_TYPES {

0 commit comments

Comments
 (0)