1 ;;; install.el --- Emacs Lisp package install utility
3 ;; Copyright (C) 1996 Free Software Foundation, Inc.
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
7 ;; Version: $Id: install.el,v 1.5 1996/08/21 12:08:41 morioka Exp $
10 ;; This file is part of tl (Tiny Library).
12 ;; This program is free software; you can redistribute it and/or
13 ;; modify it under the terms of the GNU General Public License as
14 ;; published by the Free Software Foundation; either version 2, or (at
15 ;; your option) any later version.
17 ;; This program is distributed in the hope that it will be useful, but
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 ;; General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with this program; see the file COPYING. If not, write to
24 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
29 (defun compile-elisp-module (module &optional path every-time)
30 (setq module (expand-file-name (symbol-name module) path))
31 (let ((el-file (concat module ".el"))
32 (elc-file (concat module ".elc"))
35 (file-newer-than-file-p el-file elc-file))
36 (byte-compile-file el-file)
40 (defun compile-elisp-modules (modules &optional path every-time)
43 (compile-elisp-module module path every-time)
48 (defvar install-overwritten-file-modes (+ (* 64 6)(* 8 4) 4))
50 (defun install-file (file src dest &optional move overwrite)
51 (let ((src-file (expand-file-name file src)))
52 (if (file-exists-p src-file)
53 (let ((full-path (expand-file-name file dest)))
54 (if (and (file-exists-p full-path) overwrite)
55 (set-file-modes full-path install-overwritten-file-modes)
57 (copy-file src-file full-path t t)
60 (while (file-exists-p src-file)
63 (delete-file src-file)
66 (error (princ (format "%s\n" (nth 1 err))))
68 (princ (format "%s -> %s\n" file dest))
72 (defun install-files (files src dest &optional move overwrite)
73 (or (file-exists-p dest)
74 (make-directory dest t)
76 (mapcar (function (lambda (file)
77 (install-file file src dest move overwrite)
81 (defun install-elisp-module (module src dest)
82 (let (el-file elc-file)
83 (let ((name (symbol-name module)))
84 (setq el-file (concat name ".el"))
85 (setq elc-file (concat name ".elc"))
87 (let ((src-file (expand-file-name el-file src)))
88 (if (file-exists-p src-file)
89 (let ((full-path (expand-file-name el-file dest)))
90 (if (file-exists-p full-path)
91 (set-file-modes full-path install-overwritten-file-modes)
93 (copy-file src-file full-path t t)
94 (princ (format "%s -> %s\n" el-file dest))
96 (setq src-file (expand-file-name elc-file src))
97 (if (file-exists-p src-file)
98 (let ((full-path (expand-file-name elc-file dest)))
99 (copy-file src-file full-path t t)
101 (while (file-exists-p src-file)
104 (delete-file src-file)
107 (error (princ (format "%s\n" (nth 1 err))))
109 (princ (format "%s -> %s\n" elc-file dest))
113 (defun install-elisp-modules (modules src dest)
114 (or (file-exists-p dest)
115 (make-directory dest t)
117 (mapcar (function (lambda (module)
118 (install-elisp-module module src dest)
128 ;;; install.el ends here