428
|
1 ;;; make-docfile.el --- Cache docstrings in external file
|
|
2
|
|
3 ;; Copyright (C) 1985, 1986, 1992-1995, 1997 Free Software Foundation, Inc.
|
814
|
4 ;; Copyright (C) 2002 Ben Wing.
|
428
|
5
|
|
6 ;; Author: Unknown
|
|
7 ;; Maintainer: Steven L Baur <steve@xemacs.org>
|
|
8 ;; Keywords: internal
|
|
9
|
|
10 ;; This file is part of XEmacs.
|
|
11
|
|
12 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
13 ;; under the terms of the GNU General Public License as published by
|
|
14 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
15 ;; any later version.
|
|
16
|
|
17 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
20 ;; General Public License for more details.
|
|
21
|
|
22 ;; You should have received a copy of the GNU General Public License
|
|
23 ;; along with XEmacs; see the file COPYING. If not, write to the Free
|
|
24 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
25 ;; 02111-1307, USA.
|
|
26
|
|
27 ;;; Synched up with: Not in FSF
|
|
28
|
|
29 ;;; Commentary:
|
|
30
|
|
31 ;; This is a front-end to the make-docfile program that gathers up all the
|
|
32 ;; lisp files that will be dumped with XEmacs. It would probably be best
|
|
33 ;; to just move make-docfile.c completely to lisp and be done with it.
|
|
34
|
|
35 ;;; Code:
|
|
36
|
|
37 (defvar options nil)
|
|
38 (defvar processed nil)
|
|
39 (defvar docfile nil)
|
|
40 (defvar docfile-buffer nil)
|
|
41 (defvar site-file-list nil)
|
|
42 (defvar docfile-out-of-date nil)
|
|
43
|
|
44 ;; Gobble up the stuff we don't wish to pass on.
|
|
45 (setq command-line-args (cdr (cdr (cdr (cdr command-line-args)))))
|
|
46
|
|
47 ;; First gather up the command line options.
|
|
48 (let (done)
|
|
49 (while (and (null done) command-line-args)
|
|
50 (let ((arg (car command-line-args)))
|
|
51 (cond ((or (string-equal arg "-o") ; Specify DOC file name
|
|
52 (string-equal arg "-a") ; Append to DOC file
|
|
53 (string-equal arg "-d")) ; Set working directory
|
|
54 (if (string-equal arg "-o")
|
|
55 (setq docfile (expand-file-name (car (cdr command-line-args)))))
|
|
56 (setq options (cons arg options))
|
|
57 (setq options (cons (expand-file-name (car (cdr command-line-args))) options)))
|
|
58 ((string-equal arg "-i") ; Set site files to scan
|
|
59 (setq site-file-list (car (cdr command-line-args))))
|
|
60 (t (setq done t)))
|
|
61 (if (null done)
|
|
62 (setq command-line-args (cdr (cdr command-line-args)))))))
|
|
63 (setq options (nreverse options))
|
|
64
|
|
65 ;; (print (concat "Options: " (prin1-to-string options)))
|
|
66
|
|
67 ;; Next process the list of C files.
|
|
68 (while command-line-args
|
|
69 (let ((arg (car command-line-args)))
|
|
70 (if (null (member arg processed))
|
|
71 (progn
|
|
72 (if (and (null docfile-out-of-date)
|
|
73 (file-newer-than-file-p arg docfile))
|
|
74 (setq docfile-out-of-date t))
|
|
75 (setq processed (cons arg processed)))))
|
|
76 (setq command-line-args (cdr command-line-args)))
|
|
77
|
|
78 ;; Then process the list of Lisp files.
|
442
|
79 (let ((build-root (expand-file-name ".." invocation-directory)))
|
|
80 (setq load-path (list (expand-file-name "lisp" build-root))))
|
428
|
81
|
|
82 (load "very-early-lisp" nil t)
|
|
83
|
|
84 ;; Then process the autoloads
|
|
85 (setq autoload-file-name "auto-autoloads.elc")
|
|
86 (load "find-paths.el")
|
|
87 (load "packages.el")
|
|
88 (load "setup-paths.el")
|
|
89 (load "dump-paths.el")
|
442
|
90 (require 'custom)
|
|
91 (load "process")
|
814
|
92 ;; need for stuff called from C by process code
|
|
93 (if (featurep 'windows-nt) (load "win32-native"))
|
428
|
94
|
|
95 (let (preloaded-file-list)
|
|
96 (load (expand-file-name "../lisp/dumped-lisp.el"))
|
|
97
|
|
98 (let ((package-preloaded-file-list
|
|
99 (packages-collect-package-dumped-lisps late-package-load-path)))
|
|
100
|
|
101 (setq preloaded-file-list
|
|
102 (append package-preloaded-file-list
|
|
103 preloaded-file-list
|
|
104 packages-hardcoded-lisp)))
|
|
105
|
|
106 (while preloaded-file-list
|
|
107 (let ((arg0 (packages-add-suffix (car preloaded-file-list)))
|
|
108 arg)
|
|
109 (setq arg (locate-library arg0))
|
|
110 (if (null arg)
|
|
111 (progn
|
|
112 (princ (format "Error: dumped file %s does not exist\n" arg0))
|
|
113 ;; Uncomment in case of difficulties
|
|
114 ;;(print (format "late-packages: %S" late-packages))
|
|
115 ;;(print (format "guessed-roots: %S" (paths-find-emacs-roots invocation-directory invocation-name)))
|
|
116 )
|
|
117 (if (null (member arg processed))
|
|
118 (progn
|
|
119 (if (and (null docfile-out-of-date)
|
|
120 (file-newer-than-file-p arg docfile))
|
|
121 (setq docfile-out-of-date t))
|
|
122 (setq processed (cons arg processed)))))
|
|
123 (setq preloaded-file-list (cdr preloaded-file-list)))))
|
|
124
|
|
125 ;; Finally process the list of site-loaded files.
|
|
126 (if site-file-list
|
|
127 (let (site-load-packages)
|
|
128 (load site-file-list t t)
|
|
129 (while site-load-packages
|
|
130 (let ((arg (car site-load-packages)))
|
|
131 (if (null (member arg processed))
|
|
132 (progn
|
|
133 (if (and (null docfile-out-of-date)
|
|
134 (file-newer-than-file-p arg docfile))
|
|
135 (setq docfile-out-of-date t))
|
|
136 (setq processed (cons arg processed)))))
|
|
137 (setq site-load-packages (cdr site-load-packages)))))
|
|
138
|
|
139 ;(let ((autoloads (packages-list-autoloads-path)))
|
|
140 ; ;; (print (concat "Autoloads: " (prin1-to-string autoloads)))
|
|
141 ; (while autoloads
|
|
142 ; (let ((arg (car autoloads)))
|
|
143 ; (if (null (member arg processed))
|
|
144 ; (progn
|
|
145 ; ;; (print arg)
|
|
146 ; (if (and (null docfile-out-of-date)
|
|
147 ; (file-newer-than-file-p arg docfile))
|
|
148 ; (setq docfile-out-of-date t))
|
|
149 ; (setq processed (cons arg processed))))
|
|
150 ; (setq autoloads (cdr autoloads)))))
|
|
151
|
|
152 ;; Now fire up make-docfile and we're done
|
|
153
|
|
154 (setq processed (nreverse processed))
|
|
155
|
|
156 ;; (print (prin1-to-string (append options processed)))
|
|
157
|
|
158 (if docfile-out-of-date
|
|
159 (progn
|
|
160 (princ "Spawning make-docfile ...")
|
|
161 ;; (print (prin1-to-string (append options processed)))
|
|
162
|
|
163 (setq exec-path (list (concat default-directory "../lib-src")))
|
|
164
|
|
165 ;; (locate-file-clear-hashing nil)
|
|
166 (if (memq system-type '(berkeley-unix next-mach))
|
|
167 ;; Suboptimal, but we have a unresolved bug somewhere in the
|
814
|
168 ;; low-level process code. #### Now that we've switched to using
|
|
169 ;; the regular asynch process code, we should try removing this.
|
428
|
170 (call-process-internal
|
|
171 "/bin/csh"
|
|
172 nil
|
|
173 t
|
|
174 nil
|
|
175 "-fc"
|
|
176 (mapconcat
|
|
177 #'identity
|
|
178 (append
|
|
179 (list (concat default-directory "../lib-src/make-docfile"))
|
|
180 options processed)
|
|
181 " "))
|
|
182 ;; (print (prin1-to-string (append options processed)))
|
|
183 (apply 'call-process-internal
|
|
184 ;; (concat default-directory "../lib-src/make-docfile")
|
|
185 "make-docfile"
|
|
186 nil
|
|
187 t
|
|
188 nil
|
|
189 (append options processed)))
|
|
190
|
|
191 (princ "Spawning make-docfile ...done\n")
|
|
192 ;; (write-region-internal (point-min) (point-max) "/tmp/DOC")
|
|
193 )
|
|
194 (princ "DOC file is up to date\n"))
|
|
195
|
|
196 (kill-emacs)
|
|
197
|
|
198 ;;; make-docfile.el ends here
|