5 (cons (if (featurep 'xemacs)
21 ;; riece-identity -+-> riece-channel
30 ;; riece-layout ---> riece-display
35 ;; riece-channel -+-> riece-naming
40 ;; riece-filter calls riece-{handle,000,200,300,400,500}
53 (defvar riece-mcat-modules
54 '(riece-mcat-japanese))
56 (defvar riece-generated-modules
57 '(riece-package-info))
60 '("riece-command-previous-channel.xpm"
61 "riece-command-next-channel.xpm"
62 "riece-command-configure-windows.xpm"
63 "riece-command-list-addons.xpm"
64 "riece-command-join.xpm"
65 "riece-command-part.xpm"))
71 (defun riece-byte-compile-dest-file-function (filename)
73 (concat (file-name-nondirectory filename) "c")))
75 (defun riece-compile-modules (modules srcdir)
76 (let ((load-path (cons nil (cons srcdir load-path)))
79 (let ((source (expand-file-name
80 (concat (symbol-name (car modules)) ".el")
82 (binary (expand-file-name
83 (concat (symbol-name (car modules)) ".elc"))))
84 (if (file-newer-than-file-p source binary)
86 (let ((byte-compile-dest-file-function
87 #'riece-byte-compile-dest-file-function))
88 (byte-compile-file source))
90 (setq error-modules (cons (car modules) error-modules))))))
91 (setq modules (cdr modules)))
94 WARNING: ---------------------------------------------------------
95 WARNING: Couldn't compile following modules:
97 WARNING: " (mapconcat #'symbol-name error-modules ", ") "\n\
99 WARNING: You should probably stop here, try \"make distclean\" to clear
100 WARNING: the last build, and then reconfigure.
101 WARNING: ---------------------------------------------------------\n\n")))))
103 (defun riece-compile-module ()
104 (let ((load-path (cons nil load-path)))
105 (let ((source (expand-file-name
106 (concat (car command-line-args-left) ".el"))))
107 (if (file-newer-than-file-p source (concat source "c"))
108 (byte-compile-file source)))))
110 (defun riece-install-modules (modules srcdir lispdir just-print)
111 (unless (or just-print (file-exists-p lispdir))
112 (make-directory lispdir t))
113 ;; Workaround for "make distcheck"
114 (set-file-modes lispdir 493)
116 (let ((name (symbol-name (car modules))))
117 (princ (format "%s.el -> %s\n" name lispdir))
119 (copy-file (expand-file-name
121 (if (memq (car modules) riece-generated-modules)
124 (expand-file-name (concat name ".el") lispdir)
126 (princ (format "%s.elc -> %s\n" name lispdir))
128 (if (file-exists-p (expand-file-name (concat name ".elc")))
129 (copy-file (expand-file-name (concat name ".elc"))
130 (expand-file-name (concat name ".elc") lispdir)
132 (princ (format "(%s was not successfully compiled, ignored)\n"
134 (setq modules (cdr modules))))
136 (defun riece-install-icons (icons srcdir lispdir just-print)
137 (unless (or just-print (file-exists-p lispdir))
138 (make-directory lispdir t))
139 ;; Workaround for "make distcheck"
140 (set-file-modes lispdir 493)
142 (when (file-exists-p (expand-file-name (car icons) srcdir))
143 (princ (format "%s -> %s\n" (car icons) lispdir))
145 (copy-file (expand-file-name (car icons) srcdir)
146 (expand-file-name (car icons) lispdir)
148 (setq icons (cdr icons))))
150 (defun riece-install-scripts (scripts srcdir lispdir just-print)
151 (unless (or just-print (file-exists-p lispdir))
152 (make-directory lispdir t))
153 ;; Workaround for "make distcheck"
154 (set-file-modes lispdir 493)
156 (when (file-exists-p (expand-file-name (car scripts) srcdir))
157 (princ (format "%s -> %s\n" (car scripts) lispdir))
159 (copy-file (expand-file-name (car scripts) srcdir)
160 (expand-file-name (car scripts) lispdir)
162 (setq scripts (cdr scripts))))
164 (defun riece-install-just-print-p ()
165 (let ((flag (getenv "MAKEFLAGS"))
168 (string-match "^\\(\\(--[^ ]+ \\)+-\\|[^ =-]\\)*n" flag))))
170 (defun riece-examine-modules (srcdir)
171 (let ((load-path (cons nil (cons srcdir load-path))))
172 (require 'riece-mcat)
173 (require 'riece-addon-modules)
174 (append riece-modules
176 (mapcar #'car riece-addon-modules))))
178 (defun riece-examine ()
179 (princ (mapconcat #'symbol-name (riece-examine-modules) " ")))
181 (defun riece-update-mcat ()
182 (let ((modules (riece-examine-modules))
183 (pointer riece-mcat-modules)
186 (setq modules (delq (car pointer) modules)
187 pointer (cdr pointer)))
188 (setq files (mapcar (lambda (module)
189 (concat (symbol-name module) ".el"))
191 pointer riece-mcat-modules)
193 (riece-mcat-update files (concat (symbol-name (car pointer)) ".el")
194 (intern (concat (symbol-name (car pointer))
196 (setq pointer (cdr pointer)))))
198 (defun riece-compile ()
199 (let ((srcdir (car command-line-args-left)))
200 (riece-compile-modules (riece-examine-modules srcdir) srcdir)))
202 (defun riece-install ()
203 (let ((srcdir (car command-line-args-left))
204 (lispdir (nth 1 command-line-args-left)))
205 (riece-install-modules
206 (riece-examine-modules srcdir)
208 (expand-file-name "riece" lispdir)
209 (riece-install-just-print-p))
213 (expand-file-name "riece" lispdir)
214 (riece-install-just-print-p))
215 (riece-install-scripts
218 (expand-file-name "riece" lispdir)
219 (riece-install-just-print-p))
220 ;; Workaround for an XEmacs 21.5 bug ("xemacs -batch -f <func> <arg1>"
221 ;; attempts to open <arg1> as a file after <func>).
222 (setq command-line-args-left (nthcdr 2 command-line-args-left))))
224 (defun riece-uninstall ()
225 (let ((files (directory-files (expand-file-name "riece"
226 (car command-line-args-left))
227 t "\\.\\(elc?\\|rb\\|xpm\\)$")))
229 (delete-file (car files))
230 (setq files (cdr files)))
231 ;; Workaround for an XEmacs 21.5 bug ("xemacs -batch -f <func> <arg1>"
232 ;; attempts to open <arg1> as a file after <func>).
233 (setq command-line-args-left (cdr command-line-args-left))))
235 (defun riece-compile-package ()
236 (setq autoload-package-name "riece")
237 (add-to-list 'command-line-args-left ".")
238 (batch-update-directory)
239 (add-to-list 'command-line-args-left ".")
240 (Custom-make-dependencies)
241 (riece-compile-modules
242 (append (riece-examine-modules)
243 '(auto-autoloads custom-load))))
245 (defun riece-install-package ()
246 (riece-install-modules
247 (append (riece-examine-modules)
248 '(auto-autoloads custom-load))
249 (expand-file-name "lisp/riece" (car command-line-args-left))
250 (riece-install-just-print-p))
253 (expand-file-name "etc/riece" (car command-line-args-left))
254 (riece-install-just-print-p))
255 (riece-install-scripts
257 (expand-file-name "etc/riece" (car command-line-args-left))
258 (riece-install-just-print-p)))
261 (let* ((srcdir (car command-line-args-left))
262 (load-path (cons (expand-file-name "test" srcdir)
263 (cons srcdir (cons nil load-path))))
264 (files (directory-files (expand-file-name "test" srcdir) t
267 (require 'lunit-report)
268 (setq suite (lunit-make-test-suite))
270 (when (file-regular-p (car files))
271 (load-file (car files))
272 (lunit-test-suite-add-test
274 (lunit-make-test-suite-from-class
275 (intern (file-name-sans-extension
276 (file-name-nondirectory (car files)))))))
277 (setq files (cdr files)))
278 (lunit-report suite (nth 1 command-line-args-left))))