annotate lisp/update-elc.el @ 1275:57b76886836d

[xemacs-hg @ 2003-02-08 02:29:52 by ben] fixes to hyper-apropos, menubar-items, text-props, update-elc, lread.c; see log msg in lisp/ChangeLog
author ben
date Sat, 08 Feb 2003 02:29:55 +0000
parents bada4b0bce3a
children 1b4bc72f433e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 ;;; update-elc.el --- Bytecompile out-of-date dumped files
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 ;; Copyright (C) 1997 Free Software Foundation, Inc.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
4 ;; Copyright (C) 1996 Sun Microsystems, Inc.
1261
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
5 ;; Copyright (C) 2001, 2003 Ben Wing.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
528
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
7 ;; Author: Ben Wing <ben@xemacs.org>
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
8 ;; Based On: Original by Steven L Baur <steve@xemacs.org>
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 ;; Maintainer: XEmacs Development Team
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 ;; Keywords: internal
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 ;; This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 ;; XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 ;; under the terms of the GNU General Public License as published by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 ;; the Free Software Foundation; either version 2, or (at your option)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 ;; any later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 ;; XEmacs is distributed in the hope that it will be useful, but
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 ;; General Public License for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 ;; You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 ;; along with XEmacs; see the file COPYING. If not, write to the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 ;; Free Software Foundation, 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 ;; Boston, MA 02111-1307, USA.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 ;;; Synched up with: Not in FSF.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 ;;; Commentary:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 ;; Byte compile the .EL files necessary to dump out xemacs.
1261
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
34 ;; Also update the auto-autoloads.el files.
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
35
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 ;; Use this file like this:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 ;; temacs -batch -l ../lisp/update-elc.el $lisp
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 ;; where $lisp comes from the Makefile. .elc files listed in $lisp will
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 ;; cause the corresponding .el file to be compiled. .el files listed in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 ;; $lisp will be ignored.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 ;; (the idea here is that you can bootstrap if your .ELC files
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 ;; are missing or badly out-of-date)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
47 ;; See also update-elc-2.el
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 ;;; Code:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50
1261
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
51 ;; Help debug problems.
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
52 (setq stack-trace-on-error t
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
53 load-always-display-messages t)
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
54
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 (defvar processed nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 (defvar update-elc-files-to-compile nil)
528
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
57 (defvar need-to-rebuild-autoloads nil)
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
58 (defvar need-to-rebuild-mule-autoloads nil)
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
59 (defvar need-to-recompile-autoloads nil)
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
60 (defvar need-to-recompile-mule-autoloads nil)
1261
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
61 (defvar undumped-exe nil)
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
62 (defvar dumped-exe nil)
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
63 (defvar dumped-exe-out-of-date-wrt-dump-files nil)
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
64 (defvar dumped-exe-out-of-date-wrt-undumped-exe nil)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 ;(setq update-elc-files-to-compile
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 ; (delq nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 ; (mapcar (function
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 ; (lambda (x)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 ; (if (string-match "\.elc$" x)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 ; (let ((src (substring x 0 -1)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 ; (if (file-newer-than-file-p src x)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 ; (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 ; (and (file-exists-p x)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 ; (null (file-writable-p x))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 ; (set-file-modes x (logior (file-modes x) 128)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 ; src))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 ; ;; -batch gets filtered out.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 ; (nthcdr 3 command-line-args))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
81 (let ((build-root (expand-file-name ".." invocation-directory)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
82 (setq load-path (list (expand-file-name "lisp" build-root))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83
1261
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
84 (load "very-early-lisp.el")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 (load "find-paths.el")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 (load "packages.el")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 (load "setup-paths.el")
1261
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
88 (load "dump-paths.el") ;; #### take out in my fixup ws
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
89
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
90 ;; Lisp files loaded in order to byte compile anything. If any are out of
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
91 ;; date, we need to load them as .el's, byte compile them, and reload as
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
92 ;; .elc's.
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
93 (defvar lisp-files-needed-for-byte-compilation
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
94 '("bytecomp"
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
95 "byte-optimize"))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
96
1263
bada4b0bce3a [xemacs-hg @ 2003-02-06 14:37:51 by stephent]
stephent
parents: 1261
diff changeset
97 ;; Lisp files not in `lisp-files-needed-for-byte-compilation' that need
bada4b0bce3a [xemacs-hg @ 2003-02-06 14:37:51 by stephent]
stephent
parents: 1261
diff changeset
98 ;; early byte compilation. These are files loaded by update-elc.el in
bada4b0bce3a [xemacs-hg @ 2003-02-06 14:37:51 by stephent]
stephent
parents: 1261
diff changeset
99 ;; order to do the compilation of all the rest of the files.
1261
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
100 (defvar lisp-files-needing-early-byte-compilation
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
101 '(;"easy-mmode"
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
102 "autoload"
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
103 "shadow"
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
104 "cl-macs"))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
105
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
106 (defvar unbytecompiled-lisp-files
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
107 '("paths.el"
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
108 "dumped-lisp.el"
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
109 "dumped-pkg-lisp.el"
1275
57b76886836d [xemacs-hg @ 2003-02-08 02:29:52 by ben]
ben
parents: 1263
diff changeset
110 "raw-process.el"
1261
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
111 "version.el"
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
112 "very-early-lisp.el")
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
113 "Lisp files that should not be byte compiled.")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114
528
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
115 (defun update-elc-chop-extension (file)
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
116 (if (string-match "\\.elc?$" file)
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
117 (substring file 0 (match-beginning 0))
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
118 file))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119
528
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
120 ;; we used to call packages-list-autoloads here, but it's false generality.
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
121 ;; we need to handle each autoload file differently and there are only
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
122 ;; two of them.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123
1261
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
124 (let (preloaded-file-list site-load-packages files-to-process)
528
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
125
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 (load (expand-file-name "../lisp/dumped-lisp.el"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
128 (setq dumped-exe
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
129 (cond ((file-exists-p "../src/xemacs.exe") "../src/xemacs.exe")
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
130 ((file-exists-p "../src/xemacs") "../src/xemacs")
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
131 (t nil)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
132
1261
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
133 (let ((temacs-exe
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
134 (cond ((file-exists-p "../src/temacs.exe") "../src/temacs.exe")
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
135 ((file-exists-p "../src/temacs") "../src/temacs")
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
136 (t nil)))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
137 (data-file
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
138 (cond ((file-exists-p "../src/xemacs.dmp") "../src/xemacs.dmp")
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
139 (t nil))))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
140
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
141 ;; two setups here:
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
142 ;; (1) temacs.exe is undumped, dumped into xemacs.exe. Happens with
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
143 ;; unexec, but also with pdump under MS Windows native, since
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
144 ;; the dumped data is stored as a resource in the xemacs.exe
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
145 ;; executable.
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
146 ;; (2) xemacs.exe is dumped or undumped. Running `xemacs -nd' gets
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
147 ;; you the equivalent of `temacs'. Dumping creates a file
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
148 ;; `xemacs.dmp'.
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
149
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
150 (setq dumped-exe-out-of-date-wrt-undumped-exe
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
151 (cond ((not dumped-exe) t)
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
152 (temacs-exe (file-newer-than-file-p temacs-exe dumped-exe))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
153 ((not data-file) t)
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
154 (t (file-newer-than-file-p dumped-exe data-file))))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
155 )
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
156
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
157
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 ;; Path setup
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 (let ((package-preloaded-file-list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 (packages-collect-package-dumped-lisps late-package-load-path)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 (setq preloaded-file-list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 (append package-preloaded-file-list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 preloaded-file-list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 packages-hardcoded-lisp)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 (load (concat default-directory "../site-packages") t t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 (setq preloaded-file-list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 (append packages-hardcoded-lisp
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 preloaded-file-list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 site-load-packages))
1261
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
172 ;; bytecomp, byte-optimize, autoload, etc. are mentioned specially
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
173 ;; in the lisp-files-need* variables.
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
174 (setq files-to-process (append lisp-files-needed-for-byte-compilation
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
175 lisp-files-needing-early-byte-compilation
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
176 preloaded-file-list))
528
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
177 (while files-to-process
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
178 (let* ((arg (car files-to-process))
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
179 (arg-is-preloaded (member arg preloaded-file-list))
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
180 (arg-sans-extension (update-elc-chop-extension arg))
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
181 (full-arg (locate-library arg-sans-extension))
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
182 (full-arg-sans-extension
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
183 (if (null full-arg)
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
184 (progn
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
185 (print (format "Error: Library file %s not found" arg))
1261
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
186 (backtrace)
528
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
187 ;; Uncomment in case of trouble
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
188 ;;(print (format "late-packages: %S" late-packages))
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
189 ;;(print (format "guessed-roots: %S"
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
190 ;; (paths-find-emacs-roots
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
191 ;; invocation-directory invocation-name)))
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
192 (kill-emacs))
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
193 (update-elc-chop-extension full-arg)))
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
194 (full-arg-el (concat full-arg-sans-extension ".el"))
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
195 (full-arg-elc (concat full-arg-sans-extension ".elc"))
1261
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
196 (full-arg-dir (file-name-directory full-arg-el)))
528
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
197
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
198 ;; (print full-arg-el)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
199
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
200 ;; now check if .el or .elc is newer than the dumped exe.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
201 ;; if so, need to redump.
528
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
202 (when (and dumped-exe arg-is-preloaded
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
203 (or (and (file-exists-p full-arg-el)
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
204 (file-newer-than-file-p full-arg-el dumped-exe))
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
205 (and (file-exists-p full-arg-elc)
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
206 (file-newer-than-file-p full-arg-elc dumped-exe))))
1261
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
207 (setq dumped-exe-out-of-date-wrt-dump-files t))
528
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
208
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
209 (if (and (not (member (file-name-nondirectory arg)
1261
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
210 unbytecompiled-lisp-files))
528
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
211 (not (member full-arg-el processed))
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
212 (file-exists-p full-arg-el)
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
213 (or (not (file-exists-p full-arg-elc))
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
214 (file-newer-than-file-p full-arg-el full-arg-elc)))
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
215 (setq processed (cons full-arg-el processed)))
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
216
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
217 (setq files-to-process (cdr files-to-process))))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
218
1261
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
219 ;; Check if we need to rebuild the auto-autoloads.el files -- that is,
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
220 ;; if ANY .el files have changed.
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
221 (let ((dirs-to-check '("../lisp" "../lisp/mule")))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
222 (while dirs-to-check
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
223 (let* ((dir (car dirs-to-check))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
224 (full-dir (expand-file-name dir))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
225 (all-files-in-dir (directory-files full-dir t "\\.el$" nil t))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
226 (autoload-file
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
227 (expand-file-name "auto-autoloads.el" full-dir))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
228 (autoload-is-mule (equal dir "../lisp/mule")))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
229 (while all-files-in-dir
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
230 (let* ((full-arg (car all-files-in-dir)))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
231 (when (or (not (file-exists-p autoload-file))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
232 (and (file-exists-p full-arg)
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
233 (file-newer-than-file-p full-arg autoload-file)))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
234 (if autoload-is-mule
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
235 (setq need-to-rebuild-mule-autoloads t)
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
236 (setq need-to-rebuild-autoloads t))))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
237 (setq all-files-in-dir (cdr all-files-in-dir))))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
238 (setq dirs-to-check (cdr dirs-to-check))))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
239
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
240 (if dumped-exe-out-of-date-wrt-dump-files
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
241 (condition-case nil
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
242 (write-region-internal "foo" nil "../src/NEEDTODUMP")
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
243 (file-error nil)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
244
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
245 )
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246
528
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
247 (when (or need-to-rebuild-autoloads
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
248 (not (file-exists-p "../lisp/auto-autoloads.el"))
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
249 (not (file-exists-p "../lisp/auto-autoloads.elc"))
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
250 (file-newer-than-file-p "../lisp/auto-autoloads.el"
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
251 "../lisp/auto-autoloads.elc"))
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
252 (setq need-to-recompile-autoloads t))
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
253
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
254 (when (or need-to-rebuild-mule-autoloads
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
255 (not (file-exists-p "../lisp/mule/auto-autoloads.el"))
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
256 (not (file-exists-p "../lisp/mule/auto-autoloads.elc"))
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
257 (file-newer-than-file-p "../lisp/mule/auto-autoloads.el"
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
258 "../lisp/mule/auto-autoloads.elc"))
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
259 (setq need-to-recompile-mule-autoloads t))
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
260
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
261 (when (not (featurep 'mule))
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
262 ;; sorry charlie.
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
263 (setq need-to-rebuild-mule-autoloads nil
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
264 need-to-recompile-mule-autoloads nil))
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
265
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 (setq update-elc-files-to-compile (append update-elc-files-to-compile
622
11502791fc1c [xemacs-hg @ 2001-06-22 01:49:57 by ben]
ben
parents: 528
diff changeset
267 (nreverse processed)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268
1261
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
269 ;(print update-elc-files-to-compile)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270
1261
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
271 (let ((do-autoload-commands
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
272 (append
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
273 (if (or need-to-rebuild-autoloads
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
274 need-to-rebuild-mule-autoloads)
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
275 '("-l" "autoload"))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
276 (if need-to-rebuild-autoloads
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
277 '("-f" "autoload-update-directory-autoloads"
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
278 "auto" "../lisp"))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
279 (if need-to-rebuild-mule-autoloads
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
280 '("-f" "autoload-update-directory-autoloads"
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
281 "mule" "../lisp/mule"))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
282 (if need-to-recompile-autoloads
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
283 '("-f" "batch-byte-compile-one-file"
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
284 "../lisp/auto-autoloads.el"))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
285 (if need-to-recompile-mule-autoloads
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
286 '("-f" "batch-byte-compile-one-file"
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
287 "../lisp/mule/auto-autoloads.el")))))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
288 (cond ((and (not update-elc-files-to-compile)
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
289 (not need-to-rebuild-autoloads)
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
290 (not need-to-rebuild-mule-autoloads)
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
291 (not need-to-recompile-autoloads)
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
292 (not need-to-recompile-mule-autoloads))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
293 ;; (1) Nothing to do at all. BYTECOMPILE_CHANGE is used (only by
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
294 ;; the Unix makefile) to indicate whether some files needed
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
295 ;; for dump got recompiled, and hence the executable must be
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
296 ;; redumped. We remove it if there were no files to compile.
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
297 (condition-case nil
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
298 (delete-file "../src/BYTECOMPILE_CHANGE")
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
299 (file-error nil)))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
300 ((and (not update-elc-files-to-compile)
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
301 (not dumped-exe-out-of-date-wrt-dump-files)
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
302 (not dumped-exe-out-of-date-wrt-undumped-exe))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
303 ;; (2) We have no files to byte-compile, but we do need to
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
304 ;; regenerate and compile the auto-autoloads file. (This will
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
305 ;; be needed to be up-to-date before we run update-elc-2.)
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
306 ;; If the dumped exe exists and is up-to-date, both with
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
307 ;; respect to the undumped exe and the files that will be dumped
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
308 ;; into it, then we can use the dumped exe to rebuild the
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
309 ;; autoloads. Else, we have to do it the "hard way" by loading
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
310 ;; raw temacs, running loadup, then regenerating the autoloads.
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
311 ;; #### We should see whether it's possible to load up a
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
312 ;; minimal number of files in order to get autoload.el to work.
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
313 (load "raw-process.el")
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
314 (apply 'call-process-internal dumped-exe nil t nil
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
315 (append
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
316 '("-batch -no-autoloads -no-packages")
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
317 do-autoload-commands))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
318 (condition-case nil
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
319 (delete-file "../src/BYTECOMPILE_CHANGE")
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
320 (file-error nil)))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
321 (t
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
322 (let ((bc-bootstrap
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
323 (mapcar #'(lambda (arg)
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
324 (concat (update-elc-chop-extension
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
325 (locate-library arg)) ".el"))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
326 lisp-files-needed-for-byte-compilation))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
327 (bootstrap-other
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
328 (mapcar #'(lambda (arg)
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
329 (concat (update-elc-chop-extension
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
330 (locate-library arg)) ".el"))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
331 lisp-files-needing-early-byte-compilation)))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
332 (setq inhibit-autoloads t)
528
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
333 ;; if bytecomp or byte-optimize need recompiling, then load
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
334 ;; the .el version of them first, recompile them, and reload
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
335 ;; the .elc versions to recompile everything else (so we won't
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
336 ;; be waiting until the cows come home). we need to set
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
337 ;; load-ignore-elc-files because byte-optimize gets autoloaded
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 510
diff changeset
338 ;; from bytecomp.
1261
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
339 (let ((recompile-bc-bootstrap
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
340 (apply #'nconc
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
341 (mapcar
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
342 #'(lambda (arg)
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
343 (when (member arg update-elc-files-to-compile)
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
344 (append '("-f" "batch-byte-compile-one-file")
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
345 (list arg))))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
346 bc-bootstrap)))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
347 (recompile-bootstrap-other
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
348 (apply #'nconc
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
349 (mapcar
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
350 #'(lambda (arg)
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
351 (when (member arg update-elc-files-to-compile)
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
352 (append '("-f" "batch-byte-compile-one-file")
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
353 (list arg))))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
354 bootstrap-other))))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
355 (mapc-internal
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
356 #'(lambda (arg)
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
357 (setq update-elc-files-to-compile
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
358 (delete arg update-elc-files-to-compile)))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
359 (append bc-bootstrap bootstrap-other))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
360 (setq command-line-args
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
361 (append
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
362 '("-l" "loadup-el.el" "run-temacs"
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
363 "-batch" "-no-packages" "-no-autoloads"
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
364 "-eval" "(setq stack-trace-on-error t)"
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
365 "-eval" "(setq load-always-display-messages t)")
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
366 (when recompile-bc-bootstrap
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
367 (append
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
368 '("-eval" "(setq load-ignore-elc-files t)"
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
369 "-l" "bytecomp")
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
370 recompile-bc-bootstrap
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
371 '("-eval" "(setq load-ignore-elc-files nil)")))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
372 '("-l" "bytecomp")
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
373 ;; likewise, recompile autoload.el etc. if out-of-date.
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
374 recompile-bootstrap-other
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
375 ;; then generate autoloads for lisp and maybe lisp/mule.
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
376 do-autoload-commands
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
377 ;; now load the autoloads and compile alles anderes.
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
378 '("-eval" "(setq inhibit-autoloads nil)"
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
379 "-f" "startup-load-autoloads"
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
380 "-f" "batch-byte-compile")
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
381 update-elc-files-to-compile
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
382 ))))
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
383
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
384 ;;(print command-line-args)
465bd3c7d932 [xemacs-hg @ 2003-02-06 06:35:47 by ben]
ben
parents: 1232
diff changeset
385 (load "loadup-el.el"))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387 (kill-emacs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389 ;;; update-elc.el ends here