663d082344ffdf252ab572c9fc137fb4ae6443a9
[elisp/tm.git] / gnus / mk-tgnus
1 ;;; -*-Emacs-Lisp-*-
2
3 (defun compile-tm-gnus ()
4   (require 'gnus)
5   (require 'tm-view)
6   (princ (format "%s\n" gnus-version))
7   (cond ((string-match "GNUS 3" gnus-version)
8          (byte-compile-file "tm-gnus3.el")
9          )
10         ((string-match "GNUS 4" gnus-version)
11          (byte-compile-file "tm-gnus4.el")
12          )
13         ((string-match "(ding)" gnus-version)
14          (require 'tm-dgnus)
15          (byte-compile-file "tm-dgnus.el")
16          (byte-compile-file "tm-gnus5.el")
17          )
18         ((string-match "Gnus v5" gnus-version)
19          (byte-compile-file "tm-gnus5.el")
20          ))
21   (byte-compile-file "tm-gnus.el")
22   )
23
24 (defconst el-file-mode (+ (* 64 6)(* 8 4) 4))
25
26 (defun install-el (path file)
27   (let ((full-path (expand-file-name file path)))
28     (if (file-exists-p full-path)
29         (set-file-modes full-path el-file-mode)
30       )
31     (copy-file file full-path t t)
32     (princ (format "%s -> %s\n" file path))
33     ))
34
35 (defun install-el-files (path &rest files)
36   (mapcar (function (lambda (file)
37                       (if (file-exists-p file)
38                           (install-el path file)
39                         )))
40           files))
41
42 (defun install-elc (path file)
43   (let ((full-path (expand-file-name file path)))
44     (copy-file file full-path t t)
45     (delete-file file)
46     (princ (format "%s -> %s\n" file path))
47     ))
48
49 (defun install-elc-files (path &rest files)
50   (mapcar (function (lambda (file)
51                       (if (file-exists-p file)
52                           (install-elc path file)
53                         )))
54           files))
55
56 (defun install-tm-gnus ()
57   (let ((path (car command-line-args-left)))
58     (princ (format "%s\n" emacs-version))
59     (if (< (string-to-int emacs-version) 19)
60         (progn
61           (install-el-files path
62                             "tm-gnus.el" "tm-ognus.el"
63                             "tm-gnus3.el" "tm-gnus4.el")
64           (install-elc-files path
65                              "tm-gnus.elc"
66                              "tm-gnus3.elc" "tm-gnus4.elc")
67           )
68       (progn
69         (install-el-files path
70                           "tm-gnus.el" "tm-gnus5.el"
71                           "tm-dgnus.el"
72                           "tm-ognus.el" "tm-gnus4.el")
73         (install-elc-files path
74                            "tm-gnus.elc" "tm-gnus5.elc"
75                            "tm-dgnus.elc"
76                            "tm-gnus4.elc")
77         ))))