Resolves the 13 rows still partial in docs/rewrite/notes/review-rv4- codex.md (details in final-Z5.md): - Escaped config strings are decoded to raw bytes at every OS boundary: Flatpak cwd/argv to D-Bus, screen-file paths, the default config template, GHOSTTY_RESOURCES_DIR/TERMINFO/shell integration/ bindtextdomain consumers, custom shader loading, list-themes hyperlinks. - osbytes escapes literal U+FDD0 on non-Unix too (bijective everywhere); the GTK paste dialog only decodes text that was actually encoded. - shadertoy: whole-array uses of iChannelTime rebuild a plain float[4] from the std140-padded members (naga-validated, MSL offsets checked). - libghostty-vt: the OSC parser holds caller-allocated storage inline and command payloads borrow from it, so ghostty_osc_end performs no global allocations (verified from Rust and C). - crash: aarch64 Linux minidump context fixed; macOS fatal signals record siginfo, registers and a fault-safe stack walk. - tripwire: selectionString map allocation-failure cleanup test ported. - libghostty-vt emits the versioned soname libghostty-vt.so.0 at build time (no patchelf needed at install). Test Plan: - cargo test --workspace (3342 passed) - just check-macos; just check-macos x86_64-apple-darwin; just check-windows; just check-wasm - cargo check --target aarch64-unknown-linux-gnu -p ghostty-crash
50 lines
1.7 KiB
Rust
50 lines
1.7 KiB
Rust
/// libghostty-vt version (Zig: `GhosttyLibVt` `version = .{ 0, 1, 0 }`).
|
|
/// `scripts/install-lib.sh` reads this line to name the installed files, so
|
|
/// keep the format.
|
|
const VT_VERSION: &str = "0.1.0";
|
|
|
|
/// The soname / install name of the shared library: `libghostty-vt.so.<major>`
|
|
/// on ELF platforms (Zig sets `.version` on the shared library, which makes
|
|
/// the linker emit the versioned soname), `@rpath/libghostty-vt.<major>.dylib`
|
|
/// on Apple platforms.
|
|
fn lib_name(target_os: &str, version: &str) -> Option<String> {
|
|
let major = version.split('.').next().unwrap_or(version);
|
|
match target_os {
|
|
"linux" | "android" | "freebsd" => Some(format!("libghostty-vt.so.{major}")),
|
|
"macos" | "ios" => Some(format!("@rpath/libghostty-vt.{major}.dylib")),
|
|
_ => None,
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
|
|
match (lib_name(&target_os, VT_VERSION), target_os.as_str()) {
|
|
(Some(name), "linux" | "android" | "freebsd") => {
|
|
println!("cargo:rustc-cdylib-link-arg=-Wl,-soname,{name}");
|
|
}
|
|
(Some(name), _) => {
|
|
println!("cargo:rustc-cdylib-link-arg=-Wl,-install_name,{name}");
|
|
}
|
|
_ => {}
|
|
}
|
|
println!("cargo:rerun-if-changed=build.rs");
|
|
}
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
use super::lib_name;
|
|
|
|
#[test]
|
|
fn versioned_names() {
|
|
assert_eq!(
|
|
lib_name("linux", "0.1.0").as_deref(),
|
|
Some("libghostty-vt.so.0")
|
|
);
|
|
assert_eq!(
|
|
lib_name("macos", "1.2.3").as_deref(),
|
|
Some("@rpath/libghostty-vt.1.dylib")
|
|
);
|
|
assert_eq!(lib_name("windows", "0.1.0"), None);
|
|
}
|
|
}
|