1 ;;; $Id: build.el,v 1.52 2003-10-13 15:52:13 james Exp $
5 ;; Copyright (C) 1997-2002 Adrian Aichner
7 ;; Author: Adrian Aichner <adrian@xemacs.org>
8 ;; Date: $Date: 2003-10-13 15:52:13 $
9 ;; Version: $Revision: 1.52 $
12 ;; This file is part of XEmacs.
14 ;; XEmacs is free software; you can redistribute it and/or modify
15 ;; it under the terms of the GNU General Public License as published by
16 ;; the Free Software Foundation; either version 2, or (at your option)
19 ;; XEmacs is distributed in the hope that it will be useful, but
20 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 ;; General Public License for more details.
24 ;; You should have received a copy of the GNU General Public License
25 ;; along with XEmacs; see the file COPYING. If not, write to the Free
26 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
29 ;;; Synched up with: Not synched.
40 (if (featurep 'sxemacs)
42 (require 'build-report))
44 (autoload 'ring-insert-at-beginning "ring")
45 (autoload 'efs-copy-file "efs")
47 ;; `url-copy-file' (buffer: build.el, mode: Lisp)
52 ;; Pull in compile, if it is available.
60 ;; Pull in pcl-cvs, if it is available.
67 (defcustom build-from-what
69 "The Source Code units XEmacs is to be built from (\"Tarballs\" or
77 (defcustom build-with-what
79 "The Toolset XEmacs is to be built with (\"GNU Tools\" or
80 \"Microsoft Tools\")."
84 (const "Microsoft Tools"))
90 ;;; Version-handling, based on ideas from w3.
92 (defconst build-version-number
94 (if (string-match "Name:[ \t\n]+\\([^\n]+\\) \\$" x)
95 (setq x (match-string 1 x))
96 (setq x (substring x 0)))
98 (function (lambda (x) (if (= x ?-) "." (char-to-string x)))) x ""))
99 "Version number of build package.")
101 (defconst build-version-date
102 (let ((x "2002-03-07"))
103 (if (string-match "Date:[ \t\n]+\\([^\n]+\\) \\$" x)
106 "Date this version of build was released.")
108 (defconst build-version
109 (format "build %s %s" build-version-number build-version-date)
110 "More descriptive version of build-version-number.")
113 (defun build-version (&optional here)
114 "Show the version number of `build' in the minibuffer.
115 If optional argument HERE is non-nil, insert info at point."
118 (insert build-version)
120 (message-or-box "%s" build-version)
127 "Simplifies Building XEmacs; i.e. Fetching, Configuring, Making, and
129 :link '(url-link :tag "XEmacs Build Reference Manual"
130 "http://www.xemacs.org/Documentation/packages/html/build.html")
131 :link '(url-link :tag "XEmacs Beta README"
132 "ftp://ftp@ftp.xemacs.org/pub/xemacs/beta/README")
133 :link '(url-link :tag "XEmacs Gamma README"
134 "ftp://ftp@ftp.xemacs.org/pub/xemacs/gamma/README")
135 :link '(url-link :tag "XEmacs Stable README"
136 "ftp://ftp@ftp.xemacs.org/pub/xemacs/stable/README")
140 (defun build-call-process (command infile buffer displayp)
141 (let (exit-status result)
143 (condition-case signal
147 (list (car command) infile buffer displayp)
150 (warn "\n%s\ncannot be executed: %S %S\n"
151 (mapconcat 'identity command " ")
152 (car signal) (cdr signal))))
153 ;; return value of result
154 (setq result (cons exit-status (buffer-string))))))
158 "Creates a widget-based interface to build a beta/release version of
159 XEmacs. All aspects of fetching tarballs, configuring, making and
160 reporting can be customized and executed from the newly created buffer
172 ; build-from-cvs-button-widget
173 ; build-from-tarballs-button-widget
174 (name "*Build XEmacs*"))
175 (kill-buffer (get-buffer-create name))
176 (switch-to-buffer (get-buffer-create name))
177 (kill-all-local-variables)
178 ;; Determine availability of CVS client.
180 "build: checking whether you have cvs, please wait")
182 (build-call-process command infile buffer displayp))
185 (setq build-cvs-available-p nil)
186 (warn "\nprogram %s cannot be found or executed\n"
188 (setq build-from-what "Tarballs"))
190 (setq build-cvs-available-p nil)
191 (warn "\n%s\nfailed with following output:\n%s\n"
192 (mapconcat 'identity command " ")
194 (setq build-from-what "Tarballs")
196 "\n\nPlease install cvs, unless you want to build from our tarballs.\n"))
198 (setq build-cvs-available-p t)
199 (setq build-from-what "CVS")
201 "build: cvs is available")))
202 ;; Create widget-based interface.
204 "Visit info documentation for the XEmacs build package inside ")
209 (widget-insert "\nor on the XEmacs website at\n")
213 "http://www.xemacs.org/Documentation/packages/html/build.html")
214 (widget-insert "\n\n")
216 ((inhibit-read-only t))
217 (setq build-current-build-settings-widget
220 :tag "Current Build Settings"
224 build-current-build-settings-widget
227 (widget-create 'push-button
228 :notify (lambda (&rest ignore)
230 ((name (widget-value build-settings-widget)))
232 build-current-build-settings-widget
235 build-current-build-settings-widget
238 build-current-build-settings-widget
241 (build-settings-load name build-settings)
243 "loaded \"%s\" build-settings"
247 (widget-create 'push-button
248 :notify (lambda (&rest ignore)
251 (widget-get build-settings-widget :args))
252 (value (widget-value build-settings-widget))
254 (if (string= value "default")
256 "cannot delete \"%s\" build-settings"
260 (format "delete \"%s\" build-settings? " value))
269 build-settings-widget
272 build-settings-name-widget
274 (cons (list 'string :value "default")
277 build-settings-widget
279 (first (widget-get build-settings-widget :args))
288 "deleted \"%s\" build-settings"
292 (setq build-settings-widget
293 (widget-create 'choice
294 :tag "build settings"
298 (list 'item :value "default")
302 (let ((name setting))
303 (list 'item :value (car setting)))))
305 ; :notify (lambda (widget &rest ignore)
306 ; (setq build-settings (widget-value widget)))
307 '(item :value "default")))
309 build-settings-widget
311 (first (widget-get build-settings-widget :args))
313 (widget-create 'push-button
314 :notify (lambda (&rest ignore)
317 (widget-value build-settings-name-widget)))
320 (assoc name build-settings)
323 (format "overwrite current \"%s\" build-settings? " name))))
326 (build-settings-save-custom-group
332 (cdr (list 'item :value name))
333 (widget-get build-settings-widget :args))
335 build-settings-widget
337 (cons (list 'item :value name)
338 (widget-get build-settings-widget :args)))
340 build-settings-name-widget
342 (cons (list 'item :value name)
343 (widget-get build-settings-name-widget :args))))
344 (customize-save-variable 'build-settings build-settings)
346 "saved \"%s\" build-settings"
350 (setq build-settings-name-widget
351 (widget-create 'choice
352 :tag "current build settings as"
356 (list 'string :value "default")
360 (let ((name setting))
361 (list 'item :value (car setting)))))
363 ; :notify (lambda (widget &rest ignore)
364 ; (setq build-settings (widget-value widget)))
366 (widget-insert "Build settings are named build configurations allowing you to switch\nbetween them quickly, once you have set them up and saved them. Please\nmake sure you have gone through all required customizations of the\nbuild process before you save them. You may change existing settings\nat a later time, though.\n\n")
367 (widget-create 'push-button
368 :notify (lambda (&rest ignore)
369 (customize-browse 'build))
370 "Browse Build Options ...")
371 (widget-insert "\nBrowse and customize any options of the build process according to\nyour current choices for the sources to build from and the tools to\nbuild with.\n")
372 (setq build-from-what-choice-widget
373 (widget-create 'choice
375 :value build-from-what
376 :notify (lambda (widget &rest ignore)
377 (setq build-from-what (widget-value widget))
379 ((string-equal build-from-what "CVS")
381 build-from-cvs-button-widget
384 build-from-tarballs-button-widget
386 ((string-equal build-from-what "Tarballs")
388 build-from-cvs-button-widget
391 build-from-tarballs-button-widget
394 '(item :value "Tarballs")))
396 "Please decide now whether to build XEmacs from tarballs in .tar.gz\nformat or from CVS sources. Using CVS is highly recommended.")
397 (widget-insert "\n\n")
398 (setq build-with-what-choice-widget
399 (widget-create 'choice
401 :value build-with-what
402 :notify (lambda (widget &rest ignore)
403 (setq build-with-what (widget-value widget)))
404 '(item :value "GNU Tools")
405 '(item :value "Microsoft Tools")
408 "Furthermore, please specify whether you will build with GNU tools\nusing configure and make or Microsoft Tools using nt\\xemacs.mak and\nVC++ 4.0 or higher.")
409 (widget-insert "\n\n")
411 build-from-cvs-button-widget
412 (widget-create 'push-button
413 :notify (lambda (&rest ignore)
415 "Build XEmacs From CVS Now"))
417 ;; Recommend installation of CVS or provide cvs version
419 (if build-cvs-available-p
420 (widget-insert (format "cvs -v returns this:\n%s\n" (cdr result)))
422 "\n\nPlease install cvs, unless you want to build from our tarballs.\n"))
423 ;; Building XEmacs from tarballs.
425 build-from-tarballs-button-widget
426 (widget-create 'push-button
427 :notify (lambda (&rest ignore)
428 (build-from-tarballs))
429 "Build XEmacs From Tarballs Now"))
430 ;; Initialize these buttons according to `build-from-what'.
432 ((string-equal build-from-what "CVS")
434 build-from-cvs-button-widget
437 build-from-tarballs-button-widget
439 ((string-equal build-from-what "Tarballs")
441 build-from-cvs-button-widget
444 build-from-tarballs-button-widget
447 "\nProceed after you have chosen what sources to build from and what\ntools to build with.\n")
448 ; (widget-browse-other-window build-settings-widget)
449 (use-local-map widget-keymap)
452 (goto-char (point-min))))
456 ;;{{{ Build Compilation
459 (make-variable-buffer-local
460 'compilation-finish-function)
461 (make-variable-buffer-local
462 'compilation-exit-message-function)
465 compilation-finish-function
466 'build-compilation-finish-function
467 compilation-exit-message-function
468 (function build-compilation-exit-message-function))
472 (defun build-compilation-mode-hook ()
473 (set (make-local-variable 'auto-save-hook)
475 (message "Auto-saved %s\n" (buffer-name))))
479 "Compilation started at %s %+.4d (%s)\n"
480 (current-time-string)
481 (/ (nth 0 (current-time-zone)) 36)
482 (nth 1 (current-time-zone)))))
484 (defun build-compilation-finish-function (comp-buffer finish-string)
485 (message "Build Make finished in %s with status \"%s\"."
486 (buffer-name comp-buffer) finish-string))
488 (defun build-compilation-exit-message-function (proc exit-msg)
489 (message "Build Make exited with proc status \"%s\", exit status \"%s\", exit message \"%s\"."
490 (process-status proc) (process-exit-status proc) exit-msg)
491 (cons exit-msg (process-exit-status proc)))
495 ;;{{{ Build Configure
497 (defconst build-configure-option-category
498 "^\\(\\S-+\\).+\\(options\\|features\\):$"
499 "REGEXP matching an XEmacs configuration option category in
502 (defconst build-configure-option-paragraph
503 "^\\(--[a-zA-Z][-a-zA-Z0-9]+\\)\\(=\\(\\S-+\\)\\)?\\(\\s-+(\\*)\\)?\\s-+\\(\\(.+\\)\\(\n[ \t]+.+\\)*\\)$"
504 "REGEXP matching one XEmacs configuration option in
507 (defun build-configure (&optional dir)
508 "Configure XEmacs according to the settings in customized group
509 `build' and its members."
514 (format "sh configure%s"
516 (function (lambda (e)
518 ((or (string= "" (rest e))
519 (string= "autodetected" (rest e))
520 (string= "defaulted" (rest e)))
522 ((string= "yes" (rest e))
523 (format " '%s'" (first e)))
525 (string-match "\\`--without-\\(.+\\)\\'" (first e))
526 (string= "no" (rest e)))
527 (format " '-with-%s'" (match-string 1 (first e))))
529 (format " '%s=%s'" (first e) (rest e))))))
531 build-configure-options :from-end t
534 (first a) (first b))))
536 (compilation-mode-hook
537 'build-compilation-mode-hook)
538 (compilation-buffer-name-function
540 (generate-new-buffer-name
542 ((string-equal build-from-what "Tarballs")
543 (concat build-tarball-prefix "-configure.err"))
544 ((string-equal build-from-what "CVS")
545 (concat build-cvs-checkout-dir "-configure.err")))
549 ;;; Functionality which was prototyped in co2cu.el:
551 (defun build-configure-customize (a-list)
554 (princ (format "(defgroup build-configure-%s nil\n" (first cat)))
555 (princ (format " \"%s options.\"\n" (first cat)))
556 (princ " :group 'build-configure)\n\n")
561 ((or (member "TYPE[,TYPE]..." (second opt))
562 (and (member "TYPE" (second opt))
565 (apply 'concat (fourth opt)))))
566 (build-configure-types cat opt)
568 ((member "TYPE" (second opt))
569 (build-configure-type cat opt)
571 ((member "FLAGS" (second opt))
572 (build-configure-string cat opt)
574 ;; compiler=XXXX prior to r21.0-b34
575 ((member "XXXX" (second opt))
576 (build-configure-file cat opt)
578 ;; compiler=prog after Martin Buchholz's configure
579 ;; mega-patch to r21.0-b34-pre2
580 ((member "prog" (second opt))
581 (build-configure-file cat opt)
583 ((member "VALUE" (second opt))
584 (build-configure-string cat opt)
586 ((member "DIR" (second opt))
587 (build-configure-dir cat opt)
589 ((member "LIB" (second opt))
590 (build-configure-file cat opt)
592 ((member "PATH" (second opt))
593 (build-configure-path cat opt)
595 ((or (null (second opt))
596 (subsetp (second opt)
597 '("no" "yes") :test 'string-equal))
598 (build-configure-type cat opt)
601 (build-configure-type cat opt)
605 (cdr cat) :from-end t
608 (first a) (first b)))))))
611 (defun build-configure-process-option (option value detected doc category a-list)
612 (let (prev-val prev-doc pos doc-vals)
615 (first (cdr (assoc option (assoc category a-list)))))
617 (append prev-val (list value))))
620 (second (cdr (assoc option (assoc category a-list))))
621 (null (null detected))))
623 (third (cdr (assoc option (assoc category a-list)))))
625 (setq prev-doc (append prev-doc (list doc)))
627 (setq doc-vals (concat (first prev-doc)))
628 (while (string-match "`\\(\\w+\\)'" doc pos)
630 (append prev-val (list (match-string 1 doc))))
631 (setq pos (match-end 0)))
634 (string-match "\\([Vv]alid\\s-+types\\s-+are\\s-+\\|(\\)\\(\\(\\w+\\)\\(,\\s-*\\(\\(and\\|or\\)\\s-+\\)?\\(\\w+\\)\\)+\\)\\()\\|\\.\\)" doc 0))
635 (setq doc-vals (match-string 2 doc))
638 (string-match "\\(\\(,\\s-*\\(\\(and\\|or\\)\\s-+\\)?\\)?\\(\\w+\\)\\)" doc-vals pos)
640 (append prev-val (list (match-string 5 doc-vals))))
641 (setq pos (match-end 0)))))
643 (assoc category a-list)
646 (list prev-val detected prev-doc)
647 (cdr (assoc category a-list))))))
649 (defun build-configure-generate (&optional file)
650 (interactive "fconfigure.usage file: ")
656 ((string-equal build-from-what "Tarballs")
660 ((string-equal build-from-what "CVS")
662 build-cvs-checkout-dir
663 build-cvs-checkout-parent-dir))))))
665 (category categories option value detected doc build-configure-alist
666 (buffer "build-configure.el"))
667 (kill-buffer (get-buffer-create buffer))
668 (with-output-to-temp-buffer buffer
669 (save-window-excursion
670 (find-file-read-only file)
671 (build-configure-prolog file)
672 (goto-char (point-min))
673 (while (< (point) (point-max))
675 ((looking-at build-configure-option-paragraph)
676 (goto-char (match-end 0))
677 (build-configure-process-option
683 build-configure-alist))
684 ((looking-at build-configure-option-category)
685 (goto-char (match-end 0))
686 (setq category (match-string 1))
687 (setq build-configure-alist
688 (append build-configure-alist (list (list category)))))
689 ;; We avoid matching a potentially zero-length string to
690 ;; avoid infinite looping.
693 (goto-char (match-end 0)))
695 (goto-char (match-end 0)))))
696 (build-configure-customize build-configure-alist)
697 ; (print build-configure-alist)
699 ; (set-buffer buffer)
700 ; (switch-to-buffer (get-buffer-create name))
701 (kill-all-local-variables)
704 (toggle-read-only 1)))
706 (defun build-configure-string (cat opt)
707 (princ (format "(defcustom build-configure%s\n" (first opt)))
709 (princ (format " %S\n" (build-configure-fill-doc (fourth opt))))
710 (princ (format " :group \'build-configure-%s\n" (first cat)))
711 (princ " :type '(string)\n")
712 (princ " :set 'build-configure-set-value)\n")
715 (defun build-configure-file (cat opt)
716 (princ (format "(defcustom build-configure%s\n" (first opt)))
718 (princ (format " %S\n" (build-configure-fill-doc (fourth opt))))
719 (princ (format " :group \'build-configure-%s\n" (first cat)))
720 (princ " :type '(file)\n")
721 (princ " :set 'build-configure-set-value)\n")
724 (defun build-configure-dir (cat opt)
725 (princ (format "(defcustom build-configure%s\n" (first opt)))
727 (princ (format " %S\n" (build-configure-fill-doc (fourth opt))))
728 (princ (format " :group \'build-configure-%s\n" (first cat)))
729 (princ " :type '(directory)\n")
730 (princ " :set 'build-configure-set-value)\n")
733 (defun build-configure-path (cat opt)
734 (princ (format "(defcustom build-configure%s\n" (first opt)))
736 (princ (format " %S\n" (build-configure-fill-doc (fourth opt))))
737 (princ (format " :group \'build-configure-%s\n" (first cat)))
738 (princ " :type '(repeat\n")
739 (princ " :custom-show t\n")
740 (princ " :documentation-shown t\n")
741 (princ " (directory))\n")
742 (princ " :set 'build-set-path)\n")
745 (defun build-configure-types (cat opt)
746 (princ (format "(defcustom build-configure%s\n" (first opt)))
747 (princ (format " '(%S)\n"
748 (if (third opt) "autodetected" "defaulted")))
749 (princ (format " %S\n" (build-configure-fill-doc (fourth opt))))
750 (princ (format " :group \'build-configure-%s\n" (first cat)))
751 (princ " :type '(choice\n")
753 (princ " (const (\"autodetected\"))\n")
754 (princ " (const (\"defaulted\"))\n"))
755 (princ " (const (\"no\"))\n")
758 (princ (format "\n (const %S)" e)))
761 '("no" "TYPE[,TYPE]..." "TYPE")
764 (princ " :set 'build-set-types)\n")
767 (defun build-configure-type (cat opt)
768 (princ (format "(defcustom build-configure%s\n" (first opt)))
769 (princ (format " %S\n"
770 (if (third opt) "autodetected" "defaulted")))
771 (princ (format " %S\n" (build-configure-fill-doc (fourth opt))))
772 (princ (format " :group \'build-configure-%s\n" (first cat)))
773 (princ " :type '(choice\n")
775 (princ " (const \"autodetected\")\n")
776 (princ " (const \"defaulted\")\n"))
777 (princ " (const \"no\")")
778 (if (subsetp (second opt) '("no" "yes") :test 'string-equal)
779 (princ "\n (const \"yes\")")
781 (princ (format "\n (const %S)" e)))
784 '("no" "TYPE[,TYPE]..." "TYPE")
787 (princ " :set 'build-configure-set-value)\n")
790 (defun build-configure-fill-doc (doc)
792 (let ((sentence-end-double-space t)
793 (use-hard-newlines t)
794 (colon-double-space t))
795 (insert (mapconcat 'eval doc " "))
796 (canonically-space-region (point-min) (point-max))
797 (fill-region (point-min) (point-max))
798 (goto-char (point-min))
799 (while (re-search-forward "\\s-+\\'" nil t)
800 (replace-match "" nil nil))
803 (defun build-configure-prolog (file)
804 (princ ";;; Produced from
810 ;; Make sure the RCS keyword Id does not end up in the output file,
811 ;; in case build.el is not `co -kv ...' or during development.
813 (insert build-version)
814 (while (re-search-backward "\\$" nil t)
815 (replace-match "" nil nil))
817 (princ "\n;;; at\n;;; ")
818 (princ (format-time-string "%a %b %d %T %Z %Y"))
820 (provide 'build-configure)\n
821 (setq build-configure-options nil)\n
822 (defun build-configure-sym-to-opt (sym)
823 (substring (symbol-name sym) 15))\n
824 (defun build-set-path (sym val)
825 (setq build-configure-options
826 (acons (build-configure-sym-to-opt sym)
827 (mapconcat '(lambda (item) item) val \":\")
828 build-configure-options))
829 (set-default sym val))\n
830 (defun build-set-types (sym val)
831 (setq build-configure-options
832 (acons (build-configure-sym-to-opt sym)
833 (mapconcat '(lambda (item) item) val \",\")
834 build-configure-options))
835 (set-default sym val))\n
836 (defun build-configure-set-value (sym val)
837 (setq build-configure-options
838 (acons (build-configure-sym-to-opt sym) val
839 build-configure-options))
840 (set-default sym val))\n
841 (defgroup build-configure nil
842 \"XEmacs Build Configuration.\"
850 (defvar build-cvs-available-p nil
851 "Internal variable keeping track whether CVS is available.")
853 (defgroup build-cvs nil
854 "Standardizes the fetching of XEmacs from the CVS repository."
857 (defun build-cvs-get-branch-and-release-tags ()
858 "Retrieve all symbolic names (CVS tags) for XEmacs from version.sh."
862 (file "XEmacs/xemacs/version.sh")
865 "cvs" "-d" build-cvs-xemacs-repository "checkout" file))
868 "cvs" "-d" build-cvs-xemacs-repository "status" "-v" file))
877 (cd (temp-directory))
881 "build: checking out %s to determine cvs tags" file)
883 (build-call-process co-command infile buffer displayp))
886 (warn "\nprogram %s cannot be found or executed\n"
889 (warn "\n%s\nfailed with following output:\n%s\n"
890 (mapconcat 'identity co-command " ")
894 "build: %s has been checked out" file))))
896 "build: retrieving cvs tags from %s" file)
898 (build-call-process status-command infile buffer displayp))
901 (warn "\nprogram %s cannot be found or executed\n"
902 (car status-command)))
904 (warn "\n%s\nfailed with following output:\n%s\n"
905 (mapconcat 'identity status-command " ")
909 "build: cvs tags have been retrieved from %s" file)))
911 (setq this-match-beginning
912 (string-match "^\\s-+Existing Tags:\n" (cdr result)))
913 (setq last-match-end (match-end 0)))
916 (setq this-match-beginning
918 "\t\\(\\S-+\\)\\s-+\\(.*\\)\n" (cdr result) last-match-end))
919 (= last-match-end this-match-beginning))
920 (setq last-match-end (match-end 0))
923 (match-string 1 (cdr result))
924 (match-string 2 (cdr result))) tags)))
927 (defun build-cvs-checkout-options-validate (sym val)
929 ((string-match "-\\(d\\|N\\)\\b" val)
930 (customize-set-value sym build-cvs-checkout-options)
931 (warn "cannot use -d and -N. `build-cvs-checkout-dir' will be used as -d argument if set, else `build-cvs-xemacs-module' will be used. The -N option is unsupported."))
933 (build-cvs-set-var-and-update-buffer sym val))))
935 (defun build-cvs-set-var-and-update-buffer (sym val)
936 "Internal function for build."
937 (set-default sym val)
938 (when (fboundp 'build-from-CVS)
939 (save-window-excursion
943 (defcustom build-cvs-checkout-options
945 "CVS checkout command-line options to use for all CVS commands."
947 :set 'build-cvs-checkout-options-validate
950 (defcustom build-cvs-options
952 "CVS command-line options to use for all CVS commands."
954 :set 'build-cvs-set-var-and-update-buffer
957 (defcustom build-cvs-update-options
959 "CVS update command-line options to use for all CVS commands."
961 :set 'build-cvs-set-var-and-update-buffer
964 (defcustom build-cvs-checkout-parent-dir
966 "The parent directory on the local host into which the
967 `build-cvs-xemacs-module' will be checked out, named according to
968 `build-cvs-checkout-dir'."
970 :set 'build-cvs-set-var-and-update-buffer
973 (defconst build-cvs-xemacs-module
975 "CVS XEmacs module name to be checked out.")
977 (defvar build-cvs-checkout-dir
979 "Internal variable updated from user variable
980 `build-cvs-working-dir-naming'.")
982 (defcustom build-cvs-use-pcl-cvs
984 "*Whether build is to use PCL-CVS, when available.
985 Alternatively, build will run CVS commands via `compile'."
987 :set 'build-cvs-set-var-and-update-buffer
990 (defcustom build-cvs-xemacs-repository
991 ":pserver:cvs@cvs.xemacs.org:/pack/xemacscvs"
992 "CVS Repository where XEmacs can be checked out from."
994 :set 'build-cvs-set-var-and-update-buffer
997 (defcustom build-cvs-working-dir-naming
999 build-cvs-xemacs-module
1000 build-cvs-xemacs-release)
1001 "The naming of the directory on the local host into which the
1002 `build-cvs-xemacs-module' will be checked out. Be aware that cvs
1003 checkout options -d and -N will affect the resulting directory
1004 structure. Therefor these options are disallowed in
1005 `build-cvs-checkout-options'. The -N option is not supported, in order
1006 to avoid unknown directory structures."
1008 (const :tag "Named after CVS MODULE" build-cvs-xemacs-module)
1009 (const :tag "Named after RELEASE Tag" build-cvs-xemacs-release)
1010 (const :tag "Named after MODULE-RELEASE"
1012 build-cvs-xemacs-module
1013 build-cvs-xemacs-release))
1014 (string :tag "Working Dir Named manually" ""))
1015 :set 'build-cvs-set-var-and-update-buffer
1018 (defcustom build-cvs-xemacs-release
1020 "CVS XEmacs release to be checked out.
1021 The list of available releases is updated via cvs, if installed, by
1022 `build-from-CVS'. Use \"Specify Tag Name\" to fill in the name of a
1023 release tag not yet in the list of choices."
1024 :type '(choice :custom-state t
1025 (string :tag "Unlisted Release Name" "")
1026 (const :tag "release-21-1 (branch: 1.165.2)" "release-21-1")
1027 (const :tag "release-21-4 (branch: 1.166.2)" "release-21-4")
1028 (const :tag "r21-5-9 (revision: 1.183)" "r21-5-9"))
1029 :set 'build-cvs-set-var-and-update-buffer
1032 (defun build-cvs-login ()
1033 "Login to XEmacs CVS repository."
1035 (unless (file-exists-p build-cvs-checkout-parent-dir)
1036 (make-directory build-cvs-checkout-parent-dir t))
1037 (cd build-cvs-checkout-parent-dir)
1041 "cvs" build-cvs-options "-d" build-cvs-xemacs-repository "login"))
1042 (file (make-temp-name (expand-file-name "cvs-login" (getenv "TEMP"))))
1045 (with-temp-file file (insert "cvs\n"))
1046 (message-or-box "build: cvs login at cvs.xemacs.org, please wait")
1048 (build-call-process command file buffer displayp))
1050 ((null (car result))
1051 (setq build-cvs-available-p nil)
1052 (warn "\nprogram %s cannot be found or executed\n"
1054 ((/= (car result) 0)
1055 (setq build-cvs-available-p nil)
1056 (warn "\n%s\nfails with following output:\n%s\n"
1057 (mapconcat 'identity command " ")
1060 (setq build-cvs-available-p t)
1061 (message-or-box "build: cvs login succeeded")))
1062 (delete-file file)))
1064 (defun build-cvs-checkout (&optional release-tag)
1065 "Fetch XEmacs from the repository."
1066 (interactive "sXEmacs Release Tag: ")
1067 (unless (file-exists-p build-cvs-checkout-parent-dir)
1068 (make-directory build-cvs-checkout-parent-dir t))
1069 (cd build-cvs-checkout-parent-dir)
1071 (format "cvs %s -d%s checkout %s -d %s%s %s"
1073 build-cvs-xemacs-repository
1074 build-cvs-checkout-options
1075 build-cvs-checkout-dir
1076 (if (and release-tag
1077 (not (string-equal release-tag "")))
1078 (concat " -r " release-tag)
1080 build-cvs-xemacs-module))
1081 (compilation-mode-hook
1082 'build-compilation-mode-hook)
1083 (compilation-buffer-name-function
1085 (generate-new-buffer-name
1086 (format "%s-cvs-checkout%s.err" build-cvs-checkout-dir
1087 (if (and release-tag
1088 (not (string-equal release-tag "")))
1089 (format "-%s" release-tag)
1093 (defun build-cvs-update (&optional release-tag)
1094 "Update XEmacs from the repository to newest release or to release
1095 specified by RELEASE-TAG'."
1096 (interactive "sXEmacs Release Tag: ")
1098 (expand-file-name build-cvs-checkout-dir
1099 build-cvs-checkout-parent-dir))
1101 (format "cvs %s update %s%s"
1103 build-cvs-update-options
1104 (if (and release-tag
1105 (not (string-equal release-tag "")))
1106 (concat " -r " release-tag)
1109 (compilation-mode-hook
1110 'build-compilation-mode-hook)
1111 (compilation-buffer-name-function
1113 (generate-new-buffer-name
1114 (concat build-cvs-checkout-dir "-cvs-update"
1115 (when (and release-tag
1116 (not (string-equal release-tag "")))
1117 (format "-%s" release-tag))
1121 build-cvs-use-pcl-cvs
1122 (featurep 'pcl-cvs))
1124 (expand-file-name build-cvs-checkout-dir
1125 build-cvs-checkout-parent-dir)
1126 (split-string build-cvs-update-options "\\s-+")))
1134 (defun build-from-CVS ()
1138 (format "*Build XEmacs From CVS With %s*" build-with-what)))
1139 (kill-buffer (get-buffer-create name))
1140 (switch-to-buffer (get-buffer-create name))
1141 (kill-all-local-variables)
1142 (unless (file-exists-p build-cvs-checkout-parent-dir)
1143 (make-directory build-cvs-checkout-parent-dir t))
1144 (cd build-cvs-checkout-parent-dir)
1145 ;; #### FIXME build-cvs-checkout-dir is not driven by custom
1146 ;; events as it should be!
1147 (setq build-cvs-checkout-dir
1148 (eval build-cvs-working-dir-naming))
1149 (put 'build-cvs-xemacs-release 'custom-type
1154 '(string :tag "Unlisted Release Name" "")
1160 :tag (format "%s %s" (first tag) (second tag)) (first tag))))
1161 (build-cvs-get-branch-and-release-tags)))))
1162 (widget-insert "\n")
1163 (widget-create 'push-button
1164 :notify (lambda (&rest ignore)
1166 ((buffer-back "*Build XEmacs*"))
1167 (if (buffer-live-p (get-buffer buffer-back))
1168 (switch-to-buffer buffer-back)
1172 "\nYou need to customize CVS options and then download a release\nof XEmacs.\n\n")
1173 (widget-create 'push-button
1174 :notify (lambda (&rest ignore)
1175 (customize-browse 'build-cvs))
1176 "Browse Build CVS Options ...")
1177 (widget-insert "\n")
1179 (format "\t%+20s: %s\n" "Use Pcl Cvs"
1180 (if build-cvs-use-pcl-cvs "Yes" "No")))
1182 (format "\t%+20s: \"%s\"\n" "XEmacs CVS Repository"
1183 build-cvs-xemacs-repository))
1185 (format "\t%+20s: \"%s\"\n" "CVS Options"
1188 (format "\t%+20s: \"%s\"\n" "Checkout Options"
1189 build-cvs-checkout-options))
1191 (format "\t%+20s: \"%s\"\n" "Update Options"
1192 build-cvs-update-options))
1194 (format "\t%+20s: \"%s\"\n" "XEmacs Module"
1195 build-cvs-xemacs-module))
1197 (format "\t%+20s: \"%s\"\n" "XEmacs Release"
1198 build-cvs-xemacs-release))
1200 (format "\t%+20s: %S\n" "Working Dir Naming"
1201 build-cvs-working-dir-naming))
1203 (format "\t%+20s: \"%s\"\n" "Checkout Parent Dir"
1204 build-cvs-checkout-parent-dir))
1206 (format "\t%+20s: \"%s\"\n" "Working Dir"
1207 build-cvs-checkout-dir))
1208 (widget-insert "\n")
1209 (widget-create 'push-button
1210 :notify (lambda (&rest ignore)
1213 (widget-insert "\n\n")
1214 (widget-create 'push-button
1215 :notify (lambda (&rest ignore)
1217 build-cvs-xemacs-release))
1218 "CVS Checkout XEmacs")
1219 (widget-insert "\n\n")
1220 (widget-create 'push-button
1221 :notify (lambda (&rest ignore)
1223 build-cvs-xemacs-release))
1225 "CVS Update XEmacs To CVS Tag \"%s\""
1226 build-cvs-xemacs-release))
1227 (widget-insert "\nor\n")
1228 (widget-create 'push-button
1229 :notify (lambda (&rest ignore)
1231 "CVS Update To Latest XEmacs on Trunk")
1232 (widget-insert "\nMake sure to \"Browse Build CVS Options ...\" first.\nChoose XEmacs release to be checked out.\nAlternatively you can simply get the latest sources on the trunk (not\non any branch). This is always the latest XEmacs version under\ndevelopment. As of 2002-03-14 the trunk is headed for XEmacs 21.5.\n\n")
1233 (widget-create 'push-button
1234 :notify (lambda (&rest ignore)
1238 ((string-equal build-with-what "GNU Tools")
1240 build-cvs-checkout-dir
1241 build-cvs-checkout-parent-dir))
1242 ((string-equal build-with-what "Microsoft Tools")
1246 build-cvs-checkout-dir
1247 build-cvs-checkout-parent-dir))))))
1250 (file-name-as-directory dir))
1252 ((string-equal build-with-what "GNU Tools")
1253 (build-with-GNU dir))
1254 ((string-equal build-with-what "Microsoft Tools")
1255 (build-with-MS dir)))
1256 (message-or-box "need to checkout to create %s?" dir))))
1257 (format "Build XEmacs With %s Now ..." build-with-what))
1258 (use-local-map widget-keymap)
1261 (goto-char (point-min))))
1263 (defun build-from-tarballs ()
1267 (format "*Build XEmacs From Tarballs With %s*" build-with-what)))
1268 (kill-buffer (get-buffer-create name))
1269 (switch-to-buffer (get-buffer-create name))
1270 (kill-all-local-variables)
1271 (cd build-tarball-dest)
1272 (widget-insert "\n")
1273 (widget-create 'push-button
1274 :notify (lambda (&rest ignore)
1276 ((buffer-back "*Build XEmacs*"))
1277 (if (buffer-live-p (get-buffer buffer-back))
1278 (switch-to-buffer buffer-back)
1282 "\nYou need to customize Tarball options and then download a beta/release\nversion of XEmacs.\n\n")
1283 (widget-create 'push-button
1284 :notify (lambda (&rest ignore)
1285 (customize-browse 'build-tarball))
1286 "Browse Build Tarball Options ...")
1287 (widget-insert "\n\t")
1288 (widget-create 'push-button
1289 :notify (lambda (&rest ignore)
1290 (dired build-tarball-site))
1291 "Browse Build Tarball Site ...")
1292 (widget-insert "\n\t")
1293 (widget-create 'push-button
1294 :notify (lambda (&rest ignore)
1295 (build-tarball-expand-all))
1296 "View Build Tarball Set ...")
1297 (widget-insert "\n\t")
1298 (widget-create 'push-button
1299 :notify (lambda (&rest ignore)
1300 (build-tarball-get-all))
1301 "Download Build Tarball Set")
1302 (widget-insert "\n\t")
1303 (widget-create 'push-button
1304 :notify (lambda (&rest ignore)
1305 (build-tarball-extract-all))
1306 "Install Downloaded Build Tarball Set")
1307 (widget-insert "\n\n")
1308 (widget-create 'push-button
1309 :notify (lambda (&rest ignore)
1311 ((string-equal build-with-what "GNU Tools")
1314 build-tarball-prefix
1315 build-tarball-dest)))
1316 ((string-equal build-with-what "Microsoft Tools")
1321 build-tarball-prefix
1322 build-tarball-dest))))))
1323 (format "Build XEmacs With %s Now ..." build-with-what))
1324 (use-local-map widget-keymap)
1327 (goto-char (point-min))))
1331 ;;{{{ Build Tarballs
1333 (defgroup build-tarball nil
1334 "Standardized the fetching of XEmacs beta/release tarballs."
1337 (defcustom build-tarball-dest
1339 "The destination directory on the local host the `build-tarball-set'
1340 will be deposited in."
1342 :group 'build-tarball)
1344 (defcustom build-tarball-dir
1346 "The sub-directory under `build-tarball-site' in which the
1347 `build-tarball-set' is located."
1353 :group 'build-tarball)
1355 (defcustom build-tarball-prefix
1357 "The prefix shared among all of the `build-tarball-set'. This makes
1358 it easy to switch over from one beta/gamma/stable release tarball set
1360 e.g. from \"xemacs-21.5.5\" to \"xemacs-21.5.6\"."
1362 :group 'build-tarball)
1364 (defcustom build-tarball-set
1366 "The set of final name components of XEmacs tarballs you wish to
1369 (const :tag "XEmacs byte-compiled lisp tarball" "-elc.tar.gz")
1370 (const :tag "XEmacs byte-compiled lisp tarball signature" "-elc.tar.gz.asc")
1371 (const :tag "XEmacs info tarball" "-info.tar.gz")
1372 (const :tag "XEmacs info tarball signature" "-info.tar.gz.asc")
1373 (const :tag "XEmacs Mule tarball" "-mule.tar.gz")
1374 (const :tag "XEmacs Mule tarball signature" "-mule.tar.gz.asc")
1375 (const :tag "XEmacs source tarball" ".tar.gz")
1376 (const :tag "XEmacs source tarball signature" ".tar.gz.asc")
1379 :documentation-shown t
1381 :group 'build-tarball)
1383 (defcustom build-tarball-site
1384 "/ftp@ftp.xemacs.org:/pub/xemacs/"
1385 "The EFS path to a top-level XEmacs directory to fetch the XEmacs
1386 `build-tarball-set' from.
1387 The list of available sites is dynamically generated based on
1388 `package-get-download-sites'. In addition you may set the value to a
1389 manually chosen EFS path."
1390 :link '(url-link :tag "XEmacs Download Locations"
1391 "http://www.xemacs.org/Download/")
1393 '(choice :custom-state t)
1395 '(directory :tag "EFS Path" "/user@host.domain:/directory/")
1401 (let (comment host path efs-path)
1402 (setq comment (nth 0 entry)
1407 (not (string-equal comment "Pre-Releases")))
1408 (setq efs-path (format "/ftp@%s:/%s" host path))
1411 :tag (format "%s - %s" efs-path comment)
1412 (file-name-directory efs-path))))))
1413 package-get-download-sites))))
1414 :group 'build-tarball)
1416 (defun build-tarball-expand (item)
1419 build-tarball-prefix
1420 (concat build-tarball-site build-tarball-dir))))
1421 (concat prfx item)))
1423 (defun build-tarball-collapse (item)
1425 (concat build-tarball-site build-tarball-dir build-tarball-prefix)))
1426 (string-match str item)
1427 (replace-match "" t t item)))
1429 (defun build-tarball-get (file)
1430 (if (not (featurep 'efs))
1432 "please install efs to be able to \"Download Build Tarball Set\".")
1433 (let ((efs-mode-hook
1435 (set (make-local-variable 'efs-expire-ftp-buffers) nil)
1436 (set (make-local-variable 'auto-save-hook)
1438 (message "Auto-saved %s\n" (buffer-name))))
1439 (auto-save-mode 1))))
1441 (build-tarball-expand file)
1444 build-tarball-prefix build-tarball-dest)
1448 (defun build-tarball-extract (file)
1449 (cd build-tarball-dest)
1451 (format "gunzip -c %s%s | tar -xvf -" build-tarball-prefix file))
1452 (compilation-mode-hook
1453 'build-compilation-mode-hook)
1454 (compilation-buffer-name-function
1456 (generate-new-buffer-name
1458 (file-name-sans-extension
1459 (file-name-sans-extension
1460 (concat build-tarball-prefix file))) "-toc.err"))))
1462 (if (string-match "tar\\.gz$" file)
1464 (warn "%s is not a tar.gz file, skipped."
1465 (concat build-tarball-prefix file)))))
1467 (defun build-tarball-get-all ()
1468 "Get all the expanded files of `build-tarball-set'.
1469 Use `build-tarball-expand-all' to find out which tarballs would be
1470 fetched by this function. All tarballs are saved under
1471 `build-tarball-dest'"
1473 (mapc 'build-tarball-get build-tarball-set))
1475 (defun build-tarball-extract-all ()
1476 "Extract all files from the locally present `build-tarball-set' which
1477 have to be in \".tar.gz\" format."
1479 (mapc 'build-tarball-extract build-tarball-set))
1481 (defun build-tarball-expand-all ()
1482 "Print the expanded value of `build-tarball-set' to temporary buffer
1483 \"*Build Tarball Set*\"."
1485 (cd build-tarball-dest)
1486 (with-output-to-temp-buffer
1487 "*Build Tarball Set*"
1488 (princ (mapconcat 'build-tarball-expand build-tarball-set "\n"))))
1490 (defun build-tarball-add-url ()
1491 "Add URL near point to `build-tarball-set' via
1492 `url-get-url-at-point'."
1494 (setq build-tarball-set (cons (url-get-url-at-point) build-tarball-set)))
1500 (defvar build-with-MS-has-config-inc
1502 "Internal variable indicating whether the XEmacs to be built has
1503 support for config.inc.")
1505 (defgroup build-with-MS nil
1506 "Standardizes the building of XEmacs with MiroSoft tools."
1509 (defcustom build-with-MS-make-command
1511 "Path of Microsoft make utility used to build XEmacs."
1513 :group 'build-with-MS)
1515 (defcustom build-with-MS-make-options
1517 "Options to use with Microsoft make utility when building XEmacs."
1518 :type '(repeat string)
1519 :group 'build-with-MS)
1521 (defun build-with-GNU (dir)
1524 ((name "*Build XEmacs With GNU Tools*"))
1525 ;; Overwrite any customized setting for this build session so
1526 ;; that build-report will find the right information.
1527 (customize-set-variable
1528 'build-report-installation-file
1529 (expand-file-name "Installation" dir))
1530 (customize-set-variable
1531 'build-report-version-file
1532 (expand-file-name "version.sh" dir))
1533 (kill-buffer (get-buffer-create name))
1534 (switch-to-buffer (get-buffer-create name))
1535 (kill-all-local-variables)
1537 (widget-insert "\n")
1538 (widget-create 'push-button
1539 :notify (lambda (&rest ignore)
1541 (buffer-back get-back)
1543 ((string-equal build-from-what "Tarballs")
1544 (setq buffer-back "*Build XEmacs From Tarballs With GNU Tools*")
1545 (setq get-back 'build-from-tarballs))
1546 ((string-equal build-from-what "CVS")
1547 (setq buffer-back "*Build XEmacs From CVS With GNU Tools*")
1548 (setq get-back 'build-from-CVS)))
1549 (if (buffer-live-p (get-buffer buffer-back))
1550 (switch-to-buffer buffer-back)
1551 (funcall get-back))))
1553 (widget-insert "\n\n")
1554 (widget-create 'push-button
1555 :notify (lambda (&rest ignore)
1556 (build-configure-generate "configure.usage"))
1557 "Generate Build Configure")
1558 (widget-insert "\n\t")
1560 (widget-create 'push-button
1561 :notify (lambda (&rest ignore)
1562 (eval-buffer "build-configure.el"))
1563 "Activate Generated Build Configure")
1564 (if (boundp 'build-configure-options)
1567 (when (boundp 'build-configure-options)
1569 "\n\tYou will need to restart XEmacs first if you want to activate the\n\tgenerated interface to Build Make again."))
1570 (widget-insert "\n\t")
1571 (widget-create 'push-button
1572 :notify (lambda (&rest ignore)
1573 (customize-browse 'build-configure))
1574 "Browse Build Configure ...")
1575 (widget-insert "\n\t")
1576 (widget-create 'push-button
1577 :notify (lambda (&rest ignore)
1579 "Run XEmacs Configure")
1580 (widget-insert "\n\n")
1581 (widget-create 'push-button
1582 :notify (lambda (&rest ignore)
1583 (build-make-generate))
1584 "Generate XEmacs Make")
1585 ; (widget-insert "\n\t")
1586 ; (widget-create 'push-button
1587 ; :notify (lambda (&rest ignore)
1588 ; (customize-browse 'build-make))
1589 ; "Browse Build-Make")
1590 (widget-insert "\n\t")
1591 (widget-create 'push-button
1592 :notify (lambda (&rest ignore)
1593 (call-interactively 'build-make))
1595 (widget-insert "\n\n")
1596 (widget-create 'push-button
1597 :notify (lambda (&rest ignore)
1598 (build-build-report))
1599 "Generate XEmacs Build Report ...")
1600 (widget-insert "\n\n")
1601 (use-local-map widget-keymap)
1604 (goto-char (point-min))))
1606 (defun build-with-MS (dir)
1607 (interactive "DXEmacs source directry: ")
1609 ((name "*Build XEmacs With Microsoft Tools*"))
1610 ;; Overwrite any customized setting for this build session so
1611 ;; that build-report will find the right information.
1612 (customize-set-variable
1613 'build-report-installation-file
1619 (customize-set-variable
1620 'build-report-version-file
1626 (setq build-with-MS-has-config-inc
1627 (multiple-value-bind
1628 (major minor beta codename)
1629 (build-report-version-file-data
1630 build-report-version-file)
1631 ;; APA: config.inc file was introduced by Ben Wing in 21.2-b32.
1634 (>= (string-to-int major) 21)
1636 ;; 21.2 versions >= b32
1638 (= (string-to-int minor) 2)
1639 (>= (string-to-int beta) 32))
1640 ;; 21 versions with minor number > 2
1641 (> (string-to-int minor) 2)))
1644 (kill-buffer (get-buffer-create name))
1645 (switch-to-buffer (get-buffer-create name))
1646 (kill-all-local-variables)
1647 (cd (expand-file-name "" dir))
1648 (widget-insert "\n")
1649 (widget-create 'push-button
1650 :notify (lambda (&rest ignore)
1652 (buffer-back get-back)
1654 ((string-equal build-from-what "Tarballs")
1655 (setq buffer-back "*Build XEmacs From Tarballs With Microsoft Tools*")
1656 (setq get-back 'build-from-tarballs))
1657 ((string-equal build-from-what "CVS")
1658 (setq buffer-back "*Build XEmacs From CVS With Microsoft Tools*")
1659 (setq get-back 'build-from-CVS)))
1660 (if (buffer-live-p (get-buffer buffer-back))
1661 (switch-to-buffer buffer-back)
1662 (funcall get-back))))
1664 (widget-insert "\n")
1666 "\nYou need to customize Microsoft Tools options.\n\n")
1667 (widget-create 'push-button
1668 :notify (lambda (&rest ignore)
1669 (customize-browse 'build-with-MS))
1670 "Browse Build With MS Options ...")
1671 (widget-insert "\n\n")
1672 (widget-create 'push-button
1673 :notify (lambda (&rest ignore)
1674 (build-make-generate "xemacs.mak"))
1675 "Generate XEmacs Make")
1676 (widget-insert "\n\t")
1678 (widget-create 'push-button
1679 :notify (lambda (&rest ignore)
1680 (eval-buffer "build-make.el"))
1681 "Activate Generated Build Make")
1682 (if (boundp 'build-make-options)
1685 (when (boundp 'build-make-options)
1687 "\n\tYou will need to restart XEmacs to activate\n\tthe generated interface to Build Make again."))
1688 (widget-insert "\n\t")
1689 (widget-create 'push-button
1690 :notify (lambda (&rest ignore)
1691 (customize-browse 'build-make))
1692 "Browse Build Make ...")
1693 (widget-insert "\n\t")
1695 (widget-create 'push-button
1696 :notify (lambda (&rest ignore)
1697 (eval-buffer "build-make.el")
1698 (build-config-inc-generate))
1699 "Generate config.inc")
1700 (if build-with-MS-has-config-inc
1704 "\n\tXEmacs versions prior to 21.2-b32 do not use config.inc.\n\tThose are configured by passing all variable values to nmake\n\ton the command-line.\n\nDon't forget to save config.inc before building!")
1705 (widget-insert "\n\n")
1706 (widget-create 'push-button
1707 :notify (lambda (&rest ignore)
1713 build-with-MS-make-command
1714 build-with-MS-make-options)
1716 "Clean XEmacs Distribution")
1717 (widget-insert "\n\n")
1718 (widget-create 'push-button
1719 :notify (lambda (&rest ignore)
1726 build-with-MS-make-command
1727 build-with-MS-make-options)
1729 (unless build-with-MS-has-config-inc
1730 (build-make-get-option-string)))))
1732 (widget-insert "\n\n")
1733 (widget-create 'push-button
1734 :notify (lambda (&rest ignore)
1741 build-with-MS-make-command
1742 build-with-MS-make-options)
1744 (unless build-with-MS-has-config-inc
1745 (build-make-get-option-string)))))
1746 "Build and Install XEmacs")
1747 (widget-insert "\n\n")
1748 (widget-create 'push-button
1749 :notify (lambda (&rest ignore)
1756 build-with-MS-make-command
1757 build-with-MS-make-options)
1759 (unless build-with-MS-has-config-inc
1760 (build-make-get-option-string)))))
1761 "Check temacs (XEmacs before dumping)")
1762 (widget-insert "\n\n")
1763 (widget-create 'push-button
1764 :notify (lambda (&rest ignore)
1771 build-with-MS-make-command
1772 build-with-MS-make-options)
1774 (unless build-with-MS-has-config-inc
1775 (build-make-get-option-string)))))
1777 (widget-insert "\n\n")
1778 (widget-create 'push-button
1779 :notify (lambda (&rest ignore)
1780 (build-build-report))
1781 "Generate XEmacs Build Report ...")
1782 (widget-insert "\n\n")
1783 (use-local-map widget-keymap)
1786 (goto-char (point-min))))
1792 (defun build-build-report ()
1795 ((name "*Generate XEmacs Build Report*"))
1796 (kill-buffer (get-buffer-create name))
1797 (switch-to-buffer (get-buffer-create name))
1798 (widget-insert "\n")
1799 (widget-create 'push-button
1800 :notify (lambda (&rest ignore)
1802 (buffer-back get-back dir)
1804 ((string-equal build-with-what "GNU Tools")
1805 (setq buffer-back "*Build XEmacs With GNU Tools*")
1806 (setq get-back 'build-with-GNU))
1807 ((string-equal build-with-what "Microsoft Tools")
1808 (setq buffer-back "*Build XEmacs With Microsoft Tools*")
1809 (setq get-back 'build-with-MS)))
1811 ((string-equal build-from-what "Tarballs")
1814 build-tarball-prefix
1815 build-tarball-dest)))
1816 ((string-equal build-from-what "CVS")
1819 build-cvs-checkout-dir
1820 build-cvs-checkout-parent-dir))))
1821 (if (buffer-live-p (get-buffer buffer-back))
1822 (switch-to-buffer buffer-back)
1823 (funcall get-back dir))))
1825 (widget-insert "\n\n")
1826 (widget-create 'push-button
1827 :notify (lambda (&rest ignore)
1828 (customize-browse 'build-report))
1829 "Browse Build Report ...")
1830 (widget-insert "\n\nYou may need to customize Build Report options in order to find all\ninformation created by your last building of XEamcs.\n\n")
1831 (widget-create 'push-button
1832 :notify (lambda (&rest ignore)
1833 (call-interactively 'build-report))
1834 "Generate Build Report ...")
1835 (widget-insert "\n")
1836 (use-local-map widget-keymap)
1839 (goto-char (point-min))))
1845 (defvar build-make-alist
1847 "Internal variable keeping track of makefile macros and targets")
1849 (defconst build-make-target-doc-paragraph
1850 "^##\\s-*make\\s-+\\([^
1851 ]+\\(\\s-+or\\s-+make\\s-+\\([^
1852 ]+\\)\\)*\\)\\(\\s-*\\(\\(.*\\)\\(\n##\\s-\\{3,\\}.+\\)*\\)\\)$"
1853 "Internal REGEXP matching a XEmacs makefile target comment. These comments
1854 don't exist in `xemacs.mak'")
1856 (defconst build-make-target-paragraph
1858 \\)?\\(\\(\\w\\|_\\)+\\)\\s-*:.*"
1859 "Internal REGEXP matching a XEmacs makefile target name.")
1861 (defconst build-make-macro-paragraph
1862 "^\\(?:!message Please specify root directory for your .* installation: \\)?\\(\\(\\w\\|_\\)+\\)\\s-*=\\s-*\\(\\(.*\\\\
1864 "Internal REGEXP matching a XEmacs makefile macro definition.")
1866 (defconst build-make-prolog
1868 (provide 'build-make)
1870 (setq build-make-options nil)
1872 (defun build-make-sym-to-opt (sym)
1873 ;; #### Strip the \"build-make-\" prefix.
1874 (substring (symbol-name sym) 11))
1876 (defun build-make-set-value (sym val)
1877 (setq build-make-options
1878 (remassoc (build-make-sym-to-opt sym) build-make-options))
1879 (unless (equal val (first (get sym 'standard-value)))
1880 (setq build-make-options
1881 (acons (build-make-sym-to-opt sym) val
1882 build-make-options)))
1883 (set-default sym val))
1885 (defgroup build-make nil
1886 \"build-make options.\"
1890 "Internal variable of `build'.")
1892 (defun build-config-inc-generate (&optional dir)
1895 ((buffer (buffer-name (generate-new-buffer "config.inc"))))
1898 (with-output-to-temp-buffer buffer
1899 (save-window-excursion
1900 (princ "# -*- mode: makefile -*-\n")
1901 (princ (format "# generated by %s" build-version))
1904 (if (boundp 'build-make-options)
1906 (function (lambda (e)
1909 (format "%s=%s\n" (first e) (rest e))))))
1912 build-make-options :from-end t
1915 (first a) (first b))))
1918 (first a) (first b))))
1923 (kill-all-local-variables)
1926 (toggle-read-only 1)))
1928 (defun build-make (&optional target command)
1929 "Build the XEmacs target argument according to the settings in
1930 customized group `build' and its members."
1931 (interactive "sTarget: \nsCommand: ")
1933 (if (string-equal command "")
1934 (format "make %s" target)
1935 (format "%s %s" command target)))
1936 (compilation-mode-hook
1937 'build-compilation-mode-hook)
1938 (compilation-buffer-name-function
1940 (generate-new-buffer-name
1941 (format "%s-make%s.err"
1943 ((string-equal build-from-what "Tarballs")
1944 build-tarball-prefix)
1945 ((string-equal build-from-what "CVS")
1946 build-cvs-checkout-dir))
1948 (format "-%s" target)
1952 (defun build-make-generate (&optional file)
1953 (interactive "fMakefile: ")
1954 (setq build-make-alist (list (cons 'macros nil) (cons 'targets nil)))
1960 ((string-equal build-from-what "Tarballs")
1962 build-tarball-prefix
1963 build-tarball-dest))
1964 ((string-equal build-from-what "CVS")
1966 build-cvs-checkout-dir
1967 build-cvs-checkout-parent-dir))))))
1969 (category categories option value detected doc
1970 (buffer "build-make.el"))
1971 (with-output-to-temp-buffer buffer
1972 (save-window-excursion
1973 (find-file-read-only file)
1974 ; (build-make-prolog file)
1975 (goto-char (point-min))
1976 (while (< (point) (point-max))
1978 ((looking-at build-make-target-doc-paragraph)
1979 (goto-char (match-end 0))
1980 (build-make-process-target-doc
1981 ;; target [or target ...]
1983 ;; documentation for current targets; possibly
1984 ;; spreading multiple lines.
1987 ((looking-at build-make-target-paragraph)
1988 (goto-char (match-end 0))
1989 (when (> (length (match-string 1)) 0)
1990 (build-make-process-target-doc
1993 ;; documentation for target; possibly
1994 ;; spreading multiple lines.
1998 ((looking-at build-make-macro-paragraph)
1999 (goto-char (match-end 0))
2000 ; (unless (string-match "\\$" (match-string 3))
2001 (build-make-process-macro
2010 (goto-char (match-end 0)))
2012 (goto-char (match-end 0)))
2014 (build-make-customize build-make-alist)
2017 (insert "(setq build-make-alist (quote")
2018 ; (cl-prettyprint (nreverse build-make-alist))
2019 (cl-prettyprint build-make-alist)
2021 (toggle-read-only 1)))
2023 (defun build-make-get-option-string ()
2024 (if (boundp 'build-make-options)
2026 (function (lambda (e)
2029 (format " %s=\"%s\"" (first e) (rest e))))))
2031 build-make-options :from-end t
2034 (first a) (first b))))
2038 (defun build-make-process-target-doc (targets doc a-list)
2039 (setq targets (replace-in-string targets "or\\(\n\\|\\s-\\)+make" ""))
2040 (setq doc (replace-in-string doc "##?\\s-+" ""))
2041 (setq doc (build-configure-fill-doc (list doc)))
2042 (setcdr (assoc 'targets a-list)
2043 (append (list (list targets doc)) (cdr (assoc 'targets a-list)))))
2045 (defun build-make-process-macro (name value a-list)
2046 (unless (assoc name (assoc 'macros a-list))
2047 (setcdr (assoc 'macros a-list)
2048 (append (list (list name value)) (cdr (assoc 'macros a-list))))))
2050 (defun build-make-customize (a-list)
2051 (princ build-make-prolog)
2054 (if (string-match "_DIR\\'" (first macro))
2055 (build-make-file (first macro) (second macro))
2056 (build-make-string (first macro) (second macro))))
2057 (rest (assoc 'macros a-list))))
2059 (defun build-make-string (name val)
2060 (princ (format "(defcustom build-make-%s\n" name))
2061 (princ (format " %S\n" val))
2062 (princ (format " \"macro %s\"\n" name))
2063 (princ (format " :group \'build-make\n"))
2064 (princ " :type 'string\n")
2065 (princ " :set 'build-make-set-value)\n")
2068 (defun build-make-file (name val)
2069 (princ (format "(defcustom build-make-%s\n" name))
2070 (princ (format " %S\n" val))
2071 (princ (format " \"macro %s\"\n" name))
2072 (princ (format " :group \'build-make\n"))
2073 (princ " :type 'file\n")
2074 (princ " :set 'build-make-set-value)\n")
2079 ;;{{{ Build Settings
2081 (defcustom build-settings
2083 "Internal alist of named settings for building multiple XEmacs
2085 This variable is updated via \"Delete\", Load\", and \"Save\" buttons
2086 of the `build' GUI."
2090 (defun build-settings-save-custom-group (group key alist)
2091 "Save customization values of custom GROUP as value of KEY in ALIST"
2093 (cgm (custom-group-members group nil))
2094 (let ((symbol (first cgm))
2095 (type (second cgm)))
2097 ((equal type 'custom-group)
2098 (setq alist (build-settings-save-custom-group symbol key alist)))
2103 (acons key nil alist)))
2104 (if (get symbol 'customized-value)
2112 (get symbol 'customized-value)))))))))))
2115 (defun build-settings-load (key alist)
2116 "Load build variable settings from alist."
2119 (var (cdr (assoc key alist)))
2120 (message "%S\n\t%S" (car var) (car (cdr var)))
2121 (set (car var) (eval (car (cdr var))))
2126 ;; build.el ends here