summaryrefslogtreecommitdiffstats
path: root/js/src/build.rs
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /js/src/build.rs
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/build.rs')
-rw-r--r--js/src/build.rs53
1 files changed, 53 insertions, 0 deletions
diff --git a/js/src/build.rs b/js/src/build.rs
new file mode 100644
index 000000000..d4e108232
--- /dev/null
+++ b/js/src/build.rs
@@ -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);
+}