tm 6.72
[elisp/tm.git] / mk-tm
1 ;;; -*-Emacs-Lisp-*-
2
3 (setq load-path (append
4                  (mapcar (function
5                           (lambda (path)
6                             (expand-file-name path (getenv "PWD"))
7                             ))
8                          '("." "../tl/" "../mel/")
9                          )
10                  load-path))
11
12 (require 'tl-misc)
13 (require 'gnus)
14 (require 'tm-rich)
15
16 (setq tm-modules
17       (append
18        (cons
19         (cond ((boundp 'NEMACS)
20                "tm-nemacs"
21                )
22               ((boundp 'MULE)
23                "tm-mule"
24                )
25               (t
26                "tm-orig"
27                ))
28         '("signature"
29           "tiny-mime" "tm-misc"
30           "tm-view"
31           "tm-ftp" "tm-latex"
32           "tm-rmail" "tm-comp"
33           "tm-setup" "mime-setup"
34           ))
35        (if (not (string-match "\\(XEmacs\\|Lucid\\)" emacs-version))
36            (progn
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 "vm.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-vm")))
58   (setq tm-uncompile-el-files
59         (append tm-uncompile-el-files '("tm-vm.el")))
60   )
61
62 (setq tm-el-files
63       (mapcar (function (lambda (module)
64                           (concat module ".el")
65                           ))
66               tm-modules))
67
68 (setq tm-elc-files
69       (mapcar (function (lambda (module)
70                           (concat module ".elc")
71                           ))
72               tm-modules))
73
74 (defun compile-tm ()
75   (mapcar (function byte-compile-file) tm-el-files)
76   )
77
78 (defconst el-file-mode (+ (* 64 6)(* 8 4) 4))
79
80 (defun install-el (path file)
81   (let ((full-path (expand-file-name file path)))
82     (if (file-exists-p full-path)
83         (set-file-modes full-path el-file-mode)
84       )
85     (copy-file file full-path t t)
86     (princ (format "%s -> %s\n" file path))
87     ))
88
89 (defun install-el-files (path &rest files)
90   (mapcar (function (lambda (file)
91                       (if (file-exists-p file)
92                           (install-el path file)
93                         )))
94           files))
95
96 (defun install-elc (path file)
97   (let ((full-path (expand-file-name file path)))
98     (copy-file file full-path t t)
99     (delete-file file)
100     (princ (format "%s -> %s\n" file path))
101     ))
102
103 (defun install-elc-files (path &rest files)
104   (mapcar (function (lambda (file)
105                       (if (file-exists-p file)
106                           (install-elc path file)
107                         )))
108           files))
109
110 (defun install-tm ()
111   (let ((path (car command-line-args-left)))
112     (princ (format "%s\n" emacs-version))
113     (apply (function install-el-files) path
114            (append tm-el-files tm-uncompile-el-files)
115            )
116     (apply (function install-elc-files) path tm-elc-files)
117     ))