comparison lisp/update-elc.el @ 1330:4542b72c005e

[xemacs-hg @ 2003-03-01 07:25:26 by ben] build patch Makefile.in.in: Move src deletions to src/Makefile.in.in. dump-paths.el, dumped-lisp.el: Delete. Combine stuff into setup-paths.el. find-paths.el: Removed. Make this file contain generic routines only. Move stuff to compute Emacs roots to setup-paths.el. startup.el: Removed. Move these variables into setup-paths.el. setup-paths.el, startup.el: Removed. Combine all high-level code for computing the paths into setup-paths.el. Create new function startup-find-load-path to encapsulate all logic for computing `load-path'. Eliminate invocation-directory and invocation-name parameters since there is no point (false generality) -- the code references other globals, which cannot be specified. Eliminate some code duplicated between setup-paths.el and startup.el. Clean up the debug-paths code and output load-path in addition. Add logic to paths-emacs-root-p to support separated source and build trees. loadup.el, make-docfile.el, update-elc-2.el, update-elc.el: Rewrite to allow for separated source and build trees, as may occur in MS Windows. NOTE TO BUILD HACKERS: loadup.el, make-docfile.el, update-elc.el and update-elc-2.el made two assumptions that are no longer correct: (1) The source and build trees are in the same place. (2) They can make assumptions about where `.' is. These files now compute the locations of the source and build roots at the top of the file. *ALL* constant file names or path snippets must now be made absolute using expand-file-name and one of these roots. dumped-lisp.el, packages.el: Removed. Remove some unused lists of Lisp files. packages-hardcoded-lisp (empty, in any case) moved to dumped-lisp.el. startup.el: When a compiled init file is out-of-date wrt the uncompiled version, load the uncompiled version and issue a nasty warning. update-elc-2.el: Force touching of auto-autoloads files when REBUILD_AUTOLOADS was set. update-elc.el: Fix code that checks whether dumping is necessary to check against xemacs.dmp, not xemacs.exe, when Unix and pdump. lwlib-Xm.c: Fix compile warning. README, config.inc.samp, xemacs.mak: -- Major reorganization and cleanup. -- Add support for separated build tree and source tree. -- Delete all support for X Windows building, since it's totally bit-rotten and will never be fixed up. Instruct people to use Cygwin if they want such support. make-build-dir: New script to create a skeleton build tree for use with separated build and source tree compilation. m/acorn.h, m/alliant-2800.h, m/alliant.h, m/altos.h, m/amdahl.h, m/arm.h, m/att3b.h, m/aviion.h, m/clipper.h, m/cnvrgnt.h, m/convex.h, m/cydra5.h, m/delta.h, m/delta88k.h, m/dpx2.h, m/elxsi.h, m/ews4800r.h, m/gould.h, m/hp800.h, m/hp9000s300.h, m/i860.h, m/ibmps2-aix.h, m/ibmrs6000.h, m/ibmrt-aix.h, m/ibmrt.h, m/intel386.h, m/iris4d.h, m/iris5d.h, m/iris6d.h, m/irist.h, m/m68k.h, m/masscomp.h, m/mg1.h, m/mips-nec.h, m/mips-siemens.h, m/mips.h, m/nh3000.h, m/nh4000.h, m/ns32000.h, m/plexus.h, m/powerpc.h, m/sequent-ptx.h, m/sequent.h, m/sgi-challenge.h, m/stride.h, m/tad68k.h, m/targon31.h, m/tekxd88.h, m/template.h, m/tower32.h, m/tower32v3.h, m/ustation.h, m/wicat.h, m/xps100.h, data.c, doc.c, editfns.c, emacs.c, lrecord.h, ntheap.c, process-unix.c, sysdep.c, unexec.c: Delete all support for bit-rotten CANNOT_DUMP. Just use pdump. Makefile.in.in: Lots o' cleanup. Use names like LISP, SRC instead of lispdir, srcdir, for consistency with xemacs.mak and the conventions in the rest of the file. Eliminate use of ${...} in favor of $(...), to make it easier to move code between this file and xemacs.mak. Fix dependency handling wrt NEEDTODUMP to eliminate problems some people (e.g. Vin) have been seeing with non-GNU makes. Write a long section about the subtle but oh-so-important differences in dependency processing between nmake, make, and GNU make. Add unicode-encapsulate target, from xemacs.mak. chartab.c, lrecord.h: Fix crash due to attempt to free objects across dump/undump.
author ben
date Sat, 01 Mar 2003 07:25:56 +0000
parents 70921960b980
children ecf1ebac70d8
comparison
equal deleted inserted replaced
1329:389741884c65 1330:4542b72c005e
56 (defvar update-elc-files-to-compile nil) 56 (defvar update-elc-files-to-compile nil)
57 (defvar need-to-rebuild-autoloads nil) 57 (defvar need-to-rebuild-autoloads nil)
58 (defvar need-to-rebuild-mule-autoloads nil) 58 (defvar need-to-rebuild-mule-autoloads nil)
59 (defvar need-to-recompile-autoloads nil) 59 (defvar need-to-recompile-autoloads nil)
60 (defvar need-to-recompile-mule-autoloads nil) 60 (defvar need-to-recompile-mule-autoloads nil)
61 (defvar undumped-exe nil) 61 (defvar exe-target nil)
62 ;(defvar dumped-exe nil) 62 (defvar dump-target nil)
63 (defvar dumped-exe-out-of-date-wrt-dump-files nil) 63 (defvar dump-target-out-of-date-wrt-dump-files nil)
64 ;(defvar dumped-exe-out-of-date-wrt-undumped-exe nil) 64 ;(defvar dump-target-out-of-date-wrt-exe-target nil)
65 65
66 ;(setq update-elc-files-to-compile 66 ;(setq update-elc-files-to-compile
67 ; (delq nil 67 ; (delq nil
68 ; (mapcar (function 68 ; (mapcar (function
69 ; (lambda (x) 69 ; (lambda (x)
76 ; (set-file-modes x (logior (file-modes x) 128))) 76 ; (set-file-modes x (logior (file-modes x) 128)))
77 ; src)))))) 77 ; src))))))
78 ; ;; -batch gets filtered out. 78 ; ;; -batch gets filtered out.
79 ; (nthcdr 3 command-line-args)))) 79 ; (nthcdr 3 command-line-args))))
80 80
81 (let ((build-root (expand-file-name ".." invocation-directory))) 81
82 (setq load-path (list (expand-file-name "lisp" build-root)))) 82 (defvar build-root (expand-file-name ".." invocation-directory))
83 (defvar source-lisp (file-name-directory (expand-file-name
84 (nth 2 command-line-args))))
85 (defvar source-lisp-mule (expand-file-name "mule" source-lisp))
86 (defvar source-root (expand-file-name ".." source-lisp))
87 (defvar aa-lisp (expand-file-name "auto-autoloads.el" source-lisp))
88 (defvar aac-lisp (expand-file-name "auto-autoloads.elc" source-lisp))
89 (defvar aa-lisp-mule (expand-file-name "auto-autoloads.el" source-lisp-mule))
90 (defvar aac-lisp-mule (expand-file-name "auto-autoloads.elc" source-lisp-mule))
91
92 (setq load-path (list source-lisp))
83 93
84 (load "find-paths.el") 94 (load "find-paths.el")
85 (load "packages.el") 95 (load "packages.el")
86 (load "setup-paths.el") 96 (load "setup-paths.el")
87 (load "dump-paths.el") ;; #### take out in my fixup ws
88 97
89 ;; Lisp files loaded in order to byte compile anything. If any are out of 98 ;; Lisp files loaded in order to byte compile anything. If any are out of
90 ;; date, we need to load them as .el's, byte compile them, and reload as 99 ;; date, we need to load them as .el's, byte compile them, and reload as
91 ;; .elc's. 100 ;; .elc's.
92 (defvar lisp-files-needed-for-byte-compilation 101 (defvar lisp-files-needed-for-byte-compilation
124 ;; we need to handle each autoload file differently and there are only 133 ;; we need to handle each autoload file differently and there are only
125 ;; two of them. 134 ;; two of them.
126 135
127 (let (preloaded-file-list site-load-packages files-to-process) 136 (let (preloaded-file-list site-load-packages files-to-process)
128 137
129 (load (expand-file-name "../lisp/dumped-lisp.el")) 138 (load (expand-file-name "dumped-lisp.el" source-lisp))
130 139
131 (setq dumped-exe 140 ;; two setups here:
132 (cond ((file-exists-p "../src/xemacs.exe") "../src/xemacs.exe") 141 ;; (1) temacs.exe is undumped, dumped into xemacs.exe. Happens with
133 ((file-exists-p "../src/xemacs") "../src/xemacs") 142 ;; unexec, but also with pdump under MS Windows native, since
134 (t nil))) 143 ;; the dumped data is stored as a resource in the xemacs.exe
135 144 ;; executable.
136 ;; Not currently used but might be at some point. 145 ;; (2) xemacs.exe is dumped or undumped. Running `xemacs -nd' gets
137 ; (let ((temacs-exe 146 ;; you the equivalent of `temacs'. Dumping creates a file
138 ; (cond ((file-exists-p "../src/temacs.exe") "../src/temacs.exe") 147 ;; `xemacs.dmp'.
139 ; ((file-exists-p "../src/temacs") "../src/temacs") 148
140 ; (t nil))) 149 (cond ((eq system-type 'windows-nt)
141 ; (data-file 150 (setq exe-target "src/temacs.exe"
142 ; (cond ((file-exists-p "../src/xemacs.dmp") "../src/xemacs.dmp") 151 dump-target "src/xemacs.exe"))
143 ; (t nil)))) 152 ;; #### need better ways of getting config params
144 153 ((not (memq 'pdump (emacs-run-status)))
145 ; ;; two setups here: 154 (setq exe-target "src/temacs"
146 ; ;; (1) temacs.exe is undumped, dumped into xemacs.exe. Happens with 155 dump-target "src/xemacs"))
147 ; ;; unexec, but also with pdump under MS Windows native, since 156 (t
148 ; ;; the dumped data is stored as a resource in the xemacs.exe 157 (setq exe-target "src/xemacs"
149 ; ;; executable. 158 dump-target "src/xemacs.dmp")))
150 ; ;; (2) xemacs.exe is dumped or undumped. Running `xemacs -nd' gets 159
151 ; ;; you the equivalent of `temacs'. Dumping creates a file 160 (setq exe-target (expand-file-name exe-target build-root))
152 ; ;; `xemacs.dmp'. 161 (setq dump-target (expand-file-name dump-target build-root))
153 162
154 ; (setq dumped-exe-out-of-date-wrt-undumped-exe 163 ;; Not currently used.
155 ; (cond ((not dumped-exe) t) 164 ; (setq dump-target-out-of-date-wrt-exe-target
156 ; (temacs-exe (file-newer-than-file-p temacs-exe dumped-exe)) 165 ; (cond ((not dump-target) t)
157 ; ((not data-file) t) 166 ; (temacs-exe (file-newer-than-file-p temacs-exe dump-target))
158 ; (t (file-newer-than-file-p dumped-exe data-file)))) 167 ; ((not data-file) t)
159 ; (setq dumped-exe-exists (or (and temacs-exe dumped-exe) 168 ; (t (file-newer-than-file-p dump-target data-file))))
160 ; (and data-file dumped-exe)))) 169 ; (setq dump-target-exists (or (and temacs-exe dump-target)
170 ; (and data-file dump-target))))
161 171
162 ;; Path setup 172 ;; Path setup
163 (let ((package-preloaded-file-list 173 (let ((package-preloaded-file-list
164 (packages-collect-package-dumped-lisps late-package-load-path))) 174 (packages-collect-package-dumped-lisps late-package-load-path)))
165 175
166 (setq preloaded-file-list 176 (setq preloaded-file-list
167 (append package-preloaded-file-list 177 (append package-preloaded-file-list
168 preloaded-file-list 178 preloaded-file-list
169 packages-hardcoded-lisp))) 179 packages-hardcoded-lisp)))
170 180
171 (load (concat default-directory "../site-packages") t t) 181 (load (expand-file-name "site-packages" source-root) t t)
172 (setq preloaded-file-list 182 (setq preloaded-file-list
173 (append packages-hardcoded-lisp 183 (append packages-hardcoded-lisp
174 preloaded-file-list 184 preloaded-file-list
175 site-load-packages)) 185 site-load-packages))
176 ;; bytecomp, byte-optimize, autoload, etc. are mentioned specially 186 ;; bytecomp, byte-optimize, autoload, etc. are mentioned specially
201 211
202 ;; (print full-arg-el) 212 ;; (print full-arg-el)
203 213
204 ;; now check if .el or .elc is newer than the dumped exe. 214 ;; now check if .el or .elc is newer than the dumped exe.
205 ;; if so, need to redump. 215 ;; if so, need to redump.
206 (when (and dumped-exe arg-is-preloaded 216 (when (and dump-target arg-is-preloaded
207 ;; no need to check for existence of either of the files 217 ;; no need to check for existence of either of the files
208 ;; because of the definition of file-newer-than-file-p. 218 ;; because of the definition of file-newer-than-file-p.
209 (or (file-newer-than-file-p full-arg-el dumped-exe) 219 (or (file-newer-than-file-p full-arg-el dump-target)
210 (file-newer-than-file-p full-arg-elc dumped-exe))) 220 (file-newer-than-file-p full-arg-elc dump-target)))
211 (setq dumped-exe-out-of-date-wrt-dump-files t)) 221 (setq dump-target-out-of-date-wrt-dump-files t))
212 222
213 (if (and (not (member (file-name-nondirectory arg) 223 (if (and (not (member (file-name-nondirectory arg)
214 unbytecompiled-lisp-files)) 224 unbytecompiled-lisp-files))
215 (not (member full-arg-el processed)) 225 (not (member full-arg-el processed))
216 ;; no need to check for existence of either of the files 226 ;; no need to check for existence of either of the files
220 230
221 (setq files-to-process (cdr files-to-process)))) 231 (setq files-to-process (cdr files-to-process))))
222 232
223 ;; Check if we need to rebuild the auto-autoloads.el files -- that is, 233 ;; Check if we need to rebuild the auto-autoloads.el files -- that is,
224 ;; if ANY .el files have changed. 234 ;; if ANY .el files have changed.
225 (let ((dirs-to-check '("../lisp" "../lisp/mule"))) 235 (let ((dirs-to-check (list source-lisp source-lisp-mule)))
226 (while dirs-to-check 236 (while dirs-to-check
227 (let* ((dir (car dirs-to-check)) 237 (let* ((dir (car dirs-to-check))
228 (full-dir (expand-file-name dir)) 238 (full-dir (expand-file-name dir))
229 (all-files-in-dir (directory-files full-dir t "\\.el$" nil t)) 239 (all-files-in-dir (directory-files full-dir t "\\.el$" nil t))
230 (autoload-file 240 (autoload-file
231 (expand-file-name "auto-autoloads.el" full-dir)) 241 (expand-file-name "auto-autoloads.el" full-dir))
232 (autoload-is-mule (equal dir "../lisp/mule"))) 242 (autoload-is-mule (equal dir source-lisp-mule)))
233 (while all-files-in-dir 243 (while all-files-in-dir
234 (let* ((full-arg (car all-files-in-dir))) 244 (let* ((full-arg (car all-files-in-dir)))
235 ;; custom-load.el always gets regenerated so don't let that 245 ;; custom-load.el always gets regenerated so don't let that
236 ;; trigger us. 246 ;; trigger us.
237 (when (and (not 247 (when (and (not
244 (setq need-to-rebuild-mule-autoloads t) 254 (setq need-to-rebuild-mule-autoloads t)
245 (setq need-to-rebuild-autoloads t)))) 255 (setq need-to-rebuild-autoloads t))))
246 (setq all-files-in-dir (cdr all-files-in-dir)))) 256 (setq all-files-in-dir (cdr all-files-in-dir))))
247 (setq dirs-to-check (cdr dirs-to-check)))) 257 (setq dirs-to-check (cdr dirs-to-check))))
248 258
249 (if dumped-exe-out-of-date-wrt-dump-files 259 (if dump-target-out-of-date-wrt-dump-files
250 (condition-case nil 260 (condition-case nil
251 (write-region-internal "foo" nil "../src/NEEDTODUMP") 261 (write-region-internal
262 "foo" nil (expand-file-name "src/NEEDTODUMP" build-root))
252 (file-error nil))) 263 (file-error nil)))
253 264
254 ) 265 )
255 266
256 (when (or need-to-rebuild-autoloads 267 (when (or need-to-rebuild-autoloads
257 ;; no real need for the following check either, because if the file 268 ;; no real need for the following check either, because if the file
258 ;; doesn't exist, need-to-rebuild-autoloads gets set above. but 269 ;; doesn't exist, need-to-rebuild-autoloads gets set above. but
259 ;; it's only one call, so it won't slow things down much and it keeps 270 ;; it's only one call, so it won't slow things down much and it keeps
260 ;; the logic cleaner. 271 ;; the logic cleaner.
261 (not (file-exists-p "../lisp/auto-autoloads.el")) 272 (not (file-exists-p aa-lisp))
262 ;; no need to check for file-exists of .elc due to definition 273 ;; no need to check for file-exists of .elc due to definition
263 ;; of file-newer-than-file-p 274 ;; of file-newer-than-file-p
264 (file-newer-than-file-p "../lisp/auto-autoloads.el" 275 (file-newer-than-file-p aa-lisp aac-lisp))
265 "../lisp/auto-autoloads.elc"))
266 (setq need-to-recompile-autoloads t)) 276 (setq need-to-recompile-autoloads t))
267 277
268 (when (or need-to-rebuild-mule-autoloads 278 (when (or need-to-rebuild-mule-autoloads
269 ;; not necessary but ... see comment above. 279 ;; not necessary but ... see comment above.
270 (not (file-exists-p "../lisp/mule/auto-autoloads.el")) 280 (not (file-exists-p aa-lisp-mule))
271 ;; no need to check for file-exists of .elc due to definition 281 ;; no need to check for file-exists of .elc due to definition
272 ;; of file-newer-than-file-p 282 ;; of file-newer-than-file-p
273 (file-newer-than-file-p "../lisp/mule/auto-autoloads.el" 283 (file-newer-than-file-p aa-lisp-mule aac-lisp-mule))
274 "../lisp/mule/auto-autoloads.elc"))
275 (setq need-to-recompile-mule-autoloads t)) 284 (setq need-to-recompile-mule-autoloads t))
276 285
277 (when (not (featurep 'mule)) 286 (when (not (featurep 'mule))
278 ;; sorry charlie. 287 ;; sorry charlie.
279 (setq need-to-rebuild-mule-autoloads nil 288 (setq need-to-rebuild-mule-autoloads nil
286 295
287 (let ((do-autoload-commands 296 (let ((do-autoload-commands
288 (append 297 (append
289 (if (or need-to-rebuild-autoloads 298 (if (or need-to-rebuild-autoloads
290 need-to-rebuild-mule-autoloads) 299 need-to-rebuild-mule-autoloads)
291 '("-l" "autoload")) 300 (list "-l" "autoload"))
292 (if need-to-rebuild-autoloads 301 (if need-to-rebuild-autoloads
293 '("-f" "autoload-update-directory-autoloads" 302 (list "-f" "autoload-update-directory-autoloads"
294 "auto" "../lisp")) 303 "auto" source-lisp))
295 (if need-to-rebuild-mule-autoloads 304 (if need-to-rebuild-mule-autoloads
296 '("-f" "autoload-update-directory-autoloads" 305 (list "-f" "autoload-update-directory-autoloads"
297 "mule" "../lisp/mule")) 306 "mule" source-lisp-mule))
298 (if need-to-recompile-autoloads 307 (if need-to-recompile-autoloads
299 '("-f" "batch-byte-compile-one-file" 308 (list "-f" "batch-byte-compile-one-file"
300 "../lisp/auto-autoloads.el")) 309 aa-lisp))
301 (if need-to-recompile-mule-autoloads 310 (if need-to-recompile-mule-autoloads
302 '("-f" "batch-byte-compile-one-file" 311 (list "-f" "batch-byte-compile-one-file"
303 "../lisp/mule/auto-autoloads.el"))))) 312 aa-lisp-mule)))))
304 (condition-case nil 313 (condition-case nil
305 (delete-file "../src/REBUILD_AUTOLOADS") 314 (delete-file (expand-file-name "src/REBUILD_AUTOLOADS" build-root))
306 (file-error nil)) 315 (file-error nil))
307 (cond ((and (not update-elc-files-to-compile) 316 (cond ((and (not update-elc-files-to-compile)
308 (not need-to-rebuild-autoloads) 317 (not need-to-rebuild-autoloads)
309 (not need-to-rebuild-mule-autoloads) 318 (not need-to-rebuild-mule-autoloads)
310 (not need-to-recompile-autoloads) 319 (not need-to-recompile-autoloads)
317 ;; update-elc-2 to do it. This is much faster than loading 326 ;; update-elc-2 to do it. This is much faster than loading
318 ;; all the .el's and doing it here. (We only need to rebuild 327 ;; all the .el's and doing it here. (We only need to rebuild
319 ;; the autoloads here when we have files to compile, since 328 ;; the autoloads here when we have files to compile, since
320 ;; they may depend on the updated autoloads.) 329 ;; they may depend on the updated autoloads.)
321 (condition-case nil 330 (condition-case nil
322 (write-region-internal "foo" nil "../src/REBUILD_AUTOLOADS") 331 (write-region-internal
332 "foo" nil (expand-file-name "src/REBUILD_AUTOLOADS" build-root))
323 (file-error nil)) 333 (file-error nil))
324 ) 334 )
325 (t 335 (t
326 (let ((bc-bootstrap 336 (let ((bc-bootstrap
327 (mapcar #'(lambda (arg) 337 (mapcar #'(lambda (arg)