diff options
author | Phillip Lord <phillip.lord@russet.org.uk> | 2016-10-27 08:07:05 +0100 |
---|---|---|
committer | Phillip Lord <phillip.lord@russet.org.uk> | 2016-11-20 17:33:23 +0000 |
commit | 768380780bdddadda9ed87793f4cf855cccfecf5 (patch) | |
tree | e4f4144b938398032610efc7a2b2541c0562eba5 | |
parent | 56a47981cc921369dd124cc023ca1469225b1fa7 (diff) | |
download | emacs-768380780bdddadda9ed87793f4cf855cccfecf5.tar.gz |
Replace ldefs-boot with a much smaller file
* Makefile.in (bootstrap-build,generate-ldefs-boot): New targets.
(bootstrap): Depend on bootstrap-build.
* admin/ldefs-clean.el: New file.
* lisp/Makefile.in (compile-first): Depend on loaddefs.el
* lisp/ldefs-boot.el: Remove.
* lisp/ldefs-boot-auto.el: New file.
* lisp/ldefs-boot-manual.el: New file.
* lisp/loadup.el: Load ldefs-boot-manual.el.
* src/emacs.c (generating_ldefs_boot): New variable.
(main): Check whether we are generating ldefs.
* src/eval.c (autoload-do-load): Dump autoload forms to stderr when
requested.
* src/lisp.h (generating_ldefs_boot): New variable.
-rw-r--r-- | Makefile.in | 15 | ||||
-rw-r--r-- | admin/ldefs-clean.el | 63 | ||||
-rw-r--r-- | lisp/Makefile.in | 2 | ||||
-rw-r--r-- | lisp/ldefs-boot-auto.el | 163 | ||||
-rw-r--r-- | lisp/ldefs-boot-manual.el | 19 | ||||
-rw-r--r-- | lisp/loadup.el | 2 | ||||
-rw-r--r-- | src/Makefile.in | 4 | ||||
-rw-r--r-- | src/emacs.c | 7 | ||||
-rw-r--r-- | src/eval.c | 21 | ||||
-rw-r--r-- | src/lisp.h | 2 |
10 files changed, 294 insertions, 4 deletions
diff --git a/Makefile.in b/Makefile.in index 2351537c3bc..00e75b8e6a4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1117,7 +1117,9 @@ check-info: info # * Run autogen.sh. # * Rebuild Makefile, to update the build procedure itself. # * Do the actual build. -bootstrap: bootstrap-clean +bootstrap: bootstrap-clean bootstrap-build + +bootstrap-build: cd $(srcdir) && ./autogen.sh $(MAKE) MAKEFILE_NAME=force-Makefile force-Makefile $(MAKE) all @@ -1180,3 +1182,14 @@ check-declare: exit 1; \ fi $(MAKE) -C lisp $@ + +## Generating ldefs-boot-auto.el requires a completely clean build so +## that we can see which autoloads are actually called. The build has +## to complete because we use Emacs to clean the results up! +generate-ldefs-boot: + echo "Generating Bootstrap ldefs" + $(MAKE) -j 1 bootstrap \ + GENERATE_LDEFS_BOOT="generate-ldefs-boot" \ + 2>&1 | tee lisp/ldefs-boot-auto.temp + $(EMACS) -batch --load admin/ldefs-clean.el --funcall ldefs-clean + rm lisp/ldefs-boot-auto.temp diff --git a/admin/ldefs-clean.el b/admin/ldefs-clean.el new file mode 100644 index 00000000000..8a37d6e15f0 --- /dev/null +++ b/admin/ldefs-clean.el @@ -0,0 +1,63 @@ +;; Copyright (C) 2016 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; This file takes the output from the "generate-ldefs-boot" make +;; target, takes the relevant autoload forms, removes everything else +;; and adds some comments. + +(defun ldefs-clean-uniquify-region-lines (beg end) + "Remove duplicate adjacent lines in region." + (save-excursion + (goto-char beg) + (while (re-search-forward "^\\(.*\n\\)\\1+" end t) + (replace-match "\\1")))) + +(defun ldefs-clean-uniquify-buffer-lines () + "Remove duplicate adjacent lines in the current buffer." + (interactive) + (uniquify-region-lines (point-min) (point-max))) + +(defun ldefs-clean-up () + "Clean up output from build and turn it into ldefs-boot-auto.el." + (interactive) + (goto-char (point-max)) + ;; We only need the autoloads up till loaddefs.el is + ;; generated. After this, ldefs-boot.el is not needed + (search-backward "loaddefs.el") + (delete-region (point) (point-max)) + (keep-lines "(autoload" (point-min) (point-max)) + (sort-lines nil (point-min) (point-max)) + (uniquify-buffer-lines) + (goto-char (point-min)) + (insert + ";; This file is autogenerated by admin/ldefs-clean.el +;; Do not edit +") + (goto-char (point-max)) + (insert + ";; Local Variables: +;; no-byte-compile: t +;; no-update-autoloads: t +;; End:")) + + +(defun ldefs-clean () + (find-file "lisp/ldefs-boot-auto.temp") + (ldefs-clean-up) + (write-file "ldefs-boot-auto.el")) diff --git a/lisp/Makefile.in b/lisp/Makefile.in index 12bb9c7a3ce..04a241f4654 100644 --- a/lisp/Makefile.in +++ b/lisp/Makefile.in @@ -283,7 +283,7 @@ $(THEFILE)c: .PHONY: compile-first compile-main compile compile-always -compile-first: $(COMPILE_FIRST) +compile-first: loaddefs.el $(COMPILE_FIRST) # In 'compile-main' we could directly do # ... | xargs $(MAKE) diff --git a/lisp/ldefs-boot-auto.el b/lisp/ldefs-boot-auto.el new file mode 100644 index 00000000000..5d2f99d17f5 --- /dev/null +++ b/lisp/ldefs-boot-auto.el @@ -0,0 +1,163 @@ +(autoload 'Info-directory "info" nil nil nil) +(autoload 'Info-index "info" nil nil nil) +(autoload 'View-exit-and-edit "view" nil nil nil) +(autoload 'add-change-log-entry "add-log" nil nil nil) +(autoload 'add-log-current-defun "add-log" nil nil nil) +(autoload 'batch-byte-compile "bytecomp" nil nil nil) +(autoload 'batch-update-autoloads "autoload" nil nil nil) +(autoload 'bounds-of-thing-at-point "thingatpt" nil nil nil) +(autoload 'browse-url "browse-url" nil nil nil) +(autoload 'buffer-face-mode "face-remap" nil nil nil) +(autoload 'byte-compile "bytecomp" nil nil nil) +(autoload 'byte-compile "bytecomp" nil nil t) +(autoload 'byte-compile-disable-warning "bytecomp" nil nil nil) +(autoload 'byte-compile-enable-warning "bytecomp" nil nil nil) +(autoload 'byte-compile-file "bytecomp" nil nil nil) +(autoload 'byte-compile-inline-expand "byte-opt" nil nil nil) +(autoload 'byte-compile-unfold-lambda "byte-opt" nil nil nil) +(autoload 'byte-optimize-form "byte-opt" nil nil nil) +(autoload 'byte-optimize-form "byte-opt" nil nil t) +(autoload 'byte-optimize-lapcode "byte-opt" nil nil nil) +(autoload 'byte-recompile-directory "bytecomp" nil nil nil) +(autoload 'char-displayable-p "mule-util" nil nil nil) +(autoload 'char-displayable-p "mule-util" nil nil t) +(autoload 'color-name-to-rgb "color" nil nil nil) +(autoload 'comint-redirect-results-list-from-process "comint" nil nil nil) +(autoload 'comint-redirect-send-command-to-process "comint" nil nil nil) +(autoload 'compilation-mode "compile" nil nil nil) +(autoload 'compilation-shell-minor-mode "compile" nil nil nil) +(autoload 'compilation-start "compile" nil nil nil) +(autoload 'completing-read-multiple "crm" nil nil nil) +(autoload 'conf-mode "conf-mode" nil nil nil) +(autoload 'create-glyph "disp-table" nil nil nil) +(autoload 'create-image "image" nil nil nil) +(autoload 'cursor-sensor-mode "cursor-sensor" nil nil nil) +(autoload 'custom-save-all "cus-edit" nil nil nil) +(autoload 'customize-face "cus-edit" nil nil nil) +(autoload 'customize-group "cus-edit" nil nil nil) +(autoload 'customize-option "cus-edit" nil nil nil) +(autoload 'customize-push-and-save "cus-edit" nil nil nil) +(autoload 'customize-set-variable "cus-edit" nil nil nil) +(autoload 'debug "debug" nil nil nil) +(autoload 'define-ccl-program "ccl" nil nil nil) +(autoload 'define-derived-mode "derived" nil nil nil) +(autoload 'define-minor-mode "easy-mmode" nil nil nil) +(autoload 'delete-extract-rectangle "rect" nil nil nil) +(autoload 'describe-char "descr-text" nil nil nil) +(autoload 'describe-coding-system "mule-diag" nil nil nil) +(autoload 'describe-display-table "disp-table" nil nil nil) +(autoload 'describe-function "help-fns" nil nil nil) +(autoload 'describe-function-1 "help-fns" nil nil nil) +(autoload 'describe-package "package" nil nil nil) +(autoload 'describe-variable "help-fns" nil nil nil) +(autoload 'desktop-save "desktop" nil nil nil) +(autoload 'diff-mode "diff-mode" nil nil nil) +(autoload 'dired "dired" nil nil nil) +(autoload 'dired-copy-file "dired-aux" nil nil nil) +(autoload 'dired-goto-subdir "dired-aux" nil nil nil) +(autoload 'dired-hide-subdir "dired-aux" nil nil nil) +(autoload 'dired-insert-subdir "dired-aux" nil nil nil) +(autoload 'dired-kill-subdir "dired-aux" nil nil nil) +(autoload 'dired-mark-subdir-files "dired-aux" nil nil nil) +(autoload 'dired-mode "dired" nil nil nil) +(autoload 'dired-noselect "dired" nil nil nil) +(autoload 'dired-query "dired-aux" nil nil nil) +(autoload 'dired-rename-file "dired-aux" nil nil nil) +(autoload 'display-call-tree "bytecomp" nil nil nil) +(autoload 'display-table-slot "disp-table" nil nil nil) +(autoload 'display-warning "warnings" nil nil nil) +(autoload 'display-warning "warnings" nil nil t) +(autoload 'easy-menu-create-menu "easymenu" nil nil nil) +(autoload 'edebug-basic-spec "edebug" nil nil nil) +(autoload 'ediff-patch-file "ediff" nil nil nil) +(autoload 'edit-kbd-macro "edmacro" nil nil nil) +(autoload 'extract-rectangle "rect" nil nil nil) +(autoload 'find-definition-noselect "find-func" nil nil nil) +(autoload 'find-function-search-for-symbol "find-func" nil nil nil) +(autoload 'find-lisp-object-file-name "help-fns" nil nil nil) +(autoload 'find-variable-noselect "find-func" nil nil nil) +(autoload 'format-kbd-macro "edmacro" nil nil nil) +(autoload 'goto-address-mode "goto-addr" nil nil nil) +(autoload 'grep-compute-defaults "grep" nil nil nil) +(autoload 'help-C-file-name "help-fns" nil nil nil) +(autoload 'help-buffer "help-mode" nil nil nil) +(autoload 'help-insert-xref-button "help-mode" nil nil nil) +(autoload 'help-make-xrefs "help-mode" nil nil nil) +(autoload 'help-mode "help-mode" nil nil nil) +(autoload 'help-setup-xref "help-mode" nil nil nil) +(autoload 'help-with-tutorial "tutorial" nil nil nil) +(autoload 'help-xref-button "help-mode" nil nil nil) +(autoload 'hi-lock-face-buffer "hi-lock" nil nil nil) +(autoload 'html-mode "sgml-mode" nil nil t) +(autoload 'image-type-available-p "image" nil nil nil) +(autoload 'info "info" nil nil nil) +(autoload 'info-complete-symbol "info-look" nil nil nil) +(autoload 'info-emacs-manual "info" nil nil nil) +(autoload 'insert-image "image" nil nil nil) +(autoload 'insert-rectangle "rect" nil nil nil) +(autoload 'isearch-process-search-multibyte-characters "isearch-x" nil nil nil) +(autoload 'jka-compr-uninstall "jka-compr" nil nil nil) +(autoload 'log-edit "log-edit" nil nil nil) +(autoload 'log-view-mode "log-view" nil nil nil) +(autoload 'lookup-nested-alist "mule-util" nil nil nil) +(autoload 'make-display-table "disp-table" nil nil nil) +(autoload 'make-glyph-code "disp-table" nil nil nil) +(autoload 'multi-isearch-buffers "misearch" nil nil nil) +(autoload 'multi-isearch-buffers-regexp "misearch" nil nil nil) +(autoload 'multi-isearch-files "misearch" nil nil nil) +(autoload 'multi-isearch-files-regexp "misearch" nil nil nil) +(autoload 'nxml-mode "nxml-mode" nil nil nil) +(autoload 'open-network-stream "network-stream" nil nil nil) +(autoload 'package-initialize "package" nil nil nil) +(autoload 'parse-time-string "parse-time" nil nil nil) +(autoload 'pp "pp" nil nil nil) +(autoload 'pp-buffer "pp" nil nil nil) +(autoload 'print-buffer "lpr" nil nil nil) +(autoload 'quail-defrule-internal "quail" nil nil nil) +(autoload 'read-kbd-macro "edmacro" nil nil t) +(autoload 'regexp-opt "regexp-opt" nil nil nil) +(autoload 'regexp-opt "regexp-opt" nil nil t) +(autoload 'rx "rx" nil nil nil) +(autoload 'seconds-to-string "time-date" nil nil nil) +(autoload 'seconds-to-time "time-date" nil nil nil) +(autoload 'seconds-to-time "time-date" nil nil t) +(autoload 'server-save-buffers-kill-terminal "server" nil nil nil) +(autoload 'server-start "server" nil nil nil) +(autoload 'set-nested-alist "mule-util" nil nil nil) +(autoload 'skeleton-insert "skeleton" nil nil nil) +(autoload 'smerge-mode "smerge-mode" nil nil nil) +(autoload 'smerge-start-session "smerge-mode" nil nil nil) +(autoload 'standard-display-8bit "disp-table" nil nil nil) +(autoload 'standard-display-default "disp-table" nil nil nil) +(autoload 'tags-query-replace "etags" nil nil nil) +(autoload 'tags-search "etags" nil nil nil) +(autoload 'text-scale-increase "face-remap" nil nil nil) +(autoload 'thing-at-point "thingatpt" nil nil nil) +(autoload 'time-to-days "time-date" nil nil nil) +(autoload 'timezone-make-date-arpa-standard "timezone" nil nil nil) +(autoload 'tmm-menubar "tmm" nil nil nil) +(autoload 'truncate-string-to-width "mule-util" nil nil nil) +(autoload 'ucs-normalize-HFS-NFC-region "ucs-normalize" nil nil nil) +(autoload 'ucs-normalize-HFS-NFD-region "ucs-normalize" nil nil nil) +(autoload 'ucs-normalize-NFC-region "ucs-normalize" nil nil nil) +(autoload 'ucs-normalize-NFD-region "ucs-normalize" nil nil nil) +(autoload 'ucs-normalize-NFKC-region "ucs-normalize" nil nil nil) +(autoload 'ucs-normalize-NFKD-region "ucs-normalize" nil nil nil) +(autoload 'url-handler-mode "url-handlers" nil nil nil) +(autoload 'variable-at-point "help-fns" nil nil nil) +(autoload 'vc-register "vc" nil nil nil) +(autoload 'vc-responsible-backend "vc" nil nil nil) +(autoload 'vc-transfer-file "vc" nil nil nil) +(autoload 'view-buffer "view" nil nil nil) +(autoload 'view-buffer-other-window "view" nil nil nil) +(autoload 'view-file "view" nil nil nil) +(autoload 'view-mode "view" nil nil nil) +(autoload 'view-mode-enter "view" nil nil nil) +(autoload 'visit-tags-table "etags" nil nil nil) +(autoload 'warn "warnings" nil nil nil) +(autoload 'wdired-change-to-wdired-mode "wdired" nil nil nil) +(autoload 'widget-value "wid-edit" nil nil nil) +;; Local Variables: +;; no-byte-compile: t +;; no-update-autoloads: t +;; End: diff --git a/lisp/ldefs-boot-manual.el b/lisp/ldefs-boot-manual.el new file mode 100644 index 00000000000..183703d25e8 --- /dev/null +++ b/lisp/ldefs-boot-manual.el @@ -0,0 +1,19 @@ +;; These appear to be necessary as they are used elsewhere in macro definitions. +(load "emacs-lisp/gv.el") +(load "emacs-lisp/nadvice.el") +(load "emacs-lisp/inline.el") + +;; This variable is used by bytecomp.el +(defvar warning-series nil) + +;; This variable is used by emacs-lisp-mode which is used heavily +;; during the byte-compile phase +(defvar electric-pair-text-pairs '((34 . 34))) + + +(load "ldefs-boot-auto.el") + +;; Local Variables: +;; no-byte-compile: t +;; no-update-autoloads: t +;; End: diff --git a/lisp/loadup.el b/lisp/loadup.el index 5c16464282b..b2192e9f6b3 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el @@ -155,7 +155,7 @@ ;; autogen/update_autogen can be used to periodically update ldefs-boot. (condition-case nil (load "loaddefs.el") ;; In case loaddefs hasn't been generated yet. - (file-error (load "ldefs-boot.el"))) + (file-error (load "ldefs-boot-manual.el"))) (let ((new (make-hash-table :test 'equal))) ;; Now that loaddefs has populated definition-prefixes, purify its contents. diff --git a/src/Makefile.in b/src/Makefile.in index dc0bfff9b33..48898c208fc 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -763,6 +763,10 @@ endif @: Compile some files earlier to speed up further compilation. $(MAKE) -C ../lisp compile-first EMACS="$(bootstrap_exe)" + +generate-ldefs-boot: bootstrap-emacs$(EXEEXT) + $(RUN_TEMACS) --batch $(BUILD_DETAILS) --load loadup bootstrap + ifeq ($(AUTO_DEPEND),yes) -include $(ALLOBJS:%.o=${DEPDIR}/%.d) else diff --git a/src/emacs.c b/src/emacs.c index efd4fa329df..cbe4c97a174 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -130,6 +130,8 @@ Lisp_Object Vlibrary_cache; on subsequent starts. */ bool initialized; +bool generating_ldefs_boot; + /* Set to true if this instance of Emacs might dump. */ #ifndef DOUG_LEA_MALLOC static @@ -687,7 +689,10 @@ main (int argc, char **argv) stack_base = &dummy; dumping = !initialized && (strcmp (argv[argc - 1], "dump") == 0 - || strcmp (argv[argc - 1], "bootstrap") == 0); + || strcmp (argv[argc - 1], "bootstrap") == 0 ); + + generating_ldefs_boot = getenv ("GENERATE_LDEFS_BOOT"); + /* True if address randomization interferes with memory allocation. */ # ifdef __PPC64__ diff --git a/src/eval.c b/src/eval.c index 884e1ebfb89..3aeca2bc979 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1945,6 +1945,27 @@ it defines a macro. */) if (!CONSP (fundef) || !EQ (Qautoload, XCAR (fundef))) return fundef; + /* In the special case that we are generating ldefs-boot-auto.el, + then be noisy about the autoload. */ + if( generating_ldefs_boot ) + { + fprintf(stderr, "(autoload '"); + Fprin1(funname,Qexternal_debugging_output); + fprintf(stderr, " "); + Fprin1(Fcar (Fcdr (fundef)),Qexternal_debugging_output); + fprintf(stderr, " nil nil "); + + if(! NILP(macro_only)) + { + fprintf(stderr, "nil"); + } + else + { + fprintf(stderr, "t"); + } + fprintf(stderr, ")\n"); + } + if (EQ (macro_only, Qmacro)) { Lisp_Object kind = Fnth (make_number (4), fundef); diff --git a/src/lisp.h b/src/lisp.h index e087828d94f..c08330fede2 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -611,6 +611,8 @@ extern bool might_dump; Used during startup to detect startup of dumped Emacs. */ extern bool initialized; +extern bool generating_ldefs_boot; + /* Defined in floatfns.c. */ extern double extract_float (Lisp_Object); |