Skip to content

Commit

Permalink
Mark dynamically determined features as expected
Browse files Browse the repository at this point in the history
  • Loading branch information
michaellass committed Jun 12, 2024
1 parent 23960d9 commit fe1ee1e
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
MIT License
Copyright (c) 2019-2023 Michael Lass
Copyright (c) 2019-2024 Michael Lass
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -25,29 +25,37 @@ SOFTWARE.
use e2p_sys::CONSTANTS;

fn main() {
// Available features
println!("cargo::rustc-check-cfg=cfg(INLINE_DATA)");
println!("cargo::rustc-check-cfg=cfg(PROJINHERIT)");
println!("cargo::rustc-check-cfg=cfg(ENCRYPT)");
println!("cargo::rustc-check-cfg=cfg(VERITY)");
println!("cargo::rustc-check-cfg=cfg(CASEFOLD)");
println!("cargo::rustc-check-cfg=cfg(DAX)");

// Introduced in v1.43
if CONSTANTS.iter().any(|&s| s == "EXT4_INLINE_DATA_FL") {
println!("cargo:rustc-cfg=INLINE_DATA");
println!("cargo::rustc-cfg=INLINE_DATA");
}
if CONSTANTS.iter().any(|&s| s == "EXT4_PROJINHERIT_FL") {
println!("cargo:rustc-cfg=PROJINHERIT");
println!("cargo::rustc-cfg=PROJINHERIT");
}
if CONSTANTS.iter().any(|&s| s == "EXT4_ENCRYPT_FL") {
println!("cargo:rustc-cfg=ENCRYPT");
println!("cargo::rustc-cfg=ENCRYPT");
}

// Introduced in v1.44.4
if CONSTANTS.iter().any(|&s| s == "EXT4_VERITY_FL") {
println!("cargo:rustc-cfg=VERITY");
println!("cargo::rustc-cfg=VERITY");
}

// Introduced in v1.45.0
if CONSTANTS.iter().any(|&s| s == "EXT4_CASEFOLD_FL") {
println!("cargo:rustc-cfg=CASEFOLD");
println!("cargo::rustc-cfg=CASEFOLD");
}

// Introduced in v1.45.7
if CONSTANTS.iter().any(|&s| s == "FS_DAX_FL") {
println!("cargo:rustc-cfg=DAX");
println!("cargo::rustc-cfg=DAX");
}
}

0 comments on commit fe1ee1e

Please sign in to comment.