comparison lisp/setup-paths.el @ 428:3ecd8885ac67 r21-2-22

Import from CVS: tag r21-2-22
author cvs
date Mon, 13 Aug 2007 11:28:15 +0200
parents
children abe6d1db359e
comparison
equal deleted inserted replaced
427:0a0253eac470 428:3ecd8885ac67
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
34 ;; This file describes and constructs the various paths into the
35 ;; XEmacs hierarchy from a global viewpoint.
36
37 ;; It requires find-paths.el and packages.el.
38
39 ;;; Code:
40
41 (defvar paths-load-path-depth 1
42 "Depth of load-path searches in core Lisp paths.")
43
44 (defvar paths-default-info-directories
45 (mapcar (function
46 (lambda (dirlist)
47 (paths-construct-path
48 dirlist (char-to-string directory-sep-char))))
49 '(("usr" "local" "info")
50 ("usr" "info")
51 ("usr" "local" "share" "info")
52 ("usr" "share" "info")))
53 "Directories appended to the end of the info path by default.")
54
55 (defun paths-find-site-lisp-directory (roots)
56 "Find the site Lisp directory of the XEmacs hierarchy."
57 (paths-find-site-directory roots "site-lisp"
58 nil
59 configure-site-directory))
60
61 (defun paths-find-site-module-directory (roots)
62 "Find the site modules directory of the XEmacs hierarchy."
63 (paths-find-site-directory roots "site-modules"
64 nil
65 configure-site-module-directory))
66
67 (defun paths-find-lisp-directory (roots)
68 "Find the main Lisp directory of the XEmacs hierarchy."
69 (paths-find-version-directory roots "lisp"
70 nil
71 configure-lisp-directory))
72
73 (defun paths-find-module-directory (roots)
74 "Find the main modules directory of the XEmacs hierarchy."
75 (paths-find-architecture-directory roots "modules"
76 nil configure-module-directory))
77
78 (defun paths-construct-load-path
79 (roots early-package-load-path late-package-load-path last-package-load-path
80 lisp-directory
81 &optional site-lisp-directory)
82 "Construct the load path."
83 (let* ((envvar-value (getenv "EMACSLOADPATH"))
84 (env-load-path
85 (and envvar-value
86 (paths-decode-directory-path envvar-value 'drop-empties)))
87 (site-lisp-load-path
88 (and site-lisp-directory
89 (paths-find-recursive-load-path (list site-lisp-directory)
90 paths-load-path-depth)))
91 (lisp-load-path
92 (and lisp-directory
93 (paths-find-recursive-load-path (list lisp-directory)
94 paths-load-path-depth))))
95 (append env-load-path
96 early-package-load-path
97 site-lisp-load-path
98 late-package-load-path
99 lisp-load-path
100 last-package-load-path)))
101
102 (defun paths-construct-module-load-path
103 (root module-directory &optional site-module-directory)
104 "Construct the modules load path."
105 (let* ((envvar-value (getenv "EMACSMODULEPATH"))
106 (env-module-path
107 (and envvar-value
108 (paths-decode-directory-path envvar-value 'drop-empties)))
109 (site-module-load-path
110 (and site-module-directory
111 (paths-find-recursive-load-path (list site-module-directory)
112 paths-load-path-depth)))
113 (module-load-path
114 (and module-directory
115 (paths-find-recursive-load-path (list module-directory)
116 paths-load-path-depth))))
117 (append env-module-path
118 site-module-load-path
119 module-load-path)))
120
121 (defun paths-construct-info-path (roots early-packages late-packages last-packages)
122 "Construct the info path."
123 (let ((info-path-envval (getenv "INFOPATH")))
124 (paths-uniq-append
125 (append
126 (let ((info-directory
127 (paths-find-version-directory roots "info"
128 nil
129 configure-info-directory)))
130 (and info-directory
131 (list info-directory)))
132 (packages-find-package-info-path early-packages)
133 (packages-find-package-info-path late-packages)
134 (packages-find-package-info-path last-packages)
135 (and info-path-envval
136 (paths-decode-directory-path info-path-envval 'drop-empties)))
137 (and (null info-path-envval)
138 (paths-uniq-append
139 (paths-directories-which-exist configure-info-path)
140 (paths-directories-which-exist paths-default-info-directories))))))
141
142 (defun paths-find-doc-directory (roots)
143 "Find the documentation directory."
144 (paths-find-architecture-directory roots "lib-src" nil configure-doc-directory))
145
146 (defun paths-find-lock-directory (roots)
147 "Find the lock directory."
148 (defvar configure-lock-directory)
149 (paths-find-site-directory roots "lock" "EMACSLOCKDIR" configure-lock-directory))
150
151 (defun paths-find-superlock-file (lock-directory)
152 "Find the superlock file."
153 ;; #### There is no such variable configure-superlock-file!
154 (cond
155 ((null lock-directory)
156 nil)
157 ((and configure-superlock-file
158 (file-directory-p (file-name-directory configure-superlock-file)))
159 configure-superlock-file)
160 (t
161 (expand-file-name "!!!SuperLock!!!" lock-directory))))
162
163 (defun paths-find-exec-directory (roots)
164 "Find the binary directory."
165 (paths-find-architecture-directory roots "lib-src"
166 nil configure-exec-directory))
167
168 (defun paths-construct-exec-path (roots exec-directory
169 early-packages late-packages last-packages)
170 "Find the binary path."
171 (append
172 (let ((path-envval (getenv "PATH")))
173 (if path-envval
174 (paths-decode-directory-path path-envval 'drop-empties)))
175 (packages-find-package-exec-path early-packages)
176 (packages-find-package-exec-path late-packages)
177 (let ((emacspath-envval (getenv "EMACSPATH")))
178 (and emacspath-envval
179 (split-path emacspath-envval)))
180 (and exec-directory
181 (list exec-directory))
182 (packages-find-package-exec-path last-packages)))
183
184 (defun paths-find-data-directory (roots)
185 "Find the data directory."
186 (paths-find-version-directory roots "etc" "EMACSDATA" configure-data-directory))
187
188 (defun paths-construct-data-directory-list (data-directory
189 early-packages late-packages last-packages)
190 "Find the data path."
191 (append
192 (packages-find-package-data-path early-packages)
193 (packages-find-package-data-path late-packages)
194 (list data-directory)
195 (packages-find-package-data-path last-packages)))
196
197 ;;; setup-paths.el ends here