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

build: create group features for target systems

This allows a user to create builds with or without the Unix-specific
utilities. Right now the Makefile handles this, but this is needed to
migrate away from make.

To build Unix-specific utilities (default):

cargo build
(or)
cargo build --features unix --no-default-features

To build without the Unix-specific utilities:

cargo build --features generic --no-default-features
This commit is contained in:
Joseph Crail 2015-11-29 17:27:54 -05:00
parent b46050460e
commit a8bb7f4417
2 changed files with 79 additions and 80 deletions

View file

@ -4,85 +4,86 @@ version = "0.0.1"
authors = [] authors = []
build = "build.rs" build = "build.rs"
[features] [features]
default = ["all"] unix = [
all = [ "chroot",
"base64", "du",
"basename", "groups",
"cat", "hostid",
"chmod", "hostname",
"chroot", "id",
"cksum", "kill",
"comm", "logname",
"cp", "mkfifo",
"cut", "mv",
"dirname", "nice",
"du", "nohup",
"echo", "stdbuf",
"env", "timeout",
"expand", "touch",
"expr", "tty",
"factor", "uname",
"false", "unlink",
"fmt", "uptime",
"fold", "users",
"groups",
"hashsum",
"head",
"hostid",
"hostname",
"id",
"kill",
"link",
"ln",
"logname",
"mkdir",
"mkfifo",
"mv",
"nice",
"nl",
"nohup",
"nproc",
"od",
"paste",
"printenv",
"ptx",
"pwd",
"readlink",
"realpath",
"relpath",
"rm",
"rmdir",
"seq",
"shuf",
"sleep",
"sort",
"split",
"stdbuf",
"sum",
"sync",
"tac",
"tail",
"tee",
"test",
"timeout",
"touch",
"tr",
"true",
"truncate",
"tsort",
"tty",
"uname",
"unexpand",
"uniq",
"unlink",
"uptime",
"users",
"wc",
"whoami",
"yes",
] ]
generic = [
"base64",
"basename",
"cat",
"chmod",
"cksum",
"comm",
"cp",
"cut",
"dirname",
"echo",
"env",
"expand",
"expr",
"factor",
"false",
"fmt",
"fold",
"hashsum",
"head",
"link",
"ln",
"mkdir",
"nl",
"nproc",
"od",
"paste",
"printenv",
"ptx",
"pwd",
"readlink",
"realpath",
"relpath",
"rm",
"rmdir",
"seq",
"shuf",
"sleep",
"sort",
"split",
"sum",
"sync",
"tac",
"tail",
"tee",
"test",
"tr",
"true",
"truncate",
"tsort",
"unexpand",
"uniq",
"wc",
"whoami",
"yes",
]
default = ["generic", "unix"]
[dependencies] [dependencies]
uucore = { path="src/uucore" } uucore = { path="src/uucore" }
@ -178,4 +179,3 @@ tempdir="*"
[[bin]] [[bin]]
name="uutils" name="uutils"
path="src/uutils/uutils.rs" path="src/uutils/uutils.rs"

View file

@ -12,8 +12,7 @@ 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" => continue, "default" | "unix" | "generic" => continue,
"all" => continue,
_ => {}, _ => {},
} }
crates.push(krate.to_string()); crates.push(krate.to_string());