How to enable build.zig also emit header file?

-femit-h is currently disabled by default in the build system and won’t get installed to zig-out. You might be able to do something like

const installed_lib = b.addInstallArtifact(lib, .{});
installed_lib.emitted_h = lib.getEmittedH();
b.getInstallStep().dependOn(&installed_lib.step);

to get it installed (you may also need to explicitly specify an h_dir override in your call to addInstallArtifact), but it may or may not work because -femit-h is currently a bit broken. See resurrect emit-h · Issue #9698 · ziglang/zig · GitHub for more details.