diff options
author | Igor Matuszewski <igor@sequoia-pgp.org> | 2020-10-12 00:56:24 +0200 |
---|---|---|
committer | Igor Matuszewski <igor@sequoia-pgp.org> | 2020-10-12 18:37:38 +0200 |
commit | c2b32483d20be2ef12f35e0d37202b3d6847ab9f (patch) | |
tree | a931661b14ac27870871b68e15b6c7e7ff756366 | |
parent | 394976c8a8066898604c3f5f285e5aeef3b8b743 (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)
-rw-r--r-- | autocrypt/Cargo.toml | 10 | ||||
-rw-r--r-- | ffi/Cargo.toml | 15 | ||||
-rw-r--r-- | ipc/Cargo.toml | 10 | ||||
-rw-r--r-- | openpgp-ffi/Cargo.toml | 10 | ||||
-rw-r--r-- | sop/Cargo.toml | 10 | ||||
-rw-r--r-- | sqv/Cargo.toml | 10 | ||||
-rw-r--r-- | store/Cargo.toml | 14 | ||||
-rw-r--r-- | tool/Cargo.toml | 26 |
8 files changed, 86 insertions, 19 deletions
diff --git a/autocrypt/Cargo.toml b/autocrypt/Cargo.toml index 98d60204..f8e74233 100644 --- a/autocrypt/Cargo.toml +++ b/autocrypt/Cargo.toml @@ -21,5 +21,13 @@ gitlab = { repository = "sequoia-pgp/sequoia" } maintenance = { status = "actively-developed" } [dependencies] -sequoia-openpgp = { path = "../openpgp", version = "0.19" } +sequoia-openpgp = { path = "../openpgp", version = "0.19", default-features = false } base64 = "0.12" + +[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"] diff --git a/ffi/Cargo.toml b/ffi/Cargo.toml index f76c6a61..0d9b43c2 100644 --- a/ffi/Cargo.toml +++ b/ffi/Cargo.toml @@ -23,10 +23,10 @@ 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 } sequoia-core = { path = "../core", version = "0.19" } -sequoia-store = { path = "../store", version = "0.19" } -sequoia-net = { path = "../net", version = "0.19" } +sequoia-store = { path = "../store", version = "0.19", default-features = false } +sequoia-net = { path = "../net", version = "0.19", default-features = false } anyhow = "1" lazy_static = "1.0.0" libc = "0.2.33" @@ -39,3 +39,12 @@ filetime = "0.2" [lib] crate-type = ["cdylib", "staticlib"] + +[features] +default = ["sequoia-openpgp/default", "sequoia-store/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"] +background-services = ["sequoia-store/background-services"] diff --git a/ipc/Cargo.toml b/ipc/Cargo.toml index 53e6de20..63901f32 100644 --- a/ipc/Cargo.toml +++ b/ipc/Cargo.toml @@ -20,7 +20,7 @@ gitlab = { repository = "sequoia-pgp/sequoia" } maintenance = { status = "actively-developed" } [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" } anyhow = "1" @@ -51,3 +51,11 @@ lalrpop = "0.19" [dev-dependencies] clap = "2.32.0" quickcheck = { version = "0.9", default-features = false } + +[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"] 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"] diff --git a/sop/Cargo.toml b/sop/Cargo.toml index 5386ba15..831d51b4 100644 --- a/sop/Cargo.toml +++ b/sop/Cargo.toml @@ -19,7 +19,7 @@ gitlab = { repository = "sequoia-pgp/sequoia" } maintenance = { status = "actively-developed" } [dependencies] -sequoia-openpgp = { path = "../openpgp", version = "0.19" } +sequoia-openpgp = { path = "../openpgp", version = "0.19", default-features = false } anyhow = "1" chrono = "0.4" structopt = { version = "0.3.8", default-features = false } @@ -28,3 +28,11 @@ thiserror = "1" [[bin]] name = "sqop" path = "src/main.rs" + +[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"] diff --git a/sqv/Cargo.toml b/sqv/Cargo.toml index 44274919..a0e20ab8 100644 --- a/sqv/Cargo.toml +++ b/sqv/Cargo.toml @@ -21,7 +21,7 @@ gitlab = { repository = "sequoia-pgp/sequoia" } maintenance = { status = "actively-developed" } [dependencies] -sequoia-openpgp = { path = "../openpgp", version = "0.19", default-features = false, features = ["crypto-nettle"] } +sequoia-openpgp = { path = "../openpgp", version = "0.19", default-features = false } anyhow = "1" chrono = "0.4" clap = "2.32.0" @@ -36,3 +36,11 @@ assert_cli = "0.6" [[bin]] name = "sqv" path = "src/sqv-usage.rs" + +[features] +default = ["crypto-nettle"] +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"] 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" diff --git a/tool/Cargo.toml b/tool/Cargo.toml index b4e4e035..ada5b3fe 100644 --- a/tool/Cargo.toml +++ b/tool/Cargo.toml @@ -22,13 +22,13 @@ gitlab = { repository = "sequoia-pgp/sequoia" } maintenance = { status = "actively-developed" } [dependencies] -buffered-reader = { path = "../buffered-reader", version = "0.18" } -sequoia-openpgp = { path = "../openpgp", version = "0.19" } -sequoia-autocrypt = { path = "../autocrypt", version = "0.19" } -sequoia-core = { path = "../core", version = "0.19" } -sequoia-ipc = { path = "../ipc", version = "0.19" } -sequoia-net = { path = "../net", version = "0.19" } -sequoia-store = { path = "../store", version = "0.19" } +buffered-reader = { path = "../buffered-reader", version = "0.18", default-features = false } +sequoia-openpgp = { path = "../openpgp", version = "0.19", default-features = false } +sequoia-autocrypt = { path = "../autocrypt", version = "0.19", default-features = false } +sequoia-core = { path = "../core", version = "0.19", default-features = false } +sequoia-ipc = { path = "../ipc", version = "0.19", default-features = false } +sequoia-net = { path = "../net", version = "0.19", default-features = false } +sequoia-store = { path = "../store", version = "0.19", default-features = false } anyhow = "1" chrono = "0.4" clap = "2.32.0" @@ -48,3 +48,15 @@ assert_cli = "0.6" [[bin]] name = "sq" path = "src/sq-usage.rs" + +[features] +default = [ + "buffered-reader/compression", + "sequoia-openpgp/default", + "sequoia-store/background-services" +] +crypto-nettle = ["sequoia-openpgp/crypto-nettle"] +crypto-cng = ["sequoia-openpgp/crypto-cng"] +compression = ["buffered-reader/compression", "sequoia-openpgp/compression"] +compression-deflate = ["buffered-reader/compression-deflate", "sequoia-openpgp/compression-deflate"] +compression-bzip2 = ["buffered-reader/compression-bzip2", "sequoia-openpgp/compression-bzip2"] |