]> git.lizzy.rs Git - rust.git/commitdiff
propagate build.python into cmake
authorNathan Froyd <froydnj@gmail.com>
Wed, 5 Sep 2018 15:43:48 +0000 (11:43 -0400)
committerNathan Froyd <froydnj@gmail.com>
Wed, 5 Sep 2018 15:43:48 +0000 (11:43 -0400)
If a suitable value of Python is not on PATH, one can still invoke x.py
manually, which propagates BOOTSTRAP_PYTHON into the bootstrap
environment.  But building LLVM will abort with error messages about not
being able to find Python, and instructions to set PYTHON_EXECUTABLE,
because nothing is done with BOOTSTRAP_PYTHON when invoking cmake.
Setting build.python in config.toml had no effect in this scenario,
either

To fix this, let's provide PYTHON_EXECUTABLE when invoking cmake; for
the "normal" case of Python in PATH, this doesn't alter any behavior.
For more unusual cases, however, this ensures cmake finds Python
properly.  (This change also ensures there are no differences between
what bootstrap is using, and what cmake uses, which may be useful for
consistency's sake.)

src/bootstrap/native.rs

index 347c2472c6b9b6d75197795090bf4ed85fda3771..caf38d766f54effb2e96b65b7c9d92b24d80b265 100644 (file)
@@ -239,6 +239,10 @@ fn run(self, builder: &Builder) -> PathBuf {
             cfg.define("LLVM_NATIVE_BUILD", builder.llvm_out(builder.config.build).join("build"));
         }
 
+        if let Some(ref python) = builder.config.python {
+            cfg.define("PYTHON_EXECUTABLE", python);
+        }
+
         configure_cmake(builder, target, &mut cfg, false);
 
         // FIXME: we don't actually need to build all LLVM tools and all LLVM