143 Commits

Author SHA1 Message Date
mitchellh
f6ec39a5d8 deps: Update iTerm2 color schemes 2025-04-06 00:13:30 +00:00
Jeffrey C. Ollie
9f57a03926 core: update libvaxis and zf for transitive zigimg dependency 2025-03-28 14:31:57 -05:00
Jeffrey C. Ollie
27978ef4d0 version bump for development 2025-03-26 23:29:15 -05:00
mitchellh
8aab16b6e6 deps: Update iTerm2 color schemes 2025-03-23 00:13:47 +00:00
Jeffrey C. Ollie
ee95a5f3e0 gtk: convert App to zig-gobject 2025-03-17 23:39:45 -05:00
mitchellh
291c2f541c deps: Update iTerm2 color schemes 2025-03-16 14:17:59 +00:00
Jeffrey C. Ollie
ec4d110251 build: update libvaxis and zf
Fixes #6734
2025-03-15 22:06:18 -05:00
Mitchell Hashimoto
cfea2ea12c build: mark most dependencies as lazy
Lazy dependencies are only fetched if the build script would actually
reach a usage of that dependency at runtime (when the `lazyDependency`
function is called). This can save a lot of network traffic, disk uage,
and time because we don't have to fetch and build dependencies that we
don't actually need.

Prior to this commit, Ghostty fetched almost everything for all
platforms and configurations all the time. This commit reverses that to
fetching almost nothing until it's actually needed.

There are very little downsides to doing this[1]. One downside is `zig
build --fetch` doesn't fetch lazy dependencies, but we don't rely on
this command for packaging and suggest using our custom shell script
that downloads a cached list of URLs (`build.zig.zon.txt`).

This commit doesn't cover 100% of dependencies, since some provide no
benefit to make lazy while the complexity to make them lazy is higher
(in code style typically).

Conversely, some simple dependencies are marked lazy even if they're
almost always needed if they don't introduce any real complexity to the
code, because there is very little downside to do so.

[1]: https://ziggit.dev/t/lazy-dependencies-best-dependencies/5509/5
2025-03-14 13:32:19 -07:00
Mitchell Hashimoto
221f905a1c pkg/glfw
Closes #6702

This removes our mach-glfw dependency and replaces it with an in-tree
pkg/glfw that includes both the source for compiling glfw as well as the
Zig bindings. This matches the pattern from our other packages.

This is based on the upstream mach-glfw work and therefore includes the
original license and copyright information.

The reasoning is stated in the issue but to summarize for the commit:

  - mach-glfw is no longer maintained, so we have to take ownership
  - mach-glfw depended on some large blobs of header files to enable
    cross-compilation but this isn't something we actually care about,
    so we can (and do) drop the blobs
  - mach-glfw blobs were hosted on mach hosts. given mach-glfw is
    unmaintained, we can't rely on this hosting
  - mach-glfw relied on a "glfw" package which was owned by another
    person to be Zig 0.14 compatible, but we no longer need to rely on
    this
  - mach-glfw builds were outdated based on latest Zig practices
2025-03-13 20:52:33 -07:00
Mitchell Hashimoto
b96a5d702b fix mach-glfw on windows 2025-03-12 16:29:17 -07:00
Mitchell Hashimoto
b123b14686 update zig2nix 2025-03-12 15:56:24 -07:00
Mitchell Hashimoto
18084a3e61 update gobject, fix compiler errors 2025-03-12 12:32:50 -07:00
Mitchell Hashimoto
7e9be00924 working on macos 2025-03-12 10:15:14 -07:00
Mitchell Hashimoto
bd848a27d2 update all packages to new hash for caching 2025-03-12 07:30:01 -07:00
Mitchell Hashimoto
2466de4556 pkg: update to new build.zig.zon format and hash values 2025-03-11 15:00:47 -07:00
Mitchell Hashimoto
251caeb22a Zig 0.14 fixes 2025-03-11 14:53:30 -07:00
Mitchell Hashimoto
7e2286eb8c Zig 0.14 2025-03-11 14:39:04 -07:00
Mitchell Hashimoto
dd95f727ec build: add libintl for macOS builds 2025-03-07 13:41:59 -08:00
Leah Amelia Chen
cd442eb9e2 gtk: build gtk4-layer-shell ourselves
As of now `gtk4-layer-shell` is unavailable on recent, stable releases
of many distros (Debian 12, Ubuntu 24.04, openSUSE Leap & Tumbleweed, etc.)
and outdated on many others (Nixpkgs 24.11/unstable, Fedora 41, etc.)
This is inconvenient for our users and severely limits where the quick
terminal can be used. As a result we then build gtk4-layer-shell ourselves
by default unless `--system` or `-fsys=gtk4-layer-shell` are specified.
This also allows me to add an idiomatic Zig API on top of the library
and avoiding adding even more raw C code in the GTK apprt.

Since we now build gtk4-layer-shell it should be theoretically available
on all Linux systems we target. As such, the `-Dgtk-layer-shell` build
option has been removed. This is somewhat of an experimental change as
I don't know if gtk4-layer-shell works perfectly across all distros, and
we can always add the option back if need be.
2025-03-07 17:52:06 +01:00
mitchellh
29447b60b3 deps: Update iTerm2 color schemes 2025-03-02 00:13:13 +00:00
Mitchell Hashimoto
d532a6e260 Update libxev to use dynamic backend, support Linux configurability
Related to #3224

Previously, Ghostty used a static API for async event handling: io_uring
on Linux, kqueue on macOS. This commit changes the backend to be dynamic
on Linux so that epoll will be used if io_uring isn't available, or if
the user explicitly chooses it.

This introduces a new config `async-backend` (default "auto") which can
be set by the user to change the async backend in use. This is a
best-effort setting: if the user requests io_uring but it isn't
available, Ghostty will fall back to something that is and that choice
is up to us.

Basic benchmarking both in libxev and Ghostty (vtebench) show no
noticeable performance differences introducing the dynamic API, nor
choosing epoll over io_uring.
2025-02-21 15:04:37 -08:00
mitchellh
fe11efff63 deps: Update iTerm2 color schemes 2025-02-16 00:13:20 +00:00
Tim Culverhouse
9cb297202b cli: add +boo command
Add a `+boo` command to show the animation from the website. The data
for the frames is compressed during the build process. This build step
was added to the SharedDeps object because it is used in both
libghostty and in binaries.

The compression is done as follows:
- All files are concatenated together using \x01 as a combining byte
- The files are compressed to a cached build file
- A zig file is written to stdout which `@embedFile`s the compressed
  file and exposes it to the importer
- A new anonymous module "framedata" is added in the SharedDeps object

Any file can import framedata and access the compressed bytes via
`framedata.compressed`. In the `boo` command, we decompress the file and
split it into frames for use in the animation.

The overall addition to the binary size is 348k.
2025-02-14 14:46:18 -08:00
Mitchell Hashimoto
8231ebb770 build: mirror most of our direct dependencies
This adds a new script `update-mirror.sh` which generates the proper
blob format for R2 (or any blob storage) to mirror all of our
dependencies.

It doesn't automate updating build.zig.zon but on an ongoing basis this
should be easy to do manually, and we can strive to automate it in the
future.

I omitted iTerm2 color themes because we auto-update that via CI and
updating all of the machinery to send it to our mirror and so on is a
pain. Additionally, this doesn't mirror transitive dependencies because
Zig doesn't have a way to fetch those from a mirror instead (unless you
pre-generate a full cache like packagers but that's not practical for
day to day development).

It's hugely beneficial just to get most of our dependencies mirrored.
2025-02-14 10:06:15 -08:00
Jeffrey C. Ollie
f32ad5216b build: generate a build.zig.zon.txt file for easy zig fetch scripting
This fixes a regression in 1.1.1/1.1.2 where our PACKAGING docs mention
using `fetch-zig-cache.sh` but it was removed. This commit adds it back,
generating its contents from the build.zig.zon file (via zon2nix which
we use for our Nix packaging).

For packagers, there are no dependency changes: you still need Zig and
POSIX sh. For release time, Ghostty has a new dependency on `jq` but
otherwise the release process is the same. The check-zig-cache.sh script
is updated to generate the new build.zig.zon.txt file.
2025-02-14 09:23:51 -08:00
Mitchell Hashimoto
52a5069dec up versions for development 2025-02-13 15:31:14 -08:00
Mitchell Hashimoto
710ea1c8d9 up all the metadata to 1.1.2 2025-02-13 13:02:06 -08:00
Mitchell Hashimoto
5919c57527 build: replace codeberg dep with self-hosted mirror
The content hashes match so if users don't trust us they can grab from
upstream.
2025-02-13 09:18:50 -08:00
Leah Amelia Chen
843c714088 gtk: introduce Zig bindings for GTK/GObject
`zig-gobject` is a set of GObject bindings that allow us to write
GTK-facing code in Zig instead of getting hands dirty with C.
It's been tested and refined in real-life applications and several
GTK contributors agree that it is a marked improvement over using
the C API directly, such as allowing method call syntax and avoiding
many manual `@ptrCast`s.

This commit doesn't actually contain any changes to our preexisting
GTK code — the migration process is intended to begin in chunks,
firstly in self-contained components (e.g. the header bar, overlays,
etc.), and then full-scale migration can begin when we remove non-Adwaita
GTK builds for 1.2. (After all, why port code that you'll remove later
either way?)
2025-02-10 18:34:08 +01:00
mitchellh
5100f4ff7d deps: Update iTerm2 color schemes 2025-02-02 00:10:42 +00:00
Mitchell Hashimoto
c5508e7d19 update version for development 2025-01-30 14:23:24 -08:00
Mitchell Hashimoto
a62b26cd2f next version will be 1.1.0 2025-01-30 07:18:43 -08:00
Mitchell Hashimoto
9ab2e563bb Update libxev to fix zombie processes on macOS
Fixes #4554

xev.Process.wait is documented as being equivalent to calling `waitpid`,
i.e. including reaping the process. On Linux, it does this automatically
by using pidfd and the `waitid` syscall. On macOS, it wasn't doing this.

This commit updates libxev to include a fix that explicitly calls
`waitpid` for kqueue.
2025-01-24 12:07:01 -08:00
Mitchell Hashimoto
0d6a1d3fdb Prevent fd leaks to the running shell or command
Multiple fixes to prevent file descriptor leaks:

- libxev eventfd now uses CLOEXEC
- linux: cgroup clone now uses CLOEXEC for the cgroup fd
- termio pipe uses pipe2 with CLOEXEC
- pty master always sets CLOEXEC because the child doesn't need it
- termio exec now closes pty slave fd after fork

There still appear to be some fd leaks happening. They seem related to
GTK, they aren't things we're accessig directly. I still want to
investigate them but this at least cleans up the major sources of fd
leakage.
2025-01-23 22:12:58 -08:00
mitchellh
3f367857fc deps: Update iTerm2 color schemes 2025-01-19 00:58:22 +00:00
mitchellh
50e33a6665 deps: Update iTerm2 color schemes 2025-01-12 01:01:09 +00:00
Mitchell Hashimoto
6e411d60f2 Fix wayland-scanner/protocols packaging dependency
By updating zig-wayland:
https://codeberg.org/ifreund/zig-wayland/issues/67
2025-01-10 09:57:29 -08:00
Mitchell Hashimoto
622cc3f9c7 build: update zig-wayland to use new LazyPath API
This is a more idiomatic way to handle build paths in Zig 0.13 and
later.
2025-01-08 19:55:57 -08:00
Mitchell Hashimoto
bade7be021 Use build.zig.zon for Wayland protocols 2025-01-07 20:26:26 -08:00
Leah Amelia Chen
31439f311d build: add wayland 2025-01-05 12:27:11 -08:00
mitchellh
6db39e827e deps: Update iTerm2 color schemes 2025-01-05 01:00:16 +00:00
Mitchell Hashimoto
1d71196de3 up version to 1.0.2 for development 2024-12-31 14:12:00 -08:00
mitchellh
12a333dfb4 deps: Update iTerm2 color schemes 2024-12-31 05:40:18 +00:00
mitchellh
a671ca43f8 deps: Update iTerm2 color schemes 2024-12-29 01:00:43 +00:00
Mitchell Hashimoto
35b9ceee21 up the version to 1.0.1 everywhere for dev 2024-12-26 15:21:50 -08:00
Mitchell Hashimoto
68f09eb60d set version metadata to 1.0.0 2024-12-26 11:49:31 -08:00
Qwerasd
b920352c39 deps: update z2d to v0.4.0
Introduces static path methods and a reworked context API that makes
things generally cleaner.

This update incidentally fixed a bug we had before where the corner
triangle shade characters were drawn solid rather than medium shade.
2024-12-22 16:07:05 -05:00
mitchellh
7da6af85e1 deps: Update iTerm2 color schemes 2024-12-22 01:01:15 +00:00
Mitchell Hashimoto
c74966e07e build: change object story domain to ghostty.org 2024-12-20 08:58:46 -08:00
mitchellh
854ec586f9 deps: Update iTerm2 color schemes 2024-12-15 01:05:52 +00:00