From 6dab30238adc03142c64f9b6846a43d139e9396b Mon Sep 17 00:00:00 2001 From: Laurenz Date: Wed, 28 Feb 2024 09:04:03 +0100 Subject: [PATCH] Add `vendor-openssl` feature flag (#3510) --- .github/workflows/release.yml | 2 +- Cargo.lock | 11 +++++++++++ Cargo.toml | 1 + crates/typst-cli/Cargo.toml | 10 +++++++++- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fdfaac8f0..a946218de 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -45,7 +45,7 @@ jobs: if: ${{ matrix.cross}} run: | cargo install cross --git https://github.com/cross-rs/cross.git - cross build -p typst-cli --release --target ${{ matrix.target }} --features self-update + cross build -p typst-cli --release --target ${{ matrix.target }} --features self-update vendor-openssl - name: Run Cargo if: ${{ !matrix.cross }} diff --git a/Cargo.lock b/Cargo.lock index 9684bb350..360df31ab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1534,6 +1534,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" +[[package]] +name = "openssl-src" +version = "300.1.6+3.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439fac53e092cd7442a3660c85dde4643ab3b5bd39040912388dcdabf6b88085" +dependencies = [ + "cc", +] + [[package]] name = "openssl-sys" version = "0.9.99" @@ -1542,6 +1551,7 @@ checksum = "22e1bf214306098e4832460f797824c05d25aacdf896f64a985fb0fd992454ae" dependencies = [ "cc", "libc", + "openssl-src", "pkg-config", "vcpkg", ] @@ -2634,6 +2644,7 @@ dependencies = [ "notify", "once_cell", "open", + "openssl", "parking_lot", "pathdiff", "rayon", diff --git a/Cargo.toml b/Cargo.toml index 3ada8cde6..a0d89057a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,6 +68,7 @@ native-tls = "0.2" notify = "6" once_cell = "1" open = "5.0.1" +openssl = "0.10" oxipng = { version = "9.0", default-features = false, features = ["filetime", "parallel", "zopfli"] } palette = { version = "0.7.3", default-features = false, features = ["approx", "libm"] } parking_lot = "0.12.1" diff --git a/crates/typst-cli/Cargo.toml b/crates/typst-cli/Cargo.toml index c25e290f6..9f0f280ea 100644 --- a/crates/typst-cli/Cargo.toml +++ b/crates/typst-cli/Cargo.toml @@ -56,6 +56,11 @@ ureq = { workspace = true } xz2 = { workspace = true, optional = true } zip = { workspace = true, optional = true } +# Explicitly depend on OpenSSL if applicable, so that we can add the +# `openssl/vendored` feature to it if `vendor-openssl` is enabled. +[target.'cfg(not(any(target_os = "windows", target_os = "macos", target_os = "ios", target_os = "watchos", target_os = "tvos")))'.dependencies] +openssl = { workspace = true } + [build-dependencies] clap = { workspace = true, features = ["string"] } clap_complete = { workspace = true } @@ -71,8 +76,11 @@ default = ["embed-fonts"] # - For code: Deja Vu Sans Mono embed-fonts = [] -# Permits the CLI to update itself without a package manager +# Permits the CLI to update itself without a package manager. self-update = ["dep:self-replace", "dep:xz2", "dep:zip", "ureq/json"] +# Whether to vendor OpenSSL. Not applicable to Windows and macOS builds. +vendor-openssl = ["openssl/vendored"] + [lints] workspace = true