3 * $Id: sw_build.h,v 1.2 1999/07/16 12:50:24 mdw Exp $
5 * Management of build processes
10 /*----- Licensing notice --------------------------------------------------*
12 * This file is part of sw-tools.
14 * sw-tools 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 of the License, or
17 * (at your option) any later version.
19 * sw-tools is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with sw-tools; if not, write to the Free Software Foundation,
26 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 /*----- Revision history --------------------------------------------------*
31 * $Log: sw_build.h,v $
32 * Revision 1.2 1999/07/16 12:50:24 mdw
33 * Improve exit status display. New interface from `doto' project.
35 * Revision 1.1.1.1 1999/06/02 16:53:35 mdw
47 /*----- Header files ------------------------------------------------------*/
61 /*----- Data structures ---------------------------------------------------*/
63 /* --- Information about a presentation handler --- *
65 * The @pres@ structure includes everything you need to know about a
66 * presentation handler.
68 * Presentation handler blocks are linked into a list, in a similar way to
69 * commands. (See the `sw.h' header for information on this.) The magic
70 * link macro is @PRES_LINK@.
72 * The `name' field is used to resolve the `--output=' option argument into a
73 * presentation. Make the first few characters distinctive: it uses
74 * abbreviation-matching to choose a presentation style.
76 * The various routines work like this:
78 * * @ok@ is used to find out whether the handler can *in principle* run in
79 * the current environment. For example, a presentation handler which
80 * makes use of special terminal features would ensure that standard
81 * output is a terminal; similarly, an X-based handler would ensure that
82 * there is a current display set. If the handler responds `false' to
83 * this request, the `plain' handler is chosen instead. A zero value
84 * means that it's always OK to use this handler.
86 * * @init@ is used to initialize the chosen handler. It returns zero for
87 * success, nonzero for failure. A failure at this point is a fatal
88 * error: the decision about which handler to run has already been made.
89 * The function is passed the build list as an argument. Entries with
90 * null remote contexts are not to be built and can be ignored here. Note
91 * that the actual build jobs have not been started yet. They're left
92 * until last because they're the most difficult things to stop. (Indeed,
93 * if some don't start, the others are left to run anyway.) A zero value
94 * means this handler needs no initialization.
96 * * @output@ reports new output for a particular build: a pointer to the
97 * appropriate archtecture entry is passed. The handler should format the
98 * text in the buffer in some pleasing and useful manner, and then return.
99 * Any errors which occur at this point are the handler's own problem to
100 * sort out. It is not permitted for a handler to have a null output
103 * * @close@ informs the handler that a particular build has completed. The
104 * @ok@ argument is nonzero if the build was successful, and zero
105 * otherwise. (A message describing the failure will have been
106 * synthetically output before this point, so only a small visual cue is
107 * needed here.) A zero value means this handler is not interested in
108 * close events. The argument @summ@ is a quick summary of the exit
111 * * @done@ informs the handler that all builds have completed. The handler
112 * should make sure that the display will remain as long as is needed, and
113 * deallocate any resources it obtained eariler. A zero value means the
114 * handler needs no cleanup and its output is persistent anyway.
116 * * @abort@ cleans up immediately, because something went horribly wrong.
117 * This shouldn't happen very often, but when it is, it's normally
118 * followed by a call to @die@. A zero value means that this sort of
119 * thing isn't necessary.
121 * That's all there is. Any questions?
123 * (The current structure doesn't interface very well with X toolkits. Some
124 * kind of call-tree inverstion would be handy for that, although I don't
125 * want to make all the handlers able to cope with `select' management. This
126 * needs thought, if I ever decide to add an X interface here.)
129 typedef struct pres
{
133 int (*init
)(archcons */
*a*/
);
134 void (*output
)(archent */
*e*/
, const char */
*p*/
, size_t /*sz*/);
135 void (*close
)(archent */
*e*/
, int /*ok*/, const char */
*summ*/
);
136 void (*done
)(archcons */
*a*/
);
137 void (*abort
)(archcons */
*a*/
);
140 /*----- Functions provided ------------------------------------------------*/
142 /* --- @swbuild_archlist@ --- *
144 * Arguments: @swinfo *sw@ = pointer to the build information block
146 * Returns: A list of architectures which are to be built.
148 * Use: Decides which architectures need building, and returns them
152 extern archcons
*swbuild_archlist(swinfo */
*sw*/
);
154 /*----- Subcommands -------------------------------------------------------*/
156 extern int sw_run(int /*argc*/, char */
*argv*/
[]);
157 extern int sw_make(int /*argc*/, char */
*argv*/
[]);
158 extern int sw_conf(int /*argc*/, char */
*argv*/
[]);
159 extern int sw_reset(int /*argc*/, char */
*argv*/
[]);
160 extern void swrsh_build(sw_remote */
*r*/
, char */
*argv*/
[], char */
*env*/
[]);
163 static cmd cmd_reset
= {
164 CMD_LINK
, "reset", sw_reset
,
165 "reset\tClears all the architecture build flags, so that all architectures\n\
166 will be built next time. This is useful just before a call to\n\
167 `sw make clean', for example.\n"
169 static cmd cmd_run
= {
170 &cmd_reset
, "run", sw_run
,
171 "run COMMAND [ARGS...]\n\
172 Run COMMAND across all architectures that haven't been built yet,\n\
173 in architecture-specific subdirectories. The output is written to\n\
174 logfiles in the subdirectories, and displayed in some way by the\n\
175 selected output style.\n"
177 static cmd cmd_make
= {
178 &cmd_run
, "make", sw_make
,
180 Syntactic sugar for `run make ARGS'. The `make' program named in\n\
181 the environment variable `SW_MAKE' is used by preference.\n"
183 static cmd cmd_conf
= {
184 &cmd_make
, "configure", sw_conf
,
185 "configure [ARGS...]\n\
186 Syntactic sugar for `run ../configure --prefix=PREFIX'. Put other\n\
187 autoconf site configuration in the `config.site' script. The\n\
188 `prefix' value used is " PREFIX
".\n"
191 # define CMD_LINK &cmd_conf
195 static rcmd rcmd_build
= { RCMD_LINK
, "build", swrsh_build
};
197 # define RCMD_LINK &rcmd_build
200 /*----- That's all, folks -------------------------------------------------*/