Skip to content

Commit b32308c

Browse files
committed
Replace ghostty git submodule with Zig URL dependency
Ghostty is now fetched automatically by Zig's package manager from a pinned GitHub archive URL instead of requiring a git submodule. This makes `zig build` fully self-contained — no submodule init needed. - build.zig.zon: replace .path dependency with .url + .hash pointing to ghostty commit 0182541 (latest as of 2026-04-13) - build.zig: get ghostty headers from the artifact's emitted include tree instead of hardcoded vendor/ghostty/include path - Remove .gitmodules and vendor/ghostty submodule - CI/release workflows: drop submodule checkout steps - README: update build instructions, document --override-dep for local ghostty development MELPA users can now compile from source with just `zig build` since the ghostty dependency is fetched on demand.
1 parent 3e0776d commit b32308c

7 files changed

Lines changed: 26 additions & 62 deletions

File tree

.github/workflows/ci.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,6 @@ jobs:
9797
runs-on: ${{ matrix.os }}
9898
steps:
9999
- uses: actions/checkout@v4
100-
with:
101-
submodules: recursive
102-
persist-credentials: true
103-
104-
- name: Rewrite SSH to HTTPS for submodules
105-
run: |
106-
git config --global url."https://github.com/".insteadOf "git@github.com:"
107-
git submodule sync --recursive
108-
git submodule update --init --recursive
109100

110101
- name: Install Zig
111102
uses: mlugg/setup-zig@v2

.github/workflows/release.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,6 @@ jobs:
2828
runs-on: ${{ matrix.os }}
2929
steps:
3030
- uses: actions/checkout@v4
31-
with:
32-
submodules: recursive
33-
persist-credentials: true
34-
35-
- name: Rewrite SSH to HTTPS for submodules
36-
run: |
37-
git config --global url."https://github.com/".insteadOf "git@github.com:"
38-
git submodule sync --recursive
39-
git submodule update --init --recursive
4031

4132
- name: Install Zig
4233
uses: mlugg/setup-zig@v2

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

README.md

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -94,48 +94,31 @@ require local Emacs headers. If you want to override the vendored header, set
9494
`../include` and `../share/emacs/include`.
9595

9696
```sh
97-
# Clone with submodule
98-
git clone --recurse-submodules https://github.com/dakra/ghostel.git
97+
git clone https://github.com/dakra/ghostel.git
9998
cd ghostel
10099

101-
# Optional: override the vendored header
102-
# export EMACS_INCLUDE_DIR=/path/to/include
103-
# export EMACS_BIN_DIR=/path/to/emacs/bin
104-
105-
# Build everything (libghostty-vt + ghostel module)
100+
# Build everything (fetches ghostty automatically via Zig package manager)
106101
zig build -Doptimize=ReleaseFast
107102
```
108103

109-
If you already have the repo, initialize the submodule and build:
104+
To override the vendored Emacs header, set `EMACS_INCLUDE_DIR` to a
105+
directory containing `emacs-module.h`, or set `EMACS_BIN_DIR` to an
106+
Emacs `bin/` directory.
107+
108+
To build against a local ghostty checkout:
110109

111110
```sh
112-
git submodule update --init --recursive vendor/ghostty
113-
zig build -Doptimize=ReleaseFast
111+
zig build -Doptimize=ReleaseFast --override-dep ghostty=/path/to/ghostty
114112
```
115113

116114
### Building from source (MELPA install)
117115

118-
MELPA packages only include `.el` files — `build.zig`, the vendored header,
119-
Zig sources, and the ghostty submodule are not included. This means
120-
`M-x ghostel-module-compile`
121-
is not available when installed from MELPA.
122-
123-
The recommended approach is to download a **pre-built binary** via
124-
`M-x ghostel-download-module` (this works regardless of install method).
125-
126-
If you prefer to compile from source, clone the repository, build, and copy
127-
the resulting module into your MELPA package directory:
116+
When installed from MELPA, `M-x ghostel-module-compile` builds the native
117+
module from source using `zig build`. Zig's package manager fetches the
118+
ghostty dependency automatically — no git submodule needed.
128119

129-
```sh
130-
git clone --recurse-submodules https://github.com/dakra/ghostel.git
131-
cd ghostel
132-
zig build -Doptimize=ReleaseFast
133-
134-
# Copy the module into your MELPA package directory
135-
# (adjust the path to match your Emacs package directory and ghostel version)
136-
cp ghostel-module.dylib ~/.emacs.d/elpa/ghostel-*/ # macOS
137-
cp ghostel-module.so ~/.emacs.d/elpa/ghostel-*/ # Linux
138-
```
120+
Alternatively, download a **pre-built binary** via
121+
`M-x ghostel-download-module`.
139122

140123
## Shell Integration
141124

build.zig

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ pub fn build(b: *std.Build) void {
1212
.target = target,
1313
.optimize = optimize,
1414
.@"emit-lib-vt" = true,
15-
}) orelse std.debug.panic(
16-
"ghostty dependency unavailable; initialize the vendor/ghostty submodule",
17-
.{},
18-
);
15+
}) orelse @panic("ghostty dependency unavailable; run: zig build --fetch");
16+
17+
const ghostty_lib = ghostty_dep.artifact("ghostty-vt-static");
1918

2019
const mod = b.createModule(.{
2120
.root_source_file = b.path("src/module.zig"),
@@ -25,8 +24,8 @@ pub fn build(b: *std.Build) void {
2524
.strip = if (is_release) true else null,
2625
.omit_frame_pointer = if (is_release) true else null,
2726
});
28-
addModuleIncludes(b, mod, emacs_module_dir);
29-
mod.linkLibrary(ghostty_dep.artifact("ghostty-vt-static"));
27+
addModuleIncludes(mod, emacs_module_dir, ghostty_lib);
28+
mod.linkLibrary(ghostty_lib);
3029

3130
const lib = b.addLibrary(.{
3231
.name = "ghostel-module",
@@ -58,7 +57,7 @@ pub fn build(b: *std.Build) void {
5857
.optimize = optimize,
5958
.link_libc = true,
6059
});
61-
addModuleIncludes(b, check_mod, emacs_module_dir);
60+
addModuleIncludes(check_mod, emacs_module_dir, ghostty_lib);
6261

6362
const check_obj = b.addObject(.{
6463
.name = "ghostel-module-check",
@@ -70,12 +69,12 @@ pub fn build(b: *std.Build) void {
7069
}
7170

7271
fn addModuleIncludes(
73-
b: *std.Build,
7472
mod: *std.Build.Module,
7573
emacs_module_dir: std.Build.LazyPath,
74+
ghostty_lib: *std.Build.Step.Compile,
7675
) void {
7776
mod.addSystemIncludePath(emacs_module_dir);
78-
mod.addIncludePath(b.path("vendor/ghostty/include"));
77+
mod.addIncludePath(ghostty_lib.getEmittedIncludeTree());
7978
}
8079

8180
fn resolveEmacsModuleDir(b: *std.Build) std.Build.LazyPath {

build.zig.zon

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
.paths = .{""},
55
.fingerprint = 0x5a44bdd1198a0f4b,
66
.dependencies = .{
7-
.ghostty = .{ .path = "./vendor/ghostty", .lazy = true },
7+
.ghostty = .{
8+
.url = "https://github.com/ghostty-org/ghostty/archive/01825411ab2720e47e6902e9464e805bc6a062a1.tar.gz",
9+
.hash = "ghostty-1.3.2-dev-5UdBCzaaBwVjJOr-ltYINjybeEOAmLAauH5oq8-cdNGN",
10+
.lazy = true,
11+
},
812
},
913
}

vendor/ghostty

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)