Skip to content

Commit 9b44b1e

Browse files
author
bors-servo
authored
Auto merge of #138 - asajeffrey:smup, r=jdm
Upgrade to SM 60 This is the mozjs_sys smup PR. <!-- 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/138) <!-- Reviewable:end -->
2 parents 912aea8 + 8b6abb2 commit 9b44b1e

File tree

49,653 files changed

+2483040
-1076410
lines changed

Some content is hidden

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

49,653 files changed

+2483040
-1076410
lines changed

.travis.yml

+12-6
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,36 @@ rust:
55
- stable
66
sudo: 9000
77
dist: trusty
8-
98
os:
109
- linux
1110
- osx
11+
osx_image: xcode9.3
1212

1313
addons:
1414
apt:
1515
sources:
1616
- ubuntu-toolchain-r-test
1717
- llvm-toolchain-trusty-5.0
1818
packages:
19+
- autoconf2.13
1920
- g++-6
2021
- clang-5.0
2122

2223
env:
2324
- FEATURES=""
2425
- FEATURES="--features debugmozjs"
2526

26-
script:
27-
- cargo build --verbose --verbose $FEATURES
28-
- cargo test $FEATURES
27+
before_script:
28+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export CC=gcc-6; export CXX=g++-6; fi
29+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; brew install [email protected] ccache yasm; fi
2930

30-
before_install:
31-
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; brew install yasm; fi
31+
script:
32+
- ccache -z
33+
- CCACHE=$(which ccache) travis_wait cargo build --verbose $FEATURES
34+
- CCACHE=$(which ccache) RUST_BACKTRACE=1 cargo test --verbose $FEATURES
35+
- ccache -s
3236

3337
notifications:
3438
webhooks: http://build.servo.org:54856/travis
39+
40+
cache: ccache

Cargo.toml

+1-2
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.4"
5+
version = "0.60.0"
66
authors = ["Mozilla"]
77
links = "mozjs"
88
build = "build.rs"
@@ -17,7 +17,6 @@ exclude = [
1717

1818
[features]
1919
debugmozjs = []
20-
promises = []
2120

2221
[lib]
2322
name = "mozjs_sys"

README.md

+23-5
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ set MOZTOOLS_PATH=C:\mozilla-build\msys\bin;C:\mozilla-build\mozmake;C:\mozilla-
4848
set LIBCLANG_PATH=C:\Program Files\LLVM\lib
4949
```
5050

51+
5. Set environment variables so the build script can find Python 2.7 and Autoconf 2.13:
52+
```
53+
set AUTOCONF=C:\mozilla-build\msys\local\bin\autoconf-2.13
54+
set NATIVE_WIN32_PYTHON=C:\mozilla-build\python\python2.7.exe
55+
```
56+
5157
You can now build and test the crate using cargo:
5258
```
5359
cargo build
@@ -61,10 +67,22 @@ Upgrading
6167

6268
In order to upgrade to a new version of SpiderMonkey:
6369

64-
1. Download the tarball corresponding to the desired mozilla-central commit
65-
from [treeherder's SM-tc(pkg) job][tc].
66-
2. Update `etc/COMMIT`.
67-
3. Run `python3 ./etc/update.py path/to/tarball`.
70+
1. Find the mozilla-release commit for the desired version of SpiderMonkey, at
71+
https://treeherder.mozilla.org/#/jobs?repo=mozilla-release&filter-searchStr=spidermonkey%20pkg.
72+
You are looking for an SM(pkg) tagged with FIREFOX_RELEASE.
73+
Take a note of the commit number to the left (a hex number such as ac4fbb7aaca0).
74+
75+
2. Click on the SM(pkg) link, which will open a panel with details of the
76+
commit, including an artefact uploaded link, with a name of the form
77+
mozjs-*version*.tar.bz2. Download it and save it locally.
78+
79+
3. Look at the patches in `etc/patches/*.patch`, and remove any that no longer apply
80+
(with a bit of luck this will be all of them).
81+
82+
4. Run `python3 ./etc/update.py path/to/tarball`.
83+
84+
5. Update `etc/COMMIT` with the commit number.
85+
86+
6. Build and test the bindings as above, then submit a PR!
6887

6988
[bindgen]: https://github.com/servo/rust-bindgen
70-
[tc]: https://treeherder.mozilla.org/#/jobs?repo=mozilla-central&filter-searchStr=Linux%20x64%20opt%20Spider%20Monkey,%20submitted%20by%20taskcluster%20%5BTC%5D%20Spidermonkey%20Package%20SM-tc(pkg)

appveyor.yml

+2-4
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ environment:
2626
C:\\Program Files\\Git\\cmd;\
2727
C:\\Program Files\\Git\\usr\\bin;\
2828
C:\\Program Files\\AppVeyor\\BuildAgent;"
29-
matrix:
30-
- CARGO_OPTS: ""
31-
- CARGO_OPTS: "--release"
3229

3330
# Uncomment to enable RDP & wait for exit. Connection info will be printed in the log.
3431
#init:
@@ -48,11 +45,12 @@ install:
4845
- call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
4946
- set MOZTOOLS_PATH=C:\mozilla-build\msys\bin;C:\mozilla-build\mozmake;C:\mozilla-build\yasm
5047
- set NATIVE_WIN32_PYTHON=C:/Python27/python.exe
48+
- set AUTOCONF=C:/mozilla-build/msys/local/bin/autoconf-2.13
5149
- rustc -vV
5250
- cargo -vV
5351

5452
build_script:
5553
- echo PATH %PATH%
5654
- echo VSINSTALLDIR %VSINSTALLDIR%
5755
- echo MOZTOOLS_PATH %MOZTOOLS_PATH%
58-
- cd %APPVEYOR_BUILD_FOLDER% && cargo build --verbose --verbose %CARGO_OPTS% && cargo test %CARGO_OPTS%
56+
- cd %APPVEYOR_BUILD_FOLDER% && cargo build --verbose --verbose && cargo test

build.rs

+35-4
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,14 @@ fn cc_flags() -> Vec<&'static str> {
5050
result.extend(&[
5151
"-std=c++14",
5252
"-DWIN32",
53+
// Don't use reinterpret_cast() in offsetof(),
54+
// since it's not a constant expression, so can't
55+
// be used in static_assert().
56+
"-D_CRT_USE_BUILTIN_OFFSETOF",
5357
]);
5458
} else {
5559
result.extend(&[
56-
"-std=gnu++11",
60+
"-std=gnu++14",
5761
"-fno-sized-deallocation",
5862
"-Wno-unused-parameter",
5963
"-Wno-invalid-offsetof",
@@ -95,11 +99,18 @@ fn build_jsapi() {
9599
.expect("Failed to run `make`");
96100

97101
assert!(result.success());
98-
println!("cargo:rustc-link-search=native={}/js/src", out_dir);
102+
println!("cargo:rustc-link-search=native={}/js/src/build", out_dir);
99103
println!("cargo:rustc-link-lib=static=js_static"); // Must come before c++
104+
println!("cargo:rustc-link-search=native={}/mozglue/build", out_dir);
105+
println!("cargo:rustc-link-lib=static=mozglue");
100106
if target.contains("windows") {
107+
println!("cargo:rustc-link-search=native={}/dist/bin", out_dir);
101108
println!("cargo:rustc-link-lib=winmm");
102109
println!("cargo:rustc-link-lib=psapi");
110+
println!("cargo:rustc-link-lib=user32");
111+
println!("cargo:rustc-link-lib=Dbghelp");
112+
println!("cargo:rustc-link-search=native={}/config/external/nspr/pr", out_dir);
113+
println!("cargo:rustc-link-lib=nspr4");
103114
if target.contains("gnu") {
104115
println!("cargo:rustc-link-lib=stdc++");
105116
}
@@ -114,7 +125,7 @@ fn build_jsapi() {
114125

115126
fn build_jsglue() {
116127
let out = PathBuf::from(env::var("OUT_DIR").unwrap());
117-
128+
118129
let mut build = cc::Build::new();
119130
build.cpp(true);
120131

@@ -132,6 +143,8 @@ fn build_jsglue() {
132143

133144
build.file("src/jsglue.cpp");
134145
build.include(out.join("dist/include"));
146+
build.include(out.join("js/src"));
147+
135148
build.compile("jsglue");
136149
}
137150

@@ -142,6 +155,7 @@ fn build_jsglue() {
142155
/// generated, see the `const` configuration variables below.
143156
fn build_jsapi_bindings() {
144157
let out = PathBuf::from(env::var("OUT_DIR").unwrap());
158+
let rustfmt_config = Some(PathBuf::from("rustfmt.toml"));
145159

146160
// By default, constructors, destructors and methods declared in .h files are inlined,
147161
// so their symbols aren't available. Adding the -fkeep-inlined-functions option
@@ -160,7 +174,10 @@ fn build_jsapi_bindings() {
160174
.rustified_enum(".*")
161175
.enable_cxx_namespaces()
162176
.with_codegen_config(config)
177+
.rustfmt_bindings(true)
178+
.rustfmt_configuration_file(rustfmt_config)
163179
.clang_arg("-I").clang_arg(out.join("dist/include").to_str().expect("UTF-8"))
180+
.clang_arg("-I").clang_arg(out.join("js/src").to_str().expect("UTF-8"))
164181
.clang_arg("-x").clang_arg("c++");
165182

166183
if cfg!(windows) {
@@ -175,14 +192,20 @@ fn build_jsapi_bindings() {
175192
}
176193
}
177194

195+
if let Ok(flags) = env::var("CLANGFLAGS") {
196+
for flag in flags.split_whitespace() {
197+
builder = builder.clang_arg(flag);
198+
}
199+
}
200+
178201
for flag in cc_flags() {
179202
builder = builder.clang_arg(flag);
180203
}
181204

182205
builder = builder.clang_arg("-include");
183206
builder = builder.clang_arg(out.join("js/src/js-confdefs.h").to_str().expect("UTF-8"));
184207

185-
println!("Generting bindings {:?}.", builder.command_line_flags());
208+
println!("Generting bindings {:?} {}.", builder.command_line_flags(), bindgen::clang_version().full);
186209

187210
for ty in UNSAFE_IMPL_SYNC_TYPES {
188211
builder = builder.raw_line(format!("unsafe impl Sync for root::{} {{}}", ty));
@@ -218,7 +241,9 @@ fn build_jsapi_bindings() {
218241
bindings.write_to_file(out.join("jsapi.rs"))
219242
.expect("Should write bindings to file OK");
220243

244+
println!("cargo:rerun-if-changed=rustfmt.toml");
221245
println!("cargo:rerun-if-changed=src/jsglue.hpp");
246+
println!("cargo:rerun-if-changed=src/jsglue.cpp");
222247
}
223248

224249
/// JSAPI types for which we should implement `Sync`.
@@ -270,6 +295,7 @@ const WHITELIST_FUNCTIONS: &'static [&'static str] = &[
270295
const OPAQUE_TYPES: &'static [&'static str] = &[
271296
"JS::Auto.*Impl",
272297
"JS::Auto.*Vector.*",
298+
"JS::PersistentRooted.*",
273299
"JS::ReadOnlyCompileOptions",
274300
"JS::Rooted<JS::Auto.*Vector.*>",
275301
"JS::detail::CallArgsBase.*",
@@ -279,6 +305,7 @@ const OPAQUE_TYPES: &'static [&'static str] = &[
279305
"mozilla::BufferList",
280306
"mozilla::Maybe.*",
281307
"mozilla::UniquePtr.*",
308+
"mozilla::Variant",
282309
];
283310

284311
/// Types for which we should NEVER generate bindings, even if it is used within
@@ -289,6 +316,9 @@ const BLACKLIST_TYPES: &'static [&'static str] = &[
289316
// We provide our own definition because we need to express trait bounds in
290317
// the definition of the struct to make our Drop implementation correct.
291318
"JS::Heap",
319+
// We provide our own definition because SM's use of templates
320+
// is more than bindgen can cope with.
321+
"JS::Rooted",
292322
// Bindgen generates bitfields with private fields, so they cannot
293323
// be used in const expressions.
294324
"JSJitInfo",
@@ -299,5 +329,6 @@ const MODULE_RAW_LINES: &'static [(&'static str, &'static str)] = &[
299329
("root", "pub type FILE = ::libc::FILE;"),
300330
("root", "pub type JSJitInfo = ::jsjit::JSJitInfo;"),
301331
("root::JS", "pub type Heap<T> = ::jsgc::Heap<T>;"),
332+
("root::JS", "pub type Rooted<T> = ::jsgc::Rooted<T>;"),
302333
("root::JS", "pub type AutoGCRooterTag = AutoGCRooter__bindgen_ty_1;"),
303334
];

etc/COMMIT

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
bcf4ff0c3eef
1+
ac4fbb7aaca0

0 commit comments

Comments
 (0)