Skip to content

Commit 31afcde

Browse files
authored
Fix icu_capi detection (#633)
* Fix `icu_capi` detection #623 made `icu_capi` optional, which broke the build of servo with vendored dependencies. We need to explicitly add the `intl` feature when invoking cargo metadata, otherwise the feature will not be enabled in the vendored crate directory when cargo metadata is run. Signed-off-by: Jonathan Schwender <[email protected]> * Update comment Signed-off-by: Jonathan Schwender <[email protected]> * Bump mozjs-sys version Signed-off-by: Jonathan Schwender <[email protected]> --------- Signed-off-by: Jonathan Schwender <[email protected]>
1 parent 1c2670b commit 31afcde

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

mozjs-sys/Cargo.toml

Lines changed: 1 addition & 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.workspace = true
5-
version = "0.140.0-6"
5+
version = "0.140.0-7"
66
authors = ["Mozilla", "The Servo Project Developers"]
77
links = "mozjs"
88
license.workspace = true

mozjs-sys/build.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use bindgen::callbacks::ParseCallbacks;
66
use bindgen::{CodegenConfig, Formatter, RustTarget};
7+
use cargo_metadata::CargoOpt;
78
use std::ffi::{OsStr, OsString};
89
use std::fmt::Write;
910
use std::path::{Path, PathBuf};
@@ -138,9 +139,14 @@ fn main() {
138139

139140
fn get_icu_capi_include_path() -> String {
140141
// Using cargo metadata is the official recommendation from the icu4x documentation.
141-
// See <https://icu4x.unicode.org/2_0/cppdoc/>. In the future we should try to upstream a
142-
// patch that allows us to use DEP_ syntax, like we do with libz.
143-
let metadata = cargo_metadata::MetadataCommand::new().exec().unwrap();
142+
// See <https://icu4x.unicode.org/2_0/cppdoc/>.
143+
// Once we update to a new release containing https://github.com/unicode-org/icu4x/pull/6887
144+
// we can remove the dependency on cargo metadata.
145+
let metadata = cargo_metadata::MetadataCommand::new()
146+
// icu_capi is feature guarded behind the `intl` feature.
147+
.features(CargoOpt::SomeFeatures(vec!["intl".into()]))
148+
.exec()
149+
.unwrap();
144150
let packages = metadata.packages;
145151
let icu_capi_info = packages
146152
.iter()

0 commit comments

Comments
 (0)