This commit was generated by cvs2svn to compensate for changes in r434,
[elisp/tm.git] / mk-tm
1 ;;; -*-Emacs-Lisp-*-
2 ;;;
3 ;;; $Id: mk-tm,v 7.7 1996/02/27 21:24:06 morioka Exp $
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
17 ;; Please specify VM path.
18 (add-path "vm-5.95beta/" 'all-paths)
19
20 ;; Please specify Mailcrypt path.
21 (add-path "mailcrypt-3.4/" 'all-paths)
22
23 ;; Please specify BBDB path.
24 (add-path "bbdb-1.50/" 'all-paths)
25
26
27 (setq tm-modules
28       (cons
29        (cond ((boundp 'NEMACS)
30               "tm-nemacs"
31               )
32              ((boundp 'MULE)
33               "tm-mule"
34               )
35              (t
36               "tm-orig"
37               ))
38        '("signature"
39          "tm-def"
40          "tm-ew-d" "tm-parse" "tm-view" "tm-play" "tm-partial"
41          "tm-rich"
42          "tm-latex" "tm-html" "tm-tar" "tm-file"
43          "tm-ew-e"
44          "tm-edit"
45          "tm-rmail" "tm-mail"
46          "tm-setup" "mime-setup"
47          )))
48
49 (setq tm-uncompile-el-files '("sc-setup.el"))
50
51 (if (file-installed-p "ange-ftp.el")
52     (setq tm-modules (append tm-modules '("tm-ftp")))
53   (setq tm-uncompile-el-files
54         (append tm-uncompile-el-files '("tm-ftp.el")))
55   )
56
57 (if (file-installed-p "vm.elc")
58     (setq tm-modules (append tm-modules '("tm-vm")))
59   (setq tm-uncompile-el-files
60         (append tm-uncompile-el-files '("tm-vm.el")))
61   )
62
63 (if (catch 'tag
64       (let ((paths load-path) path)
65         (while paths
66           (setq path (expand-file-name "mailcrypt.el" (car paths)))
67           (if (file-exists-p path)
68               (throw 'tag path)
69             )
70           (setq paths (cdr paths))
71           )))
72     (setq tm-modules (append tm-modules '("tm-pgp")))
73   (setq tm-uncompile-el-files
74         (append tm-uncompile-el-files '("tm-pgp.el")))
75   )
76
77 (if (catch 'tag
78       (let ((paths load-path) path)
79         (while paths
80           (setq path (expand-file-name "bbdb.el" (car paths)))
81           (if (file-exists-p path)
82               (throw 'tag path)
83             )
84           (setq paths (cdr paths))
85           )))
86     (setq tm-modules (append tm-modules '("tm-bbdb")))
87   (setq tm-uncompile-el-files
88         (append tm-uncompile-el-files '("tm-bbdb.el")))
89   )
90
91 (if (and (file-exists-p "tm-evs.el")
92          (or (boundp 'MULE)
93              (boundp 'NEMACS))
94          )
95     (setq tm-modules (append tm-modules '("tm-evs")))
96   )
97
98 (if (string-match "XEmacs" emacs-version)
99     (setq tm-modules (append tm-modules '("tm-image")))
100   (if (boundp 'MULE)
101       (if (catch 'tag
102             (let ((paths load-path) path)
103               (while paths
104                 (setq path (expand-file-name "bitmap.el" (car paths)))
105                 (if (file-exists-p path)
106                     (throw 'tag path)
107                   )
108                 (setq paths (cdr paths))
109                 )))
110           (setq tm-modules (append tm-modules '("tm-image")))
111         (setq tm-uncompile-el-files
112               (append tm-uncompile-el-files '("tm-image.el")))
113         )))
114
115 (setq tm-el-files
116       (mapcar (function (lambda (module)
117                           (concat module ".el")
118                           ))
119               tm-modules))
120
121 (setq tm-elc-files
122       (mapcar (function (lambda (module)
123                           (concat module ".elc")
124                           ))
125               tm-modules))
126
127 (defun compile-tm ()
128   ;; (require 'gnus)
129   (require 'tm-rich)
130   (require 'mel-u)
131   (require 'tm-edit)
132   (load "rmailsum")
133   (mapcar (function
134            (lambda (module)
135              (let ((el-file (concat module ".el"))
136                    (elc-file (concat module ".elc"))
137                    )
138                (if (file-newer-than-file-p el-file elc-file)
139                    (byte-compile-file el-file)
140                  )
141                )))
142           tm-modules)
143   )
144
145 (defconst el-file-mode (+ (* 64 6)(* 8 4) 4))
146
147 (defun install-el (path file)
148   (let ((full-path (expand-file-name file path)))
149     (if (file-exists-p full-path)
150         (set-file-modes full-path el-file-mode)
151       )
152     (copy-file file full-path t t)
153     (princ (format "%s -> %s\n" file path))
154     ))
155
156 (defun install-el-files (path &rest files)
157   (mapcar (function (lambda (file)
158                       (if (file-exists-p file)
159                           (install-el path file)
160                         )))
161           files))
162
163 (defun install-elc (path file)
164   (let ((full-path (expand-file-name file path)))
165     (copy-file file full-path t t)
166     (delete-file file)
167     (princ (format "%s -> %s\n" file path))
168     ))
169
170 (defun install-elc-files (path &rest files)
171   (mapcar (function (lambda (file)
172                       (if (file-exists-p file)
173                           (install-elc path file)
174                         )))
175           files))
176
177 (defun install-tm ()
178   (let ((path (car command-line-args-left)))
179     (princ (format "%s\n" emacs-version))
180     (if (not (file-exists-p path))
181         (make-directory path t)
182       )
183     (apply (function install-el-files) path
184            (append tm-el-files tm-uncompile-el-files)
185            )
186     (apply (function install-elc-files) path tm-elc-files)
187     (setq command-line-args-left (cdr command-line-args-left))
188     ))