209
|
1 ;;; update-elc.el --- Bytecompile out-of-date dumped files
|
|
2
|
|
3 ;; Copyright (C) 1997 Free Software Foundation, Inc.
|
|
4 ;; Copyright (C) 1996 Unknown
|
|
5
|
|
6 ;; Maintainer: XEmacs Development Team
|
|
7 ;; Keywords: internal
|
|
8
|
|
9 ;; This file is part of XEmacs.
|
|
10
|
|
11 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
12 ;; under the terms of the GNU General Public License as published by
|
|
13 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
14 ;; any later version.
|
|
15
|
|
16 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
19 ;; General Public License for more details.
|
|
20
|
|
21 ;; You should have received a copy of the GNU General Public License
|
|
22 ;; along with XEmacs; see the file COPYING. If not, write to the
|
|
23 ;; Free Software Foundation, 59 Temple Place - Suite 330,
|
|
24 ;; Boston, MA 02111-1307, USA.
|
|
25
|
|
26 ;;; Synched up with: Not in FSF.
|
|
27
|
|
28 ;;; Commentary:
|
|
29
|
|
30 ;; Byte compile the .EL files necessary to dump out xemacs.
|
|
31 ;; Use this file like this:
|
223
|
32
|
209
|
33 ;; temacs -batch -l ../lisp/update-elc.el $lisp
|
223
|
34
|
209
|
35 ;; where $lisp comes from the Makefile. .elc files listed in $lisp will
|
|
36 ;; cause the corresponding .el file to be compiled. .el files listed in
|
|
37 ;; $lisp will be ignored.
|
223
|
38
|
209
|
39 ;; (the idea here is that you can bootstrap if your .ELC files
|
|
40 ;; are missing or badly out-of-date)
|
|
41
|
412
|
42 ;; Currently this code gets the list of files to check passed to it from
|
|
43 ;; src/Makefile. This must be fixed. -slb
|
|
44
|
209
|
45 ;;; Code:
|
|
46
|
|
47 (defvar processed nil)
|
|
48 (defvar update-elc-files-to-compile nil)
|
|
49
|
|
50 ;(setq update-elc-files-to-compile
|
|
51 ; (delq nil
|
|
52 ; (mapcar (function
|
|
53 ; (lambda (x)
|
|
54 ; (if (string-match "\.elc$" x)
|
|
55 ; (let ((src (substring x 0 -1)))
|
|
56 ; (if (file-newer-than-file-p src x)
|
|
57 ; (progn
|
|
58 ; (and (file-exists-p x)
|
|
59 ; (null (file-writable-p x))
|
|
60 ; (set-file-modes x (logior (file-modes x) 128)))
|
|
61 ; src))))))
|
|
62 ; ;; -batch gets filtered out.
|
|
63 ; (nthcdr 3 command-line-args))))
|
|
64
|
412
|
65 (setq load-path (split-path (getenv "EMACSBOOTSTRAPLOADPATH")))
|
267
|
66
|
304
|
67 (load "very-early-lisp" nil t)
|
267
|
68
|
|
69 (load "find-paths.el")
|
237
|
70 (load "packages.el")
|
267
|
71 (load "setup-paths.el")
|
|
72 (load "dump-paths.el")
|
209
|
73
|
373
|
74 (let ((autol (packages-list-autoloads (concat default-directory "../lisp"))))
|
209
|
75 ;; (print (prin1-to-string autol))
|
|
76 (while autol
|
|
77 (let ((src (car autol)))
|
|
78 (if (and (file-exists-p src)
|
|
79 (file-newer-than-file-p src (concat src "c")))
|
|
80 (setq update-elc-files-to-compile
|
|
81 (cons src update-elc-files-to-compile))))
|
|
82 (setq autol (cdr autol))))
|
|
83
|
|
84 ;; (print (prin1-to-string update-elc-files-to-compile))
|
|
85
|
412
|
86 (let (preloaded-file-list site-load-packages)
|
414
|
87 (load (expand-file-name "../lisp/dumped-lisp.el"))
|
406
|
88
|
267
|
89 ;; Path setup
|
|
90 (let ((package-preloaded-file-list
|
|
91 (packages-collect-package-dumped-lisps late-package-load-path)))
|
276
|
92
|
267
|
93 (setq preloaded-file-list
|
276
|
94 (append package-preloaded-file-list
|
|
95 preloaded-file-list
|
|
96 packages-hardcoded-lisp)))
|
267
|
97
|
209
|
98 (load (concat default-directory "../site-packages") t t)
|
|
99 (setq preloaded-file-list
|
|
100 (append packages-hardcoded-lisp
|
|
101 preloaded-file-list
|
|
102 packages-useful-lisp
|
|
103 site-load-packages))
|
|
104 (while preloaded-file-list
|
|
105 (let ((arg (car preloaded-file-list)))
|
|
106 ;; (print (prin1-to-string arg))
|
263
|
107 (if (null (member (file-name-nondirectory arg)
|
|
108 packages-unbytecompiled-lisp))
|
209
|
109 (progn
|
|
110 (setq arg (locate-library arg))
|
|
111 (if (null arg)
|
|
112 (progn
|
219
|
113 (print (format "Error: Library file %s not found"
|
209
|
114 (car preloaded-file-list)))
|
272
|
115 ;; Uncomment in case of trouble
|
|
116 ;;(print (format "late-packages: %S" late-packages))
|
|
117 ;;(print (format "guessed-roots: %S" (paths-find-emacs-roots invocation-directory invocation-name)))
|
209
|
118 (kill-emacs)))
|
|
119 (if (string-match "\\.elc?\\'" arg)
|
|
120 (setq arg (substring arg 0 (match-beginning 0))))
|
|
121 (if (and (null (member arg processed))
|
|
122 (file-exists-p (concat arg ".el"))
|
|
123 (file-newer-than-file-p (concat arg ".el")
|
|
124 (concat arg ".elc")))
|
|
125 (setq processed (cons (concat arg ".el") processed)))))
|
412
|
126 (setq preloaded-file-list (cdr preloaded-file-list)))))
|
209
|
127
|
|
128 (setq update-elc-files-to-compile (append update-elc-files-to-compile
|
|
129 processed))
|
|
130
|
|
131 ;; (print (prin1-to-string update-elc-files-to-compile))
|
|
132
|
|
133 (if update-elc-files-to-compile
|
|
134 (progn
|
|
135 (setq command-line-args
|
|
136 (append '("-l" "loadup-el.el" "run-temacs"
|
|
137 "-batch" "-q" "-no-site-file"
|
|
138 "-l" "bytecomp" "-f" "batch-byte-compile")
|
|
139 update-elc-files-to-compile))
|
|
140 (load "loadup-el.el"))
|
|
141 (condition-case nil
|
412
|
142 (delete-file "./NOBYTECOMPILE")
|
209
|
143 (file-error nil)))
|
|
144
|
|
145 (kill-emacs)
|
|
146
|
|
147 ;;; update-elc.el ends here
|