Skip to content

Commit c3b9626

Browse files
committed
uucore: add selinux/smack cfg alias
1 parent da59839 commit c3b9626

File tree

6 files changed

+15
-4
lines changed

6 files changed

+15
-4
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fuzz/Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/uucore/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ workspace = true
2222
[lib]
2323
path = "src/lib/lib.rs"
2424

25+
[build-dependencies]
26+
cfg_aliases.workspace = true
27+
2528
[dependencies]
2629
bstr = { workspace = true, optional = true }
2730
clap = { workspace = true }

src/uucore/build.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,18 @@
33
// For the full copyright and license information, please view the LICENSE
44
// file that was distributed with this source code.
55

6+
use cfg_aliases::cfg_aliases;
67
use std::env;
78
use std::fs::File;
89
use std::io::Write;
910
use std::path::{Path, PathBuf};
1011

1112
pub fn main() -> Result<(), Box<dyn std::error::Error>> {
13+
cfg_aliases! {
14+
selinux: { all(feature = "selinux", any(target_os = "android", target_os = "linux")) },
15+
smack: { all(feature = "smack", target_os = "linux") },
16+
}
17+
1218
let out_dir = env::var("OUT_DIR")?;
1319

1420
let mut embedded_file = File::create(Path::new(&out_dir).join("embedded_locales.rs"))?;

src/uucore/src/lib/features.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ pub mod tty;
8181
pub mod fsxattr;
8282
#[cfg(feature = "hardware")]
8383
pub mod hardware;
84-
#[cfg(all(feature = "selinux", any(target_os = "linux", target_os = "android")))]
84+
#[cfg(selinux)]
8585
pub mod selinux;
8686
#[cfg(all(unix, not(target_os = "fuchsia"), feature = "signals"))]
8787
pub mod signals;
88-
#[cfg(all(target_os = "linux", feature = "smack"))]
88+
#[cfg(smack)]
8989
pub mod smack;
9090
#[cfg(feature = "feat_systemd_logind")]
9191
pub mod systemd_logind;

src/uucore/src/lib/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,10 @@ pub use crate::features::fsext;
122122
#[cfg(all(unix, feature = "fsxattr"))]
123123
pub use crate::features::fsxattr;
124124

125-
#[cfg(all(feature = "selinux", any(target_os = "linux", target_os = "android")))]
125+
#[cfg(selinux)]
126126
pub use crate::features::selinux;
127127

128-
#[cfg(all(target_os = "linux", feature = "smack"))]
128+
#[cfg(smack)]
129129
pub use crate::features::smack;
130130

131131
//## core functions

0 commit comments

Comments
 (0)