summaryrefslogtreecommitdiff
path: root/build.zig
AgeCommit message (Collapse)Author
2025-10-09set minimum required zig version from build.zig.zonĒriks Remess
2025-10-09use app_version from build.zig.zonĒriks Remess
2025-10-03Zig 0.15: zig build test Mitchell Hashimoto
2025-10-03zig-15: build binary buildsMitchell Hashimoto
2025-09-28build: use build options to configure terminal C ABI modeMitchell Hashimoto
Fixes various issues: - C ABI detection was faulty, which caused some Zig programs to use the C ABI mode and some C programs not to. Let's be explicit. - Unit tests now tests C ABI mode. - Build binary no longer rebuilds on any terminal change (a regression). - Zig programs can choose to depend on the C ABI version of the terminal lib by using the `ghostty-vt-c` module.
2025-09-27build: limit cpu affinity to 32 cpus on LinuxJeffrey C. Ollie
Related to #8924 Zig currenly has a bug where it crashes when compiling Ghostty on systems with more than 32 cpus (See the linked issue for the gory details). As a temporary hack, use `sched_setaffinity` on Linux systems to limit the compile to the first 32 cores. Note that this affects the build only. The resulting Ghostty executable is not limited in any way. This is a more general fix than wrapping the Zig compiler with `taskset`. First of all, it requires no action from the user or packagers. Second, it will be easier for us to remove once the upstream Zig bug is fixed.
2025-09-24some PR feedbackMitchell Hashimoto
2025-09-24build: add pkg-config for libghostty-vtMitchell Hashimoto
2025-09-24build: install the ghostty-vt artifactMitchell Hashimoto
2025-09-23build: shared object is a dylib on macOSMitchell Hashimoto
2025-09-23lib-vt: boilerplate to build a shared objectMitchell Hashimoto
2025-09-21Add simd flag for disabling SIMD functionalityMitchell Hashimoto
2025-09-21lib-vt: expose all of terminal for nowMitchell Hashimoto
2025-09-21start extracting core terminal zig moduleMitchell Hashimoto
2025-08-20build: add run-valgrind and test-valgrind stepsMitchell Hashimoto
This adds two explicit `zig build` steps: `run-valgrind` and `test-valgrind` to run the Ghostty exe or tests under Valgrind, respectively. This simplifies the manual Valgrind calls in a few ways: 1. It automatically sets the CPU to baseline, which is a frequent and requirement for Valgrind on newer CPUs, and generally safe. 2. It sets up the rather complicated set of flags to call Valgrind with, importantly setting up our suppressions. 3. It enables pairing it with the typical and comfortable workflow of specifying extra args (with `--`) or flags like `-Dtest-filter` for tests.
2025-08-06build: allow disabling i18nLeah Amelia Chen
GNU gettext simply is a PITA on certain platforms (i.e. Windows, musl Linux, etc.) and currently it's not possible to cleanly remove i18n from the build process, making building Ghostty on the aforementioned platforms difficult. By providing users with a way to opt-out of the i18n mechanisms (or opt-in, on platforms where i18n is disabled by default) we can make sure that people at least have *some* way of building Ghostty before i18n mechanisms can be integrated neatly.
2025-07-10build: `zig build test` runs Xcode tests on macOSMitchell Hashimoto
Related to #7879 This commit updates `zig build test` to run Xcode tests, too. These run in parallel to the Zig tests, so they don't add any time to the test. The Xcode tests will _not_ run when: (1) the target is not macOS, or (2) the `-Dtest-filter` option is non-empty. This makes it so that this change doesn't affect non-macOS and doesn't affect the general dev cycle because you usually will run `-Dtest-filter` when developing a core feature. I didn't add a step to only run Xcode tests because I find that when I'm working in Xcode I'm probably going to run the tests from there anyways. The integration with `zig build test` is just a convenience, especially around CI. Speaking of CI, this change also makes it so this will run in CI.
2025-07-05build: xcodebuild properly sets up resourcesMitchell Hashimoto
2025-07-05build: make `zig build run` on macOS work with an empty zig-outMitchell Hashimoto
2025-07-05build: add -Demit-macos-appMitchell Hashimoto
2025-07-04build: add -Dxcframework-target to specify the target for buildsMitchell Hashimoto
2025-07-04build: zig build run only builds xcframework for current archMitchell Hashimoto
2025-07-04Build system can build macOS app bundle and open itMitchell Hashimoto
`zig build run` on macOS now builds the app bundle via the `xcodebuild` CLI and runs it. The experience for running the app is now very similar to Linux or the prior GLFW build, where the app runs, blocks the zig command, and logs to the terminal. `xcodebuild` has its own build cache system that we can't really hook into so it runs on every `zig build run` command, but it does cache and I find its actually relatively fast so I think this is a good replacement for the glfw-based system.
2025-05-19build: add unwind tables and frame pointers to debug/test buildsMitchell Hashimoto
This fixes an issue where stack traces were unreliable on some platforms (namely aarch64-linux in a MacOS VM). I'm unsure if this is a bug in Zig (defaults should be changed?) or what, because this isn't necessary on other platforms, but this works around the issue. I've unconditionally enabled this for all platforms, depending on build mode (debug/test) and not the target. This is because I don't think there is a downside for other platforms but if thats wrong we can fix that quickly. Some binaries have this unconditionally enabled regardless of build mode (e.g. the Unicode tables generator) because having symbols in those cases is always useful. Some unrelated GTK test fix is also included here. I'm not sure why CI didn't catch this (perhaps we only run tests for none-runtime) but all tests pass locally and we can look into that elsewhere.
2025-03-18`zig build dist` and `distcheck` for source tarballsMitchell Hashimoto
This moves the source tarball creation process into the Zig build system and follows the autotools-standard naming conventions of `dist` and `distcheck`. The `dist` target creates a source tarball in the `PREFIX/dist` directory. The tarball is named `ghostty-VERSION.tar.gz` as expected by standard source tarball conventions. The `distcheck` target does the same as `dist`, but also takes the resulting tarball, extracts it, and runs tests on the extracted source to verify the source tarball works as expected. This commit also updates CI: 1. Tagged releases now use the new `zig build distcheck` command. 2. Tip releases now use the new `zig build dist` command. 3. A new test build tests that source tarball generation works on every commit.
2025-03-11Zig 0.14Mitchell Hashimoto
2025-03-07build: pure libghostty builds need to build translationsMitchell Hashimoto
2025-03-07build: i18n should emit mo on every platformMitchell Hashimoto
2025-03-03build: some style changes, namely we should create steps only in rootMitchell Hashimoto
2025-03-03gtk: add localization support, take 3Leah Amelia Chen
This is my third (!) attempt at implementing localization support. By leveraging GTK builder to do most of the `gettext` calls, I can avoid the whole mess about missing symbols on non-glibc platforms. Added some documentation too for contributors and translators, just for good measure.
2025-01-08build: requireZig cleanupMitchell Hashimoto
2025-01-07This is a major refactor of `build.zig`.Mitchell Hashimoto
The major idea behind the refactor is to split the `build.zig` file up into distinct `src/build/*.zig` files. By doing so, we can improve readability of the primary `build.zig` while also enabling better reuse of steps. Our `build.zig` is now less than 150 lines of code (of course, it calls into a lot more lines but they're neatly organized now). Improvements: * `build.zig` is less than 150 lines of readable code. * Help strings and unicode table generators are only run once when multiple artifacts are built since the results are the same regardless of target. * Metal lib is only built once per architecture (rather than once per artifact) * Resources (shell integration, terminfo, etc.) and docs are only built/installed for artifacts that need them Breaking changes: * Removed broken wasm build (@gabydd will re-add) * Removed conformance files, shell scripts are better and we don't run these anymore * Removed macOS app bundle creation, we don't use this anymore since we use Xcode ## Some History Our `build.zig` hasn't been significantly refactored since the project started, when Zig was _version 0.10_. Since then, the build system has changed significantly. We've only ever duct taped the `build.zig` as we needed to support new Zig versions, new features, etc. It was a mess. The major improvement is adapting the entire Ghostty `build.zig` to the Step and LazyPath changes introduced way back in Zig 0.12. This lets us better take advantage of parallelism and the dependency graph so that steps are only executed as they're needed. As such, you can see in the build.zig that we initialize a lot of things, but unless a final target (i.e. install, run) references those steps, _they'll never be executed_. This lets us clean up a lot.
2025-01-06don't error if gtk4 pkg-config configuration could not be foundJan200101
this prevents issues with people running `zig build --help` without gtk4 installed same as #4546
2025-01-05vim compiler plugin for ghostty filetype (#4645)Mitchell Hashimoto
Basically integrates `ghostty +validate-config` with vim's compiler feature. This allows validating the config from vim and navigating to errors e.g. with the quickfix list.
2025-01-05gtk(wayland): add support for background blur on KDE PlasmaLeah Amelia Chen
2025-01-05build: add waylandLeah Amelia Chen
2025-01-05vim compiler plugin for ghostty filetype - validates configBeau McCartney
`:make` will call `ghostty +validate-config` and populate the quickfix list with the errors that can be navigated to (e.g. with `:cnext`) `:h write-compiler-plugin`, and neovim's built in ftplugin/ and compiler/ plugins were used as references
2025-01-03don't error when gtk4 could not be found via pkg-configJan200101
2025-01-02core: add build option to disable sentry (#3934)Mitchell Hashimoto
This disables compiling/linking Sentry automatically on platforms other than macOS, which removes a potential blocker for getting Ghostty running on *BSD or other systems. This is also useful for the security paranoid that don't want any chance that sensitive information could be captured in a crash dump.
2025-01-02add option to strip build regardless of optimization (#3945)Mitchell Hashimoto
adds the option "strip" which can be used to override the default strip setting, which is based on the optimization mode. Useful for a distro setting where you want a release build but still keep symbols. Also reuses the option for the shared and static library
2025-01-02remove sentry test for macOS, remove windows checkMitchell Hashimoto
2025-01-02core: add build option to disable sentryJeffrey C. Ollie
2025-01-01Don't install 1024x1024 icons for FlatpakYorick Peterse
Per the Flatpak spec (https://docs.flatpak.org/en/latest/conventions.html#application-icons) the maximum icon size is 512x512. Trying to build a Flatpak with an icon larger than this will fail. To solve this, installing the icon is skipped when building with -Dflatpak=true.
2024-12-31up version to 1.0.2 for developmentMitchell Hashimoto
2024-12-31reuse strip option for librariesJan200101
2024-12-31move strip switch behind optionJan200101
2024-12-30give strip option a proper descriptionJan200101
2024-12-30gtk: Install 1024x1024 iconArvin Verain
2024-12-29add option to strip build regardless of optimizationJan200101
2024-12-29gtk/x11: link directly to libX11, no more dlopenJeffrey C. Ollie