;;; APEL-MK --- installer for APEL. -*-Emacs-Lisp-*- ;;; Commentary: ;; DON'T EDIT THIS FILE; edit APEL-CFG instead. ;;; Code: ;;; Standard configuration variables. ;; These two variables will be generated from other variables below. (defvar APEL_DIR nil) (defvar EMU_DIR nil) ;; Install to "apel" subdirectory. (defvar APEL_PREFIX "apel") (defvar EMU_PREFIX (if (or (featurep 'xemacs) (fboundp 'normal-top-level-add-subdirs-to-load-path)) ;; Install to "emu" subdirectory. "emu" ;; If your emacs does not have `normal-top-level-add-subdirs-to-load-path' ;; but have `normal-top-level-add-to-load-path' and you want to use it in ;; "subdirs.el", put the following line to "APEL-CFG". ;; (setq EMU_PREFIX "emu") "")) ;; Detect site-lisp directories. (defvar default-load-path load-path) (setq load-path (cons (expand-file-name ".") load-path)) (require 'poe) (require 'path-util) (require 'install) ;; override everything you want. (load-file "APEL-CFG") ;; The following four variables will be overrided by command line options. (defvar PREFIX install-prefix) ;; v18: (no standard site-lisp directory) ;; Emacs 19.28 and earlier: "PREFIX/lib/emacs/site-lisp" ;; Emacs 19.29 and later: "PREFIX/share/emacs/site-lisp" (defvar LISPDIR (install-detect-elisp-directory PREFIX)) ;; Emacs 19.31 and later: "PREFIX/share/emacs/VERSION/site-lisp". (defvar VERSION_SPECIFIC_LISPDIR (install-detect-elisp-directory PREFIX nil 'version-specific)) ;; for XEmacs package system. (defvar PACKAGEDIR (if (boundp 'early-packages) (let ((dirs (append (if early-package-load-path early-packages) (if late-package-load-path late-packages) (if last-package-load-path last-packages))) dir) (while (not (file-exists-p (setq dir (car dirs)))) (setq dirs (cdr dirs))) dir))) ;;; Utilities. (XXX: should be moved to install.el ?) (defun install-just-print-p () (let ((flag (getenv "MAKEFLAGS")) case-fold-search) (princ (format "%s\n" flag)) (if flag (string-match "^\\(\\(--[^ ]+ \\)+-\\|[^ =-]\\)*n" flag)))) (defun install-update-package-files (package dir &optional just-print) (cond (just-print (princ (format "Updating autoloads in directory %s..\n\n" dir)) (princ (format "Processing %s\n" dir)) (princ "Generating custom-load.el...\n\n") (princ (format "Compiling %s...\n" (expand-file-name "auto-autoloads.el" dir))) (princ (format "Wrote %s\n" (expand-file-name "auto-autoloads.elc" dir))) (princ (format "Compiling %s...\n" (expand-file-name "custom-load.el" dir))) (princ (format "Wrote %s\n" (expand-file-name "custom-load.elc" dir)))) (t (setq autoload-package-name package) (add-to-list 'command-line-args-left dir) (batch-update-directory) (add-to-list 'command-line-args-left dir) (Custom-make-dependencies) (byte-compile-file (expand-file-name "auto-autoloads.el" dir)) (byte-compile-file (expand-file-name "custom-load.el" dir))))) ;;; Tools for Configure, Compile, and Install. (defun config-apel () (let (prefix lisp-dir version-specific-lisp-dir) ;; override standard PREFIX, LISPDIR, and VERSION_SPECIFIC_LISPDIR ;; with command-line options. (and (setq prefix (prog1 ;; avoid using `pop'. (car command-line-args-left) (setq command-line-args-left (cdr command-line-args-left)))) (or (string-equal "NONE" prefix) (setq PREFIX prefix))) (and (setq lisp-dir (prog1 (car command-line-args-left) (setq command-line-args-left (cdr command-line-args-left)))) (or (string-equal "NONE" lisp-dir) (setq LISPDIR lisp-dir))) (and (setq version-specific-lisp-dir (prog1 (car command-line-args-left) (setq command-line-args-left (cdr command-line-args-left)))) (or (string-equal "NONE" version-specific-lisp-dir) (setq VERSION_SPECIFIC_LISPDIR version-specific-lisp-dir))) ;; directories we actually use. (or APEL_DIR (setq APEL_DIR (expand-file-name APEL_PREFIX LISPDIR))) (or EMU_DIR (setq EMU_DIR (expand-file-name EMU_PREFIX VERSION_SPECIFIC_LISPDIR))) ;; import `apel-modules'. (load-file "APEL-ELS") ;; import `emu-modules' and `emu-modules-to-compile'. (load-file "EMU-ELS") (princ (format "\nLISPDIR=%s\n" LISPDIR)) (princ (format "VERSION_SPECIFIC_LISPDIR=%s\n" VERSION_SPECIFIC_LISPDIR)))) (defun compile-apel () (config-apel) ;; compile emu modules first. (compile-elisp-modules emu-modules-to-compile ".") (compile-elisp-modules apel-modules ".")) (defun install-apel () (compile-apel) (let ((just-print (install-just-print-p))) (install-elisp-modules emu-modules "." EMU_DIR just-print) (install-elisp-modules apel-modules "." APEL_DIR just-print))) ;; for XEmacs package system. (defun config-apel-package () (let (package-dir) ;; override standard PACKAGEDIR with command-line option. (and (setq package-dir (prog1 ;; avoid using `pop'. (car command-line-args-left) (setq command-line-args-left (cdr command-line-args-left)))) (or (string= "NONE" package-dir) (defvar PACKAGEDIR package-dir))) ;; import `apel-modules'. (load-file "APEL-ELS") ;; import `emu-modules' and `emu-modules-to-compile'. (load-file "EMU-ELS") (princ (format "\nPACKAGEDIR=%s\n" PACKAGEDIR)))) (defun compile-apel-package () (config-apel-package) ;; compile emu modules first. (compile-elisp-modules emu-modules-to-compile ".") (compile-elisp-modules apel-modules ".")) (defun install-apel-package () (config-apel-package) (let ((just-print (install-just-print-p)) (dir (expand-file-name APEL_PREFIX (expand-file-name "lisp" PACKAGEDIR)))) (install-elisp-modules emu-modules "." dir just-print) (install-elisp-modules apel-modules "." dir just-print) (install-update-package-files "apel" dir just-print))) (defun what-where-apel () (config-apel) (princ (format " The files that belong to the EMU modules: %s -> %s The files that belong to the APEL modules: %s -> %s " (mapconcat (function symbol-name) emu-modules ", ") EMU_DIR (mapconcat (function symbol-name) apel-modules ", ") APEL_DIR))) ;;; APEL-MK ends here