comparison lisp/update-elc.el @ 412:697ef44129c6 r21-2-14

Import from CVS: tag r21-2-14
author cvs
date Mon, 13 Aug 2007 11:20:41 +0200
parents 501cfd01ee6d
children da8ed4261e83
comparison
equal deleted inserted replaced
411:12e008d41344 412:697ef44129c6
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 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
42 ;;; Code: 45 ;;; Code:
43 46
44 (defvar processed nil) 47 (defvar processed nil)
45 (defvar update-elc-files-to-compile nil) 48 (defvar update-elc-files-to-compile nil)
46 49
57 ; (set-file-modes x (logior (file-modes x) 128))) 60 ; (set-file-modes x (logior (file-modes x) 128)))
58 ; src)))))) 61 ; src))))))
59 ; ;; -batch gets filtered out. 62 ; ;; -batch gets filtered out.
60 ; (nthcdr 3 command-line-args)))) 63 ; (nthcdr 3 command-line-args))))
61 64
62 (let ((build-root (expand-file-name ".." invocation-directory))) 65 (setq load-path (split-path (getenv "EMACSBOOTSTRAPLOADPATH")))
63 (setq load-path (list (expand-file-name "lisp" build-root))))
64 66
65 (load "very-early-lisp" nil t) 67 (load "very-early-lisp" nil t)
66 68
67 (load "find-paths.el") 69 (load "find-paths.el")
68 (load "packages.el") 70 (load "packages.el")
79 (cons src update-elc-files-to-compile)))) 81 (cons src update-elc-files-to-compile))))
80 (setq autol (cdr autol)))) 82 (setq autol (cdr autol))))
81 83
82 ;; (print (prin1-to-string update-elc-files-to-compile)) 84 ;; (print (prin1-to-string update-elc-files-to-compile))
83 85
84 (let (preloaded-file-list site-load-packages need-to-dump dumped-exe) 86 (let (preloaded-file-list site-load-packages)
85 (load (expand-file-name "../lisp/dumped-lisp.el")) 87 (load (concat default-directory "../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)))
91 88
92 ;; Path setup 89 ;; Path setup
93 (let ((package-preloaded-file-list 90 (let ((package-preloaded-file-list
94 (packages-collect-package-dumped-lisps late-package-load-path))) 91 (packages-collect-package-dumped-lisps late-package-load-path)))
95 92
96 (setq preloaded-file-list 93 (setq preloaded-file-list
97 (append package-preloaded-file-list 94 (append package-preloaded-file-list
98 preloaded-file-list 95 preloaded-file-list
99 '("bytecomp")
100 packages-hardcoded-lisp))) 96 packages-hardcoded-lisp)))
101 97
102 (load (concat default-directory "../site-packages") t t) 98 (load (concat default-directory "../site-packages") t t)
103 (setq preloaded-file-list 99 (setq preloaded-file-list
104 (append packages-hardcoded-lisp 100 (append packages-hardcoded-lisp
106 packages-useful-lisp 102 packages-useful-lisp
107 site-load-packages)) 103 site-load-packages))
108 (while preloaded-file-list 104 (while preloaded-file-list
109 (let ((arg (car preloaded-file-list))) 105 (let ((arg (car preloaded-file-list)))
110 ;; (print (prin1-to-string arg)) 106 ;; (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 (when (and dumped-exe
119 (or (and (file-exists-p
120 (concat "../lisp/" frob ".el"))
121 (file-newer-than-file-p
122 (concat "../lisp/" frob ".el")
123 dumped-exe))
124 (and (file-exists-p
125 (concat "../lisp/" frob ".elc"))
126 (file-newer-than-file-p
127 (concat "../lisp/" frob ".elc")
128 dumped-exe))))
129 (setq need-to-dump t)))
130
131 (if (null (member (file-name-nondirectory arg) 107 (if (null (member (file-name-nondirectory arg)
132 packages-unbytecompiled-lisp)) 108 packages-unbytecompiled-lisp))
133 (progn 109 (progn
134 (setq arg (locate-library arg)) 110 (setq arg (locate-library arg))
135 (if (null arg) 111 (if (null arg)
145 (if (and (null (member arg processed)) 121 (if (and (null (member arg processed))
146 (file-exists-p (concat arg ".el")) 122 (file-exists-p (concat arg ".el"))
147 (file-newer-than-file-p (concat arg ".el") 123 (file-newer-than-file-p (concat arg ".el")
148 (concat arg ".elc"))) 124 (concat arg ".elc")))
149 (setq processed (cons (concat arg ".el") processed))))) 125 (setq processed (cons (concat arg ".el") processed)))))
150 (setq preloaded-file-list (cdr preloaded-file-list)))) 126 (setq preloaded-file-list (cdr preloaded-file-list)))))
151
152 (if need-to-dump
153 (condition-case nil
154 (write-region-internal "foo" nil "../src/NEEDTODUMP")
155 (file-error nil)))
156
157 )
158 127
159 (setq update-elc-files-to-compile (append update-elc-files-to-compile 128 (setq update-elc-files-to-compile (append update-elc-files-to-compile
160 processed)) 129 processed))
161 130
162 ;; (print (prin1-to-string update-elc-files-to-compile)) 131 ;; (print (prin1-to-string update-elc-files-to-compile))
168 "-batch" "-q" "-no-site-file" 137 "-batch" "-q" "-no-site-file"
169 "-l" "bytecomp" "-f" "batch-byte-compile") 138 "-l" "bytecomp" "-f" "batch-byte-compile")
170 update-elc-files-to-compile)) 139 update-elc-files-to-compile))
171 (load "loadup-el.el")) 140 (load "loadup-el.el"))
172 (condition-case nil 141 (condition-case nil
173 (delete-file "../src/NOBYTECOMPILE") 142 (delete-file "./NOBYTECOMPILE")
174 (file-error nil))) 143 (file-error nil)))
175 144
176 (kill-emacs) 145 (kill-emacs)
177 146
178 ;;; update-elc.el ends here 147 ;;; update-elc.el ends here