1DOLLY 72PACKAGE ghostty-gtk3REQUIRES HOST runtime@04REQUIRES HOST dso@05REQUIRES HOST pty@06REQUIRES HOST sockets@07REQUIRES HOST threads@089# Ghostty's GTK application from its release tarball, which carries its10# compiled interface files, built by Zig in Dolly over mesa-build: libadwaita11# and Ghostty's own build.zig12# (ghostty-dolly.patch; its packages fetched on the host, prepare-ghostty.sh).13FROM /v0.1.5/demos/ghostty-gtk/Dollyfile-mesa-build ef3311d73f9f4f632d730a6938e8c53f6f8c58681f8b44362d1397ca074b4e1a14USE /v0.1.5/demos/zig/Dollyfile-zig-llvm 6c15659e1698ea41d2e1030dc46843f6fd3f3ecf6eb656f8df3043d391f7740f1516REQUIRES TOOL   c++17REQUIRES TOOL   cc18REQUIRES TOOL   cp19REQUIRES TOOL   gzip20REQUIRES TOOL   ln21REQUIRES TOOL   meson22REQUIRES TOOL   mkdir23REQUIRES TOOL   patch24REQUIRES TOOL   python325REQUIRES TOOL   tar26REQUIRES TOOL   xz27REQUIRES TOOL   zig2829# libadwaita, static. It carries its own copies of five of GTK's builder30# helpers under GTK's names, which a static link of both would hold twice:31# its build names its copies its own.32SOURCE /v0.1.5/dist/static/ghostty-gtk/libadwaita-1.10.0.tar.xz b1bf56239269d101a6391ad4553c910eff9cc6170b803916405477ef60a66c84 /tmp/ghostty-gtk/libadwaita.tar.xz33SLOP CWD /tmp/ghostty-gtk xz -dc libadwaita.tar.xz | tar -xf -34SLOP CWD /tmp/ghostty-gtk meson setup build-adw libadwaita-1.10.0 --wrap-mode=nodownload --prefix=/usr --libdir=lib \35  --buildtype=release -Ddefault_library=static -Dintrospection=disabled -Dvapi=false -Dtests=false \36  -Dexamples=false -Ddocumentation=false "-Dc_args=-D_gtk_builder_check_parent=adw_gtk_builder_check_parent -D_gtk_builder_prefix_error=adw_gtk_builder_prefix_error -D_gtk_builder_error_unhandled_tag=adw_gtk_builder_error_unhandled_tag -D_gtk_builder_parser_translate=adw_gtk_builder_parser_translate -Dgtk_buildable_child_deprecation_warning=adwgtk_buildable_child_deprecation_warning"37SLOP meson compile -C /tmp/ghostty-gtk/build-adw && meson install --no-rebuild -C /tmp/ghostty-gtk/build-adw3839# Zig hands a link to cc without the program's own flags. This cc passes40# all of it to Dolly's and gives Ghostty's link the rest: Binaryen's cast41# emulation (GObject calls through pointers of other types), the X libraries,42# Mesa's driver, which its EGL links, and libadwaita's resources, registered43# by constructors that wasm-ld keeps only for objects something keeps (an44# export does).45FILE /tmp/ghostty-cc/cc.c46    #include <spawn.h>47    #include <stdio.h>48    #include <stdlib.h>49    #include <string.h>50    #include <sys/wait.h>51    extern char **environ;52    static const char *const ghostty[] = {"--dolly-cast-emulation", "-Wl,--initial-memory=268435456",53      "-Wl,--export=adw_get_resource", "-Wl,--export=adw_stylesheet_get_resource", "-L/usr/lib",54      "-lgallium_dri", "-lXext", "-lX11", "-lxcb", "-lXau", "-lz", "-ldolly-sockets", "-lm"};55    int main(int argc, char **argv) {56      int link = 1, program = 0;57      for (int i = 1; i < argc; i++) {58        if (!strcmp(argv[i], "-c") || !strcmp(argv[i], "-E") || !strcmp(argv[i], "-S")) link = 0;59        if (!strcmp(argv[i], "-o") && i + 1 < argc) {60          const char *slash = strrchr(argv[i + 1], '/');61          program = !strcmp(slash ? slash + 1 : argv[i + 1], "ghostty.wasm");62        }63      }64      char **args = calloc((size_t)argc + sizeof(ghostty) / sizeof(*ghostty) + 1, sizeof(char *));65      size_t n = 0;66      args[n++] = link && program ? "/bin/c++" : "/bin/cc";67      for (int i = 1; i < argc; i++) args[n++] = argv[i];68      if (link && program) for (size_t i = 0; i < sizeof(ghostty) / sizeof(*ghostty); i++) args[n++] = (char *)ghostty[i];69      pid_t pid;70      int status;71      if (posix_spawn(&pid, args[0], NULL, NULL, args, environ) != 0) return perror(args[0]), 127;72      if (waitpid(pid, &status, 0) != pid) return 127;73      return WIFEXITED(status) ? WEXITSTATUS(status) : 128 + WTERMSIG(status);74    }75SLOP cc -O1 /tmp/ghostty-cc/cc.c -o /tmp/ghostty-cc/cc76# Ghostty's build finds libdolly-sockets and libdolly-pty under a prefix's lib.77SLOP mkdir -p /tmp/ghostty-prefix && ln -s /usr/lib/dolly/process /tmp/ghostty-prefix/lib7879SOURCE /v0.1.5/dist/static/ghostty-gtk/ghostty.tar.gz 6c5d144628a8bc6b7800e3b264628ea357877cff42c60f6845936b5a327c335a /tmp/ghostty.tar.gz80SLOP gzip -dc /tmp/ghostty.tar.gz | tar -xf - -C /81# Ghostty's threads share the program's memory, so its code needs wasm's82# atomics, which Zig's baseline for Emscripten lacks: the CPU Dolly's cc83# compiles for, with the simd128 Ghostty adds when no CPU is named.84SLOP CWD /tmp/ghostty PATH=/tmp/ghostty-cc:$PATH ZIG_LIBC=/usr/lib/zig/libc.txt zig build -Dapp-runtime=gtk -Doptimize=ReleaseFast -Dcpu=generic+atomics+simd128 \85  -Dgtk-wayland=false -Dsentry=false -Di18n=false -Demit-docs=false -Demit-terminfo=false -Demit-termcap=false \86  -Dversion-string=1.4.0 -fsys=freetype -fsys=harfbuzz -fsys=fontconfig -fsys=libpng -fsys=zlib \87  --search-prefix /tmp/ghostty-prefix --summary none88SLOP cp /tmp/ghostty/zig-out/bin/ghostty.wasm /usr/bin/ghostty89SLOP ghostty +version | grep -q 'Ghostty 1.4.0'9091SLOP mkdir -p /usr/share/licenses/ghostty-gtk92SLOP cp /tmp/ghostty/LICENSE /usr/share/licenses/ghostty-gtk/ghostty-LICENSE93SLOP cp /tmp/ghostty-gtk/libadwaita-1.10.0/COPYING /usr/share/licenses/ghostty-gtk/libadwaita-COPYING94SLOP cp /usr/share/licenses/mesa/license.rst /usr/share/licenses/ghostty-gtk/mesa-license.rst95EXPORTS TOOL ghostty96FILE /usr/share/licenses/ghostty-gtk/ghostty-LICENSE97FILE /usr/share/licenses/ghostty-gtk/libadwaita-COPYING98FILE /usr/share/licenses/ghostty-gtk/mesa-license.rst99FILE /usr/share/man/cat1/ghostty.1100    ghostty: Ghostty's GTK application, built inside Dolly from the pinned101    commit, for an X server (the ghostty-x11 application starts one).102    103      ghostty                           a window with $SHELL in it104      ghostty --command=direct:/bin/slop --gtk-single-instance=false105      ghostty +version                  its version106      ghostty +help                     the actions and options107    108    It draws its terminal with Mesa's OpenGL in the program (softpipe through109    EGL's surfaceless platform) and its window with cairo: set110    GSK_RENDERER=cairo MESA_GL_VERSION_OVERRIDE=4.3111    MESA_GLSL_VERSION_OVERRIDE=430, as ghostty-x11 does.112    Upstream's documentation: https://ghostty.org/docs113