Skip to content
This repository was archived by the owner on Feb 25, 2021. It is now read-only.

Commit fba7dfb

Browse files
tomakareal-or-random
authored andcommitted
Fix cargo warning output and wrong pointer width (BlockstreamResearch#88)
Fix cargo warning output and wrong pointer width Co-Authored-By: tomaka <[email protected]>
1 parent 4f44a0f commit fba7dfb

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

build.rs

+6-11
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,22 @@
2323

2424
extern crate cc;
2525

26-
use std::io::{self, Write};
26+
use std::env;
2727

2828
fn main() {
2929
// Check whether we can use 64-bit compilation
30-
#[cfg(target_pointer_width = "64")]
31-
let use_64bit_compilation = {
30+
let use_64bit_compilation = if env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap() == "64" {
3231
let check = cc::Build::new().file("depend/check_uint128_t.c")
3332
.cargo_metadata(false)
3433
.try_compile("check_uint128_t")
3534
.is_ok();
3635
if !check {
37-
writeln!(
38-
&mut io::stderr(),
39-
"Warning: Compiling in 32-bit mode on a 64-bit architecture due to lack of uint128_t support."
40-
).expect("print to stderr")
36+
println!("cargo:warning=Compiling in 32-bit mode on a 64-bit architecture due to lack of uint128_t support.");
4137
}
4238
check
39+
} else {
40+
false
4341
};
44-
#[cfg(not(target_pointer_width = "64"))]
45-
let use_64bit_compilation = false;
46-
4742

4843
// Actual build
4944
let mut base_config = cc::Build::new();
@@ -61,7 +56,7 @@ fn main() {
6156
.define("ENABLE_MODULE_ECDH", Some("1"))
6257
.define("ENABLE_MODULE_RECOVERY", Some("1"));
6358

64-
if let Ok(target_endian) = std::env::var("CARGO_CFG_TARGET_ENDIAN") {
59+
if let Ok(target_endian) = env::var("CARGO_CFG_TARGET_ENDIAN") {
6560
if target_endian == "big" {
6661
base_config.define("WORDS_BIGENDIAN", Some("1"));
6762
}

0 commit comments

Comments
 (0)