Skip to content

Commit 8eacde9

Browse files
authored
Replace mach-glfw with pkg/glfw (#6708)
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
2 parents 73c7943 + 221f905 commit 8eacde9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+13979
-124
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ vendor/** linguist-vendored
55
website/** linguist-documentation
66
pkg/breakpad/vendor/** linguist-vendored
77
pkg/cimgui/vendor/** linguist-vendored
8+
pkg/glfw/wayland-headers/** linguist-vendored
89
pkg/libintl/config.h linguist-generated=true
910
pkg/libintl/libintl.h linguist-generated=true
1011
pkg/simdutf/vendor/** linguist-vendored

.github/workflows/test.yml

+61-27
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ jobs:
1010
name: "Required Checks: Test"
1111
runs-on: namespace-profile-ghostty-sm
1212
needs:
13-
- build
1413
- build-bench
14+
- build-linux
1515
- build-linux-libghostty
1616
- build-nix
1717
- build-snap
1818
- build-macos
1919
- build-macos-matrix
2020
- build-windows
21+
- build-windows-cross
2122
- test
2223
- test-gtk
2324
- test-sentry-linux
@@ -48,23 +49,9 @@ jobs:
4849
echo "One or more required build workflows failed: ${{ steps.status.outputs.results }}"
4950
exit 1
5051
51-
build:
52-
strategy:
53-
fail-fast: false
54-
matrix:
55-
os: ["namespace-profile-ghostty-md"]
56-
57-
target: [
58-
aarch64-linux,
59-
x86_64-linux,
60-
x86-windows-gnu,
61-
x86_64-windows-gnu,
62-
# We don't support cross-compiling to macOS because the macOS build
63-
# requires xcode due to the swift harness.
64-
#aarch64-macos,
65-
#x86_64-macos,
66-
]
67-
runs-on: ${{ matrix.os }}
52+
build-bench:
53+
# We build benchmarks on large because it uses ReleaseFast
54+
runs-on: namespace-profile-ghostty-lg
6855
needs: test
6956
env:
7057
ZIG_LOCAL_CACHE_DIR: /zig/local-cache
@@ -89,14 +76,15 @@ jobs:
8976
name: ghostty
9077
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
9178

92-
# Cross-compile the binary. We always use static building for this
93-
# because its the only way to access the headers.
94-
- name: Test Build
95-
run: nix develop -c zig build -Dapp-runtime=glfw -Dtarget=${{ matrix.target }}
79+
- name: Build Benchmarks
80+
run: nix develop -c zig build -Dapp-runtime=glfw -Demit-bench
9681

97-
build-bench:
98-
# We build benchmarks on large because it uses ReleaseFast
99-
runs-on: namespace-profile-ghostty-lg
82+
build-linux:
83+
strategy:
84+
fail-fast: false
85+
matrix:
86+
os: [namespace-profile-ghostty-md, namespace-profile-ghostty-md-arm64]
87+
runs-on: ${{ matrix.os }}
10088
needs: test
10189
env:
10290
ZIG_LOCAL_CACHE_DIR: /zig/local-cache
@@ -121,8 +109,8 @@ jobs:
121109
name: ghostty
122110
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
123111

124-
- name: Build Benchmarks
125-
run: nix develop -c zig build -Dapp-runtime=glfw -Demit-bench
112+
- name: Test Build
113+
run: nix develop -c zig build -Dapp-runtime=glfw
126114

127115
build-linux-libghostty:
128116
runs-on: namespace-profile-ghostty-md
@@ -373,6 +361,52 @@ jobs:
373361
shell: pwsh
374362
run: Get-Content -Path ".\build.log"
375363

364+
build-windows-cross:
365+
strategy:
366+
fail-fast: false
367+
matrix:
368+
os: ["namespace-profile-ghostty-md"]
369+
370+
target: [
371+
x86-windows-gnu,
372+
x86_64-windows-gnu,
373+
# We don't support cross-compiling to macOS or Linux because
374+
# we require system libraries.
375+
#aarch64-linux,
376+
#x86_64-linux,
377+
#aarch64-macos,
378+
#x86_64-macos,
379+
]
380+
runs-on: ${{ matrix.os }}
381+
needs: test
382+
env:
383+
ZIG_LOCAL_CACHE_DIR: /zig/local-cache
384+
ZIG_GLOBAL_CACHE_DIR: /zig/global-cache
385+
steps:
386+
- name: Checkout code
387+
uses: actions/checkout@v4
388+
389+
- name: Setup Cache
390+
uses: namespacelabs/[email protected]
391+
with:
392+
path: |
393+
/nix
394+
/zig
395+
396+
# Install Nix and use that to run our tests so our environment matches exactly.
397+
- uses: cachix/install-nix-action@v30
398+
with:
399+
nix_path: nixpkgs=channel:nixos-unstable
400+
- uses: cachix/cachix-action@v15
401+
with:
402+
name: ghostty
403+
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
404+
405+
# Cross-compile the binary. We always use static building for this
406+
# because its the only way to access the headers.
407+
- name: Test Build
408+
run: nix develop -c zig build -Dapp-runtime=glfw -Dtarget=${{ matrix.target }}
409+
376410
test:
377411
if: github.repository == 'ghostty-org/ghostty'
378412
runs-on: namespace-profile-ghostty-md

build.zig.zon

+1-6
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@
1111
.url = "https://github.com/mitchellh/libxev/archive/3df9337a9e84450a58a2c4af434ec1a036f7b494.tar.gz",
1212
.hash = "libxev-0.0.0-86vtc-ziEgDbLP0vihUn1MhsxNKY4GJEga6BEr7oyHpz",
1313
},
14-
.mach_glfw = .{
15-
// mitchellh/mach-glfw
16-
.url = "https://github.com/mitchellh/mach-glfw/archive/d84bc11b0601cdad71035a0e9cf21572d76aa0d2.zip",
17-
.hash = "mach_glfw-0.2.0-EJSQm2M9BQCiYGTd9VcKjg2DhSD7WT4kS-MfX68ORRT_",
18-
.lazy = true,
19-
},
2014
.vaxis = .{
2115
// rockorager/libvaxis
2216
.url = "git+https://github.com/rockorager/libvaxis#1e24e0dfb509e974e1c8713bcd119d0ae032a8c7",
@@ -62,6 +56,7 @@
6256
.cimgui = .{ .path = "./pkg/cimgui" },
6357
.fontconfig = .{ .path = "./pkg/fontconfig" },
6458
.freetype = .{ .path = "./pkg/freetype" },
59+
.glfw = .{ .path = "./pkg/glfw" },
6560
.gtk4_layer_shell = .{ .path = "./pkg/gtk4-layer-shell" },
6661
.harfbuzz = .{ .path = "./pkg/harfbuzz" },
6762
.highway = .{ .path = "./pkg/highway" },

build.zig.zon.nix

+8-48
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.zig.zon.txt

+2-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.zig.zon2json-lock

+5-30
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nix/devShell.nix

+3
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
harfbuzz,
4242
libpng,
4343
libGL,
44+
libxkbcommon,
4445
libX11,
4546
libXcursor,
4647
libXext,
@@ -83,6 +84,7 @@
8384
glslang
8485
spirv-cross
8586

87+
libxkbcommon
8688
libX11
8789
libXcursor
8890
libXi
@@ -162,6 +164,7 @@ in
162164
glslang
163165
spirv-cross
164166

167+
libxkbcommon
165168
libX11
166169
libXcursor
167170
libXext

0 commit comments

Comments
 (0)