36c4f072a7fda3a801f48775ba4771ab7bd8fe11
[elisp/tm.git] / TM-MK
1 ;;; -*-Emacs-Lisp-*-
2 ;;;
3 ;;; $Id: TM-MK,v 7.43 1996/11/27 11:48:53 morioka Exp morioka $
4 ;;;
5
6 (defun config-tm ()
7   (let (prefix exec-prefix)
8     (setq prefix (car command-line-args-left))
9     (and prefix
10          (not (string-equal "NONE" prefix))
11          (progn
12            (defvar PREFIX prefix)
13            (setq command-line-args-left (cdr command-line-args-left))
14            )
15          (setq exec-prefix (car command-line-args-left))
16          (progn
17            (defvar EXEC_PREFIX exec-prefix)
18            ;;(setq command-line-args-left (cdr command-line-args-left))
19            )))
20   (load-file "TM-CFG")
21   (load-file "../emu/EMU-ELS")
22   (load-file "../tl/TL-ELS")
23   (load-file "../bitmap-mule/BITMAP-ELS")
24   (load-file "../mu/MU-ELS")
25   (load-file "../mel/MEL-ELS")
26   (load-file "TM-ELS")
27   (load-file "../tm-mh-e/TMH-ELS")
28   (load-file "../tm-mail/TMAIL-ELS")
29   (load-file "../tm-vm/TM-VM-ELS")
30   (princ (format "PREFIX=%s\tEXEC_PREFIX=%s\n" PREFIX EXEC_PREFIX))
31   )
32
33 (defun directory= (dir1 dir2)
34   (string= (file-name-as-directory dir1)(file-name-as-directory dir2))
35   )
36
37 (defun make-mime-setup (lisp-dir
38                         tl-path bitmap-path mu-path mel-path tm-path)
39   (let ((buf (find-file "mime-setup.el.in")))
40     (goto-char (point-min))
41     (re-search-forward "^;;; Code:\n" nil t)
42     (setq buffer-read-only nil)
43
44     ;; generate tl setting
45     (let ((tl-absolute-path (expand-file-name tl-path lisp-dir)))
46       (if (MEMBER tl-absolute-path default-load-path
47                   :test (function directory=))
48           (insert "\n(require \'tl-misc)")
49         (insert
50          (format "
51
52 \(let ((load-path
53        (cons \"%s\"
54              load-path)))
55   (require \'tl-misc)
56   )
57 \(add-path \"%s\")" tl-absolute-path tl-path))
58         ))
59     
60     ;; generate MU load-path setting
61     (and bitmap-modules
62          (or (MEMBER (expand-file-name bitmap-path lisp-dir)
63                      default-load-path
64                      :test (function directory=))
65              (insert (format "\n(add-path \"%s\")" bitmap-path))
66              ))
67     
68     ;; generate MU load-path setting
69     (or (MEMBER (expand-file-name mu-path lisp-dir)
70                 default-load-path
71                 :test (function directory=))
72         (insert (format "\n(add-path \"%s\")" mu-path))
73         )
74     
75     ;; generate MEL load-path setting
76     (or (MEMBER (expand-file-name mel-path lisp-dir)
77                 default-load-path
78                 :test (function directory=))
79         (insert (format "\n(add-path \"%s\")" mel-path))
80         )
81     
82     ;; generate tm load-path setting
83     (or (MEMBER (expand-file-name tm-path lisp-dir)
84                 default-load-path
85                 :test (function directory=))
86         (insert (format "\n(add-path \"%s\")" tm-path))
87         )
88     
89     ;; generate tm external-methods path setting
90     (or (string= METHOD_DIR exec-directory)
91         (insert
92          (format "\n(defvar mime-viewer/external-progs %s)"
93                  (let ((dir (file-relative-name METHOD_DIR data-directory)))
94                    (if (< (length dir) (length METHOD_DIR))
95                        (concat "\n  (expand-file-name \""
96                                dir "\" data-directory)")
97                      (setq dir (file-relative-name METHOD_DIR
98                                                    (expand-file-name "~/")))
99                      (if (< (length dir) (length METHOD_DIR))
100                          (concat "\n  (expand-file-name \"~/"
101                                  dir "\")")
102                        (concat "\"" METHOD_DIR "\"")
103                        )))
104                  ))
105         )
106     (write-file "mime-setup.el")
107     ))
108
109 (defun compile-tm ()
110   (config-tm)
111   (print load-path)
112   (require 'mel-u)
113   (require 'tm-edit)
114   (load "rmailsum")
115   (require 'tm-mh-e)
116   (make-mime-setup LISPDIR
117                    TL_RELATIVE_DIR BITMAP_RELATIVE_DIR
118                    MU_RELATIVE_DIR MEL_RELATIVE_DIR
119                    TM_KERNEL_RELATIVE_DIR)
120   (compile-elisp-modules emu-modules            "../emu")
121   (compile-elisp-modules tl-modules             "../tl")
122   (compile-elisp-modules bitmap-modules         "../bitmap-mule")
123   (compile-elisp-modules mu-modules-to-compile  "../mu")
124   (compile-elisp-modules mel-modules            "../mel")
125   (compile-elisp-modules tm-modules-to-compile  ".")
126   (compile-elisp-modules tm-mh-e-modules        "../tm-mh-e")
127   (compile-elisp-module  'mime-setup            ".")
128   (require 'gnus)
129   (cond ((featurep 'gnus-ems)
130          (load "../gnus-mime/Gnus-MIME-ELS")
131          (compile-elisp-modules gnus-mime-modules-to-compile "../gnus-mime")
132          )
133         (t
134          (load "../tm-gnus/TGNUS-ELS")
135          (compile-elisp-modules tm-gnus-modules-to-compile "../tm-gnus")
136          ))
137   (compile-elisp-modules tm-mail-modules        "../tm-mail")
138   (compile-elisp-modules tm-vm-modules-to-compile "../tm-vm")
139   )
140
141 (defun install-tm ()
142   (config-tm)
143   (princ (format "%s\n" emacs-version))
144   (install-elisp-modules emu-modules     "../emu"       EMU_DIR)
145   (install-elisp-modules tl-modules      "../tl"        TL_DIR)
146   (install-elisp-modules bitmap-modules "../bitmap-mule" BITMAP_DIR)
147   (install-elisp-modules mu-modules      "../mu"        MU_DIR)
148   (install-elisp-modules mel-modules     "../mel"       MEL_DIR)
149   (install-elisp-modules tm-modules      "."            TM_KERNEL_DIR)
150   (install-elisp-modules tm-mh-e-modules "../tm-mh-e"   TM_MHE_DIR)
151   ;;(install-tm-gnus)
152   (require 'gnus)
153   (cond ((featurep 'gnus-ems)
154          (load "../gnus-mime/Gnus-MIME-ELS")
155          (install-elisp-modules gnus-mime-modules
156                                 "../gnus-mime" Gnus_MIME_DIR)
157          )
158         (t
159          (load "../tm-gnus/TGNUS-ELS")
160          (install-elisp-modules tm-gnus-modules "../tm-gnus" TM_GNUS_DIR)
161          ))
162   (install-elisp-modules tm-mail-modules "../tm-mail"   TM_MAIL_DIR)
163   (install-elisp-modules tm-vm-modules   "../tm-vm"     TM_VM_DIR)
164   (install-elisp-modules '(mime-setup)   "."    SETUP_FILE_DIR)
165   )
166
167 (defun install-execs ()
168   (config-tm)
169   (install-files BINS       BIN_SRC_DIR    BIN_DIR)
170   (install-files METHODS METHOD_SRC_DIR METHOD_DIR nil t)
171   )
172
173 ;;; TM-MK ends here