Skip to content

Commit f69460c

Browse files
jirutkaextrawurst
andauthored
Allow to build without vendored openssl, allow to build syntect with regex-onig (#1323)
* allow to build syntect with regex-onig Syntect supports two regex engines: * regex-fancy: a pure-rust regex engine based on the fancy-regex * regex-onig: a regex engine based on the oniguruma C library From the syntect's Readme: > The advantage of fancy-regex is that it does not require the onig > crate which requires building and linking the Oniguruma C library. > Many users experience difficulty building the onig crate, especially > on Windows and Webassembly. > As far as our tests can tell this new engine is just as correct, but > it hasn't been tested as extensively in production. It also currently > seems to be about half the speed of the default Oniguruma engine Oniguruma engine is faster than the fancy-regex engine and the syntect project chose the latter as the default only to avoid difficulties with linking Oniguruma (C library) on some platforms. This is not an issue for linux distributions - linking against system-provided shared library is preferred to bundled libraries. Moreover, gitui built with Oniguruma instead of fancy-regex is by 25% smaller. This commit adds two cargo features, regex-fancy and regex-onig, to enable respective syntect features. The former is enabled by default. * allow to build without vendored openssl Vendoring (bundling) openssl library is very bad for security and Linux distributions forbid it. The aim of this change is to simplify packaging gitui in linux distros. Co-authored-by: extrawurst <776816+extrawurst@users.noreply.github.com>
1 parent f2b2665 commit f69460c

File tree

4 files changed

+33
-3
lines changed

4 files changed

+33
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717
* use filewatcher instead of polling updates ([#1](https://github.com/extrawurst/gitui/issues/1))
1818
* word motions to text input [[@Rodrigodd](https://github.com/Rodrigodd)] ([#1256](https://github.com/extrawurst/gitui/issues/1256))
1919
* file blame at right revision from commit-details [[@heiskane](https://github.com/heiskane)] ([#1122](https://github.com/extrawurst/gitui/issues/1122))
20+
* add `regex-fancy` and `regex-onig` features to allow building Syntect with Onigumara regex engine instead of the default engine based on fancy-regex [[@jirutka](https://github.com/jirutka)]
21+
* add `vendor-openssl` feature to allow building without vendored openssl [[@jirutka](https://github.com/jirutka)]
2022

2123
### Fixes
2224
* remove insecure dependency `ansi_term` ([#1290](https://github.com/extrawurst/gitui/issues/1290))

Cargo.lock

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ scopeguard = "1.1"
4646
scopetime = { path = "./scopetime", version = "0.1" }
4747
serde = "1.0"
4848
simplelog = { version = "0.12", default-features = false }
49-
syntect = { version = "5.0", default-features = false, features = ["parsing", "default-syntaxes", "default-themes", "html", "regex-fancy"] }
49+
syntect = { version = "5.0", default-features = false, features = ["parsing", "default-syntaxes", "default-themes", "html"] }
5050
textwrap = "0.15"
5151
tui = { version = "0.19", default-features = false, features = ['crossterm', 'serde'] }
5252
unicode-segmentation = "1.10"
@@ -65,10 +65,14 @@ pretty_assertions = "1.3"
6565
maintenance = { status = "actively-developed" }
6666

6767
[features]
68-
default =["ghemoji", "trace-libgit"]
68+
default =["ghemoji", "regex-fancy", "trace-libgit", "vendor-openssl"]
6969
ghemoji =["gh-emoji"]
70+
# regex-* features are mutually exclusive.
71+
regex-fancy = ["syntect/regex-fancy"]
72+
regex-onig = ["syntect/regex-onig"]
7073
timing =["scopetime/enabled"]
7174
trace-libgit =["asyncgit/trace-libgit"]
75+
vendor-openssl = ["asyncgit/vendor-openssl"]
7276

7377
[workspace]
7478
members =[

asyncgit/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ log = "0.4"
1919
# git2 = { path = "../../extern/git2-rs", features = ["vendored-openssl"]}
2020
# git2 = { git="https://github.com/extrawurst/git2-rs.git", rev="fc13dcc", features = ["vendored-openssl"]}
2121
# pinning to vendored openssl, using the git2 feature this gets lost with new resolver
22-
openssl-sys = { version = '0.9', features = ["vendored"] }
22+
openssl-sys = { version = '0.9', features = ["vendored"], optional = true }
2323
rayon-core = "1.9"
2424
scopetime = { path = "../scopetime", version = "0.1" }
2525
shellexpand = "2.1"
@@ -37,3 +37,4 @@ tempfile = "3.2"
3737
[features]
3838
default = ["trace-libgit"]
3939
trace-libgit = []
40+
vendor-openssl = ["openssl-sys"]

0 commit comments

Comments
 (0)