зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1277338 - Part 1: Turn js/src into the mozjs-sys crate; r=sfink
This commit is contained in:
Родитель
8a2e922906
Коммит
e2cccedfb2
|
@ -0,0 +1 @@
|
|||
config
|
|
@ -0,0 +1 @@
|
|||
target/
|
|
@ -0,0 +1,38 @@
|
|||
[root]
|
||||
name = "mozjs_sys"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libz-sys 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gcc"
|
||||
version = "0.3.35"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "libz-sys"
|
||||
version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"gcc 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[metadata]
|
||||
"checksum gcc 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)" = "91ecd03771effb0c968fd6950b37e89476a578aaf1c70297d8e92b6516ec3312"
|
||||
"checksum libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)" = "408014cace30ee0f767b1c4517980646a573ec61a57957aeeabcac8ac0a02e8d"
|
||||
"checksum libz-sys 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "40f2df7730b5d29426c3e44ce4d088d8c5def6471c2c93ba98585b89fb201ce6"
|
||||
"checksum pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8cee804ecc7eaf201a4a207241472cc870e825206f6c031e3ee2a72fa425f2fa"
|
|
@ -0,0 +1,18 @@
|
|||
[package]
|
||||
name = "mozjs_sys"
|
||||
version = "0.0.0"
|
||||
authors = ["Mozilla"]
|
||||
links = "mozjs"
|
||||
build = "build.rs"
|
||||
|
||||
[features]
|
||||
debugmozjs = []
|
||||
promises = []
|
||||
|
||||
[lib]
|
||||
name = "mozjs_sys"
|
||||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
libc = "0.2"
|
||||
libz-sys = "1.0"
|
|
@ -0,0 +1,53 @@
|
|||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
use std::env;
|
||||
use std::process::{Command, Stdio};
|
||||
|
||||
fn main() {
|
||||
let out_dir = env::var("OUT_DIR").expect("Should have env var OUT_DIR");
|
||||
let target = env::var("TARGET").expect("Should have env var TARGET");
|
||||
|
||||
let js_src = env::var("CARGO_MANIFEST_DIR").expect("Should have env var CARGO_MANIFEST_DIR");
|
||||
|
||||
env::set_current_dir(&js_src).unwrap();
|
||||
|
||||
let variant = if cfg!(feature = "debugmozjs") {
|
||||
"plaindebug"
|
||||
} else {
|
||||
"plain"
|
||||
};
|
||||
|
||||
let python = env::var("PYTHON").unwrap_or("python2.7".into());
|
||||
let mut cmd = Command::new(&python);
|
||||
cmd.args(&["./devtools/automation/autospider.py",
|
||||
"--build-only",
|
||||
"--objdir", &out_dir,
|
||||
variant])
|
||||
.env("SOURCE", &js_src)
|
||||
.env("PWD", &js_src)
|
||||
.env("AUTOMATION", "1")
|
||||
.stdout(Stdio::inherit())
|
||||
.stderr(Stdio::inherit());
|
||||
println!("Running command: {:?}", cmd);
|
||||
let result = cmd
|
||||
.status()
|
||||
.expect("Should spawn autospider OK");
|
||||
assert!(result.success(), "autospider should exit OK");
|
||||
|
||||
println!("cargo:rustc-link-search=native={}/js/src", out_dir);
|
||||
|
||||
if target.contains("windows") {
|
||||
println!("cargo:rustc-link-lib=winmm");
|
||||
println!("cargo:rustc-link-lib=psapi");
|
||||
if target.contains("gnu") {
|
||||
println!("cargo:rustc-link-lib=stdc++");
|
||||
}
|
||||
} else {
|
||||
println!("cargo:rustc-link-lib=stdc++");
|
||||
}
|
||||
|
||||
println!("cargo:rustc-link-lib=static=js_static");
|
||||
println!("cargo:outdir={}", out_dir);
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
extern crate libz_sys;
|
||||
|
|
@ -101,6 +101,7 @@ case $cmd in
|
|||
cp -p ${SRCDIR}/../moz.configure ${tgtpath}/js
|
||||
cp -pPR ${SRCDIR}/../public ${tgtpath}/js
|
||||
cp -pPR ${SRCDIR}/../examples ${tgtpath}/js
|
||||
cp -pPR ${SRCDIR}/../rust ${tgtpath}/js
|
||||
find ${SRCDIR} -mindepth 1 -maxdepth 1 -not -path ${STAGING} -a -not -name ${pkg} \
|
||||
-exec cp -pPR {} ${tgtpath}/js/src \;
|
||||
|
||||
|
|
|
@ -68,6 +68,21 @@ jobs:
|
|||
- toolkit/mozapps/installer/package-name.mk
|
||||
- toolkit/mozapps/installer/upload-files.mk
|
||||
|
||||
sm-mozjs-sys/debug:
|
||||
description: "Build js/src as the mozjs_sys Rust crate"
|
||||
index:
|
||||
job-name:
|
||||
gecko-v2: sm-mozjs-sys-debug
|
||||
treeherder:
|
||||
symbol: SM-tc(mozjs-crate)
|
||||
run:
|
||||
using: spidermonkey-mozjs-crate
|
||||
spidermonkey-variant: plain
|
||||
run-on-projects:
|
||||
- integration
|
||||
- release
|
||||
- try
|
||||
|
||||
sm-plain/debug:
|
||||
description: "Spidermonkey Plain"
|
||||
index:
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -xe
|
||||
|
||||
source $(dirname $0)/sm-tooltool-config.sh
|
||||
|
||||
# Ensure that we have a .config/cargo that points us to our vendored crates
|
||||
# rather than to crates.io.
|
||||
cd "$SRCDIR/.cargo"
|
||||
sed -e "s|@top_srcdir@|$SRCDIR|" < config.in | tee config
|
||||
|
||||
cd "$SRCDIR/js/src"
|
||||
|
||||
export PATH="$PATH:$TOOLTOOL_CHECKOUT/cargo/bin:$TOOLTOOL_CHECKOUT/rustc/bin"
|
||||
export RUST_BACKTRACE=1
|
||||
|
||||
cargo build --verbose --frozen --features debugmozjs
|
||||
cargo build --verbose --frozen
|
|
@ -55,6 +55,7 @@ JOB_NAME_WHITELIST = set([
|
|||
'sm-arm-sim-debug',
|
||||
'sm-asan-opt',
|
||||
'sm-compacting-debug',
|
||||
'sm-mozjs-sys-debug',
|
||||
'sm-msan-opt',
|
||||
'sm-nonunified-debug',
|
||||
'sm-package-opt',
|
||||
|
|
|
@ -17,7 +17,7 @@ from taskgraph.transforms.job.common import (
|
|||
)
|
||||
|
||||
sm_run_schema = Schema({
|
||||
Required('using'): Any('spidermonkey', 'spidermonkey-package'),
|
||||
Required('using'): Any('spidermonkey', 'spidermonkey-package', 'spidermonkey-mozjs-crate'),
|
||||
|
||||
# The SPIDERMONKEY_VARIANT
|
||||
Required('spidermonkey-variant'): basestring,
|
||||
|
@ -30,6 +30,7 @@ sm_run_schema = Schema({
|
|||
|
||||
@run_job_using("docker-worker", "spidermonkey")
|
||||
@run_job_using("docker-worker", "spidermonkey-package")
|
||||
@run_job_using("docker-worker", "spidermonkey-mozjs-crate")
|
||||
def docker_worker_spidermonkey(config, job, taskdesc, schema=sm_run_schema):
|
||||
run = job['run']
|
||||
|
||||
|
@ -71,6 +72,8 @@ def docker_worker_spidermonkey(config, job, taskdesc, schema=sm_run_schema):
|
|||
script = "build-sm.sh"
|
||||
if run['using'] == 'spidermonkey-package':
|
||||
script = "build-sm-package.sh"
|
||||
elif run['using'] == 'spidermonkey-mozjs-crate':
|
||||
script = "build-sm-mozjs-crate.sh"
|
||||
|
||||
worker['command'] = [
|
||||
'/home/worker/bin/run-task',
|
||||
|
|
|
@ -164,6 +164,7 @@ RIDEALONG_BUILDS = {
|
|||
'sm-package',
|
||||
'sm-tsan',
|
||||
'sm-asan',
|
||||
'sm-mozjs-sys',
|
||||
'sm-msan',
|
||||
],
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче