From de99592e558ba6b1691e7b709c8a754b07729d1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Vasconcellos?= Date: Thu, 19 Oct 2023 23:08:06 -0300 Subject: [PATCH 1/3] Vendor openssl dependency --- .cargo/config.toml.mustache | 6 ++++-- Cargo.lock | 5 +++-- Cargo.toml | 2 +- apps/desktop/src-tauri/Cargo.toml | 1 + apps/mobile/modules/sd-core/core/Cargo.toml | 6 ------ core/Cargo.toml | 14 +++++++++++++- 6 files changed, 22 insertions(+), 12 deletions(-) diff --git a/.cargo/config.toml.mustache b/.cargo/config.toml.mustache index 42bb1b1b893a..14f6c9588706 100644 --- a/.cargo/config.toml.mustache +++ b/.cargo/config.toml.mustache @@ -1,10 +1,12 @@ [env] {{#protoc}} -PROTOC = "{{{protoc}}}" +PROTOC = { force = true, value = "{{{protoc}}}" } {{/protoc}} {{^isLinux}} -FFMPEG_DIR = "{{{nativeDeps}}}" +FFMPEG_DIR = { force = true, value = "{{{nativeDeps}}}" } {{/isLinux}} +OPENSSL_STATIC = { force = true, value = "1" } +OPENSSL_NO_VENDOR = { force = true, value = "0" } {{#isMacOS}} [target.x86_64-apple-darwin] diff --git a/Cargo.lock b/Cargo.lock index febede60c8c9..bdb6260465cf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4884,6 +4884,7 @@ version = "0.9.93" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" dependencies = [ + "bindgen", "cc", "libc", "openssl-src", @@ -6722,6 +6723,8 @@ dependencies = [ "normpath", "notify", "once_cell", + "openssl", + "openssl-sys", "pin-project-lite", "plist", "prisma-client-rust", @@ -6942,8 +6945,6 @@ dependencies = [ "futures-channel", "futures-locks", "once_cell", - "openssl", - "openssl-sys", "rspc", "sd-core", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index 70c624e8ffb0..cddf716c7d6c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,7 +44,7 @@ tracing-subscriber = { git = "https://github.com/tokio-rs/tracing", rev = "29146 tracing-appender = { git = "https://github.com/tokio-rs/tracing", rev = "29146260fb4615d271d2e899ad95a753bb42915e" } # Unreleased changes for rolling log deletion rspc = { version = "0.1.4" } -specta = { version = "1.0.4" } +specta = { version = "1.0.5" } tauri-specta = { version = "1.0.2" } swift-rs = { version = "1.0.6" } diff --git a/apps/desktop/src-tauri/Cargo.toml b/apps/desktop/src-tauri/Cargo.toml index dd0410d700c4..1bce800cf014 100644 --- a/apps/desktop/src-tauri/Cargo.toml +++ b/apps/desktop/src-tauri/Cargo.toml @@ -19,6 +19,7 @@ tauri = { version = "1.5.2", features = [ "shell-all", "updater", "window-all", + "native-tls-vendored" ] } rspc = { workspace = true, features = ["tauri"] } diff --git a/apps/mobile/modules/sd-core/core/Cargo.toml b/apps/mobile/modules/sd-core/core/Cargo.toml index f21f6c8e7dfb..6e489054e145 100644 --- a/apps/mobile/modules/sd-core/core/Cargo.toml +++ b/apps/mobile/modules/sd-core/core/Cargo.toml @@ -14,12 +14,6 @@ sd-core = { path = "../../../../../core", features = [ rspc = { workspace = true } serde_json = { workspace = true } tokio = { workspace = true } -openssl = { version = "0.10.57", features = [ - "vendored", -] } # Override features of transitive dependencies -openssl-sys = { version = "0.9.93", features = [ - "vendored", -] } # Override features of transitive dependencies to support IOS Simulator on M1 futures = "0.3.28" tracing = { workspace = true } futures-channel = "0.3.28" diff --git a/core/Cargo.toml b/core/Cargo.toml index 4c470eaa2914..dd5422657ade 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -28,7 +28,11 @@ sd-crypto = { path = "../crates/crypto", features = [ "keymanager", ] } -sd-images = { path = "../crates/images", features = ["rspc", "serde", "specta"] } +sd-images = { path = "../crates/images", features = [ + "rspc", + "serde", + "specta", +] } sd-file-ext = { path = "../crates/file-ext" } sd-sync = { path = "../crates/sync" } sd-p2p = { path = "../crates/p2p", features = ["specta", "serde"] } @@ -108,6 +112,14 @@ bytes = "1.5.0" reqwest = { version = "0.11.20", features = ["json"] } directories = "5.0.1" +# Override features of transitive dependencies +[dependencies.openssl] +version = "=0.10.57" +features = ["vendored", "bindgen"] +[dependencies.openssl-sys] +version = "=0.9.93" +features = ["vendored", "bindgen"] + [target.'cfg(target_os = "macos")'.dependencies] plist = "1" From b5af9926a8f81a64562a00d3e3941231aff2ca25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Vasconcellos?= Date: Fri, 20 Oct 2023 02:20:45 -0300 Subject: [PATCH 2/3] Remove bindgen, seems like windows don't like it - Add OPENSSL_RUST_USE_NASM to force windows to use nasm --- .cargo/config.toml.mustache | 1 + Cargo.lock | 1 - core/Cargo.toml | 4 ++-- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.cargo/config.toml.mustache b/.cargo/config.toml.mustache index 14f6c9588706..46c877cdc242 100644 --- a/.cargo/config.toml.mustache +++ b/.cargo/config.toml.mustache @@ -7,6 +7,7 @@ FFMPEG_DIR = { force = true, value = "{{{nativeDeps}}}" } {{/isLinux}} OPENSSL_STATIC = { force = true, value = "1" } OPENSSL_NO_VENDOR = { force = true, value = "0" } +OPENSSL_RUST_USE_NASM = { force = true, value = "1" } {{#isMacOS}} [target.x86_64-apple-darwin] diff --git a/Cargo.lock b/Cargo.lock index bdb6260465cf..4c3463974643 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4884,7 +4884,6 @@ version = "0.9.93" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" dependencies = [ - "bindgen", "cc", "libc", "openssl-src", diff --git a/core/Cargo.toml b/core/Cargo.toml index dd5422657ade..b26768fb777d 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -115,10 +115,10 @@ directories = "5.0.1" # Override features of transitive dependencies [dependencies.openssl] version = "=0.10.57" -features = ["vendored", "bindgen"] +features = ["vendored"] [dependencies.openssl-sys] version = "=0.9.93" -features = ["vendored", "bindgen"] +features = ["vendored"] [target.'cfg(target_os = "macos")'.dependencies] plist = "1" From 1105bab1ba73d346f3264f80e2f252d29d53bba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Vasconcellos?= Date: Fri, 20 Oct 2023 04:45:01 -0300 Subject: [PATCH 3/3] Add native-tls-vendored to reqwest - Shouldn't change much as the openssl crates override was already dealing with the vendoring anyway --- core/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/Cargo.toml b/core/Cargo.toml index b26768fb777d..710ed763feb6 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -109,7 +109,7 @@ axum = "0.6.20" http-body = "0.4.5" pin-project-lite = "0.2.13" bytes = "1.5.0" -reqwest = { version = "0.11.20", features = ["json"] } +reqwest = { version = "0.11.20", features = ["json", "native-tls-vendored"] } directories = "5.0.1" # Override features of transitive dependencies