annotate lisp/prim/update-elc.el @ 189:489f57a838ef r20-3b21

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