428
+ − 1 ;; dump-paths.el --- set up XEmacs paths for dumping
+ − 2
+ − 3 ;; Copyright (C) 1985, 1986, 1992, 1994, 1997 Free Software Foundation, Inc.
776
+ − 4 ;; Copyright (C) 2002 Ben Wing.
428
+ − 5
+ − 6 ;; Maintainer: XEmacs Development Team
+ − 7 ;; Keywords: internal, dumped
+ − 8
+ − 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
+ − 22 ;; along with XEmacs; see the file COPYING. If not, write to the Free
+ − 23 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ − 24 ;; 02111-1307, USA.
+ − 25
+ − 26 ;;; Synched up with: Not in FSF
+ − 27
+ − 28 ;;; Commentary:
+ − 29
776
+ − 30 ;; This sets up the various paths for continuing loading files for dumping.
+ − 31 ;; This is the only file of the basic path/package files (find-paths.el,
+ − 32 ;; package.el, setup-paths.el, dump-paths.el) that actually does stuff.
428
+ − 33
1227
+ − 34 (defun startup-setup-paths (roots data-roots user-init-directory
776
+ − 35 &optional
+ − 36 inhibit-packages inhibit-site-lisp
+ − 37 debug-paths called-early)
+ − 38 "Setup all the various paths.
+ − 39 ROOTS is a list of plausible roots of the XEmacs directory hierarchy.
+ − 40 If INHIBIT-PACKAGES is non-NIL, don't do packages.
+ − 41 If INHIBIT-SITE-LISP is non-NIL, don't do site-lisp.
+ − 42 If DEBUG-PATHS is non-NIL, print paths as they are detected.
+ − 43 It's idempotent, so call this as often as you like!"
428
+ − 44
776
+ − 45 (if (eq inhibit-packages t)
+ − 46 (setq inhibit-packages '(early late last)))
+ − 47 (if (not (listp inhibit-packages))
+ − 48 (setq inhibit-packages (list inhibit-packages)))
428
+ − 49
776
+ − 50 (apply #'(lambda (early late last)
+ − 51 (setq early-packages (and (not (memq 'early inhibit-packages))
+ − 52 early))
+ − 53 (setq late-packages (and (not (memq 'late inhibit-packages))
+ − 54 late))
+ − 55 (setq last-packages (and (not (memq 'last inhibit-packages))
+ − 56 last))
+ − 57 )
+ − 58 (packages-find-packages
1227
+ − 59 data-roots
776
+ − 60 (packages-compute-package-locations user-init-directory)))
428
+ − 61
1227
+ − 62 (setq early-package-load-path (packages-find-package-load-path early-packages))
428
+ − 63 (setq late-package-load-path (packages-find-package-load-path late-packages))
776
+ − 64 (setq last-package-load-path (packages-find-package-load-path last-packages))
428
+ − 65
+ − 66 (if debug-paths
+ − 67 (progn
1227
+ − 68 (princ (format "arguments:\nroots: %S\ndata-roots: %S\nuser-init-directory: %S\n"
+ − 69 roots data-roots user-init-directory)
776
+ − 70 'external-debugging-output)
+ − 71 (princ (format "inhibit-packages: %S\ninhibit-site-lisp: %S\n"
+ − 72 inhibit-packages inhibit-site-lisp)
+ − 73 'external-debugging-output)
+ − 74 (princ (format "debug-paths: %S\ncalled-early: %S\n\n"
+ − 75 debug-paths called-early)
+ − 76 'external-debugging-output)
428
+ − 77 (princ (format "configure-package-path:\n%S\n" configure-package-path)
+ − 78 'external-debugging-output)
776
+ − 79 (princ (format "early-packages and early-package-load-path:\n%S\n%S\n"
+ − 80 early-packages early-package-load-path)
+ − 81 'external-debugging-output)
428
+ − 82 (princ (format "late-packages and late-package-load-path:\n%S\n%S\n"
+ − 83 late-packages late-package-load-path)
776
+ − 84 'external-debugging-output)
+ − 85 (princ (format "last-packages and last-package-load-path:\n%S\n%S\n"
+ − 86 last-packages last-package-load-path)
428
+ − 87 'external-debugging-output)))
+ − 88
+ − 89 (setq lisp-directory (paths-find-lisp-directory roots))
776
+ − 90
428
+ − 91 (if debug-paths
+ − 92 (princ (format "lisp-directory:\n%S\n" lisp-directory)
+ − 93 'external-debugging-output))
776
+ − 94
460
+ − 95 (if (featurep 'mule)
+ − 96 (progn
+ − 97 (setq mule-lisp-directory
+ − 98 (paths-find-mule-lisp-directory roots
+ − 99 lisp-directory))
+ − 100 (if debug-paths
+ − 101 (princ (format "mule-lisp-directory:\n%S\n"
+ − 102 mule-lisp-directory)
+ − 103 'external-debugging-output)))
+ − 104 (setq mule-lisp-directory '()))
776
+ − 105
428
+ − 106 (setq site-directory (and (null inhibit-site-lisp)
+ − 107 (paths-find-site-lisp-directory roots)))
776
+ − 108
428
+ − 109 (if (and debug-paths (null inhibit-site-lisp))
+ − 110 (princ (format "site-directory:\n%S\n" site-directory)
+ − 111 'external-debugging-output))
+ − 112
+ − 113 (setq load-path (paths-construct-load-path roots
776
+ − 114 early-package-load-path
428
+ − 115 late-package-load-path
776
+ − 116 last-package-load-path
428
+ − 117 lisp-directory
460
+ − 118 site-directory
+ − 119 mule-lisp-directory))
428
+ − 120
1048
+ − 121 (setq module-directory (paths-find-module-directory roots))
+ − 122 (if debug-paths
+ − 123 (princ (format "module-directory:\n%S\n" module-directory)
+ − 124 'external-debugging-output))
+ − 125 (setq site-module-directory (and (null inhibit-site-modules)
+ − 126 (paths-find-site-module-directory
+ − 127 roots)))
+ − 128 (if (and debug-paths (null inhibit-site-modules))
+ − 129 (princ (format "site-module-directory:\n%S\n"
+ − 130 site-module-directory)
+ − 131 'external-debugging-output))
776
+ − 132
1048
+ − 133 (setq module-load-path (paths-construct-module-load-path
+ − 134 roots
+ − 135 module-directory
+ − 136 site-module-directory))
+ − 137
+ − 138 (unless called-early
776
+ − 139 (setq Info-directory-list
+ − 140 (paths-construct-info-path
+ − 141 roots early-packages late-packages last-packages))
+ − 142
+ − 143 (if debug-paths
+ − 144 (princ (format "Info-directory-list:\n%S\n" Info-directory-list)
+ − 145 'external-debugging-output))
+ − 146
+ − 147 (setq exec-directory (paths-find-exec-directory roots))
+ − 148
+ − 149 (if debug-paths
+ − 150 (princ (format "exec-directory:\n%s\n" exec-directory)
+ − 151 'external-debugging-output))
+ − 152
+ − 153 (setq exec-path
+ − 154 (paths-construct-exec-path roots exec-directory
+ − 155 early-packages late-packages
+ − 156 last-packages))
+ − 157
+ − 158 (if debug-paths
+ − 159 (princ (format "exec-path:\n%S\n" exec-path)
+ − 160 'external-debugging-output))
+ − 161
+ − 162 (setq doc-directory (paths-find-doc-directory roots))
+ − 163
+ − 164 (if debug-paths
+ − 165 (princ (format "doc-directory:\n%S\n" doc-directory)
+ − 166 'external-debugging-output))
+ − 167
+ − 168 (setq data-directory (paths-find-data-directory roots))
+ − 169
+ − 170 (if debug-paths
+ − 171 (princ (format "data-directory:\n%S\n" data-directory)
+ − 172 'external-debugging-output))
+ − 173
+ − 174 (setq data-directory-list (paths-construct-data-directory-list
+ − 175 data-directory early-packages
+ − 176 late-packages last-packages))
+ − 177 (if debug-paths
+ − 178 (princ (format "data-directory-list:\n%S\n" data-directory-list)
+ − 179 'external-debugging-output))))
+ − 180
+ − 181 ;;; Now actually do something.
+ − 182
+ − 183 (let ((debug-paths (or debug-paths
+ − 184 (and (getenv "EMACSDEBUGPATHS")
+ − 185 t)))
+ − 186 (roots (paths-find-emacs-roots invocation-directory
1227
+ − 187 invocation-name
+ − 188 #'paths-emacs-root-p))
+ − 189 (data-roots (paths-find-emacs-roots invocation-directory
+ − 190 invocation-name
+ − 191 #'paths-emacs-data-root-p)))
776
+ − 192
428
+ − 193 (if debug-paths
1227
+ − 194 (progn
+ − 195 (princ (format "XEmacs thinks the roots of its hierarchy are:\n%S\n"
+ − 196 roots)
+ − 197 'external-debugging-output)
+ − 198 (princ (format "XEmacs thinks the data roots of its hierarchy are:\n%S\n"
+ − 199 data-roots)
+ − 200 'external-debugging-output)))
+ − 201 (startup-setup-paths roots data-roots
776
+ − 202 (paths-construct-path '("~" ".xemacs"))
+ − 203 (if inhibit-all-packages t
+ − 204 '(early last))
+ − 205 inhibit-site-lisp
+ − 206 debug-paths
+ − 207 t))
428
+ − 208
+ − 209 ;;; dump-paths.el ends here