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