Skip to content

Commit 27588dd

Browse files
committed
Move nodejs detection into bootstrap
This avoids issues with mingw path conversions.
1 parent c772948 commit 27588dd

File tree

3 files changed

+19
-15
lines changed

3 files changed

+19
-15
lines changed

configure

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,6 @@ valopt datadir "${CFG_PREFIX}/share" "install data"
637637
valopt infodir "${CFG_PREFIX}/share/info" "install additional info"
638638
valopt llvm-root "" "set LLVM root"
639639
valopt python "" "set path to python"
640-
valopt nodejs "" "set path to nodejs"
641640
valopt jemalloc-root "" "set directory where libjemalloc_pic.a is located"
642641
valopt build "${DEFAULT_BUILD}" "GNUs ./configure syntax LLVM build triple"
643642
valopt android-cross-path "" "Android NDK standalone path (deprecated)"
@@ -754,9 +753,6 @@ if [ $(echo $python_version | grep -c '^Python 2\.7') -ne 1 ]; then
754753
err "Found $python_version, but Python 2.7 is required"
755754
fi
756755

757-
# Checking for node, but not required
758-
probe CFG_NODEJS nodejs node
759-
760756
# If we have no git directory then we are probably a tarball distribution
761757
# and shouldn't attempt to load submodules
762758
if [ ! -e ${CFG_SRC_DIR}.git ]

src/bootstrap/config.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,9 +396,6 @@ impl Config {
396396
self.rustc = Some(PathBuf::from(value).join("bin/rustc"));
397397
self.cargo = Some(PathBuf::from(value).join("bin/cargo"));
398398
}
399-
"CFG_NODEJS" if value.len() > 0 => {
400-
self.nodejs = Some(PathBuf::from(value));
401-
}
402399
_ => {}
403400
}
404401
}

src/bootstrap/sanity.rs

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,23 @@ pub fn check(build: &mut Build) {
4040
panic!("PATH contains invalid character '\"'");
4141
}
4242
}
43-
let mut need_cmd = |cmd: &OsStr| {
44-
if !checked.insert(cmd.to_owned()) {
45-
return
46-
}
43+
let have_cmd = |cmd: &OsStr| {
4744
for path in env::split_paths(&path).map(|p| p.join(cmd)) {
4845
if fs::metadata(&path).is_ok() ||
4946
fs::metadata(path.with_extension("exe")).is_ok() {
50-
return
47+
return Some(path);
5148
}
5249
}
53-
panic!("\n\ncouldn't find required command: {:?}\n\n", cmd);
50+
return None;
51+
};
52+
53+
let mut need_cmd = |cmd: &OsStr| {
54+
if !checked.insert(cmd.to_owned()) {
55+
return
56+
}
57+
if have_cmd(cmd).is_none() {
58+
panic!("\n\ncouldn't find required command: {:?}\n\n", cmd);
59+
}
5460
};
5561

5662
// If we've got a git directory we're gona need git to update
@@ -75,8 +81,13 @@ pub fn check(build: &mut Build) {
7581

7682
need_cmd("python".as_ref());
7783

78-
// If a manual nodejs was added to the config,
79-
// of if a nodejs install is detected through config, use it.
84+
// Look for the nodejs command, needed for emscripten testing
85+
if let Some(node) = have_cmd("node".as_ref()) {
86+
build.config.nodejs = Some(node);
87+
} else if let Some(node) = have_cmd("nodejs".as_ref()) {
88+
build.config.nodejs = Some(node);
89+
}
90+
8091
if let Some(ref s) = build.config.nodejs {
8192
need_cmd(s.as_ref());
8293
}

0 commit comments

Comments
 (0)