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