mirror of
https://github.com/void-linux/void-packages.git
synced 2025-04-16 06:07:00 +02:00
New package: wezterm-20220905_1
Fixes: #35721 Signed-off-by: Joseph Benden <joe@benden.us>
This commit is contained in:
parent
016aba15bd
commit
60021867f6
6 changed files with 375 additions and 0 deletions
1
srcpkgs/wezterm-terminfo
Symbolic link
1
srcpkgs/wezterm-terminfo
Symbolic link
|
@ -0,0 +1 @@
|
|||
wezterm
|
232
srcpkgs/wezterm/patches/0001-32bit.patch
Normal file
232
srcpkgs/wezterm/patches/0001-32bit.patch
Normal file
|
@ -0,0 +1,232 @@
|
|||
From 7b904f05eb4de9ed44d2068355a571b117eba0e1 Mon Sep 17 00:00:00 2001
|
||||
From: Wez Furlong <wez@wezfurlong.org>
|
||||
Date: Sat, 15 Oct 2022 16:45:02 -0700
|
||||
Subject: [PATCH] termwiz: fixup for 32-bit systems
|
||||
|
||||
I noticed from https://github.com/void-linux/void-packages/pull/36903
|
||||
that 32-bit systems were failing to pass the test suite.
|
||||
|
||||
Running `cargo test --target i686-unknown-linux-gnu -- --nocapture
|
||||
teeny_string` showed that we were faulting in the teenystring code
|
||||
and digging a bit deeper showed that it was because our assumptions
|
||||
about the high bits were wrong for 32-bit systems.
|
||||
|
||||
Fix this by making TeenyString based around a u64 rather than usize
|
||||
so that we guarantee its size on all current systems.
|
||||
---
|
||||
Cargo.lock | 1 -
|
||||
termwiz/Cargo.toml | 1 -
|
||||
termwiz/src/cell.rs | 87 ++++++++++++++-------------------------------
|
||||
3 files changed, 26 insertions(+), 63 deletions(-)
|
||||
|
||||
diff --git a/Cargo.lock b/Cargo.lock
|
||||
index 4f976535be..243e3a2b24 100644
|
||||
--- a/Cargo.lock
|
||||
+++ b/Cargo.lock
|
||||
@@ -4739,7 +4739,6 @@ dependencies = [
|
||||
"base64",
|
||||
"bitflags",
|
||||
"cassowary",
|
||||
- "cfg-if 1.0.0",
|
||||
"criterion",
|
||||
"env_logger",
|
||||
"filedescriptor",
|
||||
diff --git a/termwiz/Cargo.toml b/termwiz/Cargo.toml
|
||||
index d8d7ab543c..e843bac261 100644
|
||||
--- a/termwiz/Cargo.toml
|
||||
+++ b/termwiz/Cargo.toml
|
||||
@@ -15,7 +15,6 @@ readme = "README.md"
|
||||
base64 = "0.13"
|
||||
bitflags = "1.3"
|
||||
cassowary = {version="0.3", optional=true}
|
||||
-cfg-if = "1.0"
|
||||
anyhow = "1.0"
|
||||
filedescriptor = { version="0.8", path = "../filedescriptor" }
|
||||
finl_unicode = "1.1"
|
||||
diff --git a/termwiz/src/cell.rs b/termwiz/src/cell.rs
|
||||
index ddf38a93bb..70d6099dd0 100644
|
||||
--- a/termwiz/src/cell.rs
|
||||
+++ b/termwiz/src/cell.rs
|
||||
@@ -590,7 +590,7 @@ where
|
||||
s.serialize(serializer)
|
||||
}
|
||||
|
||||
-/// TeenyString encodes string storage in a single machine word.
|
||||
+/// TeenyString encodes string storage in a single u64.
|
||||
/// The scheme is simple but effective: strings that encode into a
|
||||
/// byte slice that is 1 less byte than the machine word size can
|
||||
/// be encoded directly into the usize bits stored in the struct.
|
||||
@@ -603,60 +603,40 @@ where
|
||||
/// calling grapheme_column_width; if it is set, then the TeenyString
|
||||
/// has length 2, otherwise, it has length 1 (we don't allow zero-length
|
||||
/// strings).
|
||||
-struct TeenyString(usize);
|
||||
+struct TeenyString(u64);
|
||||
struct TeenyStringHeap {
|
||||
bytes: Vec<u8>,
|
||||
width: usize,
|
||||
}
|
||||
|
||||
impl TeenyString {
|
||||
- const fn marker_mask() -> usize {
|
||||
+ const fn marker_mask() -> u64 {
|
||||
if cfg!(target_endian = "little") {
|
||||
- cfg_if::cfg_if! {
|
||||
- if #[cfg(target_pointer_width = "64")] {
|
||||
- 0x80000000_00000000
|
||||
- } else if #[cfg(target_pointer_width = "32")] {
|
||||
- 0x80000000
|
||||
- } else if #[cfg(target_pointer_width = "16")] {
|
||||
- 0x8000
|
||||
- } else {
|
||||
- panic!("unsupported target");
|
||||
- }
|
||||
- }
|
||||
+ 0x80000000_00000000
|
||||
} else {
|
||||
0x1
|
||||
}
|
||||
}
|
||||
|
||||
- const fn double_wide_mask() -> usize {
|
||||
+ const fn double_wide_mask() -> u64 {
|
||||
if cfg!(target_endian = "little") {
|
||||
- cfg_if::cfg_if! {
|
||||
- if #[cfg(target_pointer_width = "64")] {
|
||||
- 0xc0000000_00000000
|
||||
- } else if #[cfg(target_pointer_width = "32")] {
|
||||
- 0xc0000000
|
||||
- } else if #[cfg(target_pointer_width = "16")] {
|
||||
- 0xc000
|
||||
- } else {
|
||||
- panic!("unsupported target");
|
||||
- }
|
||||
- }
|
||||
+ 0xc0000000_00000000
|
||||
} else {
|
||||
0x3
|
||||
}
|
||||
}
|
||||
|
||||
- const fn is_marker_bit_set(word: usize) -> bool {
|
||||
+ const fn is_marker_bit_set(word: u64) -> bool {
|
||||
let mask = Self::marker_mask();
|
||||
word & mask == mask
|
||||
}
|
||||
|
||||
- const fn is_double_width(word: usize) -> bool {
|
||||
+ const fn is_double_width(word: u64) -> bool {
|
||||
let mask = Self::double_wide_mask();
|
||||
word & mask == mask
|
||||
}
|
||||
|
||||
- const fn set_marker_bit(word: usize, width: usize) -> usize {
|
||||
+ const fn set_marker_bit(word: u64, width: usize) -> u64 {
|
||||
if width > 1 {
|
||||
word | Self::double_wide_mask()
|
||||
} else {
|
||||
@@ -689,18 +669,18 @@ impl TeenyString {
|
||||
let len = bytes.len();
|
||||
let width = width.unwrap_or_else(|| grapheme_column_width(s, unicode_version));
|
||||
|
||||
- if len < std::mem::size_of::<usize>() {
|
||||
+ if len < std::mem::size_of::<u64>() {
|
||||
debug_assert!(width < 3);
|
||||
|
||||
- let mut word = 0usize;
|
||||
+ let mut word = 0u64;
|
||||
unsafe {
|
||||
std::ptr::copy_nonoverlapping(
|
||||
bytes.as_ptr(),
|
||||
- &mut word as *mut usize as *mut u8,
|
||||
+ &mut word as *mut u64 as *mut u8,
|
||||
len,
|
||||
);
|
||||
}
|
||||
- let word = Self::set_marker_bit(word, width);
|
||||
+ let word = Self::set_marker_bit(word as u64, width);
|
||||
Self(word)
|
||||
} else {
|
||||
let vec = Box::new(TeenyStringHeap {
|
||||
@@ -708,35 +688,15 @@ impl TeenyString {
|
||||
width,
|
||||
});
|
||||
let ptr = Box::into_raw(vec);
|
||||
- Self(ptr as usize)
|
||||
+ Self(ptr as u64)
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn space() -> Self {
|
||||
Self(if cfg!(target_endian = "little") {
|
||||
- cfg_if::cfg_if! {
|
||||
- if #[cfg(target_pointer_width = "64")] {
|
||||
- 0x80000000_00000020
|
||||
- } else if #[cfg(target_pointer_width = "32")] {
|
||||
- 0x80000020
|
||||
- } else if #[cfg(target_pointer_width = "16")] {
|
||||
- 0x8020
|
||||
- } else {
|
||||
- panic!("unsupported target");
|
||||
- }
|
||||
- }
|
||||
+ 0x80000000_00000020
|
||||
} else {
|
||||
- cfg_if::cfg_if! {
|
||||
- if #[cfg(target_pointer_width = "64")] {
|
||||
- 0x20000000_00000001
|
||||
- } else if #[cfg(target_pointer_width = "32")] {
|
||||
- 0x20000001
|
||||
- } else if #[cfg(target_pointer_width = "16")] {
|
||||
- 0x2001
|
||||
- } else {
|
||||
- panic!("unsupported target");
|
||||
- }
|
||||
- }
|
||||
+ 0x20000000_00000001
|
||||
})
|
||||
}
|
||||
|
||||
@@ -753,7 +713,7 @@ impl TeenyString {
|
||||
1
|
||||
}
|
||||
} else {
|
||||
- let heap = self.0 as *const usize as *const TeenyStringHeap;
|
||||
+ let heap = self.0 as *const u64 as *const TeenyStringHeap;
|
||||
unsafe { (*heap).width }
|
||||
}
|
||||
}
|
||||
@@ -766,17 +726,17 @@ impl TeenyString {
|
||||
|
||||
pub fn as_bytes(&self) -> &[u8] {
|
||||
if Self::is_marker_bit_set(self.0) {
|
||||
- let bytes = &self.0 as *const usize as *const u8;
|
||||
+ let bytes = &self.0 as *const u64 as *const u8;
|
||||
let bytes =
|
||||
- unsafe { std::slice::from_raw_parts(bytes, std::mem::size_of::<usize>() - 1) };
|
||||
+ unsafe { std::slice::from_raw_parts(bytes, std::mem::size_of::<u64>() - 1) };
|
||||
let len = bytes
|
||||
.iter()
|
||||
.position(|&b| b == 0)
|
||||
- .unwrap_or(std::mem::size_of::<usize>() - 1);
|
||||
+ .unwrap_or(std::mem::size_of::<u64>() - 1);
|
||||
|
||||
&bytes[0..len]
|
||||
} else {
|
||||
- let heap = self.0 as *const usize as *const TeenyStringHeap;
|
||||
+ let heap = self.0 as *const u64 as *const TeenyStringHeap;
|
||||
unsafe { (*heap).bytes.as_slice() }
|
||||
}
|
||||
}
|
||||
@@ -1072,6 +1032,11 @@ mod test {
|
||||
|
||||
#[test]
|
||||
fn teeny_string() {
|
||||
+ assert!(
|
||||
+ std::mem::size_of::<usize>() <= std::mem::size_of::<u64>(),
|
||||
+ "if a pointer doesn't fit in u64 then we need to change TeenyString"
|
||||
+ );
|
||||
+
|
||||
let s = TeenyString::from_char('a');
|
||||
assert_eq!(s.as_bytes(), &[b'a']);
|
||||
|
22
srcpkgs/wezterm/patches/0002-remove-distro-fonts.patch
Normal file
22
srcpkgs/wezterm/patches/0002-remove-distro-fonts.patch
Normal file
|
@ -0,0 +1,22 @@
|
|||
--- a/wezterm-font/src/parser.rs 2022-09-05 10:28:02.000000000 -0700
|
||||
+++ b/wezterm-font/src/parser.rs 2022-10-24 09:06:02.529054286 -0700
|
||||
@@ -715,19 +715,6 @@
|
||||
font!("../../assets/fonts/JetBrainsMono-Regular.ttf"),
|
||||
font!("../../assets/fonts/JetBrainsMono-ThinItalic.ttf"),
|
||||
font!("../../assets/fonts/JetBrainsMono-Thin.ttf"),
|
||||
- font!("../../assets/fonts/Roboto-Black.ttf"),
|
||||
- font!("../../assets/fonts/Roboto-BlackItalic.ttf"),
|
||||
- font!("../../assets/fonts/Roboto-Bold.ttf"),
|
||||
- font!("../../assets/fonts/Roboto-BoldItalic.ttf"),
|
||||
- font!("../../assets/fonts/Roboto-Italic.ttf"),
|
||||
- font!("../../assets/fonts/Roboto-Light.ttf"),
|
||||
- font!("../../assets/fonts/Roboto-LightItalic.ttf"),
|
||||
- font!("../../assets/fonts/Roboto-Medium.ttf"),
|
||||
- font!("../../assets/fonts/Roboto-MediumItalic.ttf"),
|
||||
- font!("../../assets/fonts/Roboto-Regular.ttf"),
|
||||
- font!("../../assets/fonts/Roboto-Thin.ttf"),
|
||||
- font!("../../assets/fonts/Roboto-ThinItalic.ttf"),
|
||||
- font!("../../assets/fonts/NotoColorEmoji.ttf"),
|
||||
font!("../../assets/fonts/Symbols-Nerd-Font-Mono.ttf"),
|
||||
font!("../../assets/fonts/LastResortHE-Regular.ttf"),
|
||||
] {
|
59
srcpkgs/wezterm/patches/remove-libgit.patch
Normal file
59
srcpkgs/wezterm/patches/remove-libgit.patch
Normal file
|
@ -0,0 +1,59 @@
|
|||
--- a/config/build.rs 2022-09-05 10:28:02.000000000 -0700
|
||||
+++ b/config/build.rs 2022-11-16 11:25:28.938783238 -0700
|
||||
@@ -13,44 +13,6 @@
|
||||
}
|
||||
} else {
|
||||
// Otherwise we'll derive it from the git information
|
||||
-
|
||||
- if let Ok(repo) = git2::Repository::discover(".") {
|
||||
- if let Ok(ref_head) = repo.find_reference("HEAD") {
|
||||
- let repo_path = repo.path().to_path_buf();
|
||||
-
|
||||
- if let Ok(resolved) = ref_head.resolve() {
|
||||
- if let Some(name) = resolved.name() {
|
||||
- let path = repo_path.join(name);
|
||||
- if path.exists() {
|
||||
- println!(
|
||||
- "cargo:rerun-if-changed={}",
|
||||
- path.canonicalize().unwrap().display()
|
||||
- );
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- let head = Path::new("../.git/HEAD");
|
||||
- if head.exists() {
|
||||
- let head = head.canonicalize().unwrap();
|
||||
- println!("cargo:rerun-if-changed={}", head.display());
|
||||
- if let Ok(output) = std::process::Command::new("git")
|
||||
- .args(&[
|
||||
- "-c",
|
||||
- "core.abbrev=8",
|
||||
- "show",
|
||||
- "-s",
|
||||
- "--format=%cd-%h",
|
||||
- "--date=format:%Y%m%d-%H%M%S",
|
||||
- ])
|
||||
- .output()
|
||||
- {
|
||||
- let info = String::from_utf8_lossy(&output.stdout);
|
||||
- ci_tag = info.trim().to_string();
|
||||
- }
|
||||
- }
|
||||
}
|
||||
|
||||
let target = std::env::var("TARGET").unwrap_or_else(|_| "unknown".to_string());
|
||||
--- a/config/Cargo.toml 2022-09-05 10:28:02.000000000 -0700
|
||||
+++ b/config/Cargo.toml 2022-11-16 11:26:47.258458105 -0700
|
||||
@@ -10,9 +10,6 @@
|
||||
[dev-dependencies]
|
||||
env_logger = "0.9"
|
||||
|
||||
-[build-dependencies]
|
||||
-git2 = { version = "0.14", default-features = false }
|
||||
-
|
||||
[features]
|
||||
distro-defaults = []
|
||||
|
59
srcpkgs/wezterm/template
Normal file
59
srcpkgs/wezterm/template
Normal file
|
@ -0,0 +1,59 @@
|
|||
# Template file for 'wezterm'
|
||||
pkgname=wezterm
|
||||
version=20220905
|
||||
revision=1
|
||||
_srcver=${version}-102802-7d4b8249
|
||||
archs="x86_64* i686* aarch64* arm*" # ring
|
||||
build_style=cargo
|
||||
configure_args="--no-default-features --features wezterm-gui/distro-defaults,wezterm-gui/wayland"
|
||||
hostmakedepends="pkg-config"
|
||||
makedepends="fontconfig-devel freetype-devel harfbuzz-devel openssl-devel
|
||||
libssh2-devel libX11-devel libxkbcommon-devel wayland-devel xcb-util-devel
|
||||
xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel"
|
||||
depends="noto-fonts-emoji fonts-roboto-ttf"
|
||||
short_desc="GPU-accelerated cross-platform terminal emulator and multiplexer"
|
||||
maintainer="Joseph Benden <joe@benden.us>"
|
||||
license="MIT"
|
||||
homepage="https://wezfurlong.org/wezterm/"
|
||||
changelog="https://wezfurlong.org/wezterm/changelog.html"
|
||||
distfiles="https://github.com/wez/wezterm/releases/download/${_srcver}/wezterm-${_srcver}-src.tar.gz"
|
||||
checksum="5898af2bb2dbedcae2648764d5b7abd3d98b0aa3d05d171b09e0e3f76b7dd545"
|
||||
|
||||
do_check() {
|
||||
# NOTE: cannot use build_style cargo do_check because of --release flag.
|
||||
# NOTE: e2e::sftp is skipped due to missing ssh
|
||||
# NOTE: shapecache::test::ligatures_jetbrains is skipped due to removal of fonts
|
||||
cargo test --target ${RUST_TARGET} --workspace --locked -- \
|
||||
--skip e2e::sftp \
|
||||
--skip shapecache::test::ligatures_jetbrains
|
||||
}
|
||||
|
||||
do_install() {
|
||||
vbin target/${RUST_TARGET}/release/wezterm
|
||||
vbin target/${RUST_TARGET}/release/wezterm-gui
|
||||
vbin target/${RUST_TARGET}/release/wezterm-mux-server
|
||||
vbin target/${RUST_TARGET}/release/strip-ansi-escapes
|
||||
|
||||
vinstall assets/shell-integration/wezterm.sh 644 etc/profile.d org_wezfurlong_wezterm.sh
|
||||
vinstall assets/icon/terminal.png 644 usr/share/icons/hicolor/128x128/apps org.wezfurlong.wezterm.png
|
||||
vinstall assets/icon/wezterm-icon.svg 644 usr/share/icons/hicolor/scalable/apps org.wezfurlong.wezterm.svg
|
||||
vinstall assets/wezterm.desktop 644 usr/share/applications org.wezfurlong.wezterm.desktop
|
||||
vinstall assets/wezterm.appdata.xml 644 usr/share/metainfo org.wezfurlong.wezterm.appdata.xml
|
||||
|
||||
vcompletion assets/shell-completion/bash bash
|
||||
vcompletion assets/shell-completion/fish fish
|
||||
vcompletion assets/shell-completion/zsh zsh
|
||||
|
||||
vmkdir usr/share/terminfo
|
||||
tic -sx -o ${DESTDIR}/usr/share/terminfo termwiz/data/wezterm.terminfo
|
||||
|
||||
vdoc README.md
|
||||
vlicense LICENSE.md
|
||||
}
|
||||
|
||||
wezterm-terminfo_package() {
|
||||
short_desc+=" - terminfo data"
|
||||
pkg_install() {
|
||||
vmove usr/share/terminfo
|
||||
}
|
||||
}
|
2
srcpkgs/wezterm/update
Normal file
2
srcpkgs/wezterm/update
Normal file
|
@ -0,0 +1,2 @@
|
|||
site="https://github.com/wez/wezterm/releases"
|
||||
pattern='/tags/\K[\d.]+(?=-\d+-[a-f0-9]+.tar.gz)'
|
Loading…
Add table
Reference in a new issue