Files
gentoo-zh/dev-util/herdr/files/herdr-0.9.5-build.patch
T
2026-10-15 16:16:31 +11:00

38 lines
1.4 KiB
Diff

Build libghostty-vt separately so Gentoo Zig flags and offline inputs apply.
Avoid initializing unused Ghostty GUI build steps in lib-vt mode.
Applies to Herdr 0.9.5.
--- a/crates/ghostty-vt/build.rs
+++ b/crates/ghostty-vt/build.rs
@@ -32,6 +32,12 @@ fn env_bool(name: &str) -> Option<bool> {
}
fn main() {
+ if let Ok(lib_dir) = env::var("LIBGHOSTTY_VT_LIB_DIR") {
+ println!("cargo:rerun-if-env-changed=LIBGHOSTTY_VT_LIB_DIR");
+ println!("cargo:rustc-link-search=native={lib_dir}");
+ println!("cargo:rustc-link-lib=static=ghostty-vt");
+ return;
+ }
// The vendored source stays at the repository root, shared with its maintenance scripts.
let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR"));
let vendor_dir = manifest_dir.join("../../vendor");
--- a/vendor/libghostty-vt/build.zig
+++ b/vendor/libghostty-vt/build.zig
@@ -57,6 +57,15 @@ pub fn build(b: *std.Build) !void {
&deps,
);
+ if (config.emit_lib_vt) {
+ const lib = try buildpkg.GhosttyLibVt.initStatic(b, &mod);
+ b.getInstallStep().dependOn(&b.addInstallLibFile(
+ lib.output,
+ "libghostty-vt.a",
+ ).step);
+ return;
+ }
+
// All our steps which we'll hook up later. The steps are shown
// up here just so that they are more self-documenting.
const run_step = b.step("run", "Run the app");