Skip to content

build: add ghostty-internal pkg-config modules (shared + static)#12214

Open
deblasis wants to merge 1 commit intoghostty-org:mainfrom
deblasis:build/libghostty-pkg-config-for-main
Open

build: add ghostty-internal pkg-config modules (shared + static)#12214
deblasis wants to merge 1 commit intoghostty-org:mainfrom
deblasis:build/libghostty-pkg-config-for-main

Conversation

@deblasis
Copy link
Copy Markdown
Contributor

@deblasis deblasis commented Apr 10, 2026

Summary

Mirror the libghostty-vt-static pkg-config pattern from #12210 for the internal library.

  • Add ghostty-internal.pc (shared, -lghostty) and ghostty-internal-static.pc (static, direct archive reference) so consumers can discover either variant via pkg-config
  • Named ghostty-internal to distinguish from the public libghostty-vt API
  • Static module points at the platform-correct archive name (ghostty-static.lib on Windows, libghostty.a elsewhere)
  • pkg-config files are generated during shared builds and installed via GhosttyLib.install()

Test plan

  • zig build succeeds (default target)
  • ghostty-internal.pc and ghostty-internal-static.pc appear in zig-out/share/pkgconfig/
  • Static .pc points at ghostty-static.lib (Windows) / libghostty.a (Unix)
  • Shared .pc uses standard -L -l flags
  • Existing libghostty-vt pkg-config files are unaffected

@deblasis
Copy link
Copy Markdown
Contributor Author

deblasis commented Apr 10, 2026

If this one lands, next one would be to create a "fat archive" for windows as well.
Like libtool does on darwin.

I will 90% hit a wall with NativeAOT on windows with winui3 but regardless, that's something MS is supposedly working on.
I might chime in to give a hand with repro/bugs etc.

Update

I hit the wall eventually but found workarounds and managed to get a single executable for Ghostty Windows!
32MB single exe with libghostty (and the other deps) baked in. No ghostty.dll needed.

I filed an issue upstream for anyone else bumping into the same problem: microsoft/WindowsAppSDK#6394

@mitchellh
Copy link
Copy Markdown
Contributor

Lets rename these to ghostty-internal and ghostty-internal-static because this version of "libghostty" is

  1. Not meant for external use
  2. Not libghostty and confuses people for it.

Copy link
Copy Markdown
Contributor

@mitchellh mitchellh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocked on some naming.

@deblasis deblasis force-pushed the build/libghostty-pkg-config-for-main branch from b2935cb to 66ffe8f Compare April 10, 2026 14:04
@deblasis deblasis force-pushed the build/libghostty-pkg-config-for-main branch from 66ffe8f to dd04856 Compare April 10, 2026 14:13
@deblasis deblasis requested a review from mitchellh April 10, 2026 14:17
@deblasis deblasis changed the title build: add libghostty pkg-config modules (shared + static) build: add ghostty-internal pkg-config modules (shared + static) Apr 10, 2026
return if (os_tag == .windows)
"ghostty-static.lib"
else
"libghostty.a";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's rename this too. And anywhere else we write it out, let's use this PR to fix it up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants