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))
35 ;; override everything you want.
36 (load-file "APEL-CFG")
38 ;; The following four variables will be overrided by command line options.
39 (defvar PREFIX install-prefix)
40 ;; v18: (no standard site-lisp directory)
41 ;; Emacs 19.28 and earlier: "PREFIX/lib/emacs/site-lisp"
42 ;; Emacs 19.29 and later: "PREFIX/share/emacs/site-lisp"
44 (install-detect-elisp-directory PREFIX))
45 ;; Emacs 19.31 and later: "PREFIX/share/emacs/VERSION/site-lisp".
46 (defvar VERSION_SPECIFIC_LISPDIR
47 (install-detect-elisp-directory PREFIX nil 'version-specific))
48 ;; for XEmacs package system.
50 (if (boundp 'early-packages)
51 (let ((dirs (append (if early-package-load-path
53 (if late-package-load-path
55 (if last-package-load-path
58 (while (not (file-exists-p (setq dir (car dirs))))
59 (setq dirs (cdr dirs)))
63 ;;; Utilities. (XXX: should be moved to install.el ?)
65 (defun install-just-print-p ()
66 (let ((flag (getenv "MAKEFLAGS"))
68 (princ (format "%s\n" flag))
70 (string-match "^\\(\\(--[^ ]+ \\)+-\\|[^ =-]\\)*n" flag))))
72 (defun install-update-package-files (package dir &optional just-print)
75 (princ (format "Updating autoloads in directory %s..\n\n" dir))
77 (princ (format "Processing %s\n" dir))
78 (princ "Generating custom-load.el...\n\n")
80 (princ (format "Compiling %s...\n"
81 (expand-file-name "auto-autoloads.el" dir)))
82 (princ (format "Wrote %s\n"
83 (expand-file-name "auto-autoloads.elc" dir)))
85 (princ (format "Compiling %s...\n"
86 (expand-file-name "custom-load.el" dir)))
87 (princ (format "Wrote %s\n"
88 (expand-file-name "custom-load.elc" dir))))
90 (setq autoload-package-name package)
91 (add-to-list 'command-line-args-left dir)
92 (batch-update-directory)
94 (add-to-list 'command-line-args-left dir)
95 (Custom-make-dependencies)
97 (byte-compile-file (expand-file-name "auto-autoloads.el" dir))
98 (byte-compile-file (expand-file-name "custom-load.el" dir)))))
101 ;;; Tools for Configure, Compile, and Install.
103 (defun config-apel ()
104 (let (prefix lisp-dir version-specific-lisp-dir)
105 ;; override standard PREFIX, LISPDIR, and VERSION_SPECIFIC_LISPDIR
106 ;; with command-line options.
107 (and (setq prefix (prog1
108 ;; avoid using `pop'.
109 (car command-line-args-left)
110 (setq command-line-args-left
111 (cdr command-line-args-left))))
112 (or (string-equal "NONE" prefix)
113 (setq PREFIX prefix)))
114 (and (setq lisp-dir (prog1
115 (car command-line-args-left)
116 (setq command-line-args-left
117 (cdr command-line-args-left))))
118 (or (string-equal "NONE" lisp-dir)
119 (setq LISPDIR lisp-dir)))
120 (and (setq version-specific-lisp-dir
122 (car command-line-args-left)
123 (setq command-line-args-left
124 (cdr command-line-args-left))))
125 (or (string-equal "NONE" version-specific-lisp-dir)
126 (setq VERSION_SPECIFIC_LISPDIR version-specific-lisp-dir)))
127 ;; directories we actually use.
129 (setq APEL_DIR (expand-file-name APEL_PREFIX LISPDIR)))
131 (setq EMU_DIR (expand-file-name EMU_PREFIX VERSION_SPECIFIC_LISPDIR)))
132 ;; import `apel-modules'.
133 (load-file "APEL-ELS")
134 ;; import `emu-modules' and `emu-modules-to-compile'.
135 (load-file "EMU-ELS")
136 (princ (format "\nLISPDIR=%s\n" LISPDIR))
137 (princ (format "VERSION_SPECIFIC_LISPDIR=%s\n" VERSION_SPECIFIC_LISPDIR))))
139 (defun compile-apel ()
141 ;; compile emu modules first.
142 (compile-elisp-modules emu-modules-to-compile ".")
143 (compile-elisp-modules apel-modules "."))
145 (defun install-apel ()
147 (let ((just-print (install-just-print-p)))
148 (install-elisp-modules emu-modules "." EMU_DIR just-print)
149 (install-elisp-modules apel-modules "." APEL_DIR just-print)))
151 ;; for XEmacs package system.
152 (defun config-apel-package ()
154 ;; override standard PACKAGEDIR with command-line option.
155 (and (setq package-dir (prog1
156 ;; avoid using `pop'.
157 (car command-line-args-left)
158 (setq command-line-args-left
159 (cdr command-line-args-left))))
160 (or (string= "NONE" package-dir)
161 (defvar PACKAGEDIR package-dir)))
162 ;; import `apel-modules'.
163 (load-file "APEL-ELS")
164 ;; import `emu-modules' and `emu-modules-to-compile'.
165 (load-file "EMU-ELS")
166 (princ (format "\nPACKAGEDIR=%s\n" PACKAGEDIR))))
168 (defun compile-apel-package ()
169 (config-apel-package)
170 ;; compile emu modules first.
171 (compile-elisp-modules emu-modules-to-compile ".")
172 (compile-elisp-modules apel-modules "."))
174 (defun install-apel-package ()
175 (config-apel-package)
176 (let ((just-print (install-just-print-p))
177 (dir (expand-file-name APEL_PREFIX
178 (expand-file-name "lisp" PACKAGEDIR))))
179 (install-elisp-modules emu-modules "." dir just-print)
180 (install-elisp-modules apel-modules "." dir just-print)
181 (install-update-package-files "apel" dir just-print)))
183 (defun what-where-apel ()
186 The files that belong to the EMU modules:
190 The files that belong to the APEL modules:
194 (mapconcat (function symbol-name) emu-modules ", ")
196 (mapconcat (function symbol-name) apel-modules ", ")
199 ;;; APEL-MK ends here