1 ;;; First things first - if they do not have the WIDGETDIR environment
2 ;;; variable set, choke, scream, and die.
5 (setq srcdir (or (getenv "W3SRCDIR") "."))
7 (push srcdir load-path)
8 (push (or (getenv "GNUSDIR") (expand-file-name "../../gnus/lisp/" srcdir))
10 (push (or (getenv "URLDIR") (expand-file-name "../../url/lisp/" srcdir))
13 (setq max-specpdl-size (* 1000 max-specpdl-size)
14 max-lisp-eval-depth (* 1000 max-lisp-eval-depth))
16 ;; If we are building w3 in a different directory than the source
17 ;; directory, we must read *.el from source directory and write *.elc
18 ;; into the building directory. For that, we define this function
19 ;; before loading bytecomp. Bytecomp doesn't overwrite this function.
20 (unless (featurep 'xemacs)
21 (defun byte-compile-dest-file (filename)
22 "Convert an Emacs Lisp source file name to a compiled file name.
23 In addition, remove directory name part from FILENAME."
24 (setq filename (byte-compiler-base-file-name filename))
25 (setq filename (file-name-sans-versions filename))
26 (setq filename (file-name-nondirectory filename))
27 (if (memq system-type '(win32 w32 mswindows windows-nt))
28 (setq filename (downcase filename)))
29 (cond ((eq system-type 'vax-vms)
30 (concat (substring filename 0 (string-match ";" filename)) "c"))
31 ((string-match emacs-lisp-file-regexp filename)
32 (concat (substring filename 0 (match-beginning 0)) ".elc"))
33 (t (concat filename ".elc")))))
37 ;; Emacs 19 byte compiler complains about too much stuff by default.
38 ;; Turn off most of the warnings here.
39 ;; XEmacs; warnings, please
40 (setq ; byte-compile-warnings nil
44 (let ((files (directory-files "." t ".*.[eE][lL]$" nil)))
46 (if (and (not (file-directory-p (car files)))
47 (not (string-match "w3-sysdp.el$" (car files))))
48 (byte-compile-file (car files)))
49 (setq files (cdr files)))))
51 (defun emacs-build-autoloads (dir autofile)
53 (let ((files (directory-files dir t ".*.[eE][lL]$" nil)))
57 (mapc 'generate-file-autoloads files)
58 (goto-char (point-max))
59 (insert "\n(provide 'w3-autoloads)\n")
61 (kill-buffer (current-buffer))))
63 ;; Now we need to munge that file to deal with
64 (find-file "w3-auto.el")
66 (insert-file-contents autofile)
67 (goto-char (point-min))
68 (while (re-search-forward "w3-autoloads" nil t)
69 (replace-match "w3-auto"))
71 (kill-buffer (current-buffer))
74 (defun emacs-batch-build-autoloads ()
75 (emacs-build-autoloads (nth 0 command-line-args-left)
76 (nth 1 command-line-args-left)))
78 (defun emacs-build-custom-load (dir)
82 (load-library "cus-dep")
83 (error (setq foundit nil)))
85 (let ((command-line-args-left (list dir)))
86 (Custom-make-dependencies))
87 (write-region "\n" nil "cus-load.el")))))
89 (defun emacs-batch-build-custom-load ()
90 (emacs-build-custom-load (car command-line-args-left)))
92 (or (fboundp 'declare-function)
93 (defmacro declare-function (function file &optional arglist fileonly)
94 `(autoload ',function ,file)))