summaryrefslogtreecommitdiffstats
path: root/openpgp-ffi
diff options
context:
space:
mode:
authorIgor Matuszewski <igor@sequoia-pgp.org>2020-10-12 00:56:24 +0200
committerIgor Matuszewski <igor@sequoia-pgp.org>2020-10-12 18:37:38 +0200
commitc2b32483d20be2ef12f35e0d37202b3d6847ab9f (patch)
treea931661b14ac27870871b68e15b6c7e7ff756366 /openpgp-ffi
parent394976c8a8066898604c3f5f285e5aeef3b8b743 (diff)
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)
Diffstat (limited to 'openpgp-ffi')
-rw-r--r--openpgp-ffi/Cargo.toml10
1 files changed, 9 insertions, 1 deletions
diff --git a/openpgp-ffi/Cargo.toml b/openpgp-ffi/Cargo.toml
index 38faa85e..1e22973f 100644
--- a/openpgp-ffi/Cargo.toml
+++ b/openpgp-ffi/Cargo.toml
@@ -23,7 +23,7 @@ maintenance = { status = "actively-developed" }
[dependencies]
sequoia-ffi-macros = { path = "../ffi-macros", version = "0.19" }
-sequoia-openpgp = { path = "../openpgp", version = "0.19" }
+sequoia-openpgp = { path = "../openpgp", version = "0.19", default-features = false }
anyhow = "1"
lazy_static = "1.0.0"
libc = "0.2.33"
@@ -34,3 +34,11 @@ filetime = "0.2"
[lib]
crate-type = ["lib", "cdylib", "staticlib"]
+
+[features]
+default = ["sequoia-openpgp/default"]
+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"]