Commit Graph

67 Commits (main)

Author SHA1 Message Date
Pyry Takala d4c2376c2d Fix LangSet.hasLang() to compare against FcLangEqual instead of FcTrue
FcLangSetHasLang returns FcLangResult enum values:
- FcLangEqual (0): Exact match
- FcLangDifferentTerritory (1): Same language, different territory
- FcLangDifferentLang (2): Different language

The previous comparison to FcTrue (1) caused:
- Exact matches (0) to incorrectly return false
- Partial matches (1) to incorrectly return true

This fix changes the comparison to FcLangEqual (0) so hasLang()
correctly returns true only for exact language matches.

Fixes emoji font detection which relies on checking for 'und-zsye'
language tag support.
2025-11-24 20:34:07 +00:00
Mitchell Hashimoto d02770d292
zig-15: build binary builds 2025-10-03 07:10:41 -07:00
Mitchell Hashimoto c979ece916
build-system: Replace deprecated usages of root_source_file on addTests (#8031)
Yet another low-hanging fruit
2025-07-22 15:28:11 -07:00
Jayson Reis d5995ac45c
build-system: Replace deprecated usages of root_source_file on addTests 2025-07-23 00:03:44 +02:00
Jayson Reis acc2ea724f
build-system: Replace deprecated usages of addStaticLibrary with addLibrary (#8029)
Hi there, this is just a low-hanging fruit and it also prepares the way
for the future 0.15, which removes addStaticLibrary.
Please, let me know what to do on the `// TODO` comments.
2025-07-22 14:47:18 -07:00
-k 89b39775e5 build: fix `fontconfig` paths on FreeBSD 2025-06-21 14:11:50 -07:00
Qwerasd 2384bd69cc style: use decl literals
This commit changes a LOT of areas of the code to use decl literals
instead of redundantly referring to the type.

These changes were mostly driven by some regex searches and then manual
adjustment on a case-by-case basis.

I almost certainly missed quite a few places where decl literals could
be used, but this is a good first step in converting things, and other
instances can be addressed when they're discovered.

I tested GLFW+Metal and building the framework on macOS and tested a GTK
build on Linux, so I'm 99% sure I didn't introduce any syntax errors or
other problems with this. (fingers crossed)
2025-05-26 21:50:14 -06: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 816ff8cef0
fix tests building on Linux 2025-03-12 11:29:13 -07:00
Mitchell Hashimoto bd848a27d2
update all packages to new hash for caching 2025-03-12 07:30:01 -07:00
Jan200101 0493b79caf
don't make library building logic public 2025-01-03 22:42:29 +01:00
Jan200101 1dc9157727
always link system freetype2 using pkg-config 2025-01-03 22:42:01 +01:00
Jan200101 9d286de834
don't build fontconfig when system integration is enabled 2025-01-03 18:39:11 +01:00
Mitchell Hashimoto c74966e07e
build: change object story domain to ghostty.org 2024-12-20 08:58:46 -08:00
Mitchell Hashimoto 8bb8b01e54
build: use Zig system packaging options
This allows dynamically linking against system libraries, which is
particularly useful for packaging.
2024-10-24 14:46:37 -07:00
Mitchell Hashimoto 38a7a55300
pkg/fontconfig: yeet usingns 2024-08-16 16:58:16 -07:00
Mitchell Hashimoto 4b5ad77b70
font: fontconfig always prefer monospace in pattern
Fixes #1984
2024-07-21 09:48:07 -07:00
Mitchell Hashimoto a30e791c85
begin 0.13 update process -- very broken 2024-06-24 15:16:22 -07:00
Mitchell Hashimoto 595f24585e
working on more zig breaking changes 2024-04-17 20:50:50 -07:00
Mitchell Hashimoto 026484fea6
fix more comptime var leaks 2024-04-17 20:50:50 -07:00
Krzysztof Wolicki edaafdf57a build API change: update usage of addCSourceFiles 2024-02-26 18:00:43 +01:00
Krzysztof Wolicki f75558b387 Use addCSourceFiles with dependency instead of manually adding files in a loop 2024-01-15 23:23:41 +01:00
Krzysztof Wolicki 5698607a1c Clean pkg/fontconfig/build.zig 2024-01-07 20:54:22 +01:00
Krzysztof Wolicki 9e14a7ea62 Add include paths to modules in pkg/ 2024-01-07 17:39:39 +01:00
Krzysztof Wolicki 1913243c35 WIP: Update to new build module API after Zig PR #18160
Temporarily change dependency sources to forks until they update
2024-01-03 21:50:32 +01:00
Mitchell Hashimoto 3fc5b02d73
pkg/fontconfig: move some dependencies to our own mirror
These are unmodified, so users can still verify the checksum with the
official downloads if they feel unsafe.
2024-01-02 15:27:59 -08:00
Krzysztof Wolicki 0750698b62 Update to latest master,
update libxev dependency,
change mach_glfw to an updated fork until upstream updates
2023-11-30 21:41:33 +01:00
Krzysztof Wolicki 44a48f62f1 change unmodified `var`s to `const`s in anticipation of zig changes 2023-11-17 15:46:46 +01:00
Mitchell Hashimoto b9b33ab25d
pkg/fontconfig: make iconv build param non-windows specific 2023-10-23 08:40:25 -07:00
Krzysztof Wolicki b830deb8a9 pkg/fontconfig: windows check more readable 2023-10-19 17:21:23 +02:00
Krzysztof Wolicki 3936b471a8 Disable iconv on Windows by default (enabled via cli flag).
Skip various tests not implemented on windows.
2023-10-19 09:39:20 +02:00
James Tucker 5007e90ae5
pkg/fontconfig: move defines to fix x86_64-windows targets
Some targets were duplicated in the all-targets definition list that
will not build for a Windows target. They're all moved to the
non-Windows configuration. The target now builds against a mingw64
prefix with the appropriate dependencies installed.

Updates #437
2023-10-17 23:24:20 -07:00
Mitchell Hashimoto 0021b290cf
pkg: add test targets 2023-10-01 18:43:25 -07:00
Mitchell Hashimoto 3a4842a0a5
fix build on linux 2023-10-01 17:32:59 -07:00
Mitchell Hashimoto bc0f5c3012
pkg/fontconfig module 2023-10-01 16:52:36 -07:00
Mitchell Hashimoto 5f8dbb498f
pkg/fontconfig: depend on libxml2 2023-10-01 14:55:47 -07:00
Mitchell Hashimoto 7edb86f9e1
pkg/fontconfig 2023-10-01 12:43:36 -07:00
Jonathan Marler a0911c954e windows: fix fontconfig into libxml runtime crash from implicit func decl
Fixes the next issue on windows.  The fontconfig library is calling
the function xmlCreatePushParserCtxt from libxml2, however, the function
declaration was being omitted because fontconfig was not defining
the LIBXML_PUSH_ENABLED preprocessor symbol.  However, instead of a
compile error, C's support for implicit function declrations allows it
to happily call the function anyway, with the wrong ABI.  The main issue
was the return type being implicitly declared as "int" instead of a
pointer.  On my system this was causing the return pointer to be
truncated to 32 bits and then sign-extended which caused a segfault
once it was dereferenced.

I've gone ahead and added the -Werror=implicit-function-declaration
to fontconfig to avoid these issues in the future.  However, this
flag didn't compile on linux so I've left it as Windows only for now.

I also needed to add the LIBXML_STATIC define because not defining it
causes some functions on windows to be declared with
`__declspec(dllimport)` which results in linker errors since we are
actually statically linking libxml2.
2023-09-18 01:12:56 -06:00
Jonathan Marler a2e881ff4e windows: initial support for zig build test
Makes progress getting "zig build test" to work on windows.  Mostly
fixed issues around build configuration and added some branches throughout
the Zig code to return/throw errors for unimplemented parts.

I also added an initial implementation for getting the home dir.
2023-09-14 03:15:40 -06:00
Kevin Hovsäter 22b8173164 Fix typos 2023-08-08 14:27:34 +02:00
Mitchell Hashimoto dd18eaab5d
fix various build scripts 2023-08-02 15:06:24 -07:00
Mitchell Hashimoto 314f9287b1
Update Zig (#164)
* update zig

* pkg/fontconfig: clean up @as

* pkg/freetype,harfbuzz: clean up @as

* pkg/imgui: clean up @as

* pkg/macos: clean up @as

* pkg/pixman,utf8proc: clean up @as

* clean up @as

* lots more @as cleanup

* undo flatpak changes

* clean up @as
2023-06-30 12:15:31 -07:00
Mitchell Hashimoto 56f8e39e5b
Update zig, mach, fmt 2023-06-25 11:08:20 -07:00
Mitchell Hashimoto 7116ce0806
update zig version 2023-05-29 08:24:12 -07:00
Mitchell Hashimoto 97d9157d22
update zig version 2023-05-07 20:50:51 -07:00
Mitchell Hashimoto 8db30107ae
pkg: fmt 2023-02-27 21:46:59 -08:00
Mitchell Hashimoto be75109a1d
new build system 2023-02-14 20:58:33 -08:00
Mitchell Hashimoto 7703873142
pkg/fontconfig: charset can add chars 2022-11-17 14:37:36 -08:00
Mitchell Hashimoto 3bd9ed5952
Fix invalid c types with fontconfig 2022-09-23 13:14:08 -07:00
Mitchell Hashimoto 72105fc6cd
update to the latest stage2 compiler we can 2022-09-23 12:08:06 -07:00