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 ;;; Configure, Compile, and Install.
55 ;; Override everything you want.
56 (load-file "APEL-CFG")
57 ;; Override PREFIX, LISPDIR, and VERSION_SPECIFIC_LISPDIR with
58 ;; command-line options.
59 (let (prefix lisp-dir version-specific-lisp-dir)
62 ;; (pop command-line-args-left)
64 (car command-line-args-left)
65 (setq command-line-args-left
66 (cdr command-line-args-left))))
67 (or (string-equal "NONE" prefix)
68 (setq PREFIX prefix)))
71 ;; (pop command-line-args-left)
73 (car command-line-args-left)
74 (setq command-line-args-left
75 (cdr command-line-args-left))))
76 (or (string-equal "NONE" lisp-dir)
77 (setq LISPDIR lisp-dir)))
78 (and (setq version-specific-lisp-dir
80 ;; (pop command-line-args-left)
82 (car command-line-args-left)
83 (setq command-line-args-left
84 (cdr command-line-args-left))))
85 (or (string-equal "NONE" version-specific-lisp-dir)
86 (setq VERSION_SPECIFIC_LISPDIR version-specific-lisp-dir))))
87 ;; Load some APEL modules from this directory.
88 (defvar default-load-path load-path)
89 (setq load-path (cons (expand-file-name ".") load-path))
94 ;; Import `apel-modules'.
95 (load-file "APEL-ELS")
96 ;; Import `emu-modules' and `emu-modules-to-compile'.
99 ;; Set PREFIX, LISPDIR, and VERSION_SPECIFIC_LISPDIR if not set yet.
101 (setq PREFIX install-prefix))
103 (setq LISPDIR (install-detect-elisp-directory PREFIX)))
104 (or VERSION_SPECIFIC_LISPDIR
105 (setq VERSION_SPECIFIC_LISPDIR
106 (install-detect-elisp-directory PREFIX nil 'version-specific)))
107 ;; The directories where APEL and EMU will be installed.
109 (setq APEL_DIR (expand-file-name APEL_PREFIX LISPDIR)))
111 (setq EMU_DIR (expand-file-name EMU_PREFIX VERSION_SPECIFIC_LISPDIR)))
114 VERSION_SPECIFIC_LISPDIR=%s
116 LISPDIR VERSION_SPECIFIC_LISPDIR)))
118 (defun compile-apel ()
120 ;; Compile emu modules first.
121 (compile-elisp-modules emu-modules-to-compile ".")
122 (compile-elisp-modules apel-modules "."))
124 (defun install-apel (&optional just-print)
126 ;; `just-print' will be non-nil if `install-apel' is called by
127 (or just-print ; "make what-where", or
128 (setq just-print (install-just-print-p))) ; "make -n install".
129 (install-elisp-modules emu-modules "." EMU_DIR just-print)
130 (install-elisp-modules apel-modules "." APEL_DIR just-print))
132 ;; For XEmacs package system.
133 (defun config-apel-package ()
134 ;; Override everything you want.
135 (load-file "APEL-CFG")
136 ;; Override PACKAGEDIR with command-line option.
138 (and (setq package-dir
139 ;; Avoid using `pop'.
140 ;; (pop command-line-args-left)
142 (car command-line-args-left)
143 (setq command-line-args-left
144 (cdr command-line-args-left))))
145 (or (string= "NONE" package-dir)
146 (setq PACKAGEDIR package-dir))))
147 ;; Load some APEL modules from this directory.
148 (defvar default-load-path load-path)
149 (setq load-path (cons (expand-file-name ".") load-path))
154 ;; Import `apel-modules'.
155 (load-file "APEL-ELS")
156 ;; Import `emu-modules' and `emu-modules-to-compile'.
157 (load-file "EMU-ELS")
159 ;; Set PACKAGEDIR if not set yet.
162 (if (boundp 'early-packages)
163 (let ((dirs (append (if early-package-load-path
165 (if late-package-load-path
167 (if last-package-load-path
170 (while (not (file-exists-p (setq dir (car dirs))))
171 (setq dirs (cdr dirs)))
178 (error "XEmacs package system is not available")))
180 (defun compile-apel-package ()
181 (config-apel-package)
182 ;; Compile emu modules first.
183 (compile-elisp-modules emu-modules-to-compile ".")
184 (compile-elisp-modules apel-modules "."))
186 (defun install-apel-package ()
187 (config-apel-package)
188 (let ((just-print (install-just-print-p))
189 (dir (expand-file-name APEL_PREFIX
190 (expand-file-name "lisp" PACKAGEDIR))))
191 (install-elisp-modules emu-modules "." dir just-print)
192 (install-elisp-modules apel-modules "." dir just-print)
193 (install-update-package-files "apel" dir just-print)))
195 (defun what-where-apel ()
196 (install-apel 'just-print))
198 ;;; APEL-MK ends here