Skip to content

Commit 1284081

Browse files
authored
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
2 parents f1f40f8 + 89bc13c commit 1284081

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

configure

+4
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,7 @@ valopt datadir "${CFG_PREFIX}/share" "install data"
633633
valopt infodir "${CFG_PREFIX}/share/info" "install additional info"
634634
valopt llvm-root "" "set LLVM root"
635635
valopt python "" "set path to python"
636+
valopt nodejs "" "set path to nodejs"
636637
valopt jemalloc-root "" "set directory where libjemalloc_pic.a is located"
637638
valopt build "${DEFAULT_BUILD}" "GNUs ./configure syntax LLVM build triple"
638639
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
748749
err "Found $python_version, but Python 2.7 is required"
749750
fi
750751

752+
# Checking for node, but not required
753+
probe CFG_NODEJS nodejs node
754+
751755
# If we have no git directory then we are probably a tarball distribution
752756
# and shouldn't attempt to load submodules
753757
if [ ! -e ${CFG_SRC_DIR}.git ]

src/bootstrap/config.rs

+4
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ pub struct Config {
8080
pub musl_root: Option<PathBuf>,
8181
pub prefix: Option<String>,
8282
pub codegen_tests: bool,
83+
pub nodejs: Option<PathBuf>,
8384
}
8485

8586
/// Per-target configuration stored in the global configuration structure.
@@ -395,6 +396,9 @@ impl Config {
395396
self.rustc = Some(PathBuf::from(value).join("bin/rustc"));
396397
self.cargo = Some(PathBuf::from(value).join("bin/cargo"));
397398
}
399+
"CFG_NODEJS" if value.len() > 0 => {
400+
self.nodejs = Some(PathBuf::from(value));
401+
}
398402
_ => {}
399403
}
400404
}

src/bootstrap/sanity.rs

+6
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ pub fn check(build: &mut Build) {
7575

7676
need_cmd("python".as_ref());
7777

78+
// If a manual nodejs was added to the config,
79+
// of if a nodejs install is detected through config, use it.
80+
if let Some(ref s) = build.config.nodejs {
81+
need_cmd(s.as_ref());
82+
}
83+
7884
// We're gonna build some custom C code here and there, host triples
7985
// also build some C++ shims for LLVM so we need a C++ compiler.
8086
for target in build.config.target.iter() {

0 commit comments

Comments
 (0)