tm 7.21.
[elisp/tm.git] / mk-tm
1 ;;; -*-Emacs-Lisp-*-
2 ;;;
3 ;;; $Id: mk-tm,v 6.0 1995/10/26 09:32:03 morioka Exp morioka $
4 ;;;
5
6 (setq load-path (append
7                  (mapcar (function
8                           (lambda (path)
9                             (expand-file-name path (getenv "PWD"))
10                             ))
11                          '("." "../tl/" "../mel/")
12                          )
13                  load-path))
14
15 (require 'tl-misc)
16 (require 'gnus)
17 (require 'tm-rich)
18 (require 'mel-u)
19
20 (setq tm-modules
21       (append
22        (cons
23         (cond ((boundp 'NEMACS)
24                "tm-nemacs"
25                )
26               ((boundp 'MULE)
27                "tm-mule"
28                )
29               (t
30                "tm-orig"
31                ))
32         '("signature"
33           "tm-def"
34           "tm-ew-d" "tm-ew-e" "tm-eword"
35           "tm-parse" "tm-view" "tm-play"
36           "tm-latex" "tm-w3" "tm-tar" "tm-partial"
37           "tm-rmail" "tm-edit"
38           "tm-setup" "mime-setup"
39           ))
40        (cons
41         (if (or (< emacs-major-version 19)(< emacs-minor-version 29))
42             "tinyrich"
43           "richtext"
44           )
45         '("tm-rich")
46         )
47        ))
48
49 (setq tm-uncompile-el-files '("sc-setup.el"))
50
51 (if (catch 'tag
52       (let ((paths load-path) path)
53         (while paths
54           (setq path (expand-file-name "ange-ftp.el" (car paths)))
55           (if (file-exists-p path)
56               (throw 'tag path)
57             )
58           (setq paths (cdr paths))
59           )))
60     (setq tm-modules (append tm-modules '("tm-ftp")))
61   (setq tm-uncompile-el-files
62         (append tm-uncompile-el-files '("tm-ftp.el")))
63   )
64
65 (if (catch 'tag
66       (let ((paths load-path) path)
67         (while paths
68           (setq path (expand-file-name "vm.elc" (car paths)))
69           (if (file-exists-p path)
70               (throw 'tag path)
71             )
72           (setq paths (cdr paths))
73           )))
74     (setq tm-modules (append tm-modules '("tm-vm")))
75   (setq tm-uncompile-el-files
76         (append tm-uncompile-el-files '("tm-vm.el")))
77   )
78
79 (if (file-exists-p "tm-evs.el")
80     (setq tm-modules (append tm-modules '("tm-evs")))
81   )
82
83 (setq tm-el-files
84       (mapcar (function (lambda (module)
85                           (concat module ".el")
86                           ))
87               tm-modules))
88
89 (setq tm-elc-files
90       (mapcar (function (lambda (module)
91                           (concat module ".elc")
92                           ))
93               tm-modules))
94
95 (defun compile-tm ()
96   (mapcar (function byte-compile-file file) tm-el-files)
97   )
98
99 (defconst el-file-mode (+ (* 64 6)(* 8 4) 4))
100
101 (defun install-el (path file)
102   (let ((full-path (expand-file-name file path)))
103     (if (file-exists-p full-path)
104         (set-file-modes full-path el-file-mode)
105       )
106     (copy-file file full-path t t)
107     (princ (format "%s -> %s\n" file path))
108     ))
109
110 (defun install-el-files (path &rest files)
111   (mapcar (function (lambda (file)
112                       (if (file-exists-p file)
113                           (install-el path file)
114                         )))
115           files))
116
117 (defun install-elc (path file)
118   (let ((full-path (expand-file-name file path)))
119     (copy-file file full-path t t)
120     (delete-file file)
121     (princ (format "%s -> %s\n" file path))
122     ))
123
124 (defun install-elc-files (path &rest files)
125   (mapcar (function (lambda (file)
126                       (if (file-exists-p file)
127                           (install-elc path file)
128                         )))
129           files))
130
131 (defun install-tm ()
132   (let ((path (car command-line-args-left)))
133     (princ (format "%s\n" emacs-version))
134     (if (not (file-exists-p path))
135         (make-directory path t)
136       )
137     (apply (function install-el-files) path
138            (append tm-el-files tm-uncompile-el-files)
139            )
140     (apply (function install-elc-files) path tm-elc-files)
141     ))