1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 11:07:44 +00:00

maint/build ~ refactor feature strategy (allows simple cargo build on all platforms) and easier cross-targeted builds

This commit is contained in:
Roy Ivy III 2020-01-01 13:21:51 -06:00
parent 5af8503a5e
commit b7a3c4d8a8
2 changed files with 64 additions and 45 deletions

View file

@ -6,7 +6,29 @@ build = "build.rs"
autotests = false autotests = false
[features] [features]
unix = [ default = [ "feat_common_core" ]
#
macos = [ "feat_os_unix" ]
unix = [ "feat_os_unix" ]
windows = [ "feat_os_windows" ]
#
test_unimplemented = []
nightly = []
#
# "feat_os_unix" == set of utilities which can be compiled/run on modern/usual *nix platforms
feat_os_unix = [
"stdbuf",
#
"feat_os_unix_musl",
"feat_os_unix_utmpx",
]
# "feat_os_unix_gnueabihf" == set of utilities which can be build/run for "arm-unknown-linux-gnueabihf" target (ARMv6 Linux, hardfloat)
feat_os_unix_gnueabihf = [
"feat_os_unix_musl",
"feat_os_unix_utmpx",
]
# "feat_os_unix_musl" == set of utilities which can be built/run on targets binding to the "musl" library (ref: <https://musl.libc.org/about.html>)
feat_os_unix_musl = [
"chgrp", "chgrp",
"chmod", "chmod",
"chown", "chown",
@ -24,36 +46,25 @@ unix = [
"numfmt", "numfmt",
"nohup", "nohup",
"pathchk", "pathchk",
"pinky",
"stat", "stat",
"stdbuf",
"timeout", "timeout",
"touch", "touch",
"tty", "tty",
"uname", "uname",
"unlink", "unlink",
#
"feat_common"
]
# "feat_os_unix_utmpx" == set of utilites requiring utmp/utmpx support
# * ref: <https://wiki.musl-libc.org/faq.html#Q:-Why-is-the-utmp/wtmp-functionality-only-implemented-as-stubs?>
feat_os_unix_utmpx = [
"pinky",
"uptime", "uptime",
"users", "users",
"who", "who",
"generic"
] ]
windows = ["generic"] # "feat_os_unix_fuchsia" == set of utilities which can be built/run on the "Fuschia" OS (refs: <https://fuchsia.dev>; <https://en.wikipedia.org/wiki/Google_Fuchsia>)
windows_legacy = [ feat_os_unix_fuchsia = [
"arch",
"nproc",
"sync",
"touch",
"whoami",
"redox_generic"
]
# Feature "fuchsia" contains the exclusive list of utilities
# that can be compiled and run on Fuchsia. Should be built
# with --no-default-features when selecting this feature.
# TODO: merge with "unix" to avoid duplication once we support
# all utilities in that feature.
fuchsia = [
# unix utilities # unix utilities
"chgrp", "chgrp",
"chmod", "chmod",
@ -71,27 +82,43 @@ fuchsia = [
"tty", "tty",
"uname", "uname",
"unlink", "unlink",
#
# All generic utilities "feat_common_core"
"generic"
] ]
generic = [ # "feat_os_unix_redox" == set of utilities which can be compiled/run on "Redox OS" (refs: <https://www.redox-os.org>; <https://en.wikipedia.org/wiki/Redox_(operating_system)>)
feat_os_unix_redox = [
"uname",
"chmod",
"install",
#
"feat_common_core"
]
# "feat_os_windows" == set of utilities which can be compiled/run on modern/usual windows platforms
feat_os_windows = [ "feat_common" ]
# "feat_os_windows_legacy" == slightly restricted set of utilities which can be compiled/run on early windows platforms (eg, "WinXP")
feat_os_windows_legacy = [
"arch",
"nproc",
"sync",
"touch",
"whoami",
"feat_common_core"
]
##
# "feat_common" == expanded set of utilities which can be compiled/run on usual rust "tier 1" target platforms (ref: <https://forge.rust-lang.org/release/platform-support.html>)
feat_common = [
"arch", "arch",
"hostname", "hostname",
"nproc", "nproc",
"sync", "sync",
"touch", "touch",
"whoami", "whoami",
"redox_generic" #
"feat_common_core"
] ]
# Feature "redox"/"redox_generic" contains the exclusive list of utilities # "feat_common_core" == baseline core set of utilities which can be compiled/run on most targets
# that can be compiled and run on redox. Should be built feat_common_core = [
# with --no-default-features when selecting this feature.
# TODO: merge with "generic" to avoid duplication once we support
# all utilities in that feature.
redox_generic = [
# And maybe all generic utilities
"base32", "base32",
"base64", "base64",
"basename", "basename",
@ -153,15 +180,6 @@ redox_generic = [
"wc", "wc",
"yes", "yes",
] ]
redox = [
"uname",
"chmod",
"install",
"redox_generic"
]
test_unimplemented = []
nightly = []
default = ["unix"]
[workspace] [workspace]

View file

@ -16,8 +16,9 @@ pub fn main() {
if val == "1" && key.starts_with(feature_prefix) { if val == "1" && key.starts_with(feature_prefix) {
let krate = key[feature_prefix.len()..].to_lowercase(); let krate = key[feature_prefix.len()..].to_lowercase();
match krate.as_ref() { match krate.as_ref() {
"default" | "unix" | "redox" | "redox_generic" | "fuchsia" | "generic" "default" | "macos" | "unix" | "windows" => continue,
| "windows" | "windows_legacy" | "nightly" | "test_unimplemented" => continue, "nightly" | "test_unimplemented" => continue,
s if s.starts_with("feat_") => continue,
_ => {} _ => {}
} }
crates.push(krate.to_string()); crates.push(krate.to_string());