1 ;;; APEL-MK --- installer for APEL. -*-Emacs-Lisp-*-
5 ;; DON'T EDIT THIS FILE; edit APEL-CFG instead.
9 ;;; Configuration variables.
11 ;; Set these four variables in "APEL-CFG" or in "Makefile".
13 ;; This variable will be detected automatically.
16 ;; This variable will be detected automatically using PREFIX.
17 ;; v18: (no standard site-lisp directory)
18 ;; Emacs 19.28 and earlier: "PREFIX/lib/emacs/site-lisp"
19 ;; Emacs 19.29 and later: "PREFIX/share/emacs/site-lisp"
22 ;; This variable will be detected automatically using PREFIX.
23 ;; Emacs 19.31 and later: "PREFIX/share/emacs/VERSION/site-lisp"
24 (defvar VERSION_SPECIFIC_LISPDIR nil)
26 ;; This variable will be detected automatically.
27 ;; XEmacs 21.0 and later: "/usr/local/lib/xemacs/xemacs-packages"
28 (defvar PACKAGEDIR nil)
30 ;; Install APEL modules to "apel" subdirectory.
31 (defvar APEL_PREFIX "apel")
33 ;; Install EMU modules to "emu" subdirectory if emacs supports some features.
34 ;; If your emacs does not have `normal-top-level-add-subdirs-to-load-path'
35 ;; but have `normal-top-level-add-to-load-path' and you want to use it in
36 ;; "subdirs.el", put the following line to "APEL-CFG".
37 ;; (setq EMU_PREFIX "emu")
39 (if (or (featurep 'xemacs)
40 (fboundp 'normal-top-level-add-subdirs-to-load-path))
41 ;; Make "emu" subdirectory.
43 ;; Don't make "emu" subdirectory.
46 ;; The directories where APEL and EMU modules will be installed.
47 ;; These two variables will be generated from other variables above.
48 (defvar APEL_DIR nil) ; LISPDIR/APEL_PREFIX
49 (defvar EMU_DIR nil) ; VERSION_SPECIFIC_LISPDIR/EMU_PREFIX
52 ;;; Utilities. (XXX: should be moved to install.el ?)
54 (defun install-just-print-p ()
55 (let ((flag (getenv "MAKEFLAGS"))
56 (case-fold-search nil))
57 (princ (format "%s\n" flag))
59 (string-match "^\\(\\(--[^ ]+ \\)+-\\|[^ =-]\\)*n" flag))))
61 (defun install-update-package-files (package dir &optional just-print)
64 (princ (format "Updating autoloads in directory %s..\n\n" dir))
66 (princ (format "Processing %s\n" dir))
67 (princ "Generating custom-load.el...\n\n")
69 (princ (format "Compiling %s...\n"
70 (expand-file-name "auto-autoloads.el" dir)))
71 (princ (format "Wrote %s\n"
72 (expand-file-name "auto-autoloads.elc" dir)))
74 (princ (format "Compiling %s...\n"
75 (expand-file-name "custom-load.el" dir)))
76 (princ (format "Wrote %s\n"
77 (expand-file-name "custom-load.elc" dir))))
79 (setq autoload-package-name package)
81 (let ((command-line-args-left (list dir)))
82 (batch-update-directory))
84 (let ((command-line-args-left (list dir)))
85 (Custom-make-dependencies))
87 (byte-compile-file (expand-file-name "auto-autoloads.el" dir))
88 (byte-compile-file (expand-file-name "custom-load.el" dir)))))
91 ;;; Configure, Compile, and Install.
94 ;; Override everything you want.
95 (load-file "APEL-CFG")
96 ;; Override PREFIX, LISPDIR, and VERSION_SPECIFIC_LISPDIR with
97 ;; command-line options.
98 (let (prefix lisp-dir version-specific-lisp-dir)
100 ;; Avoid using `pop'.
101 ;; (pop command-line-args-left)
103 (car command-line-args-left)
104 (setq command-line-args-left
105 (cdr command-line-args-left))))
106 (or (string-equal "NONE" prefix)
107 (setq PREFIX prefix)))
109 ;; Avoid using `pop'.
110 ;; (pop command-line-args-left)
112 (car command-line-args-left)
113 (setq command-line-args-left
114 (cdr command-line-args-left))))
115 (or (string-equal "NONE" lisp-dir)
116 (setq LISPDIR lisp-dir)))
117 (and (setq version-specific-lisp-dir
118 ;; Avoid using `pop'.
119 ;; (pop command-line-args-left)
121 (car command-line-args-left)
122 (setq command-line-args-left
123 (cdr command-line-args-left))))
124 (or (string-equal "NONE" version-specific-lisp-dir)
125 (setq VERSION_SPECIFIC_LISPDIR version-specific-lisp-dir))))
126 ;; Load some APEL modules from this directory.
127 (defvar default-load-path load-path)
128 (setq load-path (cons (expand-file-name ".") load-path))
133 ;; Import `apel-modules'.
134 (load-file "APEL-ELS")
135 ;; Import `emu-modules' and `emu-modules-to-compile'.
136 (load-file "EMU-ELS")
138 ;; Set PREFIX, LISPDIR, and VERSION_SPECIFIC_LISPDIR if not set yet.
140 (setq PREFIX install-prefix))
142 (setq LISPDIR (install-detect-elisp-directory PREFIX)))
143 (or VERSION_SPECIFIC_LISPDIR
144 (setq VERSION_SPECIFIC_LISPDIR
145 (install-detect-elisp-directory PREFIX nil 'version-specific)))
146 ;; The directories where APEL and EMU will be installed.
148 (setq APEL_DIR (expand-file-name APEL_PREFIX LISPDIR)))
150 (setq EMU_DIR (expand-file-name EMU_PREFIX VERSION_SPECIFIC_LISPDIR)))
151 (princ (format "\nLISPDIR=%s\n" LISPDIR))
152 (princ (format "VERSION_SPECIFIC_LISPDIR=%s\n" VERSION_SPECIFIC_LISPDIR)))
154 (defun compile-apel ()
156 ;; Compile emu modules first.
157 (compile-elisp-modules emu-modules-to-compile ".")
158 (compile-elisp-modules apel-modules "."))
160 (defun install-apel ()
162 (let ((just-print (install-just-print-p)))
163 (install-elisp-modules emu-modules "." EMU_DIR just-print)
164 (install-elisp-modules apel-modules "." APEL_DIR just-print)))
166 ;; For XEmacs package system.
167 (defun config-apel-package ()
168 ;; Override everything you want.
169 (load-file "APEL-CFG")
170 ;; Override PACKAGEDIR with command-line option.
172 (and (setq package-dir
173 ;; Avoid using `pop'.
174 ;; (pop command-line-args-left)
176 (car command-line-args-left)
177 (setq command-line-args-left
178 (cdr command-line-args-left))))
179 (or (string= "NONE" package-dir)
180 (setq PACKAGEDIR package-dir))))
181 ;; Load some APEL modules from this directory.
182 (defvar default-load-path load-path)
183 (setq load-path (cons (expand-file-name ".") load-path))
188 ;; Import `apel-modules'.
189 (load-file "APEL-ELS")
190 ;; Import `emu-modules' and `emu-modules-to-compile'.
191 (load-file "EMU-ELS")
193 ;; Set PACKAGEDIR if not set yet.
196 (if (boundp 'early-packages)
197 (let ((dirs (append (if early-package-load-path
199 (if late-package-load-path
201 (if last-package-load-path
204 (while (not (file-exists-p (setq dir (car dirs))))
205 (setq dirs (cdr dirs)))
208 (princ (format "\nPACKAGEDIR=%s\n" PACKAGEDIR))
209 (error "XEmacs package system is not available")))
211 (defun compile-apel-package ()
212 (config-apel-package)
213 ;; Compile emu modules first.
214 (compile-elisp-modules emu-modules-to-compile ".")
215 (compile-elisp-modules apel-modules "."))
217 (defun install-apel-package ()
218 (config-apel-package)
219 (let ((just-print (install-just-print-p))
220 (dir (expand-file-name APEL_PREFIX
221 (expand-file-name "lisp" PACKAGEDIR))))
222 (install-elisp-modules emu-modules "." dir just-print)
223 (install-elisp-modules apel-modules "." dir just-print)
224 (install-update-package-files "apel" dir just-print)))
226 (defun what-where-apel ()
229 The files that belong to the EMU modules:
233 The files that belong to the APEL modules:
237 Do `make elc', `make install', `make package', or `make install-package'.
239 (mapconcat (function symbol-name) emu-modules ", ")
241 (mapconcat (function symbol-name) apel-modules ", ")
244 ;;; APEL-MK ends here