From b66410043a8d2f352b8261f93c4227d48292df72 Mon Sep 17 00:00:00 2001 From: Jake Goldsborough Date: Sat, 3 Sep 2016 20:22:12 -0700 Subject: [PATCH 1/5] adding a check to bootstrap script and a check to the rust config script --- src/bootstrap/bootstrap.py | 9 +++++++++ src/bootstrap/config.rs | 3 +++ 2 files changed, 12 insertions(+) diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 17a7c9ca66a..3f4a18ab124 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -236,6 +236,15 @@ class RustBuild: return config + '/bin/rustc' + self.exe_suffix() return os.path.join(self.bin_root(), "bin/rustc" + self.exe_suffix()) + def nodejs(self): + config = self.get_toml('nodejs') + if config: + return config + if os.path.exists(os.path.join(self.bin_root(), "bin/nodejs")): + return os.path.join(self.bin_root(), "bin/nodejs" + self.exe_suffix()) + elif os.path.exists(os.path.join(self.bin_root(), "bin/node")): + return os.path.join(self.bin_root(), "bin/node" + self.exe_suffix()) + def get_string(self, line): start = line.find('"') end = start + 1 + line[start+1:].find('"') diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 682a6f74126..5a7ae4f6973 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -67,6 +67,7 @@ pub struct Config { pub target: Vec, pub rustc: Option, pub cargo: Option, + pub nodejs: Option, pub local_rebuild: bool, // libstd features @@ -111,6 +112,7 @@ struct Build { host: Vec, target: Vec, cargo: Option, + nodejs: Option, rustc: Option, compiler_docs: Option, docs: Option, @@ -215,6 +217,7 @@ impl Config { } config.rustc = build.rustc.map(PathBuf::from); config.cargo = build.cargo.map(PathBuf::from); + config.nodejs = build.nodejs.map(PathBuf::from); set(&mut config.compiler_docs, build.compiler_docs); set(&mut config.docs, build.docs); From 79644ac3c4fe1b27dc64e0b172d3fca80a88335c Mon Sep 17 00:00:00 2001 From: Jake Goldsborough Date: Tue, 6 Sep 2016 07:41:20 -0700 Subject: [PATCH 2/5] adding a check to sanity to look for the nodejs command --- src/bootstrap/sanity.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs index c0d303c0ea9..ae7f2e018f9 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 bootstrap.py, use it. + if build.config.nodejs.is_some() { + need_cmd("nodejs".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() { From 0adcf46cdf3d85e78e761fdaaa9c3fa8a69df927 Mon Sep 17 00:00:00 2001 From: Jake Goldsborough Date: Tue, 6 Sep 2016 18:31:00 -0700 Subject: [PATCH 3/5] detecting nodejs in configure --- configure | 4 ++++ src/bootstrap/bootstrap.py | 9 --------- src/bootstrap/config.rs | 3 --- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/configure b/configure index bcc1faea3b5..352b77560b7 100755 --- a/configure +++ b/configure @@ -634,6 +634,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)" @@ -749,6 +750,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/bootstrap.py b/src/bootstrap/bootstrap.py index 3f4a18ab124..17a7c9ca66a 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -236,15 +236,6 @@ class RustBuild: return config + '/bin/rustc' + self.exe_suffix() return os.path.join(self.bin_root(), "bin/rustc" + self.exe_suffix()) - def nodejs(self): - config = self.get_toml('nodejs') - if config: - return config - if os.path.exists(os.path.join(self.bin_root(), "bin/nodejs")): - return os.path.join(self.bin_root(), "bin/nodejs" + self.exe_suffix()) - elif os.path.exists(os.path.join(self.bin_root(), "bin/node")): - return os.path.join(self.bin_root(), "bin/node" + self.exe_suffix()) - def get_string(self, line): start = line.find('"') end = start + 1 + line[start+1:].find('"') diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 5a7ae4f6973..682a6f74126 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -67,7 +67,6 @@ pub struct Config { pub target: Vec, pub rustc: Option, pub cargo: Option, - pub nodejs: Option, pub local_rebuild: bool, // libstd features @@ -112,7 +111,6 @@ struct Build { host: Vec, target: Vec, cargo: Option, - nodejs: Option, rustc: Option, compiler_docs: Option, docs: Option, @@ -217,7 +215,6 @@ impl Config { } config.rustc = build.rustc.map(PathBuf::from); config.cargo = build.cargo.map(PathBuf::from); - config.nodejs = build.nodejs.map(PathBuf::from); set(&mut config.compiler_docs, build.compiler_docs); set(&mut config.docs, build.docs); From 7e46f2ceaa84ae7ba7143fcbe8bb3d0da2449fb4 Mon Sep 17 00:00:00 2001 From: Jake Goldsborough Date: Wed, 7 Sep 2016 13:13:37 -0700 Subject: [PATCH 4/5] moving nodejs detection logic to configure and adding a nodejs cmd sanity check --- src/bootstrap/config.rs | 4 ++++ src/bootstrap/sanity.rs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 682a6f74126..b1701202511 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -79,6 +79,7 @@ pub struct Config { pub musl_root: Option, pub prefix: Option, pub codegen_tests: bool, + pub nodejs: Option, } /// Per-target configuration stored in the global configuration structure. @@ -391,6 +392,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 ae7f2e018f9..c345893954f 100644 --- a/src/bootstrap/sanity.rs +++ b/src/bootstrap/sanity.rs @@ -76,7 +76,7 @@ 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 bootstrap.py, use it. + // of if a nodejs install is detected through config, use it. if build.config.nodejs.is_some() { need_cmd("nodejs".as_ref()) } From 89bc13c37d0fc58b583f07a5902f62e598c69b0e Mon Sep 17 00:00:00 2001 From: Jake Goldsborough Date: Thu, 8 Sep 2016 17:51:06 -0700 Subject: [PATCH 5/5] tweaking the nodejs cmd sanity check --- src/bootstrap/sanity.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs index c345893954f..e5e66f1035d 100644 --- a/src/bootstrap/sanity.rs +++ b/src/bootstrap/sanity.rs @@ -77,8 +77,8 @@ pub fn check(build: &mut Build) { // If a manual nodejs was added to the config, // of if a nodejs install is detected through config, use it. - if build.config.nodejs.is_some() { - need_cmd("nodejs".as_ref()) + 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