1DOLLY 72PACKAGE emacs3REQUIRES HOST runtime@045# GNU Emacs 31.1 for the terminal. demos/emacs/prepare-emacs.sh patches and6# configures the release outside; Dolly compiles every object and dumps it.7FROM /v0.1.4/Dollyfile-system 915c71d4ce772989e3076060967824e48ccd6a1a6259624fe6213542df088dbc8REQUIRES HEADER libc9REQUIRES TOOL   cc10REQUIRES TOOL   ar11REQUIRES TOOL   make12REQUIRES TOOL   sh13REQUIRES TOOL   sed14REQUIRES TOOL   awk15REQUIRES TOOL   gzip16REQUIRES TOOL   tar17REQUIRES TOOL   find18REQUIRES TOOL   xargs19REQUIRES TOOL   cp20REQUIRES TOOL   mkdir21REQUIRES TOOL   rm2223SOURCE /v0.1.4/dist/static/emacs/emacs.tar.gz 464698bdbb30356fa709dde331130bef592dd16d94fdb0dd1fbb0a059fba0184 /tmp/emacs.tar.gz24SLOP gzip -dc /tmp/emacs.tar.gz | tar -xf - -C /2526# Built at -O0, Emacs needs more stack at its first prompt than a Worker gives27# a fresh Chromium's baseline code: it asks for the deeper one (docs/browser-stack.md).28FILE /tmp/emacs-stack.c29    __asm__(".section .custom_section.dolly.process.stack,\"\",@\n.byte 1\n");30SLOP cat /tmp/emacs-stack.c >> /tmp/emacs/src/emacs.c3132# Dolly's tar does not restore archive times. One time for every file lets33# Make treat the generated files the release ships as current.34FILE /tmp/emacs-release-time.c35    #include <fcntl.h>36    #include <stdio.h>37    #include <sys/stat.h>38    39    int main(int argc, char **argv) {40      const struct timespec release[2] = {{1787529600, 0}, {1787529600, 0}};41      for (int index = 1; index < argc; index++) {42        if (utimensat(AT_FDCWD, argv[index], release, 0) != 0) {43          perror(argv[index]);44          return 1;45        }46      }47      return 0;48    }49SLOP cc /tmp/emacs-release-time.c -o /tmp/emacs-release-time50SLOP find /tmp/emacs -type f -exec /tmp/emacs-release-time {} +5152# The release's byte-compiled Lisp is used as shipped: bootstrapping it from53# source interprets the loadup files and overflows a browser Worker's stack.54SLOP make -C /tmp/emacs/lib -j455SLOP make -C /tmp/emacs/lib-src -j456SLOP make -C /tmp/emacs/src -j45758# Install as upstream's make install lays it out, which needs tar -c. Lisp59# sources whose bytecode is installed are left out: upstream compresses them,60# and Dolly's gzip only decompresses.61SLOP mkdir -p /usr/libexec/emacs/31.1/wasm64-unknown-emscripten /usr/share/emacs/31.1 \62  /usr/share/emacs/site-lisp /usr/share/licenses/emacs63SLOP cp /tmp/emacs/src/emacs /usr/bin/emacs64SLOP cp /tmp/emacs/lib-src/etags /usr/bin/etags65SLOP cp /tmp/emacs/lib-src/hexl /usr/libexec/emacs/31.1/wasm64-unknown-emscripten/hexl66SLOP cp /tmp/emacs/src/emacs.pdmp \67  "/usr/libexec/emacs/31.1/wasm64-unknown-emscripten/emacs-$(/tmp/emacs/src/emacs --fingerprint).pdmp"68SLOP cp -R /tmp/emacs/lisp /usr/share/emacs/31.1/lisp69SLOP cp -R /tmp/emacs/etc /usr/share/emacs/31.1/etc70SLOP cp -R /tmp/emacs/info /usr/share/info71SLOP find /usr/share/emacs/31.1/lisp -name '*.elc' | sed 's/c$//' | xargs rm -f72SLOP find /usr/share/emacs/31.1 -name 'Makefile*' -exec rm -f {} +73SLOP cp /tmp/emacs/COPYING /usr/share/licenses/emacs/COPYING7475# The mode is on for what it skips: Emacs's XTVERSION probe, whose 0.1 s wait76# is shorter than the terminal's reply. Dolly's terminal reports no mouse.77FILE /usr/share/emacs/site-lisp/site-start.el78    ;;; -*- lexical-binding: t -*-79    (xterm-mouse-mode 1)8081EXPORTS TOOL   emacs82EXPORTS TOOL   etags83EXPORTS FOLDER emacs-data    /usr/share/emacs84EXPORTS FOLDER emacs-libexec /usr/libexec/emacs85EXPORTS FOLDER emacs-info    /usr/share/info86FILE /usr/share/licenses/emacs/COPYING8788FILE /tmp/emacs-check.el89    ;;; -*- lexical-binding: t -*-90    (require 'cl-lib)91    (with-temp-file "/tmp/emacs-check.txt" (insert "Dolly 日本語\n"))92    (cl-assert (equal (with-temp-buffer (insert-file-contents "/tmp/emacs-check.txt")93                        (buffer-string))94                      "Dolly 日本語\n"))95    (cl-assert (equal (shell-command-to-string "printf SLOP-CHILD") "SLOP-CHILD"))96    (cl-assert (= (call-process "/bin/slop" nil nil nil "-c" "exit 3") 3))97    (let* ((fired nil)98           (process (make-process :name "check" :buffer (generate-new-buffer "check")99                                  :command '("/bin/slop" "-c" "sleep 1; printf ASYNC; exit 4"))))100      (run-with-timer 0.2 nil (lambda () (setq fired t)))101      (while (process-live-p process) (accept-process-output process 0.1))102      (cl-assert fired)103      (cl-assert (= (process-exit-status process) 4))104      (cl-assert (equal (with-current-buffer (process-buffer process) (buffer-substring 1 6))105                        "ASYNC")))106    (garbage-collect)107    (princ (format "%s %s\n" emacs-version system-type))108SLOP timeout 120 emacs --batch -l /tmp/emacs-check.el109FILE /usr/share/man/cat1/emacs.1110    emacs: GNU Emacs 31.1 for the terminal, with etags.111    112      emacs FILE           edits FILE; C-x C-s saves, C-x C-c leaves113      emacs --batch ...    runs Lisp without a terminal114    115    M-! and M-x compile run Slop commands; M-x shell does not: Slop has no -i.116    C-g stops Lisp only when it makes a system call. There are no117    pseudo-terminals, network processes, emacsclient or Lisp threads here, and118    no Lisp packages are installed from the network. Its manual is inside it:119    C-h r, and C-h t for the tutorial.120