Mercurial > hg > xemacs-beta
comparison lisp/setup-paths.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 | 79940b592197 |
children | 8b284a83dd90 |
comparison
equal
deleted
inserted
replaced
1329:389741884c65 | 1330:4542b72c005e |
---|---|
1 ;;; setup-paths.el --- setup various XEmacs paths | 1 ;;; setup-paths.el --- setup various XEmacs paths |
2 | 2 |
3 ;; Copyright (C) 1985-1986, 1990, 1992-1997 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1985-1986, 1990, 1992-1997 Free Software Foundation, Inc. |
4 ;; Copyright (c) 1993, 1994 Sun Microsystems, Inc. | 4 ;; Copyright (c) 1993, 1994 Sun Microsystems, Inc. |
5 ;; Copyright (C) 1995 Board of Trustees, University of Illinois | 5 ;; Copyright (C) 1995 Board of Trustees, University of Illinois |
6 ;; Copyright (C) 2003 Ben Wing. | |
6 | 7 |
7 ;; Author: Mike Sperber <sperber@informatik.uni-tuebingen.de> | 8 ;; Author: Mike Sperber <sperber@informatik.uni-tuebingen.de> |
8 ;; Maintainer: XEmacs Development Team | 9 ;; Maintainer: XEmacs Development Team |
9 ;; Keywords: internal, dumped | 10 ;; Keywords: internal, dumped |
10 | 11 |
34 ;; This file contains functions and variables that describe and construct | 35 ;; This file contains functions and variables that describe and construct |
35 ;; the various paths into the XEmacs hierarchy from a global viewpoint. | 36 ;; the various paths into the XEmacs hierarchy from a global viewpoint. |
36 ;; This file doesn't actually do anything. | 37 ;; This file doesn't actually do anything. |
37 | 38 |
38 ;; It requires find-paths.el and packages.el. | 39 ;; It requires find-paths.el and packages.el. |
40 | |
41 ;;; Code: | |
42 | |
43 ;(setq debug-paths t) | |
44 | |
39 | 45 |
40 ;;; Code: | 46 ;;; Path-related variables. |
47 ;;; NOTE: Many of them (`lisp-directory', `data-directory', etc.) are | |
48 ;;; built-in. | |
49 | |
50 (defvar emacs-roots nil | |
51 "List of plausible roots of the XEmacs hierarchy. | |
52 This is a list of plausible directories in which to search for the important | |
53 directories used by XEmacs at run-time, for example `exec-directory', | |
54 `data-directory' and `lisp-directory'. | |
55 | |
56 Normally set at startup by calling `paths-find-emacs-roots'.") | |
57 | |
58 (defvar emacs-data-roots nil | |
59 "List of plausible data roots of the XEmacs hierarchy.") | |
60 | |
61 (defvar user-init-directory-base ".xemacs" | |
62 "Base of directory where user-installed init files may go.") | |
63 | |
64 (defvar user-init-directory | |
65 (file-name-as-directory | |
66 (paths-construct-path (list "~" user-init-directory-base))) | |
67 "Directory where user-installed init files may go.") | |
68 | |
69 (defvar user-init-file-base "init.el" | |
70 "Default name of the user init file if uncompiled. | |
71 This should be used for migration purposes only.") | |
72 | |
73 (defvar user-init-file-base-list '("init.el") | |
74 "List of allowed init files in the user's init directory. | |
75 The first one found takes precedence. .elc files do not need to be listed.") | |
76 | |
77 (defvar user-home-init-file-base-list | |
78 (append '(".emacs.el" ".emacs") | |
79 (and (eq system-type 'windows-nt) | |
80 '("_emacs.el" "_emacs"))) | |
81 "List of allowed init files in the user's home directory. | |
82 The first one found takes precedence. .elc files do not need to be listed.") | |
83 | |
84 (defvar load-home-init-file nil | |
85 "Non-nil if XEmacs should load the init file from the home directory. | |
86 Otherwise, XEmacs will offer migration to the init directory.") | |
87 | |
88 (defvar load-user-init-file-p t | |
89 "Non-nil if XEmacs should load the user's init file.") | |
41 | 90 |
42 (defvar paths-core-load-path-depth 0 | 91 (defvar paths-core-load-path-depth 0 |
43 "Depth of load-path searches in core Lisp paths.") | 92 "Depth of load-path searches in core Lisp paths.") |
44 | 93 |
45 (defvar paths-site-load-path-depth 1 | 94 (defvar paths-site-load-path-depth 1 |
56 '(("usr" "local" "info") | 105 '(("usr" "local" "info") |
57 ("usr" "info") | 106 ("usr" "info") |
58 ("usr" "local" "share" "info") | 107 ("usr" "local" "share" "info") |
59 ("usr" "share" "info"))) | 108 ("usr" "share" "info"))) |
60 "Directories appended to the end of the info path by default.") | 109 "Directories appended to the end of the info path by default.") |
110 | |
111 | |
112 ;;; Basic utility functions. | |
113 | |
114 (defun paths-emacs-root-p (directory) | |
115 "Check if DIRECTORY is a plausible installation root." | |
116 (or | |
117 ;; installed | |
118 (paths-file-readable-directory-p (paths-construct-path (list directory | |
119 "lib" | |
120 (construct-emacs-version-name)))) | |
121 ;; in-place or windows-nt. windows-nt equivalent of --srcdir is | |
122 ;; BUILD_DIR in config.inc, and has no lisp/ or etc/ since symlinks | |
123 ;; don't exist. instead, xemacs.mak points configure-lisp-directory and | |
124 ;; configure-data-directory at the right places. | |
125 (and | |
126 (or configure-exec-directory (paths-file-readable-directory-p (paths-construct-path (list directory "lib-src")))) | |
127 (or configure-lisp-directory (paths-file-readable-directory-p (paths-construct-path (list directory "lisp")))) | |
128 (or configure-data-directory (paths-file-readable-directory-p (paths-construct-path (list directory "etc"))))))) | |
129 | |
130 (defun paths-emacs-data-root-p (directory) | |
131 "Check if DIRECTORY is a plausible data installation root. | |
132 A data installation root is one containing data files that may be shared | |
133 among multiple different versions of XEmacs, the packages in particular." | |
134 (or | |
135 ;; installed | |
136 (paths-file-readable-directory-p (paths-construct-path (list directory | |
137 "lib" | |
138 emacs-program-name))) | |
139 (paths-file-readable-directory-p (paths-construct-path (list directory | |
140 "lib" | |
141 (construct-emacs-version-name)))) | |
142 ;; in-place or windows-nt | |
143 (and | |
144 (paths-file-readable-directory-p (paths-construct-path (list directory "lisp"))) | |
145 (paths-file-readable-directory-p (paths-construct-path (list directory "etc")))))) | |
146 | |
147 (defun paths-find-emacs-root (invocation-directory invocation-name) | |
148 "Find the run-time root of XEmacs." | |
149 (let* ((executable-file-name (paths-chase-symlink | |
150 (concat invocation-directory | |
151 invocation-name))) | |
152 (executable-directory (file-name-directory executable-file-name)) | |
153 (maybe-root-1 (file-name-as-directory | |
154 (paths-construct-path '("..") executable-directory))) | |
155 (maybe-root-2 (file-name-as-directory | |
156 (paths-construct-path '(".." "..") executable-directory)))) | |
157 (or (and (paths-emacs-root-p maybe-root-1) | |
158 maybe-root-1) | |
159 (and (paths-emacs-root-p maybe-root-2) | |
160 maybe-root-2)))) | |
161 | |
162 (defun paths-find-emacs-roots (root-p) | |
163 "Find all plausible installation roots for XEmacs. | |
164 This is a list of plausible directories in which to search for the important | |
165 directories used by XEmacs at run-time, for example `exec-directory', | |
166 `data-directory' and `lisp-directory'. | |
167 ROOT-P is a function that tests whether a root is plausible." | |
168 (let* ((potential-invocation-root | |
169 (paths-find-emacs-root invocation-directory invocation-name)) | |
170 (invocation-roots | |
171 (and potential-invocation-root | |
172 (list potential-invocation-root))) | |
173 (potential-installation-roots | |
174 (paths-uniq-append | |
175 (and configure-exec-prefix-directory | |
176 (list (file-name-as-directory | |
177 configure-exec-prefix-directory))) | |
178 (and configure-prefix-directory | |
179 (list (file-name-as-directory | |
180 configure-prefix-directory))))) | |
181 (installation-roots | |
182 (paths-filter root-p potential-installation-roots))) | |
183 (paths-uniq-append invocation-roots | |
184 installation-roots))) | |
61 | 185 |
62 (defun paths-find-site-lisp-directory (roots) | 186 (defun paths-find-site-lisp-directory (roots) |
63 "Find the site Lisp directory of the XEmacs hierarchy." | 187 "Find the site Lisp directory of the XEmacs hierarchy." |
64 (paths-find-site-directory roots "site-lisp" | 188 (paths-find-site-directory roots "site-lisp" |
65 nil | 189 nil |
200 (packages-find-package-data-path early-packages) | 324 (packages-find-package-data-path early-packages) |
201 (packages-find-package-data-path late-packages) | 325 (packages-find-package-data-path late-packages) |
202 (list data-directory) | 326 (list data-directory) |
203 (packages-find-package-data-path last-packages))) | 327 (packages-find-package-data-path last-packages))) |
204 | 328 |
329 | |
330 ;;; High-level functions to set up the paths. | |
331 | |
332 (defun startup-find-load-path (&optional inhibit-packages | |
333 set-global-package-paths) | |
334 "Determine the value for `load-path'. | |
335 INHIBIT-PACKAGES says which types of packages, if any, to omit from the | |
336 returned value. It can be `t' (omit all), one of the symbols `early', | |
337 `late', or `last', or a list of one or more of the symbols. | |
338 | |
339 If SET-GLOBAL-PACKAGE-PATHS is non-nil, initialize the global package path | |
340 variables referring to the particular types of packages (`early-packages', | |
341 `early-package-load-path', `late-packages', `late-package-load-path', | |
342 `last-packages', `last-package-load-path')." | |
343 (let (earlyp latep lastp earlyp-lp latep-lp lastp-lp) | |
344 (apply #'(lambda (early late last) | |
345 (setq earlyp (and (not (memq 'early inhibit-packages)) early)) | |
346 (setq latep (and (not (memq 'late inhibit-packages)) late)) | |
347 (setq lastp (and (not (memq 'last inhibit-packages)) last))) | |
348 (packages-find-packages | |
349 emacs-data-roots | |
350 (packages-compute-package-locations user-init-directory))) | |
351 | |
352 (setq earlyp-lp (packages-find-package-load-path earlyp)) | |
353 (setq latep-lp (packages-find-package-load-path latep)) | |
354 (setq lastp-lp (packages-find-package-load-path lastp)) | |
355 | |
356 (when set-global-package-paths | |
357 (setq early-packages earlyp | |
358 late-packages latep | |
359 last-packages lastp | |
360 early-package-load-path earlyp-lp | |
361 late-package-load-path latep-lp | |
362 last-package-load-path lastp-lp)) | |
363 | |
364 (paths-construct-load-path emacs-roots earlyp-lp latep-lp lastp-lp | |
365 lisp-directory site-directory | |
366 mule-lisp-directory))) | |
367 | |
368 (defun startup-setup-paths (&optional inhibit-packages called-early) | |
369 "Setup all the various paths. | |
370 INHIBIT-PACKAGES says which types of packages, if any, to omit from the | |
371 returned value. It can be `t' (omit all), one of the symbols `early', | |
372 `late', or `last', or a list of one or more of the symbols. | |
373 | |
374 This function is idempotent, so call this as often as you like!" | |
375 | |
376 (setq debug-paths (or debug-paths | |
377 (and (getenv "EMACSDEBUGPATHS") | |
378 t))) | |
379 | |
380 (setq emacs-roots (paths-find-emacs-roots #'paths-emacs-data-root-p)) | |
381 | |
382 (setq emacs-data-roots (paths-find-emacs-roots #'paths-emacs-data-root-p)) | |
383 | |
384 (if (null emacs-roots) | |
385 (save-excursion | |
386 (set-buffer (get-buffer-create " *warning-tmp*")) | |
387 (erase-buffer) | |
388 (buffer-disable-undo (current-buffer)) | |
389 | |
390 (insert "Couldn't find an obvious default for the root of the\n" | |
391 "XEmacs hierarchy.") | |
392 | |
393 (princ "\nWARNING:\n" 'external-debugging-output) | |
394 (princ (buffer-string) 'external-debugging-output))) | |
395 | |
396 (if (eq inhibit-packages t) | |
397 (setq inhibit-packages '(early late last))) | |
398 (if (not (listp inhibit-packages)) | |
399 (setq inhibit-packages (list inhibit-packages))) | |
400 | |
401 (when debug-paths | |
402 (princ (format | |
403 "startup-setup-paths arguments: | |
404 inhibit-packages: %S | |
405 inhibit-site-lisp: %S | |
406 called-early: %S | |
407 " inhibit-packages inhibit-site-lisp called-early) | |
408 'external-debugging-output) | |
409 (princ (format | |
410 "emacs-roots: | |
411 %S | |
412 emacs-data-roots: | |
413 %S | |
414 user-init-directory: %S | |
415 configure-package-path: %S | |
416 " emacs-roots emacs-data-roots user-init-directory configure-package-path) | |
417 'external-debugging-output) | |
418 ) | |
419 | |
420 (setq lisp-directory (paths-find-lisp-directory emacs-roots)) | |
421 | |
422 (if debug-paths | |
423 (princ (format "lisp-directory:\n%S\n" lisp-directory) | |
424 'external-debugging-output)) | |
425 | |
426 (if (featurep 'mule) | |
427 (progn | |
428 (setq mule-lisp-directory | |
429 (paths-find-mule-lisp-directory emacs-roots | |
430 lisp-directory)) | |
431 (if debug-paths | |
432 (princ (format "mule-lisp-directory:\n%S\n" | |
433 mule-lisp-directory) | |
434 'external-debugging-output))) | |
435 (setq mule-lisp-directory '())) | |
436 | |
437 (setq site-directory (and (null inhibit-site-lisp) | |
438 (paths-find-site-lisp-directory emacs-roots))) | |
439 | |
440 (if (and debug-paths (null inhibit-site-lisp)) | |
441 (princ (format "site-directory:\n%S\n" site-directory) | |
442 'external-debugging-output)) | |
443 | |
444 (setq load-path (startup-find-load-path inhibit-packages t)) | |
445 | |
446 (when debug-paths | |
447 (princ (format "early-packages and early-package-load-path:\n%S\n%S\n" | |
448 early-packages early-package-load-path) | |
449 'external-debugging-output) | |
450 (princ (format "late-packages and late-package-load-path:\n%S\n%S\n" | |
451 late-packages late-package-load-path) | |
452 'external-debugging-output) | |
453 (princ (format "last-packages and last-package-load-path:\n%S\n%S\n" | |
454 last-packages last-package-load-path) | |
455 'external-debugging-output)) | |
456 | |
457 (if debug-paths | |
458 (princ (format "load-path:\n%S\n" load-path) | |
459 'external-debugging-output)) | |
460 (setq module-directory (paths-find-module-directory emacs-roots)) | |
461 (if debug-paths | |
462 (princ (format "module-directory:\n%S\n" module-directory) | |
463 'external-debugging-output)) | |
464 (setq site-module-directory (and (null inhibit-site-modules) | |
465 (paths-find-site-module-directory | |
466 emacs-roots))) | |
467 (if (and debug-paths (null inhibit-site-modules)) | |
468 (princ (format "site-module-directory:\n%S\n" | |
469 site-module-directory) | |
470 'external-debugging-output)) | |
471 | |
472 (setq module-load-path (paths-construct-module-load-path | |
473 emacs-roots | |
474 module-directory | |
475 site-module-directory)) | |
476 | |
477 (unless called-early | |
478 (setq Info-directory-list | |
479 (paths-construct-info-path | |
480 emacs-roots early-packages late-packages last-packages)) | |
481 | |
482 (if debug-paths | |
483 (princ (format "Info-directory-list:\n%S\n" Info-directory-list) | |
484 'external-debugging-output)) | |
485 | |
486 (setq exec-directory (paths-find-exec-directory emacs-roots)) | |
487 | |
488 (if debug-paths | |
489 (princ (format "exec-directory:\n%s\n" exec-directory) | |
490 'external-debugging-output)) | |
491 | |
492 (setq exec-path | |
493 (paths-construct-exec-path emacs-roots exec-directory | |
494 early-packages late-packages | |
495 last-packages)) | |
496 | |
497 (if debug-paths | |
498 (princ (format "exec-path:\n%S\n" exec-path) | |
499 'external-debugging-output)) | |
500 | |
501 (setq doc-directory (paths-find-doc-directory emacs-roots)) | |
502 | |
503 (if debug-paths | |
504 (princ (format "doc-directory:\n%S\n" doc-directory) | |
505 'external-debugging-output)) | |
506 | |
507 (setq data-directory (paths-find-data-directory emacs-roots)) | |
508 | |
509 (if debug-paths | |
510 (princ (format "data-directory:\n%S\n" data-directory) | |
511 'external-debugging-output)) | |
512 | |
513 (setq data-directory-list (paths-construct-data-directory-list | |
514 data-directory early-packages | |
515 late-packages last-packages)) | |
516 (if debug-paths | |
517 (princ (format "data-directory-list:\n%S\n" data-directory-list) | |
518 'external-debugging-output)))) | |
519 | |
520 (defun startup-find-load-path-for-packages (packages) | |
521 "Return a suitable load-path for PACKAGES. | |
522 PACKAGES is a list of package names (strings). This looks for package | |
523 directories in the load path whose last component is one of the members of | |
524 PACKAGES." | |
525 (mapcan | |
526 #'(lambda (package) | |
527 (and (member (file-name-nondirectory (directory-file-name package)) | |
528 packages) | |
529 (list package))) | |
530 (startup-find-load-path))) | |
531 | |
532 ; (defun startup-set-basic-packages-load-path () | |
533 ; "#### This is a hack. When recompiling .el files, we use -no-packages | |
534 ; to avoid problems with packages shadowing standard Lisp files | |
535 ; (e.g. unicode.el), but we really still need the stuff in xemacs-base and | |
536 ; xemacs-devel, which SHOULD NOT be in the packages." | |
537 ; (setq load-path (startup-find-load-path-for-packages | |
538 ; '("xemacs-base" "xemacs-devel")))) | |
539 | |
540 | |
541 ;;; Now actually set the paths up, for bootstrapping purposes. This is run | |
542 ;;; at early dump time and in certain cases where we use a minimal temacs | |
543 ;;; to do useful things, like rebuild DOC. | |
544 | |
545 (startup-setup-paths (if inhibit-all-packages t '(early last)) t) | |
546 | |
205 ;;; setup-paths.el ends here | 547 ;;; setup-paths.el ends here |