From c2b32483d20be2ef12f35e0d37202b3d6847ab9f Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Mon, 12 Oct 2020 00:56:24 +0200 Subject: Allow to opt out of default features for sequoia-* dependencies Cargo features are inherently additive, which means that if: - package A walts to build package C with features ABC, - package B walts to build package C with features BCD, the package C will be built with *both* ABC and BCD enabled. There is currently no way to specify mutually exclusive features and these have to be implemented using existing, additive, ones. That's problematic for us, because currently the cryptographic backend in sequoia-openpgp is selected globally at build-time and thus at most one can be selected for the compilation to succeed. It's worth noting that we can't use Cargo build scripts to emit the `--cfg`-passing [directive] because it does *not* affect Cargo's dependency resolution and that's needed in order to skip unbuildable backends on certain OSes (e.g. nettle when using Windows MSVC ABI). To allow for other local crates, most notably sequoia-openpgp-ffi, to build with different backends, we expose and forward any features that may be used by the crates they transitively depend on. At the time of writing, these different features seem to be implemented: - buffered-reader: compression support - openpgp: compression support and cryptographic backend - store: background-services feature [directive](https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-cfgkeyvalue) --- store/Cargo.toml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'store') diff --git a/store/Cargo.toml b/store/Cargo.toml index 73536f76..46beefa0 100644 --- a/store/Cargo.toml +++ b/store/Cargo.toml @@ -22,14 +22,20 @@ gitlab = { repository = "sequoia-pgp/sequoia" } maintenance = { status = "actively-developed" } [features] -default = ["background-services"] +default = ["background-services", "sequoia-openpgp/default"] background-services = [] +crypto-nettle = ["sequoia-openpgp/crypto-nettle"] +crypto-cng = ["sequoia-openpgp/crypto-cng"] +compression = ["sequoia-openpgp/compression"] +compression-deflate = ["sequoia-openpgp/compression-deflate"] +compression-bzip2 = ["sequoia-openpgp/compression-bzip2"] + [dependencies] -sequoia-openpgp = { path = "../openpgp", version = "0.19" } +sequoia-openpgp = { path = "../openpgp", version = "0.19", default-features = false } sequoia-core = { path = "../core", version = "0.19" } -sequoia-ipc = { path = "../ipc", version = "0.19" } -sequoia-net = { path = "../net", version = "0.19" } +sequoia-ipc = { path = "../ipc", version = "0.19", default-features = false } +sequoia-net = { path = "../net", version = "0.19", default-features = false } anyhow = "1" capnp = "0.10" capnp-rpc = "0.10" -- cgit v1.2.3