summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-02-28 09:04:03 +0100
committerGitHub <noreply@github.com>2024-02-28 08:04:03 +0000
commit6dab30238adc03142c64f9b6846a43d139e9396b (patch)
tree8e1ddbecac0f429eeeb86a7b32cc0520e9946687
parent85305139cd896b60d6a80e64602099573ea5470e (diff)
Add `vendor-openssl` feature flag (#3510)
-rw-r--r--.github/workflows/release.yml2
-rw-r--r--Cargo.lock11
-rw-r--r--Cargo.toml1
-rw-r--r--crates/typst-cli/Cargo.toml10
4 files changed, 22 insertions, 2 deletions
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index fdfaac8f..a946218d 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 9684bb35..360df31a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1535,6 +1535,15 @@ 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"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -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 3ada8cde..a0d89057 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 c25e290f..9f0f280e 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