librespot
librespot copied to clipboard
Allow avahi support using dns-sd for Discovery
rust-mdns is still the default but can also be specified explicitly with
--feature "with-internal-mdns"
switch at build time.
Added --feature "with-external-mdns"
switch to build librespot to use
avahi for discovery using dns-sd package.
This commit does not provide option for building without mdns.
This pull request replaces pull request https://github.com/plietar/librespot/pull/201 started by @awiouy and has been rebased on the current master branch.
@plietar,
It seems I'm still having an issue when building with --no-default-features
. As mdns is optional and not a dependency of an enabled feature (with-internal-mdns
) in cargo.toml
, cargo doesn't pass it to rustc.
In src/lib.rs
, I've used cfg-if
to reference mdns:
cfg_if! {
if #[cfg(feature = "with-internal-mdns")] {
extern crate mdns;
} else if #[cfg(feature = "with-external-mdns")] {
extern crate dns_sd;
} else {
extern crate mdns;
}
}
resulting in this error: https://travis-ci.org/plietar/librespot/jobs/272099406#L929
In the PR201, you asked:
Did you use
#[cfg(mdns)]
around theextern crate mdns
? Would this not have just checked if the dependencymdns
was enabled? Which it isn't?
Is there a way to make one of the features a default requirement if none is specified?