Skip to content

Commit

Permalink
build.rs: Enable linux_time_bits64 with RUST_LIBC_UNSTABLE_LINUX_TIME…
Browse files Browse the repository at this point in the history
…_BITS64

Verify linux_time_bits64 from verify-build.sh.
  • Loading branch information
snogge committed Nov 26, 2024
1 parent e2418ec commit e38313d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ fn main() {
let rustc_dep_of_std = env::var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok();
let libc_ci = env::var("LIBC_CI").is_ok();
let libc_check_cfg = env::var("LIBC_CHECK_CFG").is_ok() || rustc_minor_ver >= 80;
let linux_time_bits64 = env::var("RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64").is_ok();

// The ABI of libc used by std is backward compatible with FreeBSD 12.
// The ABI of libc from crates.io is backward compatible with FreeBSD 12.
Expand Down Expand Up @@ -70,6 +71,10 @@ fn main() {
Some(_) | None => (),
}

if linux_time_bits64 {
set_cfg("linux_time_bits64");
}

// On CI: deny all warnings
if libc_ci {
set_cfg("libc_deny_warnings");
Expand Down
5 changes: 5 additions & 0 deletions ci/verify-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ test_target() {
$cmd --features const-extern-fn
$cmd --features extra_traits

if [ "$os" = "linux" ]; then
# Test with the equivalent of __USE_TIME_BITS64
RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64=1 $cmd
fi

# Test again without default features, i.e. without "std"
$cmd --no-default-features
$cmd --no-default-features --features extra_traits
Expand Down

0 comments on commit e38313d

Please sign in to comment.