feat: remove OpenSSL dependency on Linux #1056 (#1287)

This commit is contained in:
Federico Terzi 2022-07-04 21:48:49 +02:00 committed by GitHub
parent 1c660d9cfb
commit 930bf807b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 153 additions and 3 deletions

121
Cargo.lock generated
View File

@ -1042,6 +1042,19 @@ version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "522de2a0fe3e380f1bc577ba0474108faf3f6b18321dbf60b3b9c39a75073377"
[[package]]
name = "futures-macro"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18e4a4b95cea4b4ccbcf1c5675ca7c4ee4e9e75eb79944d07defde18068f79bb"
dependencies = [
"autocfg",
"proc-macro-hack",
"proc-macro2",
"quote 1.0.9",
"syn 1.0.67",
]
[[package]]
name = "futures-sink"
version = "0.3.17"
@ -1063,10 +1076,13 @@ dependencies = [
"autocfg",
"futures-core",
"futures-io",
"futures-macro",
"futures-task",
"memchr",
"pin-project-lite",
"pin-utils",
"proc-macro-hack",
"proc-macro-nested",
"slab",
]
@ -1246,6 +1262,21 @@ dependencies = [
"want",
]
[[package]]
name = "hyper-rustls"
version = "0.22.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f9f7a97316d44c0af9b0301e65010573a853a9fc97046d7331d7f6bc0fd5a64"
dependencies = [
"futures-util",
"hyper",
"log",
"rustls",
"tokio",
"tokio-rustls",
"webpki",
]
[[package]]
name = "hyper-tls"
version = "0.5.0"
@ -2043,6 +2074,12 @@ version = "0.5.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
[[package]]
name = "proc-macro-nested"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086"
[[package]]
name = "proc-macro2"
version = "1.0.24"
@ -2297,6 +2334,7 @@ dependencies = [
"http",
"http-body",
"hyper",
"hyper-rustls",
"hyper-tls",
"ipnet",
"js-sys",
@ -2306,17 +2344,35 @@ dependencies = [
"native-tls",
"percent-encoding",
"pin-project-lite",
"rustls",
"serde",
"serde_urlencoded",
"tokio",
"tokio-native-tls",
"tokio-rustls",
"url",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"webpki-roots",
"winreg 0.7.0",
]
[[package]]
name = "ring"
version = "0.16.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc"
dependencies = [
"cc",
"libc",
"once_cell",
"spin",
"untrusted",
"web-sys",
"winapi 0.3.9",
]
[[package]]
name = "rust-argon2"
version = "0.8.3"
@ -2329,6 +2385,19 @@ dependencies = [
"crossbeam-utils",
]
[[package]]
name = "rustls"
version = "0.19.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7"
dependencies = [
"base64",
"log",
"ring",
"sct",
"webpki",
]
[[package]]
name = "ryu"
version = "1.0.5"
@ -2366,6 +2435,16 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "sct"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce"
dependencies = [
"ring",
"untrusted",
]
[[package]]
name = "security-framework"
version = "2.3.1"
@ -2514,6 +2593,12 @@ dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "spin"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
[[package]]
name = "squote"
version = "0.1.2"
@ -2795,6 +2880,17 @@ dependencies = [
"tokio",
]
[[package]]
name = "tokio-rustls"
version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6"
dependencies = [
"rustls",
"tokio",
"webpki",
]
[[package]]
name = "tokio-util"
version = "0.6.7"
@ -2916,6 +3012,12 @@ version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7"
[[package]]
name = "untrusted"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
[[package]]
name = "url"
version = "2.2.2"
@ -3145,6 +3247,25 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "webpki"
version = "0.21.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea"
dependencies = [
"ring",
"untrusted",
]
[[package]]
name = "webpki-roots"
version = "0.21.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aabe153544e473b775453675851ecc86863d2a81d786d741f6b76778f2a48940"
dependencies = [
"webpki",
]
[[package]]
name = "widestring"
version = "0.4.3"

View File

@ -14,11 +14,19 @@ serde_yaml = "0.8.17"
tempdir = "0.3.7"
glob = "0.3.0"
natord = "1.0.9"
reqwest = { version = "0.11.4", features = ["blocking"] }
lazy_static = "1.4.0"
regex = "1.4.3"
zip = "0.5.13"
scopeguard = "1.1.0"
fs_extra = "1.2.0"
sha2 = "0.9.6"
hex = "0.4.3"
hex = "0.4.3"
reqwest = { version = "0.11.4", features = ["blocking"], default-features = false}
# On Linux we don't want to depend on openssl to avoid dependency issues
# https://github.com/espanso/espanso/issues/1056
# We need to use features to control this behavior instead of targets due to this Cargo bug:
# https://github.com/rust-lang/cargo/issues/1197
[features]
default-tls=["reqwest/default-tls"]
rustls-tls=["reqwest/rustls-tls"]

View File

@ -9,7 +9,14 @@ homepage = "https://github.com/federico-terzi/espanso"
edition = "2018"
[features]
default = ["modulo"]
default = ["modulo", "native-tls"]
# These features control whether Espanso will use the native TLS functionality
# or not. On some platforms (currently Linux) we prefer vendoring the SSL
# logic used by the packages to avoid dependency issues.
# https://github.com/espanso/espanso/issues/1056
native-tls = ["espanso-package/default-tls"]
vendored-tls = ["espanso-package/rustls-tls"]
# If the wayland feature is enabled, all X11 dependencies will be dropped
# and only methods suitable for Wayland will be used

View File

@ -53,6 +53,13 @@ fn main() {
if !avoid_modulo {
features.push("modulo");
}
// On linux, we don't want to rely on OpenSSL to avoid dependency issues
// https://github.com/espanso/espanso/issues/1056
if cfg!(target_os = "linux") {
features.push("vendored-tls")
} else {
features.push("native-tls")
}
let features_flag = features.join(" ");

View File

@ -48,6 +48,13 @@ fn main() {
if wayland {
features.push("wayland");
}
// On linux, we don't want to rely on OpenSSL to avoid dependency issues
// https://github.com/espanso/espanso/issues/1056
if cfg!(target_os = "linux") {
features.push("vendored-tls")
} else {
features.push("native-tls")
}
let features_flag = features.join(" ");