3 * $Id: sw_build.h,v 1.1 1999/06/02 16:53:35 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.1 1999/06/02 16:53:35 mdw
44 /*----- Header files ------------------------------------------------------*/
58 /*----- Data structures ---------------------------------------------------*/
60 /* --- Information about a presentation handler --- *
62 * The @pres@ structure includes everything you need to know about a
63 * presentation handler.
65 * Presentation handler blocks are linked into a list, in a similar way to
66 * commands. (See the `sw.h' header for information on this.) The magic
67 * link macro is @PRES_LINK@.
69 * The `name' field is used to resolve the `--output=' option argument into a
70 * presentation. Make the first few characters distinctive: it uses
71 * abbreviation-matching to choose a presentation style.
73 * The various routines work like this:
75 * * @ok@ is used to find out whether the handler can *in principle* run in
76 * the current environment. For example, a presentation handler which
77 * makes use of special terminal features would ensure that standard
78 * output is a terminal; similarly, an X-based handler would ensure that
79 * there is a current display set. If the handler responds `false' to
80 * this request, the `plain' handler is chosen instead. A zero value
81 * means that it's always OK to use this handler.
83 * * @init@ is used to initialize the chosen handler. It returns zero for
84 * success, nonzero for failure. A failure at this point is a fatal
85 * error: the decision about which handler to run has already been made.
86 * The function is passed the build list as an argument. Entries with
87 * null remote contexts are not to be built and can be ignored here. Note
88 * that the actual build jobs have not been started yet. They're left
89 * until last because they're the most difficult things to stop. (Indeed,
90 * if some don't start, the others are left to run anyway.) A zero value
91 * means this handler needs no initialization.
93 * * @output@ reports new output for a particular build: a pointer to the
94 * appropriate archtecture entry is passed. The handler should format the
95 * text in the buffer in some pleasing and useful manner, and then return.
96 * Any errors which occur at this point are the handler's own problem to
97 * sort out. It is not permitted for a handler to have a null output
100 * * @close@ informs the handler that a particular build has completed. The
101 * @ok@ argument is nonzero if the build was successful, and zero
102 * otherwise. (A message describing the failure will have been
103 * synthetically output before this point, so only a small visual cue is
104 * needed here.) A zero value means this handler is not interested in
107 * * @done@ informs the handler that all builds have completed. The handler
108 * should make sure that the display will remain as long as is needed, and
109 * deallocate any resources it obtained eariler. A zero value means the
110 * handler needs no cleanup and its output is persistent anyway.
112 * * @abort@ cleans up immediately, because something went horribly wrong.
113 * This shouldn't happen very often, but when it is, it's normally
114 * followed by a call to @die@. A zero value means that this sort of
115 * thing isn't necessary.
117 * That's all there is. Any questions?
119 * (The current structure doesn't interface very well with X toolkits. Some
120 * kind of call-tree inverstion would be handy for that, although I don't
121 * want to make all the handlers able to cope with `select' management. This
122 * needs thought, if I ever decide to add an X interface here.)
125 typedef struct pres
{
129 int (*init
)(archcons */
*a*/
);
130 void (*output
)(archent */
*e*/
, const char */
*p*/
, size_t /*sz*/);
131 void (*close
)(archent */
*e*/
, int /*ok*/);
132 void (*done
)(archcons */
*a*/
);
133 void (*abort
)(archcons */
*a*/
);
136 /*----- Functions provided ------------------------------------------------*/
138 /* --- @swbuild_archlist@ --- *
140 * Arguments: @swinfo *sw@ = pointer to the build information block
142 * Returns: A list of architectures which are to be built.
144 * Use: Decides which architectures need building, and returns them
148 extern archcons
*swbuild_archlist(swinfo */
*sw*/
);
150 /*----- Subcommands -------------------------------------------------------*/
152 extern int sw_run(int /*argc*/, char */
*argv*/
[]);
153 extern int sw_make(int /*argc*/, char */
*argv*/
[]);
154 extern int sw_conf(int /*argc*/, char */
*argv*/
[]);
155 extern int sw_reset(int /*argc*/, char */
*argv*/
[]);
156 extern void swrsh_build(sw_remote */
*r*/
, char */
*argv*/
[], char */
*env*/
[]);
159 static cmd cmd_reset
= {
160 CMD_LINK
, "reset", sw_reset
,
161 "reset\tClears all the architecture build flags, so that all architectures\n\
162 will be built next time. This is useful just before a call to\n\
163 `sw make clean', for example.\n"
165 static cmd cmd_run
= {
166 &cmd_reset
, "run", sw_run
,
167 "run COMMAND [ARGS...]\n\
168 Run COMMAND across all architectures that haven't been built yet,\n\
169 in architecture-specific subdirectories. The output is written to\n\
170 logfiles in the subdirectories, and displayed in some way by the\n\
171 selected output style.\n"
173 static cmd cmd_make
= {
174 &cmd_run
, "make", sw_make
,
176 Syntactic sugar for `run make ARGS'. The `make' program named in\n\
177 the environment variable `SW_MAKE' is used by preference.\n"
179 static cmd cmd_conf
= {
180 &cmd_make
, "configure", sw_conf
,
181 "configure [ARGS...]\n\
182 Syntactic sugar for `run ../configure --prefix=PREFIX'. Put other\n\
183 autoconf site configuration in the `config.site' script. The\n\
184 `prefix' value used is " PREFIX
".\n"
187 # define CMD_LINK &cmd_conf
191 static rcmd rcmd_build
= { RCMD_LINK
, "build", swrsh_build
};
193 # define RCMD_LINK &rcmd_build
196 /*----- That's all, folks -------------------------------------------------*/