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.7/demos/ghostty-gtk/Dollyfile-mesa-build 60df67c2cec05569eb4a466f2c2928bf67d3ce273baf4e0fcb1f2c7c9ddb040a14USE /v0.1.7/demos/zig/Dollyfile-zig-llvm 80244b9715c6aaafab8311f4730904e2d9ff55f35f716e91d84ce44b8af6bbd615USE /v0.1.7/Dollyfile-libdolly-pty 67d1c150da08266c5297e377f4cab8dda24306e701ac3f58d2347f90778a4c071617REQUIRES TOOL   c++18REQUIRES TOOL   cc19REQUIRES TOOL   cp20REQUIRES TOOL   glib-compile-schemas21REQUIRES TOOL   gzip22REQUIRES TOOL   ln23REQUIRES TOOL   meson24REQUIRES TOOL   mkdir25REQUIRES TOOL   patch26REQUIRES TOOL   python327REQUIRES TOOL   tar28REQUIRES TOOL   xz29REQUIRES TOOL   zig3031# What GTK's libraries read as they start, which a static link leaves out:32# GTK's settings schemas, compiled (a dialog that keeps a setting, as the emoji33# chooser of a text field does, aborts without its schema), and fontconfig's34# configuration, for the fonts an image has in /usr/share/fonts.35SOURCE /v0.1.7/dist/static/gtk/gtk-4.24.1.tar.xz e98abe720e16129c8c0f50761dee0a2e9ae2478055e31018f6cf977fcf6513e9 /tmp/ghostty-gtk/gtk.tar.xz36SLOP CWD /tmp/ghostty-gtk xz -dc gtk.tar.xz | tar -xf -37SLOP mkdir -p /usr/share/glib-2.0/schemas && cp /tmp/ghostty-gtk/gtk-4.24.1/gtk/*.gschema.xml /usr/share/glib-2.0/schemas/38SLOP glib-compile-schemas --strict /usr/share/glib-2.0/schemas39FILE /usr/share/glib-2.0/schemas/gschemas.compiled40FILE /etc/fonts/fonts.conf41    <?xml version="1.0"?>42    <!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">43    <fontconfig>44      <dir>/usr/share/fonts</dir>45      <cachedir>/tmp/fontconfig</cachedir>46    </fontconfig>4748# libadwaita, static. It carries its own copies of five of GTK's builder49# helpers under GTK's names, which a static link of both would hold twice:50# its build names its copies its own.51SOURCE /v0.1.7/dist/static/ghostty-gtk/libadwaita-1.10.0.tar.xz b1bf56239269d101a6391ad4553c910eff9cc6170b803916405477ef60a66c84 /tmp/ghostty-gtk/libadwaita.tar.xz52SLOP CWD /tmp/ghostty-gtk xz -dc libadwaita.tar.xz | tar -xf -53SLOP CWD /tmp/ghostty-gtk meson setup build-adw libadwaita-1.10.0 --wrap-mode=nodownload --prefix=/usr --libdir=lib \54  --buildtype=release -Ddefault_library=static -Dintrospection=disabled -Dvapi=false -Dtests=false \55  -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"56SLOP meson compile -C /tmp/ghostty-gtk/build-adw && meson install --no-rebuild -C /tmp/ghostty-gtk/build-adw5758# Zig hands a link to cc without the program's own flags. This cc passes59# all of it to Dolly's and gives Ghostty's link the rest: Binaryen's cast60# emulation (GObject calls through pointers of other types), the X libraries,61# Mesa's driver, which its EGL links, and libadwaita's resources, registered62# by constructors that wasm-ld keeps only for objects something keeps (an63# export does).64FILE /tmp/ghostty-cc/cc.c65    #include <spawn.h>66    #include <stdio.h>67    #include <stdlib.h>68    #include <string.h>69    #include <sys/wait.h>70    extern char **environ;71    static const char *const ghostty[] = {"--dolly-cast-emulation", "-Wl,--initial-memory=268435456",72      "-Wl,--export=adw_get_resource", "-Wl,--export=adw_stylesheet_get_resource", "-L/usr/lib",73      "-lgallium_dri", "-lXext", "-lX11", "-lxcb", "-lXau", "-lz", "-ldolly-sockets", "-lm"};74    int main(int argc, char **argv) {75      int link = 1, program = 0;76      for (int i = 1; i < argc; i++) {77        if (!strcmp(argv[i], "-c") || !strcmp(argv[i], "-E") || !strcmp(argv[i], "-S")) link = 0;78        if (!strcmp(argv[i], "-o") && i + 1 < argc) {79          const char *slash = strrchr(argv[i + 1], '/');80          program = !strcmp(slash ? slash + 1 : argv[i + 1], "ghostty.wasm");81        }82      }83      char **args = calloc((size_t)argc + sizeof(ghostty) / sizeof(*ghostty) + 1, sizeof(char *));84      size_t n = 0;85      args[n++] = link && program ? "/bin/c++" : "/bin/cc";86      for (int i = 1; i < argc; i++) args[n++] = argv[i];87      if (link && program) for (size_t i = 0; i < sizeof(ghostty) / sizeof(*ghostty); i++) args[n++] = (char *)ghostty[i];88      pid_t pid;89      int status;90      if (posix_spawn(&pid, args[0], NULL, NULL, args, environ) != 0) return perror(args[0]), 127;91      if (waitpid(pid, &status, 0) != pid) return 127;92      return WIFEXITED(status) ? WEXITSTATUS(status) : 128 + WTERMSIG(status);93    }94SLOP cc -O1 /tmp/ghostty-cc/cc.c -o /tmp/ghostty-cc/cc95# Ghostty's build finds libdolly-sockets and libdolly-pty under a prefix's lib.96SLOP mkdir -p /tmp/ghostty-prefix && ln -s /usr/lib /tmp/ghostty-prefix/lib9798SOURCE /v0.1.7/dist/static/ghostty-gtk/ghostty.tar.gz f11c48d17b3237e5f8590f6df96a61eac3f5abade37d1b52aaf75f5611600077 /tmp/ghostty.tar.gz99SLOP gzip -dc /tmp/ghostty.tar.gz | tar -xf - -C /100# Ghostty's threads share the program's memory, so its code needs wasm's101# atomics, which Zig's baseline for Emscripten lacks: the CPU Dolly's cc102# compiles for, with the simd128 Ghostty adds when no CPU is named.103SLOP 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 \104  -Dgtk-wayland=false -Dsentry=false -Di18n=false -Demit-docs=false -Demit-terminfo=false -Demit-termcap=false \105  -Dversion-string=1.4.0 -fsys=freetype -fsys=harfbuzz -fsys=fontconfig -fsys=libpng -fsys=zlib \106  --search-prefix /tmp/ghostty-prefix --summary none107SLOP cp /tmp/ghostty/zig-out/bin/ghostty.wasm /usr/bin/ghostty108SLOP ghostty +version | grep -q 'Ghostty 1.4.0'109110SLOP mkdir -p /usr/share/licenses/ghostty-gtk111SLOP cp /tmp/ghostty/LICENSE /usr/share/licenses/ghostty-gtk/ghostty-LICENSE112SLOP cp /tmp/ghostty-gtk/libadwaita-1.10.0/COPYING /usr/share/licenses/ghostty-gtk/libadwaita-COPYING113SLOP cp /usr/share/licenses/mesa/license.rst /usr/share/licenses/ghostty-gtk/mesa-license.rst114EXPORTS TOOL ghostty115FILE /usr/share/licenses/ghostty-gtk/ghostty-LICENSE116FILE /usr/share/licenses/ghostty-gtk/libadwaita-COPYING117FILE /usr/share/licenses/ghostty-gtk/mesa-license.rst118FILE /usr/share/man/cat1/ghostty.1119    ghostty: Ghostty's GTK application, built inside Dolly from the pinned120    commit, for an X server (the ghostty-x11 application starts one).121    122      ghostty                           a window with $SHELL in it123      ghostty --command=direct:/bin/slop --gtk-single-instance=false124      ghostty +version                  its version125      ghostty +help                     the actions and options126    127    It draws its terminal with Mesa's OpenGL in the program (softpipe through128    EGL's surfaceless platform) and its window with cairo.129    Upstream's documentation: https://ghostty.org/docs130