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.2/Dollyfile-system cb003619fa38f3340386739e0df6a500c95f5ff040b1efb6804461adf294b2598REQUIRES 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.2/dist/static/emacs/emacs.tar.gz b152cfe40981dbb0ee1764c3ace278346fbd9aff6d2cb94ebbd22485c478ba1a /tmp/emacs.tar.gz24SLOP gzip -dc /tmp/emacs.tar.gz | tar -xf - -C /2526# Dolly's tar does not restore archive times. One time for every file lets27# Make treat the generated files the release ships as current.28FILE /tmp/emacs-release-time.c29    #include <fcntl.h>30    #include <stdio.h>31    #include <sys/stat.h>32    33    int main(int argc, char **argv) {34      const struct timespec release[2] = {{1787529600, 0}, {1787529600, 0}};35      for (int index = 1; index < argc; index++) {36        if (utimensat(AT_FDCWD, argv[index], release, 0) != 0) {37          perror(argv[index]);38          return 1;39        }40      }41      return 0;42    }43SLOP cc /tmp/emacs-release-time.c -o /tmp/emacs-release-time44SLOP find /tmp/emacs -type f -exec /tmp/emacs-release-time {} +4546# The release's byte-compiled Lisp is used as shipped: bootstrapping it from47# source interprets the loadup files and overflows a browser Worker's stack.48SLOP make -C /tmp/emacs/lib -j449SLOP make -C /tmp/emacs/lib-src -j450SLOP make -C /tmp/emacs/src -j45152# Install as upstream's make install lays it out, which needs tar -c. Lisp53# sources whose bytecode is installed are left out: upstream compresses them,54# and Dolly's gzip only decompresses.55SLOP mkdir -p /usr/libexec/emacs/31.1/wasm64-unknown-emscripten /usr/share/emacs/31.1 \56  /usr/share/emacs/site-lisp /usr/share/licenses/emacs57SLOP cp /tmp/emacs/src/emacs /usr/bin/emacs58SLOP cp /tmp/emacs/lib-src/etags /usr/bin/etags59SLOP cp /tmp/emacs/lib-src/hexl /usr/libexec/emacs/31.1/wasm64-unknown-emscripten/hexl60SLOP cp /tmp/emacs/src/emacs.pdmp \61  "/usr/libexec/emacs/31.1/wasm64-unknown-emscripten/emacs-$(/tmp/emacs/src/emacs --fingerprint).pdmp"62SLOP cp -R /tmp/emacs/lisp /usr/share/emacs/31.1/lisp63SLOP cp -R /tmp/emacs/etc /usr/share/emacs/31.1/etc64SLOP cp -R /tmp/emacs/info /usr/share/info65SLOP find /usr/share/emacs/31.1/lisp -name '*.elc' | sed 's/c$//' | xargs rm -f66SLOP find /usr/share/emacs/31.1 -name 'Makefile*' -exec rm -f {} +67SLOP cp /tmp/emacs/COPYING /usr/share/licenses/emacs/COPYING6869# Dolly's terminal reports the mouse. Turning it on also skips Emacs's70# XTVERSION probe, whose 0.1 s wait is shorter than the terminal's reply.71FILE /usr/share/emacs/site-lisp/site-start.el72    ;;; -*- lexical-binding: t -*-73    (xterm-mouse-mode 1)7475EXPORTS TOOL   emacs76EXPORTS TOOL   etags77EXPORTS FOLDER emacs-data    /usr/share/emacs78EXPORTS FOLDER emacs-libexec /usr/libexec/emacs79EXPORTS FOLDER emacs-info    /usr/share/info80FILE /usr/share/licenses/emacs/COPYING8182FILE /tmp/emacs-check.el83    ;;; -*- lexical-binding: t -*-84    (require 'cl-lib)85    (with-temp-file "/tmp/emacs-check.txt" (insert "Dolly 日本語\n"))86    (cl-assert (equal (with-temp-buffer (insert-file-contents "/tmp/emacs-check.txt")87                        (buffer-string))88                      "Dolly 日本語\n"))89    (cl-assert (equal (shell-command-to-string "printf SLOP-CHILD") "SLOP-CHILD"))90    (cl-assert (= (call-process "/bin/slop" nil nil nil "-c" "exit 3") 3))91    (let* ((fired nil)92           (process (make-process :name "check" :buffer (generate-new-buffer "check")93                                  :command '("/bin/slop" "-c" "sleep 1; printf ASYNC; exit 4"))))94      (run-with-timer 0.2 nil (lambda () (setq fired t)))95      (while (process-live-p process) (accept-process-output process 0.1))96      (cl-assert fired)97      (cl-assert (= (process-exit-status process) 4))98      (cl-assert (equal (with-current-buffer (process-buffer process) (buffer-substring 1 6))99                        "ASYNC")))100    (garbage-collect)101    (princ (format "%s %s\n" emacs-version system-type))102SLOP timeout 120 emacs --batch -l /tmp/emacs-check.el103