1 ;;; APEL-MK --- installer for APEL. -*-Emacs-Lisp-*-
5 ;; DON'T EDIT THIS FILE; edit APEL-CFG instead.
9 ;;; Standard configuration variables.
11 ;; These two variables will be generated from other variables below.
15 ;; Install to "apel" subdirectory.
16 (defvar APEL_PREFIX "apel")
18 (if (or (featurep 'xemacs)
19 (fboundp 'normal-top-level-add-subdirs-to-load-path))
20 ;; Install to "emu" subdirectory.
22 ;; If your emacs does not have `normal-top-level-add-subdirs-to-load-path'
23 ;; but have `normal-top-level-add-to-load-path' and you want to use it in
24 ;; "subdirs.el", put the following line to "APEL-CFG".
25 ;; (setq EMU_PREFIX "emu")
28 ;; Detect site-lisp directories.
29 (defvar default-load-path load-path)
30 (setq load-path (cons (expand-file-name ".") load-path))
34 ;; override everything you want.
35 (load-file "APEL-CFG")
37 ;; The following four variables will be overrided by command line options.
38 (defvar PREFIX install-prefix)
39 ;; v18: (no standard site-lisp directory)
40 ;; Emacs 19.28 and earlier: "PREFIX/lib/emacs/site-lisp"
41 ;; Emacs 19.29 and later: "PREFIX/share/emacs/site-lisp"
43 (install-detect-elisp-directory PREFIX))
44 ;; Emacs 19.31 and later: "PREFIX/share/emacs/VERSION/site-lisp".
45 (defvar VERSION_SPECIFIC_LISPDIR
46 (install-detect-elisp-directory PREFIX nil 'version-specific))
47 ;; for XEmacs package system.
49 (if (boundp 'early-packages)
50 (let ((dirs (append (if early-package-load-path
52 (if late-package-load-path
54 (if last-package-load-path
57 (while (not (file-exists-p (setq dir (car dirs))))
58 (setq dirs (cdr dirs)))
62 ;;; Utilities. (XXX: should be moved to install.el ?)
64 (defun install-just-print-p ()
65 (let ((flag (getenv "MAKEFLAGS"))
67 (princ (format "%s\n" flag))
69 (string-match "^\\(\\(--[^ ]+ \\)+-\\|[^ =-]\\)*n" flag))))
71 (defun install-update-package-files (package dir &optional just-print)
74 (princ (format "Updating autoloads in directory %s..\n\n" dir))
76 (princ (format "Processing %s\n" dir))
77 (princ "Generating custom-load.el...\n\n")
79 (princ (format "Compiling %s...\n"
80 (expand-file-name "auto-autoloads.el" dir)))
81 (princ (format "Wrote %s\n"
82 (expand-file-name "auto-autoloads.elc" dir)))
84 (princ (format "Compiling %s...\n"
85 (expand-file-name "custom-load.el" dir)))
86 (princ (format "Wrote %s\n"
87 (expand-file-name "custom-load.elc" dir))))
89 (setq autoload-package-name package)
90 (add-to-list 'command-line-args-left dir)
91 (batch-update-directory)
93 (add-to-list 'command-line-args-left dir)
94 (Custom-make-dependencies)
96 (byte-compile-file (expand-file-name "auto-autoloads.el" dir))
97 (byte-compile-file (expand-file-name "custom-load.el" dir)))))
100 ;;; Tools for Configure, Compile, and Install.
102 (defun config-apel ()
103 (let (prefix lisp-dir version-specific-lisp-dir)
104 ;; override standard PREFIX, LISPDIR, and VERSION_SPECIFIC_LISPDIR
105 ;; with command-line options.
106 (and (setq prefix (prog1
107 ;; avoid using `pop'.
108 (car command-line-args-left)
109 (setq command-line-args-left
110 (cdr command-line-args-left))))
111 (or (string-equal "NONE" prefix)
112 (setq PREFIX prefix)))
113 (and (setq lisp-dir (prog1
114 (car command-line-args-left)
115 (setq command-line-args-left
116 (cdr command-line-args-left))))
117 (or (string-equal "NONE" lisp-dir)
118 (setq LISPDIR lisp-dir)))
119 (and (setq version-specific-lisp-dir
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 ;; directories we actually use.
128 (setq APEL_DIR (expand-file-name APEL_PREFIX LISPDIR)))
130 (setq EMU_DIR (expand-file-name EMU_PREFIX VERSION_SPECIFIC_LISPDIR)))
131 ;; import `apel-modules'.
132 (load-file "APEL-ELS")
133 ;; import `emu-modules' and `emu-modules-to-compile'.
134 (load-file "EMU-ELS")
135 (princ (format "\nLISPDIR=%s\n" LISPDIR))
136 (princ (format "VERSION_SPECIFIC_LISPDIR=%s\n" VERSION_SPECIFIC_LISPDIR))))
138 (defun compile-apel ()
140 ;; compile emu modules first.
141 (compile-elisp-modules emu-modules-to-compile ".")
142 (compile-elisp-modules apel-modules "."))
144 (defun install-apel ()
146 (let ((just-print (install-just-print-p)))
147 (install-elisp-modules emu-modules "." EMU_DIR just-print)
148 (install-elisp-modules apel-modules "." APEL_DIR just-print)))
150 ;; for XEmacs package system.
151 (defun config-apel-package ()
153 ;; override standard PACKAGEDIR with command-line option.
154 (and (setq package-dir (prog1
155 ;; avoid using `pop'.
156 (car command-line-args-left)
157 (setq command-line-args-left
158 (cdr command-line-args-left))))
159 (or (string= "NONE" package-dir)
160 (defvar PACKAGEDIR package-dir)))
161 ;; import `apel-modules'.
162 (load-file "APEL-ELS")
163 ;; import `emu-modules' and `emu-modules-to-compile'.
164 (load-file "EMU-ELS")
165 (princ (format "\nPACKAGEDIR=%s\n" PACKAGEDIR))))
167 (defun compile-apel-package ()
168 (config-apel-package)
169 ;; compile emu modules first.
170 (compile-elisp-modules emu-modules-to-compile ".")
171 (compile-elisp-modules apel-modules "."))
173 (defun install-apel-package ()
174 (config-apel-package)
175 (let ((just-print (install-just-print-p))
176 (dir (expand-file-name APEL_PREFIX
177 (expand-file-name "lisp" PACKAGEDIR))))
178 (install-elisp-modules emu-modules "." dir just-print)
179 (install-elisp-modules apel-modules "." dir just-print)
180 (install-update-package-files "apel" dir just-print)))
182 (defun what-where-apel ()
185 The files that belong to the EMU modules:
189 The files that belong to the APEL modules:
193 (mapconcat (function symbol-name) emu-modules ", ")
195 (mapconcat (function symbol-name) apel-modules ", ")
198 ;;; APEL-MK ends here