Skip to content

Commit

Permalink
Allow specifying make via an environment variable.
Browse files Browse the repository at this point in the history
This is what mozjs does, and allows me to fix up servo/webrender#3308.
  • Loading branch information
emilio committed Nov 13, 2018
1 parent e17b23b commit ebf6c08
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "osmesa-src"
version = "0.1.0"
version = "0.1.1"
authors = ["mesa3d maintainers"]
build = "build.rs"
repository = "https://github.com/servo/osmesa-src/"
Expand Down
14 changes: 13 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
use std::env;
use std::ffi::{OsStr, OsString};
use std::path::PathBuf;
use std::process::Command;

fn find_make() -> OsString {
if let Some(make) = env::var_os("MAKE") {
return make
}

match Command::new("gmake").status() {
Ok(_) => OsStr::new("gmake").to_os_string(),
Err(_) => OsStr::new("make").to_os_string(),
}
}

fn main() {
let src = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap());
let dst = PathBuf::from(env::var_os("OUT_DIR").unwrap());
Expand Down Expand Up @@ -45,7 +57,7 @@ fn main() {
.arg("--enable-gallium-osmesa")
.arg("--with-gallium-drivers=swrast"));

run(Command::new("make")
run(Command::new(find_make())
.env("MAKEFLAGS", env::var("CARGO_MAKEFLAGS").unwrap_or_default())
.env("PYTHONPATH", src.join("Mako-1.0.7.zip"))
.current_dir(&dst));
Expand Down

0 comments on commit ebf6c08

Please sign in to comment.