155
|
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
|
0
|
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
|
16
|
22 ;; along with XEmacs; see the file COPYING. If not, write to the
|
70
|
23 ;; Free Software Foundation, 59 Temple Place - Suite 330,
|
16
|
24 ;; Boston, MA 02111-1307, USA.
|
0
|
25
|
|
26 ;;; Synched up with: Not in FSF.
|
|
27
|
155
|
28 ;;; Commentary:
|
|
29
|
0
|
30 ;; Byte compile the .EL files necessary to dump out xemacs.
|
|
31 ;; Use this file like this:
|
|
32 ;;
|
|
33 ;; temacs -batch -l ../lisp/prim/update-elc.el $lisp
|
|
34 ;;
|
|
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.
|
|
38 ;;
|
|
39 ;; (the idea here is that you can bootstrap if your .ELC files
|
|
40 ;; are missing or badly out-of-date)
|
|
41
|
155
|
42 ;; Currently this code gets the list of files to check passed to it from
|
|
43 ;; src/Makefile. This must be fixed. -slb
|
|
44
|
|
45 ;;; Code:
|
|
46
|
163
|
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
|
|
65 (define-function 'defalias 'define-function)
|
|
66 (require 'packages)
|
|
67
|
|
68 (let ((autol (list-autoloads)))
|
|
69 ;; (print (prin1-to-string autol))
|
|
70 (while autol
|
|
71 (let ((src (car autol)))
|
|
72 (if (and (file-exists-p src)
|
|
73 (file-newer-than-file-p src (concat src "c")))
|
|
74 (setq update-elc-files-to-compile
|
|
75 (cons src update-elc-files-to-compile))))
|
|
76 (setq autol (cdr autol))))
|
|
77
|
|
78 ;; We must have some lisp support at this point
|
|
79 (let ((temp-path (expand-file-name ".." (car load-path))))
|
|
80 (setq load-path (nconc (directory-files temp-path t "^[^-.]"
|
|
81 nil 'dirs-only)
|
|
82 (cons temp-path load-path))))
|
|
83
|
|
84 ;(load "backquote")
|
|
85 ;(load "bytecomp-runtime")
|
|
86 ;(load "subr")
|
|
87 ;(load "replace")
|
|
88 ;(load "version.el")
|
|
89 ;(load "cl")
|
|
90 ;(load "featurep")
|
|
91
|
|
92 ;; (print (prin1-to-string update-elc-files-to-compile))
|
|
93
|
189
|
94 (let (preloaded-file-list site-load-packages)
|
163
|
95 (load (concat default-directory "../lisp/prim/dumped-lisp.el"))
|
189
|
96 ;; (print (prin1-to-string preloaded-file-list))
|
163
|
97 (load (concat default-directory "../site-packages") t t)
|
189
|
98 (setq preloaded-file-list
|
163
|
99 (append packages-hardcoded-lisp
|
189
|
100 preloaded-file-list
|
163
|
101 packages-useful-lisp
|
|
102 site-load-packages))
|
189
|
103 (while preloaded-file-list
|
|
104 (let ((arg (car preloaded-file-list)))
|
163
|
105 ;; (print (prin1-to-string arg))
|
|
106 (if (null (member arg packages-unbytecompiled-lisp))
|
|
107 (progn
|
|
108 (setq arg (locate-library arg))
|
|
109 (if (null arg)
|
|
110 (progn
|
|
111 (print (format "Library file %s: not found"
|
189
|
112 (car preloaded-file-list)))
|
163
|
113 (kill-emacs)))
|
|
114 (if (string-match "\\.elc?\\'" arg)
|
|
115 (setq arg (substring arg 0 (match-beginning 0))))
|
|
116 (if (and (null (member arg processed))
|
|
117 (file-exists-p (concat arg ".el"))
|
|
118 (file-newer-than-file-p (concat arg ".el")
|
|
119 (concat arg ".elc")))
|
|
120 (setq processed (cons (concat arg ".el") processed)))))
|
189
|
121 (setq preloaded-file-list (cdr preloaded-file-list)))))
|
163
|
122
|
|
123 (setq update-elc-files-to-compile (append update-elc-files-to-compile
|
|
124 processed))
|
|
125
|
|
126 ;; (print (prin1-to-string update-elc-files-to-compile))
|
0
|
127
|
|
128 (if update-elc-files-to-compile
|
|
129 (progn
|
|
130 (setq command-line-args
|
173
|
131 (append '("-l" "loadup-el.el" "run-temacs"
|
|
132 "-batch" "-q" "-no-site-file"
|
|
133 "-l" "bytecomp" "-f" "batch-byte-compile")
|
|
134 update-elc-files-to-compile))
|
|
135 (load "loadup-el.el"))
|
|
136 (condition-case nil
|
|
137 (delete-file "./NOBYTECOMPILE")
|
185
|
138 (file-error nil)))
|
0
|
139
|
|
140 (kill-emacs)
|
155
|
141
|
|
142 ;;; update-elc.el ends here
|