1 ;;; setup-paths.el --- setup various XEmacs paths
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
7 ;; Author: Mike Sperber <sperber@informatik.uni-tuebingen.de>
8 ;; Maintainer: XEmacs Development Team
9 ;; Keywords: internal, dumped
11 ;; This file is part of XEmacs.
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)
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.
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.
28 ;;; Synched up with: Not in FSF.
32 ;; This file is dumped with XEmacs.
34 ;; This file describes and constructs the various paths into the
35 ;; XEmacs hierarchy from a global viewpoint.
37 ;; It requires find-paths.el and packages.el.
41 (defvar paths-load-path-depth 1
42 "Depth of load-path searches in core Lisp paths.")
44 (defvar paths-default-info-directories
48 dirlist (char-to-string directory-sep-char))))
49 '(("usr" "local" "info")
51 ("usr" "local" "share" "info")
52 ("usr" "share" "info")))
53 "Directories appended to the end of the info path by default.")
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"
59 configure-site-directory))
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"
65 configure-site-module-directory))
67 (defun paths-find-lisp-directory (roots)
68 "Find the main Lisp directory of the XEmacs hierarchy."
69 (paths-find-version-directory roots "lisp"
71 configure-lisp-directory))
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))
78 (defun paths-construct-load-path
79 (roots early-package-load-path late-package-load-path last-package-load-path
81 &optional site-lisp-directory)
82 "Construct the load path."
83 (let* ((envvar-value (getenv "EMACSLOADPATH"))
86 (paths-decode-directory-path envvar-value 'drop-empties)))
88 (and site-lisp-directory
89 (paths-find-recursive-load-path (list site-lisp-directory)
90 paths-load-path-depth)))
93 (paths-find-recursive-load-path (list lisp-directory)
94 paths-load-path-depth))))
96 early-package-load-path
98 late-package-load-path
100 last-package-load-path)))
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"))
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)))
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
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")))
126 (let ((info-directory
127 (paths-find-version-directory roots "info"
129 configure-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)
139 (paths-directories-which-exist configure-info-path)
140 (paths-directories-which-exist paths-default-info-directories))))))
142 (defun paths-find-doc-directory (roots)
143 "Find the documentation directory."
144 (paths-find-architecture-directory roots "lib-src" nil configure-doc-directory))
146 (defun paths-find-exec-directory (roots)
147 "Find the binary directory."
148 (paths-find-architecture-directory roots "lib-src"
149 nil configure-exec-directory))
151 (defun paths-construct-exec-path (roots exec-directory
152 early-packages late-packages last-packages)
153 "Find the binary path."
155 (let ((path-envval (getenv "PATH")))
157 (paths-decode-directory-path path-envval 'drop-empties)))
158 (packages-find-package-exec-path early-packages)
159 (packages-find-package-exec-path late-packages)
160 (let ((emacspath-envval (getenv "EMACSPATH")))
161 (and emacspath-envval
162 (split-path emacspath-envval)))
164 (list exec-directory))
165 (packages-find-package-exec-path last-packages)))
167 (defun paths-find-data-directory (roots)
168 "Find the data directory."
169 (paths-find-version-directory roots "etc" "EMACSDATA" configure-data-directory))
171 (defun paths-construct-data-directory-list (data-directory
172 early-packages late-packages last-packages)
173 "Find the data path."
175 (packages-find-package-data-path early-packages)
176 (packages-find-package-data-path late-packages)
177 (list data-directory)
178 (packages-find-package-data-path last-packages)))
180 ;;; setup-paths.el ends here