8a9d4c17cf6b3d79f71b8aefb71328e5df8606e6
[chise/xemacs-chise.git.1] / lisp / package-admin.el
1 ;;; package-admin.el --- Installation and Maintenance of XEmacs packages
2
3 ;; Copyright (C) 1997 by Free Software Foundation, Inc.
4
5 ;; Author: SL Baur <steve@altair.xemacs.org>
6 ;; Keywords: internal
7
8 ;; This file is part of XEmacs.
9
10 ;; XEmacs is free software; you can redistribute it and/or modify it
11 ;; under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
14
15 ;; XEmacs is distributed in the hope that it will be useful, but
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 ;; General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with XEmacs; see the file COPYING.  If not, write to the Free
22 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23 ;; 02111-1307, USA.
24
25 ;;; Synched up with: Not in FSF
26
27 ;;; Commentary:
28
29 ;; First pass at lisp front end to package maintenance.
30
31 ;;; Code:
32
33 (require 'config)
34
35 (defvar package-admin-xemacs (concat invocation-directory invocation-name)
36   "Location of XEmacs binary to use.")
37
38 (defvar package-admin-temp-buffer "*Package Output*"
39   "Temporary buffer where output of backend commands is saved.")
40
41 ;;;###autoload
42 (defun package-admin-add-single-file-package (file destdir &optional pkg-dir)
43   "Install a single file Lisp package into XEmacs package hierarchy.
44 `file' should be the full path to the lisp file to install.
45 `destdir' should be a simple directory name.
46 The optional `pkg-dir' can be used to override the default package hierarchy
47 \(car \(last late-packages))."
48   (interactive "fLisp File: \nsDestination: ")
49   (when (null pkg-dir)
50     (setq pkg-dir (car (last late-packages))))
51   (let ((destination (concat pkg-dir "/lisp/" destdir))
52         (buf (get-buffer-create package-admin-temp-buffer)))
53     (call-process "add-little-package.sh"
54                   nil
55                   buf
56                   t
57                   ;; rest of command line follows
58                   package-admin-xemacs file destination)))
59
60 ;;;###autoload
61 (defun package-admin-add-binary-package (file &optional pkg-dir)
62   "Install a pre-bytecompiled XEmacs package into package hierarchy."
63   (interactive "fPackage tarball: ")
64   (when (null pkg-dir)
65     (when (or (not (listp late-packages))
66               (not late-packages))
67       (error "No package path"))
68     (setq pkg-dir (car (last late-packages))))
69
70   (let ((buf (get-buffer-create package-admin-temp-buffer)))
71     (call-process "add-big-package.sh"
72                   nil
73                   buf
74                   t
75                   ;; rest of command line follows
76                   package-admin-xemacs file pkg-dir)))
77
78 (provide 'package-admin)
79
80 ;;; package-admin.el ends here