forked from mirrors/gecko-dev
Differential Revision: https://phabricator.services.mozilla.com/D41489 --HG-- rename : third_party/rust/image/src/hdr/hdr_decoder.rs => third_party/rust/image/src/hdr/decoder.rs rename : third_party/rust/image/src/hdr/hdr_encoder.rs => third_party/rust/image/src/hdr/encoder.rs extra : moz-landing-system : lando
35 lines
849 B
Rust
35 lines
849 B
Rust
use std::env;
|
|
use std::process::Command;
|
|
use std::str;
|
|
|
|
fn main() {
|
|
println!("cargo:rerun-if-changed=build.rs");
|
|
|
|
let minor = match rustc_minor_version() {
|
|
Some(n) => n,
|
|
None => return,
|
|
};
|
|
|
|
if minor >= 27 {
|
|
println!("cargo:rustc-cfg=crc32fast_stdarchx86");
|
|
}
|
|
}
|
|
|
|
fn rustc_minor_version() -> Option<u32> {
|
|
macro_rules! otry {
|
|
($e:expr) => {
|
|
match $e {
|
|
Some(e) => e,
|
|
None => return None,
|
|
}
|
|
};
|
|
}
|
|
let rustc = otry!(env::var_os("RUSTC"));
|
|
let output = otry!(Command::new(rustc).arg("--version").output().ok());
|
|
let version = otry!(str::from_utf8(&output.stdout).ok());
|
|
let mut pieces = version.split('.');
|
|
if pieces.next() != Some("rustc 1") {
|
|
return None;
|
|
}
|
|
otry!(pieces.next()).parse().ok()
|
|
}
|