| 1 |
;;; APEL-MK --- installer for APEL. -*-Emacs-Lisp-*- |
| 2 |
|
| 3 |
;;; Commentary: |
| 4 |
|
| 5 |
;; DON'T EDIT THIS FILE; edit APEL-CFG instead. |
| 6 |
|
| 7 |
;;; Code: |
| 8 |
|
| 9 |
;;; Configuration variables. |
| 10 |
|
| 11 |
;; Set these four variables in "APEL-CFG" or in "Makefile". |
| 12 |
|
| 13 |
;; This variable will be detected automatically. |
| 14 |
(defvar PREFIX nil) |
| 15 |
|
| 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" |
| 20 |
(defvar LISPDIR nil) |
| 21 |
|
| 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) |
| 25 |
|
| 26 |
;; This variable will be detected automatically. |
| 27 |
;; XEmacs 21.0 and later: "/usr/local/lib/xemacs/xemacs-packages" |
| 28 |
(defvar PACKAGEDIR nil) |
| 29 |
|
| 30 |
;; Install APEL modules to "apel" subdirectory. |
| 31 |
(defvar APEL_PREFIX "apel") |
| 32 |
|
| 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") |
| 38 |
(defvar EMU_PREFIX "emu") |
| 39 |
|
| 40 |
;; The directories where APEL and EMU modules will be installed. |
| 41 |
;; These two variables will be generated from other variables above. |
| 42 |
(defvar APEL_DIR nil) ; LISPDIR/APEL_PREFIX |
| 43 |
(defvar EMU_DIR nil) ; VERSION_SPECIFIC_LISPDIR/EMU_PREFIX |
| 44 |
|
| 45 |
|
| 46 |
;;; Configure, Compile, and Install. |
| 47 |
|
| 48 |
(defun config-apel () |
| 49 |
;; Override everything you want. |
| 50 |
(load-file "APEL-CFG") |
| 51 |
;; Override PREFIX, LISPDIR, and VERSION_SPECIFIC_LISPDIR with |
| 52 |
;; command-line options. |
| 53 |
(let (prefix lisp-dir version-specific-lisp-dir) |
| 54 |
(and (setq prefix |
| 55 |
;; Avoid using `pop'. |
| 56 |
;; (pop command-line-args-left) |
| 57 |
(prog1 |
| 58 |
(car command-line-args-left) |
| 59 |
(setq command-line-args-left |
| 60 |
(cdr command-line-args-left)))) |
| 61 |
(or (string-equal "NONE" prefix) |
| 62 |
(setq PREFIX prefix))) |
| 63 |
(and (setq lisp-dir |
| 64 |
;; Avoid using `pop'. |
| 65 |
;; (pop command-line-args-left) |
| 66 |
(prog1 |
| 67 |
(car command-line-args-left) |
| 68 |
(setq command-line-args-left |
| 69 |
(cdr command-line-args-left)))) |
| 70 |
(or (string-equal "NONE" lisp-dir) |
| 71 |
(setq LISPDIR lisp-dir))) |
| 72 |
(and (setq version-specific-lisp-dir |
| 73 |
;; Avoid using `pop'. |
| 74 |
;; (pop command-line-args-left) |
| 75 |
(prog1 |
| 76 |
(car command-line-args-left) |
| 77 |
(setq command-line-args-left |
| 78 |
(cdr command-line-args-left)))) |
| 79 |
(or (string-equal "NONE" version-specific-lisp-dir) |
| 80 |
(setq VERSION_SPECIFIC_LISPDIR version-specific-lisp-dir)))) |
| 81 |
;; Load some APEL modules from this directory. |
| 82 |
(defvar default-load-path load-path) |
| 83 |
(setq load-path (cons (expand-file-name ".") load-path)) |
| 84 |
(require 'poe) |
| 85 |
(require 'path-util) |
| 86 |
(require 'install) |
| 87 |
|
| 88 |
;; Import `apel-modules'. |
| 89 |
(load-file "APEL-ELS") |
| 90 |
;; Import `emu-modules' and `emu-modules-to-compile'. |
| 91 |
(load-file "EMU-ELS") |
| 92 |
|
| 93 |
;; Set PREFIX, LISPDIR, and VERSION_SPECIFIC_LISPDIR if not set yet. |
| 94 |
(or PREFIX |
| 95 |
(setq PREFIX install-prefix)) |
| 96 |
(or LISPDIR |
| 97 |
(setq LISPDIR (install-detect-elisp-directory PREFIX))) |
| 98 |
(or VERSION_SPECIFIC_LISPDIR |
| 99 |
(setq VERSION_SPECIFIC_LISPDIR |
| 100 |
(install-detect-elisp-directory PREFIX nil 'version-specific))) |
| 101 |
;; The directories where APEL and EMU will be installed. |
| 102 |
(or APEL_DIR |
| 103 |
(setq APEL_DIR (expand-file-name APEL_PREFIX LISPDIR))) |
| 104 |
(or EMU_DIR |
| 105 |
(setq EMU_DIR (expand-file-name EMU_PREFIX VERSION_SPECIFIC_LISPDIR))) |
| 106 |
(princ (format "\nLISPDIR=%s\n" LISPDIR)) |
| 107 |
(princ (format "VERSION_SPECIFIC_LISPDIR=%s\n" VERSION_SPECIFIC_LISPDIR))) |
| 108 |
|
| 109 |
(defun compile-apel () |
| 110 |
(config-apel) |
| 111 |
;; Compile emu modules first. |
| 112 |
(compile-elisp-modules emu-modules-to-compile ".") |
| 113 |
(compile-elisp-modules apel-modules ".")) |
| 114 |
|
| 115 |
(defun install-apel (&optional just-print) |
| 116 |
(config-apel) |
| 117 |
(or just-print |
| 118 |
(setq just-print (install-just-print-p))) |
| 119 |
(install-elisp-modules emu-modules "." EMU_DIR just-print) |
| 120 |
(install-elisp-modules apel-modules "." APEL_DIR just-print)) |
| 121 |
|
| 122 |
;; For XEmacs package system. |
| 123 |
(defun config-apel-package () |
| 124 |
;; Override everything you want. |
| 125 |
(load-file "APEL-CFG") |
| 126 |
;; Override PACKAGEDIR with command-line option. |
| 127 |
(let (package-dir) |
| 128 |
(and (setq package-dir |
| 129 |
;; Avoid using `pop'. |
| 130 |
;; (pop command-line-args-left) |
| 131 |
(prog1 |
| 132 |
(car command-line-args-left) |
| 133 |
(setq command-line-args-left |
| 134 |
(cdr command-line-args-left)))) |
| 135 |
(or (string= "NONE" package-dir) |
| 136 |
(setq PACKAGEDIR package-dir)))) |
| 137 |
;; Load some APEL modules from this directory. |
| 138 |
(defvar default-load-path load-path) |
| 139 |
(setq load-path (cons (expand-file-name ".") load-path)) |
| 140 |
(require 'poe) |
| 141 |
(require 'path-util) |
| 142 |
(require 'install) |
| 143 |
|
| 144 |
;; Import `apel-modules'. |
| 145 |
(load-file "APEL-ELS") |
| 146 |
;; Import `emu-modules' and `emu-modules-to-compile'. |
| 147 |
(load-file "EMU-ELS") |
| 148 |
|
| 149 |
;; Set PACKAGEDIR if not set yet. |
| 150 |
(or PACKAGEDIR |
| 151 |
(setq PACKAGEDIR (install-get-default-package-directory))) |
| 152 |
(if PACKAGEDIR |
| 153 |
(princ (format "\nPACKAGEDIR=%s\n" PACKAGEDIR)) |
| 154 |
(error "XEmacs package system is not available"))) |
| 155 |
|
| 156 |
(defun compile-apel-package () |
| 157 |
(config-apel-package) |
| 158 |
;; Compile emu modules first. |
| 159 |
(compile-elisp-modules emu-modules-to-compile ".") |
| 160 |
(compile-elisp-modules apel-modules ".")) |
| 161 |
|
| 162 |
(defun install-apel-package () |
| 163 |
(config-apel-package) |
| 164 |
(let ((just-print (install-just-print-p)) |
| 165 |
(dir (expand-file-name APEL_PREFIX |
| 166 |
(expand-file-name "lisp" PACKAGEDIR)))) |
| 167 |
(install-elisp-modules emu-modules "." dir just-print) |
| 168 |
(install-elisp-modules apel-modules "." dir just-print) |
| 169 |
(install-update-package-files "apel" dir just-print))) |
| 170 |
|
| 171 |
(defun what-where-apel () |
| 172 |
(install-apel 'just-print) |
| 173 |
;; (config-apel) |
| 174 |
;;; (princ (format " |
| 175 |
;;; The files that belong to the EMU modules: |
| 176 |
;;; %s |
| 177 |
;;; -> %s |
| 178 |
|
| 179 |
;;; The files that belong to the APEL modules: |
| 180 |
;;; %s |
| 181 |
;;; -> %s |
| 182 |
|
| 183 |
;;; Do `make elc', `make install', `make package', or `make install-package'. |
| 184 |
;;; " |
| 185 |
;;; (mapconcat (function symbol-name) emu-modules ", ") |
| 186 |
;;; EMU_DIR |
| 187 |
;;; (mapconcat (function symbol-name) apel-modules ", ") |
| 188 |
;;; APEL_DIR)) |
| 189 |
) |
| 190 |
|
| 191 |
;;; APEL-MK ends here |