1DOLLY 82PACKAGE 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 /Dollyfile-system 5eb06684bc61be6a1d9af98b8a740fba55b22ff4216f6cdb117c6ff6583104f08REQUIRES 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 /dist/static/emacs/emacs.tar.gz 56a662b94601b2fd99b9fd9b41d660dba81d472dd99a999e58a0e5f90ecae355 /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# Upstream's bootstrap from the Lisp sources: a dump that loads them, the33# bytecode compiled by it, then the dump of that bytecode.34SLOP make -C /tmp/emacs/lib -j435SLOP make -C /tmp/emacs/lib-src -j436SLOP make -C /tmp/emacs/src bootstrap-emacs bootstrap-emacs.pdmp37# A file loads each library it requires as bytecode if that is compiled by38# then, else as source, and its own bytecode differs with it: under make -j4,39# by timing. compile-main runs 4 at once in batches of 16 (upstream's40# XARGS_LIMIT), each batch's bytecode written aside and moved into place when41# the batch ends: a file sees the bytecode of the batches before it and no42# other. Upstream's first files and the loaddefs, which compile-main makes43# beside the first batch, go before it, one after the other. diary-icalendar's44# vevent macro makes a UID while it expands, by default from the sxhash of its45# forms, which hashes symbols by their address: a counter makes it instead.46FILE /tmp/emacs-batch.el47    ;;; -*- lexical-binding: t -*-48    (setq byte-compile-dest-file-function (lambda (source) (concat source "c-next")))49    (setq icalendar-uid-format "%c")50FILE /tmp/emacs-batch.mk51    compile-targets: ; @for elc in $(TARGETS); do if test -f $$elc-next; then mv -f $$elc-next $$elc; fi; done52SLOP make -C /tmp/emacs/lisp main-first autoloads EMACS=../src/bootstrap-emacs53SLOP MAKEFILES=/tmp/emacs-batch.mk make -C /tmp/emacs/lisp -j4 compile-main \54  EMACS=../src/bootstrap-emacs XARGS_LIMIT='-n 16' BYTE_COMPILE_EXTRA_FLAGS='-l /tmp/emacs-batch.el'55SLOP make -C /tmp/emacs/src -j45657# Install as upstream's make install lays it out, which needs tar -c, and58# compress what it compresses: the Lisp sources whose bytecode is installed,59# the public suffix list and the info pages. Emacs reads them through gzip.60SLOP mkdir -p /usr/libexec/emacs/31.1/wasm64-unknown-emscripten /usr/share/emacs/31.1 \61  /usr/share/emacs/site-lisp /usr/share/licenses/emacs62SLOP cp /tmp/emacs/src/emacs /usr/bin/emacs63SLOP cp /tmp/emacs/lib-src/etags /usr/bin/etags64SLOP cp /tmp/emacs/lib-src/hexl /usr/libexec/emacs/31.1/wasm64-unknown-emscripten/hexl65SLOP cp /tmp/emacs/src/emacs.pdmp \66  "/usr/libexec/emacs/31.1/wasm64-unknown-emscripten/emacs-$(/tmp/emacs/src/emacs --fingerprint).pdmp"67SLOP cp -R /tmp/emacs/lisp /usr/share/emacs/31.1/lisp68SLOP cp -R /tmp/emacs/etc /usr/share/emacs/31.1/etc69SLOP cp -R /tmp/emacs/info /usr/share/info70SLOP find /usr/share/emacs/31.1/lisp -name '*.elc' | sed 's/c$//' | xargs gzip -9n71SLOP gzip -9n /usr/share/emacs/31.1/etc/publicsuffix.txt72SLOP find /usr/share/info -name '*.info' -exec gzip -9n {} +73SLOP find /usr/share/emacs/31.1 -name 'Makefile*' -exec rm -f {} +74SLOP cp /tmp/emacs/COPYING /usr/share/licenses/emacs/COPYING7576# The mode is on for what it skips: Emacs's XTVERSION probe, whose 0.1 s wait77# is shorter than the terminal's reply. Dolly's terminal reports no mouse.78FILE /usr/share/emacs/site-lisp/site-start.el79    ;;; -*- lexical-binding: t -*-80    (xterm-mouse-mode 1)8182EXPORTS TOOL   emacs83EXPORTS TOOL   etags84EXPORTS FOLDER emacs-data    /usr/share/emacs85EXPORTS FOLDER emacs-libexec /usr/libexec/emacs86EXPORTS FOLDER emacs-info    /usr/share/info87FILE /usr/share/licenses/emacs/COPYING8889FILE /tmp/emacs-check.el90    ;;; -*- lexical-binding: t -*-91    (require 'cl-lib)92    (with-temp-file "/tmp/emacs-check.txt" (insert "Dolly 日本語\n"))93    (cl-assert (equal (with-temp-buffer (insert-file-contents "/tmp/emacs-check.txt")94                        (buffer-string))95                      "Dolly 日本語\n"))96    (cl-assert (equal (shell-command-to-string "printf SLOP-CHILD") "SLOP-CHILD"))97    (cl-assert (= (call-process "/bin/slop" nil nil nil "-c" "exit 3") 3))98    (let* ((fired nil)99           (process (make-process :name "check" :buffer (generate-new-buffer "check")100                                  :command '("/bin/slop" "-c" "sleep 1; printf ASYNC; exit 4"))))101      (run-with-timer 0.2 nil (lambda () (setq fired t)))102      (while (process-live-p process) (accept-process-output process 0.1))103      (cl-assert fired)104      (cl-assert (= (process-exit-status process) 4))105      (cl-assert (equal (with-current-buffer (process-buffer process) (buffer-substring 1 6))106                        "ASYNC")))107    (require 'find-func)108    (cl-assert (string-suffix-p "/subr.el.gz" (find-library-name "subr")))109    (cl-assert (with-temp-buffer (insert-file-contents (find-library-name "subr"))110                 (search-forward ";;; subr.el ---" nil t)))111    (garbage-collect)112    (princ (format "%s %s\n" emacs-version system-type))113SLOP timeout 120 emacs --batch -l /tmp/emacs-check.el114FILE /usr/share/man/cat1/emacs.1115    emacs: GNU Emacs 31.1 for the terminal, with etags.116    117      emacs FILE           edits FILE; C-x C-s saves, C-x C-c leaves118      emacs --batch ...    runs Lisp without a terminal119    120    M-! and M-x compile run Slop commands; M-x shell does not: Slop has no -i.121    C-g stops Lisp only when it makes a system call. There are no122    pseudo-terminals, network processes, emacsclient or Lisp threads here, and123    no Lisp packages are installed from the network. Its manual is inside it:124    C-h r, and C-h t for the tutorial.125