about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-09-09 14:04:31 -0700
committerGitHub <noreply@github.com>2016-09-09 14:04:31 -0700
commit1284081d33d0e7856c6d242b3e311876c4eec048 (patch)
tree79f20cc3b90fab6ae38ce34dfc236616bf2b10c1
parentf1f40f850e2546c2c187514e3d61d17544ba433f (diff)
parent89bc13c37d0fc58b583f07a5902f62e598c69b0e (diff)
downloadrust-1284081d33d0e7856c6d242b3e311876c4eec048.tar.gz
rust-1284081d33d0e7856c6d242b3e311876c4eec048.zip
Auto merge of #36256 - rjgoldsborough:make-configure-detect-nodejs-36207, r=alexcrichton
adding a check to bootstrap script

and a check to the rust config script

refs #36207

first crack at making configure detect nodejs
-rwxr-xr-xconfigure4
-rw-r--r--src/bootstrap/config.rs4
-rw-r--r--src/bootstrap/sanity.rs6
3 files changed, 14 insertions, 0 deletions
diff --git a/configure b/configure
index 71fb164f891..a1b62e6267f 100755
--- a/configure
+++ b/configure
@@ -633,6 +633,7 @@ valopt datadir "${CFG_PREFIX}/share" "install data"
 valopt infodir "${CFG_PREFIX}/share/info" "install additional info"
 valopt llvm-root "" "set LLVM root"
 valopt python "" "set path to python"
+valopt nodejs "" "set path to nodejs"
 valopt jemalloc-root "" "set directory where libjemalloc_pic.a is located"
 valopt build "${DEFAULT_BUILD}" "GNUs ./configure syntax LLVM build triple"
 valopt android-cross-path "" "Android NDK standalone path (deprecated)"
@@ -748,6 +749,9 @@ if [ $(echo $python_version | grep -c '^Python 2\.7') -ne 1 ]; then
     err "Found $python_version, but Python 2.7 is required"
 fi
 
+# Checking for node, but not required
+probe CFG_NODEJS nodejs node
+
 # If we have no git directory then we are probably a tarball distribution
 # and shouldn't attempt to load submodules
 if [ ! -e ${CFG_SRC_DIR}.git ]
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index 5f18dfcaa12..0f69bcfbb64 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -80,6 +80,7 @@ pub struct Config {
     pub musl_root: Option<PathBuf>,
     pub prefix: Option<String>,
     pub codegen_tests: bool,
+    pub nodejs: Option<PathBuf>,
 }
 
 /// Per-target configuration stored in the global configuration structure.
@@ -395,6 +396,9 @@ impl Config {
                     self.rustc = Some(PathBuf::from(value).join("bin/rustc"));
                     self.cargo = Some(PathBuf::from(value).join("bin/cargo"));
                 }
+                "CFG_NODEJS" if value.len() > 0 => {
+                    self.nodejs = Some(PathBuf::from(value));
+                }
                 _ => {}
             }
         }
diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs
index c69f9489c30..05c35543e3e 100644
--- a/src/bootstrap/sanity.rs
+++ b/src/bootstrap/sanity.rs
@@ -75,6 +75,12 @@ pub fn check(build: &mut Build) {
 
     need_cmd("python".as_ref());
 
+    // If a manual nodejs was added to the config,
+    // of if a nodejs install is detected through config, use it.
+    if let Some(ref s) = build.config.nodejs {
+        need_cmd(s.as_ref());
+    }
+
     // We're gonna build some custom C code here and there, host triples
     // also build some C++ shims for LLVM so we need a C++ compiler.
     for target in build.config.target.iter() {