Subject: Re: bug#75237: Packaging ghostty terminal

From: "Murilo" <[email-masked]>
Date: Fri, 10 Jan 2025 10:49:32 -0300

Hi Frank,

> error: sub-compilation of libcxx failed
>     /gnu/store/...-zig-pkgdir-xcode_frameworks-.../include/i386/_types.h:48:33: note: typedef redefinition with different types ('long long' vs 'long')
>     [...]
>     /gnu/store/...-glibc-2.39/include/bits/types.h:44:25: note: previous definition is here
>     [...]
> Build Summary: 78/81 steps succeeded; 1 failed (disable with --summary none)

I took a glance at the package definition in the link you sent, it seems to me
that this error is caused because ghostty vendors [1] various zig custom builds
[2] from the C sources within its own source repository.
What I suspect is happening (again, I didn't try building your
package definition to check, I could be wrong!) with this error is the
'unpack-dependencies phase from zig-build-system runs 'zig fetch' in all the
dependencies and thus replaces all the zig sources in the main 'build.zig.zon',
including the local vendored ones [2], thus you won't get the custom vendored
builds from the local source repository [1].

This is why I replaced [3] the 'unpack-dependencies in the %standard-phases.
This doesn't mean we absolutely cannot use 'unpack-dependencies, infact I am
trying to package it with the 'unpack-dependencies phase, but its proving to be
a bit hard to accomodate it.
The easier option would be to reimplement it and only run 'zig fetch' on the
packages that we want it to replace, but it would be best if we could use the
'unpack-dependency phase from zig-build-system for upstreaming purposes.

[1] https://github.com/ghostty-org/ghostty/tree/6ef757a8f85db7a124d370378850339a899c9e65/pkg
[2] https://github.com/ghostty-org/ghostty/blob/6ef757a8f85db7a124d370378850339a899c9e65/build.zig.zon#L46-L59
[3] https://codeberg.org/look/saayix/src/commit/b319144fbcd37ce786134cca1092946afad8393b/saayix/packages/terminals.scm#L64