428
|
1 ;;; setup-paths.el --- setup various XEmacs paths
|
|
2
|
|
3 ;; Copyright (C) 1985-1986, 1990, 1992-1997 Free Software Foundation, Inc.
|
|
4 ;; Copyright (c) 1993, 1994 Sun Microsystems, Inc.
|
|
5 ;; Copyright (C) 1995 Board of Trustees, University of Illinois
|
|
6
|
|
7 ;; Author: Mike Sperber <sperber@informatik.uni-tuebingen.de>
|
|
8 ;; Maintainer: XEmacs Development Team
|
|
9 ;; Keywords: internal, dumped
|
|
10
|
|
11 ;; This file is part of XEmacs.
|
|
12
|
|
13 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
14 ;; under the terms of the GNU General Public License as published by
|
|
15 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
16 ;; any later version.
|
|
17
|
|
18 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
19 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
21 ;; General Public License for more details.
|
|
22
|
|
23 ;; You should have received a copy of the GNU General Public License
|
|
24 ;; along with XEmacs; see the file COPYING. If not, write to the
|
|
25 ;; Free Software Foundation, 59 Temple Place - Suite 330,
|
|
26 ;; Boston, MA 02111-1307, USA.
|
|
27
|
|
28 ;;; Synched up with: Not in FSF.
|
|
29
|
|
30 ;;; Commentary:
|
|
31
|
|
32 ;; This file is dumped with XEmacs.
|
|
33
|
776
|
34 ;; This file contains functions and variables that describe and construct
|
|
35 ;; the various paths into the XEmacs hierarchy from a global viewpoint.
|
|
36 ;; This file doesn't actually do anything.
|
428
|
37
|
|
38 ;; It requires find-paths.el and packages.el.
|
|
39
|
|
40 ;;; Code:
|
|
41
|
460
|
42 (defvar paths-core-load-path-depth 0
|
428
|
43 "Depth of load-path searches in core Lisp paths.")
|
|
44
|
452
|
45 (defvar paths-site-load-path-depth 1
|
|
46 "Depth of load-path searches in site Lisp paths.")
|
|
47
|
460
|
48 (defvar paths-mule-load-path-depth 0
|
|
49 "Depth of load-path searches in Mule Lisp paths.")
|
|
50
|
428
|
51 (defvar paths-default-info-directories
|
|
52 (mapcar (function
|
|
53 (lambda (dirlist)
|
|
54 (paths-construct-path
|
|
55 dirlist (char-to-string directory-sep-char))))
|
|
56 '(("usr" "local" "info")
|
|
57 ("usr" "info")
|
|
58 ("usr" "local" "share" "info")
|
|
59 ("usr" "share" "info")))
|
|
60 "Directories appended to the end of the info path by default.")
|
|
61
|
|
62 (defun paths-find-site-lisp-directory (roots)
|
|
63 "Find the site Lisp directory of the XEmacs hierarchy."
|
|
64 (paths-find-site-directory roots "site-lisp"
|
|
65 nil
|
|
66 configure-site-directory))
|
|
67
|
|
68 (defun paths-find-site-module-directory (roots)
|
|
69 "Find the site modules directory of the XEmacs hierarchy."
|
|
70 (paths-find-site-directory roots "site-modules"
|
|
71 nil
|
|
72 configure-site-module-directory))
|
|
73
|
|
74 (defun paths-find-lisp-directory (roots)
|
|
75 "Find the main Lisp directory of the XEmacs hierarchy."
|
|
76 (paths-find-version-directory roots "lisp"
|
|
77 nil
|
|
78 configure-lisp-directory))
|
|
79
|
460
|
80 (defun paths-find-mule-lisp-directory (roots &optional lisp-directory)
|
|
81 "Find the Mule Lisp directory of the XEmacs hierarchy."
|
|
82 ;; #### kludge
|
|
83 (if lisp-directory
|
|
84 (let ((guess
|
|
85 (file-name-as-directory
|
|
86 (paths-construct-path (list lisp-directory "mule")))))
|
|
87 (if (paths-file-readable-directory-p guess)
|
|
88 guess
|
|
89 (paths-find-version-directory roots "mule-lisp"
|
|
90 nil
|
|
91 configure-mule-lisp-directory)))))
|
|
92
|
428
|
93 (defun paths-find-module-directory (roots)
|
|
94 "Find the main modules directory of the XEmacs hierarchy."
|
|
95 (paths-find-architecture-directory roots "modules"
|
|
96 nil configure-module-directory))
|
|
97
|
|
98 (defun paths-construct-load-path
|
|
99 (roots early-package-load-path late-package-load-path last-package-load-path
|
|
100 lisp-directory
|
460
|
101 &optional site-lisp-directory mule-lisp-directory)
|
428
|
102 "Construct the load path."
|
|
103 (let* ((envvar-value (getenv "EMACSLOADPATH"))
|
|
104 (env-load-path
|
|
105 (and envvar-value
|
|
106 (paths-decode-directory-path envvar-value 'drop-empties)))
|
|
107 (site-lisp-load-path
|
|
108 (and site-lisp-directory
|
|
109 (paths-find-recursive-load-path (list site-lisp-directory)
|
452
|
110 paths-site-load-path-depth)))
|
460
|
111 (mule-lisp-load-path
|
|
112 (and mule-lisp-directory
|
|
113 (paths-find-recursive-load-path (list mule-lisp-directory)
|
|
114 paths-mule-load-path-depth)))
|
428
|
115 (lisp-load-path
|
|
116 (and lisp-directory
|
|
117 (paths-find-recursive-load-path (list lisp-directory)
|
452
|
118 paths-core-load-path-depth))))
|
428
|
119 (append env-load-path
|
|
120 early-package-load-path
|
|
121 site-lisp-load-path
|
|
122 late-package-load-path
|
460
|
123 mule-lisp-load-path
|
428
|
124 lisp-load-path
|
|
125 last-package-load-path)))
|
|
126
|
|
127 (defun paths-construct-module-load-path
|
|
128 (root module-directory &optional site-module-directory)
|
|
129 "Construct the modules load path."
|
|
130 (let* ((envvar-value (getenv "EMACSMODULEPATH"))
|
|
131 (env-module-path
|
|
132 (and envvar-value
|
|
133 (paths-decode-directory-path envvar-value 'drop-empties)))
|
|
134 (site-module-load-path
|
|
135 (and site-module-directory
|
|
136 (paths-find-recursive-load-path (list site-module-directory)
|
452
|
137 paths-site-load-path-depth)))
|
428
|
138 (module-load-path
|
|
139 (and module-directory
|
|
140 (paths-find-recursive-load-path (list module-directory)
|
452
|
141 paths-core-load-path-depth))))
|
428
|
142 (append env-module-path
|
|
143 site-module-load-path
|
|
144 module-load-path)))
|
|
145
|
|
146 (defun paths-construct-info-path (roots early-packages late-packages last-packages)
|
|
147 "Construct the info path."
|
|
148 (let ((info-path-envval (getenv "INFOPATH")))
|
|
149 (paths-uniq-append
|
|
150 (append
|
|
151 (let ((info-directory
|
|
152 (paths-find-version-directory roots "info"
|
|
153 nil
|
|
154 configure-info-directory)))
|
|
155 (and info-directory
|
|
156 (list info-directory)))
|
|
157 (packages-find-package-info-path early-packages)
|
|
158 (packages-find-package-info-path late-packages)
|
|
159 (packages-find-package-info-path last-packages)
|
|
160 (and info-path-envval
|
|
161 (paths-decode-directory-path info-path-envval 'drop-empties)))
|
|
162 (and (null info-path-envval)
|
|
163 (paths-uniq-append
|
|
164 (paths-directories-which-exist configure-info-path)
|
|
165 (paths-directories-which-exist paths-default-info-directories))))))
|
|
166
|
|
167 (defun paths-find-doc-directory (roots)
|
|
168 "Find the documentation directory."
|
|
169 (paths-find-architecture-directory roots "lib-src" nil configure-doc-directory))
|
|
170
|
|
171 (defun paths-find-exec-directory (roots)
|
|
172 "Find the binary directory."
|
|
173 (paths-find-architecture-directory roots "lib-src"
|
|
174 nil configure-exec-directory))
|
|
175
|
|
176 (defun paths-construct-exec-path (roots exec-directory
|
|
177 early-packages late-packages last-packages)
|
|
178 "Find the binary path."
|
|
179 (append
|
|
180 (let ((path-envval (getenv "PATH")))
|
|
181 (if path-envval
|
|
182 (paths-decode-directory-path path-envval 'drop-empties)))
|
|
183 (packages-find-package-exec-path early-packages)
|
|
184 (packages-find-package-exec-path late-packages)
|
|
185 (let ((emacspath-envval (getenv "EMACSPATH")))
|
|
186 (and emacspath-envval
|
|
187 (split-path emacspath-envval)))
|
|
188 (and exec-directory
|
|
189 (list exec-directory))
|
|
190 (packages-find-package-exec-path last-packages)))
|
|
191
|
|
192 (defun paths-find-data-directory (roots)
|
|
193 "Find the data directory."
|
|
194 (paths-find-version-directory roots "etc" "EMACSDATA" configure-data-directory))
|
|
195
|
|
196 (defun paths-construct-data-directory-list (data-directory
|
|
197 early-packages late-packages last-packages)
|
|
198 "Find the data path."
|
|
199 (append
|
|
200 (packages-find-package-data-path early-packages)
|
|
201 (packages-find-package-data-path late-packages)
|
|
202 (list data-directory)
|
|
203 (packages-find-package-data-path last-packages)))
|
|
204
|
|
205 ;;; setup-paths.el ends here
|