```toml
[dependencies]
bitflags = "~0.7"
ansi_term = { version = "~0.9.0", optional = true }
term_size = { version = "~0.2.0", optional = true }
libc = { version = "~0.2.9", optional = true }
[features]
default = ["color", "wrap_help"]
color = ["ansi_term", "libc"]
wrap_help = ["libc", "term_size"]
```
Since we are packaging source code, -devel package will have `Requires:
crate(bitflags)`. But applications (which are built out of this sources
statically) can request features which this source is exposing and it
means that it should pull additional dependencies.
Syntax for such dependencies is like:
```toml
[dependencies]
clap = { version = "2.19.2", features = ["yaml"] }
```
Obviously, first thing which is coming to mind is to specify provides
for features and use rich dependencies for requirements, something
like:
```
Provides: crate(clap)
Provides: crate(clap)(color)
Requires: ((crate(ansi_term) and crate(libc)) if crate(clap)(color))
Provides: crate(clap)(wrap_help)
Requires: ((crate(libc) and crate(term_size)) if
crate(clap)(wrap_help))
```
But it doesn't work since it works the RPM thinks that crate(clap)(xxx)
is going to be installed (since it's provided by same package) so it
requires other packages to be installed as well which is something not
what we want.
Probably for now sane way would be just require all optional packages
to cover *all* features which package provides, but it means that
builds will be slow because they would need to pull a lot of packages
always.
P.S. I omit version stuff to make examples more easy.
P.P.S. ignore `default` feature for now since I'm not sure how exactly
it works in rust/cargo ecosystem at this moment.
--
-Igor Gnatenko