1 ;;; APEL-MK --- installer for APEL. -*-Emacs-Lisp-*-
5 ;; DON'T EDIT THIS FILE; edit APEL-CFG instead.
9 ;;; Configuration variables.
11 ;; These two variables will be generated from other variables below.
15 ;; Install to "apel" subdirectory.
16 (defvar APEL_PREFIX "apel")
17 ;; Install to "emu" subdirectory if emacs supports some features.
19 (if (or (featurep 'xemacs)
20 (fboundp 'normal-top-level-add-subdirs-to-load-path))
21 ;; Install to "emu" subdirectory.
23 ;; If your emacs does not have `normal-top-level-add-subdirs-to-load-path'
24 ;; but have `normal-top-level-add-to-load-path' and you want to use it in
25 ;; "subdirs.el", put the following line to "APEL-CFG".
26 ;; (setq EMU_PREFIX "emu")
29 ;; We can load APEL modules safely;-)
30 (defvar default-load-path load-path)
31 (setq load-path (cons (expand-file-name ".") load-path))
36 ;; Override everything you want.
37 (load-file "APEL-CFG")
39 ;; The following four variables will be overrided by command line options.
40 (defvar PREFIX install-prefix)
41 ;; v18: (no standard site-lisp directory)
42 ;; Emacs 19.28 and earlier: "PREFIX/lib/emacs/site-lisp"
43 ;; Emacs 19.29 and later: "PREFIX/share/emacs/site-lisp"
45 (install-detect-elisp-directory PREFIX))
46 ;; Emacs 19.31 and later: "PREFIX/share/emacs/VERSION/site-lisp".
47 (defvar VERSION_SPECIFIC_LISPDIR
48 (install-detect-elisp-directory PREFIX nil 'version-specific))
49 ;; for XEmacs package system.
51 (if (boundp 'early-packages)
52 (let ((dirs (append (if early-package-load-path
54 (if late-package-load-path
56 (if last-package-load-path
59 (while (not (file-exists-p (setq dir (car dirs))))
60 (setq dirs (cdr dirs)))
64 ;;; Utilities. (XXX: should be moved to install.el ?)
66 (defun install-just-print-p ()
67 (let ((flag (getenv "MAKEFLAGS"))
69 (princ (format "%s\n" flag))
71 (string-match "^\\(\\(--[^ ]+ \\)+-\\|[^ =-]\\)*n" flag))))
73 (defun install-update-package-files (package dir &optional just-print)
76 (princ (format "Updating autoloads in directory %s..\n\n" dir))
78 (princ (format "Processing %s\n" dir))
79 (princ "Generating custom-load.el...\n\n")
81 (princ (format "Compiling %s...\n"
82 (expand-file-name "auto-autoloads.el" dir)))
83 (princ (format "Wrote %s\n"
84 (expand-file-name "auto-autoloads.elc" dir)))
86 (princ (format "Compiling %s...\n"
87 (expand-file-name "custom-load.el" dir)))
88 (princ (format "Wrote %s\n"
89 (expand-file-name "custom-load.elc" dir))))
91 (setq autoload-package-name package)
92 (add-to-list 'command-line-args-left dir)
93 (batch-update-directory)
95 (add-to-list 'command-line-args-left dir)
96 (Custom-make-dependencies)
98 (byte-compile-file (expand-file-name "auto-autoloads.el" dir))
99 (byte-compile-file (expand-file-name "custom-load.el" dir)))))
102 ;;; Configure, Compile, and Install.
104 (defun config-apel ()
105 (let (prefix lisp-dir version-specific-lisp-dir)
106 ;; override standard PREFIX, LISPDIR, and VERSION_SPECIFIC_LISPDIR
107 ;; with command-line options.
108 (and (setq prefix (prog1
109 ;; avoid using `pop'.
110 (car command-line-args-left)
111 (setq command-line-args-left
112 (cdr command-line-args-left))))
113 (or (string-equal "NONE" prefix)
114 (setq PREFIX prefix)))
115 (and (setq lisp-dir (prog1
116 (car command-line-args-left)
117 (setq command-line-args-left
118 (cdr command-line-args-left))))
119 (or (string-equal "NONE" lisp-dir)
120 (setq LISPDIR lisp-dir)))
121 (and (setq version-specific-lisp-dir
123 (car command-line-args-left)
124 (setq command-line-args-left
125 (cdr command-line-args-left))))
126 (or (string-equal "NONE" version-specific-lisp-dir)
127 (setq VERSION_SPECIFIC_LISPDIR version-specific-lisp-dir)))
128 ;; directories we actually use.
130 (setq APEL_DIR (expand-file-name APEL_PREFIX LISPDIR)))
132 (setq EMU_DIR (expand-file-name EMU_PREFIX VERSION_SPECIFIC_LISPDIR)))
133 ;; import `apel-modules'.
134 (load-file "APEL-ELS")
135 ;; import `emu-modules' and `emu-modules-to-compile'.
136 (load-file "EMU-ELS")
137 (princ (format "\nLISPDIR=%s\n" LISPDIR))
138 (princ (format "VERSION_SPECIFIC_LISPDIR=%s\n" VERSION_SPECIFIC_LISPDIR))))
140 (defun compile-apel ()
142 ;; compile emu modules first.
143 (compile-elisp-modules emu-modules-to-compile ".")
144 (compile-elisp-modules apel-modules "."))
146 (defun install-apel ()
148 (let ((just-print (install-just-print-p)))
149 (install-elisp-modules emu-modules "." EMU_DIR just-print)
150 (install-elisp-modules apel-modules "." APEL_DIR just-print)))
152 ;; for XEmacs package system.
153 (defun config-apel-package ()
155 ;; override standard PACKAGEDIR with command-line option.
156 (and (setq package-dir (prog1
157 ;; avoid using `pop'.
158 (car command-line-args-left)
159 (setq command-line-args-left
160 (cdr command-line-args-left))))
161 (or (string= "NONE" package-dir)
162 (defvar PACKAGEDIR package-dir)))
163 ;; import `apel-modules'.
164 (load-file "APEL-ELS")
165 ;; import `emu-modules' and `emu-modules-to-compile'.
166 (load-file "EMU-ELS")
167 (princ (format "\nPACKAGEDIR=%s\n" PACKAGEDIR))))
169 (defun compile-apel-package ()
170 (config-apel-package)
171 ;; compile emu modules first.
172 (compile-elisp-modules emu-modules-to-compile ".")
173 (compile-elisp-modules apel-modules "."))
175 (defun install-apel-package ()
176 (config-apel-package)
177 (let ((just-print (install-just-print-p))
178 (dir (expand-file-name APEL_PREFIX
179 (expand-file-name "lisp" PACKAGEDIR))))
180 (install-elisp-modules emu-modules "." dir just-print)
181 (install-elisp-modules apel-modules "." dir just-print)
182 (install-update-package-files "apel" dir just-print)))
184 (defun what-where-apel ()
187 The files that belong to the EMU modules:
191 The files that belong to the APEL modules:
195 (mapconcat (function symbol-name) emu-modules ", ")
197 (mapconcat (function symbol-name) apel-modules ", ")
200 ;;; APEL-MK ends here