File: CMAIL-MK

package info (click to toggle)
cmail 2.62-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,496 kB
  • ctags: 2,104
  • sloc: lisp: 25,492; makefile: 189; perl: 148; sh: 68
file content (157 lines) | stat: -rw-r--r-- 5,391 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
;;; CMAIL-MK					-*-Emacs-Lisp-*-

(defvar install-apel nil)
(defvar compile-cmail-options t)
(defvar install-cmail-options t)

(defun config-cmail ()
  (let (prefix exec-prefix lisp-dir)
    (and (setq prefix (car command-line-args-left))
	 (or (string-equal "NONE" prefix)
	     (defvar PREFIX prefix)
	     ))
    (setq command-line-args-left (cdr command-line-args-left))
    (and (setq exec-prefix (car command-line-args-left))
	 (or (string-equal "NONE" exec-prefix)
	     (defvar EXEC_PREFIX exec-prefix)
	     ))
    (setq command-line-args-left (cdr command-line-args-left))
    (and (setq lisp-dir (car command-line-args-left))
	 (or (string-equal "NONE" lisp-dir)
	     (defvar LISPDIR lisp-dir)
	     ))
    (setq command-line-args-left (cdr command-line-args-left))
    (and (setq info-dir (car command-line-args-left))
	 (or (string-equal "NONE" info-dir)
	     (defvar INFODIR info-dir)
	     ))
    (setq command-line-args-left (cdr command-line-args-left))
    (and (setq version-specific-lisp-dir (car command-line-args-left))
	 (or (string-equal "NONE" version-specific-lisp-dir)
	     (progn
	       (defvar VERSION_SPECIFIC_LISPDIR version-specific-lisp-dir)
	       (princ (format "VERSION_SPECIFIC_LISPDIR=%s\n"
			      VERSION_SPECIFIC_LISPDIR)))
	     ))
    (setq command-line-args-left (cdr command-line-args-left))
    )
  (load-file "CMAIL-CFG")
  (load-file "CMAIL-ELS")
  (princ (format "PREFIX=%s\nEXEC_PREFIX=%s\nLISPDIR=%s\n"
		 PREFIX EXEC_PREFIX LISPDIR)))

(defun compile-info (file)
  (condition-case err
      (progn
	(if buffer-file-name (kill-buffer (current-buffer)))
	(find-file file)
	(buffer-disable-undo (current-buffer))
	(set-buffer-modified-p nil)
	(texinfo-mode)
	(message "texinfo formatting %s..." file)
	(texinfo-format-buffer nil)
	(if (buffer-modified-p)
	    (progn (message "Saving modified %s" (buffer-file-name))
		   (save-buffer)
		   (kill-buffer (current-buffer)))))
    (error
     (message ">> Error: %s" (prin1-to-string err))
     (message ">>  point at")
     (let ((s (buffer-substring (point)
				(min (+ (point) 100)
				     (point-max))))
	   (tem 0))
       (while (setq tem (string-match "\n+" s tem))
	 (setq s (concat (substring s 0 (match-beginning 0))
			 "\n>>  "
			 (substring s (match-end 0)))
	       tem (1+ tem)))
       (message ">>  %s" s))
     (setq error 1))))

(defun compile-cmail ()
  (let ((curdir (expand-file-name ".")))
    (config-cmail)
    (princ (format "%s\n" (emacs-version)))
    (if install-apel (compile-apel-from-cmail))
    (compile-elisp-modules cmail-modules ".")
    (if compile-cmail-options (compile-cmail-options-from-cmail))
    (if (file-exists-p "doc/cmail.en.info")
	nil
      (compile-info "doc/cmail.en.texi"))
    (if (file-exists-p "doc/cmail.info")
	nil
      (if (>= (string-to-int emacs-version) 20)
	  (set-language-environment "Japanese"))
      (compile-info "doc/cmail.texi"))
    (install-change-dir curdir)))

(defun compile-cmail-no-options ()
  (setq compile-cmail-options nil)
  (compile-cmail))

(defun compile-apel-from-cmail (&optional just-print)
  (let ((curdir (expand-file-name ".")))
    (install-change-dir (expand-file-name "apel"))
    (load "APEL-MK")
    (compile-apel)
    (install-change-dir curdir)))

(defun compile-cmail-options-from-cmail ()
  (let ((curdir (expand-file-name ".")))
    (install-change-dir (expand-file-name "options"))
    (setq CMAIL_OPTIONS_PREFIX (concat CMAIL_DIR "/options"))
    (load "CMAIL-OPTIONS-MK")
    (compile-cmail-options)
    (install-change-dir curdir)))

(defun install-cmail (&optional just-print)
  (if (null just-print) (compile-cmail))
  (princ (format "%s\n" (emacs-version)))
  (if install-apel (install-apel-from-cmail just-print))
  ;; Use cmail-vars.elc to check if it has been compiled.  If not
  ;; compiled yet, most likely we should not use del-elc flag.
  (let ((del-elc (file-exists-p "cmail-vars.elc")))
    (install-elisp-modules cmail-modules "." CMAIL_DIR just-print del-elc))
  (if install-cmail-options (install-cmail-options-from-cmail just-print))
  (if (or (featurep 'xemacs) (>= emacs-major-version 21))
      (install-files (directory-files "icon" nil "\\.x[bp]m$")
		     "icon" CMAIL_ICON_DIR nil t just-print))
  (install-files '("cmail.info" "cmail.en.info") "doc" INFODIR
		 t t just-print))

(defun install-cmail-no-options (&optional just-print)
  (setq install-cmail-options nil)
  (install-cmail just-print))

(defun install-cmail-options-from-cmail (&optional just-print)
  (let ((curdir (expand-file-name ".")))
    (install-change-dir (expand-file-name "options"))
    (setq CMAIL_OPTIONS_PREFIX (concat CMAIL_DIR "/options"))
    (load "CMAIL-OPTIONS-MK")
    (install-cmail-options just-print)
    (install-change-dir curdir)))

(defun install-apel-from-cmail (&options just-print)
  (let ((curdir (expand-file-name ".")))
    (install-change-dir (expand-file-name "apel"))
    (load "APEL-MK")
    (install-apel just-print)
    (install-change-dir curdir)))

(defun install-change-dir (dir)
  (princ (format "Changing Directory to %s\n" dir))
  (setq-default default-directory dir)
  (mapcar (function
	   (lambda (buffer)
	     (save-excursion
	       (set-buffer buffer)
	       (setq default-directory dir))))
	  (buffer-list)))

(defun what-where-cmail ()
  (config-cmail)
  (load-file "CMAIL-ELS")
  (install-cmail 'just-print))

;;; CMAIL-MK ends here