comparison lisp/update-elc.el @ 406:b8cc9ab3f761 r21-2-33

Import from CVS: tag r21-2-33
author cvs
date Mon, 13 Aug 2007 11:17:09 +0200
parents 5a2589c672dc
children 501cfd01ee6d
comparison
equal deleted inserted replaced
405:0e08f63c74d2 406:b8cc9ab3f761
36 ;; cause the corresponding .el file to be compiled. .el files listed in 36 ;; cause the corresponding .el file to be compiled. .el files listed in
37 ;; $lisp will be ignored. 37 ;; $lisp will be ignored.
38 38
39 ;; (the idea here is that you can bootstrap if your .ELC files 39 ;; (the idea here is that you can bootstrap if your .ELC files
40 ;; are missing or badly out-of-date) 40 ;; are missing or badly out-of-date)
41
42 ;; Currently this code gets the list of files to check passed to it from
43 ;; src/Makefile. This must be fixed. -slb
44 41
45 ;;; Code: 42 ;;; Code:
46 43
47 (defvar processed nil) 44 (defvar processed nil)
48 (defvar update-elc-files-to-compile nil) 45 (defvar update-elc-files-to-compile nil)
82 (cons src update-elc-files-to-compile)))) 79 (cons src update-elc-files-to-compile))))
83 (setq autol (cdr autol)))) 80 (setq autol (cdr autol))))
84 81
85 ;; (print (prin1-to-string update-elc-files-to-compile)) 82 ;; (print (prin1-to-string update-elc-files-to-compile))
86 83
87 (let (preloaded-file-list site-load-packages) 84 (let (preloaded-file-list site-load-packages need-to-dump dumped-exe)
88 (load (expand-file-name "../lisp/dumped-lisp.el")) 85 (load (expand-file-name "../lisp/dumped-lisp.el"))
86
87 (setq dumped-exe
88 (cond ((file-exists-p "../src/xemacs.exe") "../src/xemacs.exe")
89 ((file-exists-p "../src/xemacs") "../src/xemacs")
90 (t nil)))
89 91
90 ;; Path setup 92 ;; Path setup
91 (let ((package-preloaded-file-list 93 (let ((package-preloaded-file-list
92 (packages-collect-package-dumped-lisps late-package-load-path))) 94 (packages-collect-package-dumped-lisps late-package-load-path)))
93 95
94 (setq preloaded-file-list 96 (setq preloaded-file-list
95 (append package-preloaded-file-list 97 (append package-preloaded-file-list
96 preloaded-file-list 98 preloaded-file-list
99 '("bytecomp")
97 packages-hardcoded-lisp))) 100 packages-hardcoded-lisp)))
98 101
99 (load (concat default-directory "../site-packages") t t) 102 (load (concat default-directory "../site-packages") t t)
100 (setq preloaded-file-list 103 (setq preloaded-file-list
101 (append packages-hardcoded-lisp 104 (append packages-hardcoded-lisp
103 packages-useful-lisp 106 packages-useful-lisp
104 site-load-packages)) 107 site-load-packages))
105 (while preloaded-file-list 108 (while preloaded-file-list
106 (let ((arg (car preloaded-file-list))) 109 (let ((arg (car preloaded-file-list)))
107 ;; (print (prin1-to-string arg)) 110 ;; (print (prin1-to-string arg))
111
112 ;; now check if .el or .elc is newer than the dumped exe.
113 ;; if so, need to redump.
114 (let ((frob
115 (if (string-match "\\.elc?\\'" arg)
116 (substring arg 0 (match-beginning 0))
117 arg)))
118 (if (and dumped-exe
119 (or (and (file-exists-p (concat frob ".el"))
120 (file-newer-than-file-p (concat frob ".el")
121 dumped-exe))
122 (and (file-exists-p (concat frob ".elc"))
123 (file-newer-than-file-p (concat frob ".elc")
124 dumped-exe))))
125 (setq need-to-dump t)))
126
108 (if (null (member (file-name-nondirectory arg) 127 (if (null (member (file-name-nondirectory arg)
109 packages-unbytecompiled-lisp)) 128 packages-unbytecompiled-lisp))
110 (progn 129 (progn
111 (setq arg (locate-library arg)) 130 (setq arg (locate-library arg))
112 (if (null arg) 131 (if (null arg)
122 (if (and (null (member arg processed)) 141 (if (and (null (member arg processed))
123 (file-exists-p (concat arg ".el")) 142 (file-exists-p (concat arg ".el"))
124 (file-newer-than-file-p (concat arg ".el") 143 (file-newer-than-file-p (concat arg ".el")
125 (concat arg ".elc"))) 144 (concat arg ".elc")))
126 (setq processed (cons (concat arg ".el") processed))))) 145 (setq processed (cons (concat arg ".el") processed)))))
127 (setq preloaded-file-list (cdr preloaded-file-list))))) 146 (setq preloaded-file-list (cdr preloaded-file-list))))
147
148 (if need-to-dump
149 (condition-case nil
150 (write-region-internal "foo" nil "../src/NEEDTODUMP")
151 (file-error nil)))
152
153 )
128 154
129 (setq update-elc-files-to-compile (append update-elc-files-to-compile 155 (setq update-elc-files-to-compile (append update-elc-files-to-compile
130 processed)) 156 processed))
131 157
132 ;; (print (prin1-to-string update-elc-files-to-compile)) 158 ;; (print (prin1-to-string update-elc-files-to-compile))
138 "-batch" "-q" "-no-site-file" 164 "-batch" "-q" "-no-site-file"
139 "-l" "bytecomp" "-f" "batch-byte-compile") 165 "-l" "bytecomp" "-f" "batch-byte-compile")
140 update-elc-files-to-compile)) 166 update-elc-files-to-compile))
141 (load "loadup-el.el")) 167 (load "loadup-el.el"))
142 (condition-case nil 168 (condition-case nil
143 (delete-file "./NOBYTECOMPILE") 169 (delete-file "../src/NOBYTECOMPILE")
144 (file-error nil))) 170 (file-error nil)))
145 171
146 (kill-emacs) 172 (kill-emacs)
147 173
148 ;;; update-elc.el ends here 174 ;;; update-elc.el ends here