Mercurial > hg > xemacs-beta
comparison lisp/update-elc.el @ 528:ef4d2466a29c
[xemacs-hg @ 2001-05-10 09:59:45 by ben]
implement user-name-all-completions under Windows.
xemacs.mak: need another lib (netapi32.lib) for user-name-all-completions.
emacs.c: create new function force-debugging-signal (only when DEBUG_XEMACS)
to breakpoint or abort to the debugger.
mule\mule-coding.el, file-coding.c, file-coding.h, lisp.h: move
coding-system-charset to lisp to avoid doc warning.
autoload.el, packages.el, startup.el, update-elc-2.el, update-elc.el:
Rewrite much of the bootstrapping process to be more robust,
and in particular to rebuild the auto-autoloads and
custom-loads files no matter what state (including missing)
they're currently in.
xemacs.mak: remove autoload-building target.
Makefile.in.in: remove autoload targets.
author | ben |
---|---|
date | Thu, 10 May 2001 09:59:57 +0000 |
parents | 5bdbc721d46a |
children | 11502791fc1c |
comparison
equal
deleted
inserted
replaced
527:7b35ad872326 | 528:ef4d2466a29c |
---|---|
1 ;;; update-elc.el --- Bytecompile out-of-date dumped files | 1 ;;; update-elc.el --- Bytecompile out-of-date dumped files |
2 | 2 |
3 ;; Copyright (C) 1997 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1997 Free Software Foundation, Inc. |
4 ;; Copyright (C) 1996 Sun Microsystems, Inc. | 4 ;; Copyright (C) 1996 Sun Microsystems, Inc. |
5 | 5 ;; Copyright (C) 2001 Ben Wing. |
6 ;; Author: Ben Wing <ben@xemacs.org>, Steven L Baur <steve@xemacs.org> | 6 |
7 ;; Author: Ben Wing <ben@xemacs.org> | |
8 ;; Based On: Original by Steven L Baur <steve@xemacs.org> | |
7 ;; Maintainer: XEmacs Development Team | 9 ;; Maintainer: XEmacs Development Team |
8 ;; Keywords: internal | 10 ;; Keywords: internal |
9 | 11 |
10 ;; This file is part of XEmacs. | 12 ;; This file is part of XEmacs. |
11 | 13 |
44 | 46 |
45 ;;; Code: | 47 ;;; Code: |
46 | 48 |
47 (defvar processed nil) | 49 (defvar processed nil) |
48 (defvar update-elc-files-to-compile nil) | 50 (defvar update-elc-files-to-compile nil) |
51 (defvar need-to-rebuild-autoloads nil) | |
52 (defvar need-to-rebuild-mule-autoloads nil) | |
53 (defvar need-to-recompile-autoloads nil) | |
54 (defvar need-to-recompile-mule-autoloads nil) | |
49 | 55 |
50 ;(setq update-elc-files-to-compile | 56 ;(setq update-elc-files-to-compile |
51 ; (delq nil | 57 ; (delq nil |
52 ; (mapcar (function | 58 ; (mapcar (function |
53 ; (lambda (x) | 59 ; (lambda (x) |
70 (load "find-paths.el") | 76 (load "find-paths.el") |
71 (load "packages.el") | 77 (load "packages.el") |
72 (load "setup-paths.el") | 78 (load "setup-paths.el") |
73 (load "dump-paths.el") | 79 (load "dump-paths.el") |
74 | 80 |
75 (let ((autol (packages-list-autoloads (concat default-directory "../lisp")))) | 81 (defun update-elc-chop-extension (file) |
76 ;; (print (prin1-to-string autol)) | 82 (if (string-match "\\.elc?$" file) |
77 (while autol | 83 (substring file 0 (match-beginning 0)) |
78 (let ((src (car autol))) | 84 file)) |
79 (if (and (file-exists-p src) | 85 |
80 (file-newer-than-file-p src (concat src "c"))) | 86 ;; we used to call packages-list-autoloads here, but it's false generality. |
81 (setq update-elc-files-to-compile | 87 ;; we need to handle each autoload file differently and there are only |
82 (cons src update-elc-files-to-compile)))) | 88 ;; two of them. |
83 (setq autol (cdr autol)))) | 89 |
84 | 90 (let (preloaded-file-list site-load-packages need-to-dump dumped-exe |
85 ;; (print (prin1-to-string update-elc-files-to-compile)) | 91 files-to-process) |
86 | 92 |
87 (let (preloaded-file-list site-load-packages need-to-dump dumped-exe) | |
88 (load (expand-file-name "../lisp/dumped-lisp.el")) | 93 (load (expand-file-name "../lisp/dumped-lisp.el")) |
89 | 94 |
90 (setq dumped-exe | 95 (setq dumped-exe |
91 (cond ((file-exists-p "../src/xemacs.exe") "../src/xemacs.exe") | 96 (cond ((file-exists-p "../src/xemacs.exe") "../src/xemacs.exe") |
92 ((file-exists-p "../src/xemacs") "../src/xemacs") | 97 ((file-exists-p "../src/xemacs") "../src/xemacs") |
97 (packages-collect-package-dumped-lisps late-package-load-path))) | 102 (packages-collect-package-dumped-lisps late-package-load-path))) |
98 | 103 |
99 (setq preloaded-file-list | 104 (setq preloaded-file-list |
100 (append package-preloaded-file-list | 105 (append package-preloaded-file-list |
101 preloaded-file-list | 106 preloaded-file-list |
102 '("bytecomp" "byte-optimize") | |
103 packages-hardcoded-lisp))) | 107 packages-hardcoded-lisp))) |
104 | 108 |
105 (load (concat default-directory "../site-packages") t t) | 109 (load (concat default-directory "../site-packages") t t) |
106 (setq preloaded-file-list | 110 (setq preloaded-file-list |
107 (append packages-hardcoded-lisp | 111 (append packages-hardcoded-lisp |
108 preloaded-file-list | 112 preloaded-file-list |
109 packages-useful-lisp | |
110 site-load-packages)) | 113 site-load-packages)) |
111 (while preloaded-file-list | 114 ;; bytecomp, byte-optimize, and autoload are mentioned in |
112 (let ((arg (car preloaded-file-list))) | 115 ;; packages-useful-lisp. |
113 ;; (print (prin1-to-string arg)) | 116 (setq files-to-process (append packages-useful-lisp preloaded-file-list)) |
117 (while files-to-process | |
118 (let* ((arg (car files-to-process)) | |
119 (arg-is-preloaded (member arg preloaded-file-list)) | |
120 (arg-sans-extension (update-elc-chop-extension arg)) | |
121 (full-arg (locate-library arg-sans-extension)) | |
122 (full-arg-sans-extension | |
123 (if (null full-arg) | |
124 (progn | |
125 (print (format "Error: Library file %s not found" arg)) | |
126 ;; Uncomment in case of trouble | |
127 ;;(print (format "late-packages: %S" late-packages)) | |
128 ;;(print (format "guessed-roots: %S" | |
129 ;; (paths-find-emacs-roots | |
130 ;; invocation-directory invocation-name))) | |
131 (kill-emacs)) | |
132 (update-elc-chop-extension full-arg))) | |
133 (full-arg-el (concat full-arg-sans-extension ".el")) | |
134 (full-arg-elc (concat full-arg-sans-extension ".elc")) | |
135 (full-arg-dir (file-name-directory full-arg-el)) | |
136 (autoload-file (expand-file-name "auto-autoloads.el" full-arg-dir)) | |
137 (autoload-is-mule (string-match "[/\\]mule[/\\]$" full-arg-dir))) | |
138 | |
139 ;; (print full-arg-el) | |
114 | 140 |
115 ;; now check if .el or .elc is newer than the dumped exe. | 141 ;; now check if .el or .elc is newer than the dumped exe. |
116 ;; if so, need to redump. | 142 ;; if so, need to redump. |
117 (let ((frob | 143 (when (and dumped-exe arg-is-preloaded |
118 (if (string-match "\\.elc?\\'" arg) | 144 (or (and (file-exists-p full-arg-el) |
119 (substring arg 0 (match-beginning 0)) | 145 (file-newer-than-file-p full-arg-el dumped-exe)) |
120 arg))) | 146 (and (file-exists-p full-arg-elc) |
121 (when (and dumped-exe | 147 (file-newer-than-file-p full-arg-elc dumped-exe)))) |
122 (or (and (file-exists-p | 148 (setq need-to-dump t)) |
123 (concat "../lisp/" frob ".el")) | 149 |
124 (file-newer-than-file-p | 150 (when (or (not (file-exists-p autoload-file)) |
125 (concat "../lisp/" frob ".el") | 151 (and (file-exists-p full-arg-el) |
126 dumped-exe)) | 152 (file-newer-than-file-p full-arg-el autoload-file))) |
127 (and (file-exists-p | 153 (if autoload-is-mule |
128 (concat "../lisp/" frob ".elc")) | 154 (setq need-to-rebuild-mule-autoloads t) |
129 (file-newer-than-file-p | 155 (setq need-to-rebuild-autoloads t))) |
130 (concat "../lisp/" frob ".elc") | 156 |
131 dumped-exe)))) | 157 (if (and (not (member (file-name-nondirectory arg) |
132 (setq need-to-dump t))) | 158 packages-unbytecompiled-lisp)) |
133 | 159 (not (member full-arg-el processed)) |
134 (if (null (member (file-name-nondirectory arg) | 160 (file-exists-p full-arg-el) |
135 packages-unbytecompiled-lisp)) | 161 (or (not (file-exists-p full-arg-elc)) |
136 (progn | 162 (file-newer-than-file-p full-arg-el full-arg-elc))) |
137 (setq arg (locate-library arg)) | 163 (setq processed (cons full-arg-el processed))) |
138 (if (null arg) | 164 |
139 (progn | 165 (setq files-to-process (cdr files-to-process)))) |
140 (print (format "Error: Library file %s not found" | |
141 (car preloaded-file-list))) | |
142 ;; Uncomment in case of trouble | |
143 ;;(print (format "late-packages: %S" late-packages)) | |
144 ;;(print (format "guessed-roots: %S" (paths-find-emacs-roots invocation-directory invocation-name))) | |
145 (kill-emacs))) | |
146 (if (string-match "\\.elc?\\'" arg) | |
147 (setq arg (substring arg 0 (match-beginning 0)))) | |
148 (if (and (null (member arg processed)) | |
149 (file-exists-p (concat arg ".el")) | |
150 (file-newer-than-file-p (concat arg ".el") | |
151 (concat arg ".elc"))) | |
152 (setq processed (cons (concat arg ".el") processed))))) | |
153 (setq preloaded-file-list (cdr preloaded-file-list)))) | |
154 | 166 |
155 (if need-to-dump | 167 (if need-to-dump |
156 (condition-case nil | 168 (condition-case nil |
157 (write-region-internal "foo" nil "../src/NEEDTODUMP") | 169 (write-region-internal "foo" nil "../src/NEEDTODUMP") |
158 (file-error nil))) | 170 (file-error nil))) |
159 | 171 |
160 ) | 172 ) |
161 | 173 |
174 (when (or need-to-rebuild-autoloads | |
175 (not (file-exists-p "../lisp/auto-autoloads.el")) | |
176 (not (file-exists-p "../lisp/auto-autoloads.elc")) | |
177 (file-newer-than-file-p "../lisp/auto-autoloads.el" | |
178 "../lisp/auto-autoloads.elc")) | |
179 (setq need-to-recompile-autoloads t)) | |
180 | |
181 (when (or need-to-rebuild-mule-autoloads | |
182 (not (file-exists-p "../lisp/mule/auto-autoloads.el")) | |
183 (not (file-exists-p "../lisp/mule/auto-autoloads.elc")) | |
184 (file-newer-than-file-p "../lisp/mule/auto-autoloads.el" | |
185 "../lisp/mule/auto-autoloads.elc")) | |
186 (setq need-to-recompile-mule-autoloads t)) | |
187 | |
188 (when (not (featurep 'mule)) | |
189 ;; sorry charlie. | |
190 (setq need-to-rebuild-mule-autoloads nil | |
191 need-to-recompile-mule-autoloads nil)) | |
192 | |
162 (setq update-elc-files-to-compile (append update-elc-files-to-compile | 193 (setq update-elc-files-to-compile (append update-elc-files-to-compile |
163 processed)) | 194 processed)) |
164 | 195 |
165 ;; (print (prin1-to-string update-elc-files-to-compile)) | 196 ;; (print update-elc-files-to-compile) |
166 | 197 |
167 (if update-elc-files-to-compile | 198 (if (and (not update-elc-files-to-compile) |
168 (progn | 199 (not need-to-rebuild-autoloads) |
169 (let ((bytecomp-arg (locate-library "bytecomp")) | 200 (not need-to-rebuild-mule-autoloads) |
170 (byte-opt-arg (locate-library "byte-optimize"))) | 201 (not need-to-recompile-autoloads) |
171 (if (string-match "\\.elc?\\'" bytecomp-arg) | 202 (not need-to-recompile-mule-autoloads)) |
172 (setq bytecomp-arg (substring bytecomp-arg 0 | 203 (condition-case nil |
173 (match-beginning 0)))) | 204 (delete-file "../src/NOBYTECOMPILE") |
174 (setq bytecomp-arg (concat bytecomp-arg ".el")) | 205 (file-error nil)) |
175 (if (string-match "\\.elc?\\'" byte-opt-arg) | 206 (let* ( |
176 (setq byte-opt-arg (substring byte-opt-arg 0 | 207 (bytecomp-arg (concat (update-elc-chop-extension |
177 (match-beginning 0)))) | 208 (locate-library "bytecomp")) ".el")) |
178 (setq byte-opt-arg (concat byte-opt-arg ".el")) | 209 (byte-opt-arg (concat (update-elc-chop-extension |
179 ;; if bytecomp or byte-optimize need recompiling, then load | 210 (locate-library "byte-optimize")) ".el")) |
180 ;; the .el version of them first, recompile them, and reload | 211 (autoload-arg (concat (update-elc-chop-extension |
181 ;; the .elc versions to recompile everything else (so we won't | 212 (locate-library "autoload")) ".el")) |
182 ;; be waiting until the cows come home). | 213 ) |
183 (setq command-line-args | 214 (setq inhibit-autoloads t) |
184 (append '("-l" "loadup-el.el" "run-temacs" | 215 (setq command-line-args |
185 "-batch" "-q" "-no-site-file") | 216 (append |
186 (if (or | 217 '("-l" "loadup-el.el" "run-temacs" "-batch" "-q" "-no-site-file") |
187 (member bytecomp-arg update-elc-files-to-compile) | 218 ;; if bytecomp or byte-optimize need recompiling, then load |
188 (member byte-opt-arg update-elc-files-to-compile)) | 219 ;; the .el version of them first, recompile them, and reload |
189 (append | 220 ;; the .elc versions to recompile everything else (so we won't |
190 '("-eval" "(setq load-ignore-elc-files t)" | 221 ;; be waiting until the cows come home). we need to set |
191 "-l" "bytecomp") | 222 ;; load-ignore-elc-files because byte-optimize gets autoloaded |
192 (if (member bytecomp-arg | 223 ;; from bytecomp. |
193 update-elc-files-to-compile) | 224 (if (or (member bytecomp-arg update-elc-files-to-compile) |
194 (append '("-f" "batch-byte-compile-one-file") | 225 (member byte-opt-arg update-elc-files-to-compile)) |
195 (list bytecomp-arg))) | 226 (append |
196 (if (member byte-opt-arg | 227 '("-eval" "(setq load-ignore-elc-files t)" "-l" "bytecomp") |
197 update-elc-files-to-compile) | 228 (if (member bytecomp-arg update-elc-files-to-compile) |
198 (append '("-f" "batch-byte-compile-one-file") | 229 (append '("-f" "batch-byte-compile-one-file") |
199 (list byte-opt-arg))) | 230 (list bytecomp-arg))) |
200 '("-eval" "(setq load-ignore-elc-files nil)"))) | 231 (if (member byte-opt-arg update-elc-files-to-compile) |
201 '("-l" "bytecomp" "-f" "batch-byte-compile") | 232 (append '("-f" "batch-byte-compile-one-file") |
202 (delete byte-opt-arg | 233 (list byte-opt-arg))) |
203 (delete bytecomp-arg | 234 '("-eval" "(setq load-ignore-elc-files nil)"))) |
204 update-elc-files-to-compile))))) | 235 '("-l" "bytecomp") |
205 (load "loadup-el.el")) | 236 ;; likewise, recompile autoload.el if out-of-date. |
206 (condition-case nil | 237 (if (member autoload-arg update-elc-files-to-compile) |
207 (delete-file "../src/NOBYTECOMPILE") | 238 (append '("-f" "batch-byte-compile-one-file") |
208 (file-error nil))) | 239 (list autoload-arg))) |
240 ;; then generate autoloads for lisp and maybe lisp/mule. | |
241 (if (or need-to-rebuild-autoloads | |
242 need-to-rebuild-mule-autoloads) | |
243 '("-l" "autoload")) | |
244 (if need-to-rebuild-autoloads | |
245 '("-f" "batch-force-update-one-directory" "../lisp")) | |
246 (if need-to-rebuild-mule-autoloads | |
247 '("-f" "batch-force-update-one-directory" "../lisp/mule")) | |
248 (if need-to-recompile-autoloads | |
249 '("-f" "batch-byte-compile-one-file" | |
250 "../lisp/auto-autoloads.el")) | |
251 (if need-to-recompile-mule-autoloads | |
252 '("-f" "batch-byte-compile-one-file" | |
253 "../lisp/mule/auto-autoloads.el")) | |
254 ;; now load the autoloads and compile alles anderes. | |
255 '("-eval" "(setq inhibit-autoloads nil)" | |
256 "-f" "startup-load-autoloads" | |
257 "-f" "batch-byte-compile") | |
258 (delete autoload-arg | |
259 (delete byte-opt-arg | |
260 (delete bytecomp-arg | |
261 update-elc-files-to-compile)))))) | |
262 (load "loadup-el.el")) | |
209 | 263 |
210 (kill-emacs) | 264 (kill-emacs) |
211 | 265 |
212 ;;; update-elc.el ends here | 266 ;;; update-elc.el ends here |