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"))
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)
99 (and (setq prefix (prog1
100 ;; Avoid using `pop'.
101 ;; (pop command-line-args-left)
102 (car command-line-args-left)
103 (setq command-line-args-left
104 (cdr command-line-args-left))))
105 (or (string-equal "NONE" prefix)
106 (setq PREFIX prefix)))
107 (and (setq lisp-dir (prog1
108 (car command-line-args-left)
109 (setq command-line-args-left
110 (cdr command-line-args-left))))
111 (or (string-equal "NONE" lisp-dir)
112 (setq LISPDIR lisp-dir)))
113 (and (setq version-specific-lisp-dir
115 (car command-line-args-left)
116 (setq command-line-args-left
117 (cdr command-line-args-left))))
118 (or (string-equal "NONE" version-specific-lisp-dir)
119 (setq VERSION_SPECIFIC_LISPDIR version-specific-lisp-dir))))
120 ;; Load some APEL modules from this directory.
121 (defvar default-load-path load-path)
122 (setq load-path (cons (expand-file-name ".") load-path))
127 ;; We use `module-installed-p' in "EMU-ELS".
128 ;; Import `apel-modules'.
129 (load-file "APEL-ELS")
130 ;; Import `emu-modules' and `emu-modules-to-compile'.
131 (load-file "EMU-ELS")
133 ;; Set PREFIX, LISPDIR, and VERSION_SPECIFIC_LISPDIR if not set yet.
135 (setq PREFIX install-prefix))
137 (setq LISPDIR (install-detect-elisp-directory PREFIX)))
138 (or VERSION_SPECIFIC_LISPDIR
139 (setq VERSION_SPECIFIC_LISPDIR
140 (install-detect-elisp-directory PREFIX nil 'version-specific)))
141 ;; The directories where APEL and EMU will be installed.
143 (setq APEL_DIR (expand-file-name APEL_PREFIX LISPDIR)))
145 (setq EMU_DIR (expand-file-name EMU_PREFIX VERSION_SPECIFIC_LISPDIR)))
146 (princ (format "\nLISPDIR=%s\n" LISPDIR))
147 (princ (format "VERSION_SPECIFIC_LISPDIR=%s\n" VERSION_SPECIFIC_LISPDIR)))
149 (defun compile-apel ()
151 ;; Compile emu modules first.
152 (compile-elisp-modules emu-modules-to-compile ".")
153 (compile-elisp-modules apel-modules "."))
155 (defun install-apel ()
157 (let ((just-print (install-just-print-p)))
158 (install-elisp-modules emu-modules "." EMU_DIR just-print)
159 (install-elisp-modules apel-modules "." APEL_DIR just-print)))
161 ;; For XEmacs package system.
162 (defun config-apel-package ()
163 ;; Override everything you want.
164 (load-file "APEL-CFG")
165 ;; Override PACKAGEDIR with command-line option.
167 (and (setq package-dir (prog1
168 (car command-line-args-left)
169 (setq command-line-args-left
170 (cdr command-line-args-left))))
171 (or (string= "NONE" package-dir)
172 (setq PACKAGEDIR package-dir))))
173 ;; Load some APEL modules from this directory.
174 (defvar default-load-path load-path)
175 (setq load-path (cons (expand-file-name ".") load-path))
180 ;; We use `module-installed-p' in "EMU-ELS".
181 ;; Import `apel-modules'.
182 (load-file "APEL-ELS")
183 ;; Import `emu-modules' and `emu-modules-to-compile'.
184 (load-file "EMU-ELS")
186 ;; Set PACKAGEDIR if not set yet.
189 (if (boundp 'early-packages)
190 (let ((dirs (append (if early-package-load-path
192 (if late-package-load-path
194 (if last-package-load-path
197 (while (not (file-exists-p (setq dir (car dirs))))
198 (setq dirs (cdr dirs)))
201 (princ (format "\nPACKAGEDIR=%s\n" PACKAGEDIR))
202 (error "XEmacs package system is not available")))
204 (defun compile-apel-package ()
205 (config-apel-package)
206 ;; Compile emu modules first.
207 (compile-elisp-modules emu-modules-to-compile ".")
208 (compile-elisp-modules apel-modules "."))
210 (defun install-apel-package ()
211 (config-apel-package)
212 (let ((just-print (install-just-print-p))
213 (dir (expand-file-name APEL_PREFIX
214 (expand-file-name "lisp" PACKAGEDIR))))
215 (install-elisp-modules emu-modules "." dir just-print)
216 (install-elisp-modules apel-modules "." dir just-print)
217 (install-update-package-files "apel" dir just-print)))
219 (defun what-where-apel ()
222 The files that belong to the EMU modules:
226 The files that belong to the APEL modules:
230 Do `make elc', `make install', `make package', or `make install-package'.
232 (mapconcat (function symbol-name) emu-modules ", ")
234 (mapconcat (function symbol-name) apel-modules ", ")
237 ;;; APEL-MK ends here