Skip to content

Commit 18029ea

Browse files
authored
Keep icu_capi headers in SM (#639)
* Keep icu_capi headers Signed-off-by: sagudev <[email protected]> * Apply Signed-off-by: sagudev <[email protected]> * bump mozjs-sys Signed-off-by: sagudev <[email protected]> --------- Signed-off-by: sagudev <[email protected]>
1 parent 31afcde commit 18029ea

File tree

207 files changed

+7136
-104
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

207 files changed

+7136
-104
lines changed

mozjs-sys/Cargo.toml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,11 @@
22
name = "mozjs_sys"
33
description = "System crate for the Mozilla SpiderMonkey JavaScript engine."
44
repository.workspace = true
5-
version = "0.140.0-7"
5+
version = "0.140.0-8"
66
authors = ["Mozilla", "The Servo Project Developers"]
77
links = "mozjs"
88
license.workspace = true
9-
exclude = [
10-
"__pycache__",
11-
"/etc/",
12-
"/mozjs/.cargo/",
13-
14-
]
9+
exclude = ["__pycache__", "/etc/", "/mozjs/.cargo/"]
1510
edition.workspace = true
1611

1712
[lib]
@@ -36,16 +31,25 @@ encoding_c = "0.9.8"
3631
encoding_c_mem = "0.2.6"
3732
# unicode-bidi-ffi = { path = "./mozjs/intl/bidi/rust/unicode-bidi-ffi" }
3833
# keep in sync with intl/icu_capi/Cargo.toml
39-
icu_capi = { version = "=1.5.0", default-features = false, features = ["compiled_data", "icu_calendar", "icu_properties", "icu_segmenter"], optional = true }
34+
icu_capi = { version = "=1.5.0", default-features = false, features = [
35+
"compiled_data",
36+
"icu_calendar",
37+
"icu_properties",
38+
"icu_segmenter",
39+
], optional = true }
4040

41-
libz-rs-sys = { version = "0.5.1", features = ["export-symbols"], optional = true }
41+
libz-rs-sys = { version = "0.5.1", features = [
42+
"export-symbols",
43+
], optional = true }
4244
# SM depends on them and we provide them using cargo
43-
libz-sys = { version = "1.1.19", default-features = false, features = ["libc", "stock-zlib"], optional = true }
45+
libz-sys = { version = "1.1.19", default-features = false, features = [
46+
"libc",
47+
"stock-zlib",
48+
], optional = true }
4449

4550
[build-dependencies]
4651
bindgen.workspace = true
4752
cc.workspace = true
4853
walkdir = "2"
4954
flate2 = "1"
5055
tar = "0.4"
51-
cargo_metadata = "0.20.0"

mozjs-sys/build.rs

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

55
use bindgen::callbacks::ParseCallbacks;
66
use bindgen::{CodegenConfig, Formatter, RustTarget};
7-
use cargo_metadata::CargoOpt;
87
use std::ffi::{OsStr, OsString};
98
use std::fmt::Write;
109
use std::path::{Path, PathBuf};
@@ -137,34 +136,6 @@ fn main() {
137136
}
138137
}
139138

140-
fn get_icu_capi_include_path() -> String {
141-
// Using cargo metadata is the official recommendation from the icu4x documentation.
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();
150-
let packages = metadata.packages;
151-
let icu_capi_info = packages
152-
.iter()
153-
.find(|pkg| pkg.name.contains("icu_capi"))
154-
.expect("icu_capi not found");
155-
let icu_cpath = &icu_capi_info.manifest_path;
156-
// Include path for icu_capi 1.5:
157-
let c_include_path = icu_cpath
158-
.parent()
159-
.expect("manifest dir?")
160-
.join("bindings/c");
161-
assert!(
162-
c_include_path.exists(),
163-
"ICU_C C include path {c_include_path} does not exist"
164-
);
165-
c_include_path.to_string()
166-
}
167-
168139
fn build_spidermonkey(build_dir: &Path) {
169140
let target = env::var("TARGET").unwrap();
170141
let make;
@@ -247,12 +218,6 @@ fn build_spidermonkey(build_dir: &Path) {
247218

248219
let mut cxxflags = vec![];
249220

250-
#[cfg(feature = "intl")]
251-
{
252-
let icu_c_include_path = get_icu_capi_include_path();
253-
cxxflags.push(format!("-I{}", &icu_c_include_path.replace("\\", "/")));
254-
}
255-
256221
if target.contains("apple") || target.contains("freebsd") || target.contains("ohos") {
257222
cxxflags.push(String::from("-stdlib=libc++"));
258223
}

mozjs-sys/etc/filters.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
- /build/workspace-hack
2121
- /build/rust
2222
- /intl/bidi
23-
- /intl/icu_capi
2423
- /intl/icu_segmenter_data
2524
- /js/rust
2625
- /js/src/build.rs
@@ -36,6 +35,12 @@
3635
- /Cargo.toml
3736
- /.cargo
3837

38+
# Keep icu_capi headers
39+
+ /intl/icu_capi/bindings/
40+
+ /intl/icu_capi/bindings/c/
41+
+ /intl/icu_capi/bindings/c/*
42+
- /intl/icu_capi/**
43+
3944
# Keep zlib headers for libz-rs-sys
4045
+ modules/zlib/src/
4146
+ modules/zlib/src/zlib.h

mozjs-sys/etc/patches/0041-use-icu_capi-headers-from-cargo.patch

Lines changed: 0 additions & 57 deletions
This file was deleted.

mozjs-sys/mozjs/intl/components/moz.build

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mozjs-sys/mozjs/intl/components/src/calendar/moz.build

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mozjs-sys/mozjs/intl/icu_capi/bindings/c/CodePointRangeIterator.h

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mozjs-sys/mozjs/intl/icu_capi/bindings/c/CodePointRangeIteratorResult.h

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mozjs-sys/mozjs/intl/icu_capi/bindings/c/ICU4XAnyCalendarKind.h

Lines changed: 55 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mozjs-sys/mozjs/intl/icu_capi/bindings/c/ICU4XBcp47ToIanaMapper.h

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)