Don't load poe twice;
[elisp/mu-cite.git] / MU-MK
1 ;;; -*-Emacs-Lisp-*-
2
3 ;; MU-MK: installer for mu-cite.
4
5 ;;; Code:
6
7 (defun config-mu ()
8   (let (prefix lisp-dir version-specific-lisp-dir)
9     (and (setq prefix (car command-line-args-left))
10          (or (string-equal "NONE" prefix)
11              (defvar PREFIX prefix)))
12     (setq command-line-args-left (cdr command-line-args-left))
13     (and (setq lisp-dir (car command-line-args-left))
14          (or (string-equal "NONE" lisp-dir)
15              (defvar LISPDIR lisp-dir)))
16     (setq command-line-args-left (cdr command-line-args-left))
17     (and (setq version-specific-lisp-dir (car command-line-args-left))
18          (or (string-equal "NONE" version-specific-lisp-dir)
19              (progn
20                (defvar VERSION_SPECIFIC_LISPDIR version-specific-lisp-dir)
21                (princ (format "VERSION_SPECIFIC_LISPDIR=%s\n"
22                               VERSION_SPECIFIC_LISPDIR)))))
23     (setq command-line-args-left (cdr command-line-args-left))
24     (load-file "MU-CFG")
25     (load-file "MU-ELS")
26     (princ (format "PREFIX=%s
27 LISPDIR=%s\n" PREFIX LISPDIR))))
28
29 (defun compile-mu ()
30   (config-mu)
31   (compile-elisp-modules mu-modules-to-compile "."))
32
33 (defun install-mu ()
34   (config-mu)
35   (install-elisp-modules mu-modules "./" MU_DIR))
36
37 (defun config-mu-package ()
38   (let (package-dir)
39     (and (setq package-dir (car command-line-args-left))
40          (or (string= "NONE" package-dir)
41              (defvar PACKAGEDIR package-dir)))
42     (setq command-line-args-left (cdr command-line-args-left))
43     (load-file "MU-CFG")
44     (load-file "MU-ELS")
45     (setq mu-modules-to-compile (append mu-modules-to-compile
46                                         '(auto-autoloads custom-load)))
47     (setq mu-modules (append mu-modules-to-compile
48                              mu-modules-not-to-compile))
49     (princ (format "PACKAGEDIR=%s\n" PACKAGEDIR))))
50
51 (defun compile-mu-package ()
52   (config-mu-package)
53
54   (if (fboundp 'batch-update-directory-autoloads)
55       ;; XEmacs 21.5.19 and newer.
56       (progn
57         (add-to-list 'command-line-args-left ".")
58         (add-to-list 'command-line-args-left "mu")
59         (batch-update-directory-autoloads))
60     (setq autoload-package-name "mu")
61     (add-to-list 'command-line-args-left ".")
62     (batch-update-directory))
63
64   (add-to-list 'command-line-args-left ".")
65   (Custom-make-dependencies)
66
67   (compile-elisp-modules mu-modules-to-compile "."))
68
69 (defun install-mu-package ()
70   (config-mu-package)
71   (install-elisp-modules mu-modules
72                          "./"
73                          (expand-file-name MU_PREFIX
74                                            (expand-file-name "lisp"
75                                                              PACKAGEDIR))))
76
77 (load "bytecomp" nil t)
78
79 (if (fboundp 'byte-compile-file-form-custom-declare-variable)
80     nil
81   ;; Bind defcustom'ed variables when byte-compiling.
82   (put 'custom-declare-variable 'byte-hunk-handler
83        'byte-compile-file-form-custom-declare-variable)
84   (defun byte-compile-file-form-custom-declare-variable (form)
85     (if (memq 'free-vars byte-compile-warnings)
86         (setq byte-compile-bound-variables
87               (cons (nth 1 (nth 1 form)) byte-compile-bound-variables)))
88     form))
89
90 (cond ((featurep 'xemacs)
91        ;; Shut up!
92        (setq byte-compile-warnings
93              (delq 'unused-vars
94                    (copy-sequence byte-compile-default-warnings))))
95       ((and (boundp 'emacs-major-version)
96             (or (> emacs-major-version 20)
97                 (and (eq emacs-major-version 20)
98                      (>= emacs-minor-version 3))))
99        ;; Compiler macro for replacing `sref' with `aref'.
100        (put 'sref 'byte-optimizer
101             (lambda (form)
102               (cons 'aref (cdr form))))))
103
104 ;;; MU-MK ends here