annotate lisp/update-elc.el @ 269:b2472a1930f2 r20-5b33

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