1 .\" $NetBSD: sysbuild.1,v 1.6 2012/10/13 18:40:33 jmmv Exp $
2 .\" Copyright 2012 Google Inc.
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions are
9 .\" * Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" * Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
14 .\" * Neither the name of Google Inc. nor the names of its contributors
15 .\" may be used to endorse or promote products derived from this software
16 .\" without specific prior written permission.
18 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 .\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 .\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 .\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 .\" OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 .\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 .\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 .Nd performs fully automatic builds of NetBSD
37 .Op Fl c Ar config_name
38 .Op Fl o Ar variable=value
43 .Op Fl c Ar config_name
44 .Op Fl o Ar variable=value
47 .Op Fl c Ar config_name
48 .Op Fl o Ar variable=value
52 .Op Fl c Ar config_name
53 .Op Fl o Ar variable=value
59 releases in a fully automated manner.
60 The process is made unattended by relying on a configuration file that
61 prespecifies the location of all build components and the desired goals of
72 can be seen as a simple wrapper over
76 script that ships with the
80 provides the following additional features:
83 Automatically fetch or update the
85 source trees (both src and xsrc)
86 before performing a build.
90 is invoked by storing all relevant details in a configuration file.
92 Perform builds for a variety of platforms with a single invocation.
94 Trivially set up periodic
96 rebuilds by adding a single line to your
99 Hooks to plug other components into the build procedure.
102 to push the results of a successful build to a file server.
105 As you can see in the
109 provides a subcommand-interface: the tool has several modes of operation,
110 and the particular mode to use for a given run is selected by the first
111 non-option argument in the command line.
113 The following options apply to all commands:
115 .It Fl c Ar config_name
116 Specifies the configuration file to use.
117 The format of the file is described in
118 .Xr sysbuild.conf 5 .
122 includes any directory separator (aka, one or more slashes) or the
124 suffix, then this specifies the path of the configuration file to load.
128 is a plain name without any directory components nor extension, then this
129 specifies the name of the configuration.
131 will first look for a configuration file in
132 .Pa ~/.sysbuild/<config_name>.conf
133 and, if not found, will use
134 .Pa @SYSBUILD_ETCDIR@/<config_name>.conf .
135 Any of the two files must exist, or else
137 will exit with an error.
138 .It Fl o Ar variable=value
139 Applies an override to the loaded configuration.
143 part of the argument must be any of the recognized configuration variables
145 .Xr sysbuild.conf 5 .
148 if not empty, specifies the value to set the configuration variable to.
151 is empty, then the configuration variable is unset.
153 .Ss The build command
154 The build command provides the main functionality of
156 It performs the following steps:
161 is true, the fetch command is invoked first.
163 .Sx The fetch command
166 For every machine type listed in
170 call for that particular machine using the rest of the settings defined in
171 the configuration file.
172 The targets passed to the
174 script are those defined in the
176 variable, or the arguments passed through the command line if any.
179 The following options apply only to the build command:
182 Enables fast mode, which skips updating the source trees and performs
184 This is a shorthand for these generic flags:
185 .Fl o Ar INCREMENTAL_BUILD=true
186 .Fl o Ar UPDATE_SOURCES=false .
188 .Ss The config command
189 The config command dumps the loaded configuration to the standard output.
190 The format of the output is not a script, so it cannot be fed back into
192 The purpose of this command is to aid in debugging the configuration of the
193 tool before performing any builds, particularly when the configuration
194 files use shell logic to determine the value of any variables.
196 The env command prints a shell script snippet that defines environment variables
197 to simplify working with the directory layout of a
199 build for a particular machine.
202 variable is not defined, or if it lists more than one machine, then the
204 argument is required.
206 The common mechanism to use these variables is by executing
208 in the following way:
209 .Bd -literal -offset indent
210 $ eval $(sysbuild env)
213 The following variables are defined and/or modified:
216 The path to the tools is prepended to the path.
217 Of particular interest is the
219 script made available in this way, which allows you to build arbitrary targets
220 within the source directory using the tools.
224 Path to the objects directory for the source tree.
226 Path to the source tree.
229 Note that this points to the root of the tools, not their
235 is defined, path to the objects directory for the X source tree.
239 is defined, path to the X source tree.
242 And the following functions are defined:
243 .Bl -tag -width curobj
245 When invoked from a subdirectory of either src or xsrc, prints the path to that
246 same subdirectory within the objects hierarchy.
247 You may use this to reference temporary build files easily when you are working
248 within the source tree as follows:
249 .Bd -literal -offset indent
251 /usr/src/bin/ls$ nbmake-amd64
252 /usr/src/bin/ls$ cd $(curobj)
253 /usr/obj/usr/src/bin/ls$
256 .Ss The fetch command
257 The fetch command downloads or updates the
259 source trees, which include src and, optionally, xsrc.
261 If the modules do not exist yet in the locations specified by
265 this performs an initial CVS checkout of the trees.
266 If the modules exist, this performs a CVS update.
272 variables are used to determine where to get the sources from and whether a
273 particular tag is desired.
275 The major use of this subcommand is the following.
276 Consider that you wish to use the standard locations of
280 for your source trees, and that you would like to keep these owned by root
281 while, at the same time, you run your
283 builds as an unprivileged user.
284 In this situation, you can use the
286 command as root only, set
290 in your user configuration files, and do your builds as another user.
293 .It Pa @SYSBUILD_ETCDIR@/
294 Directory containing all system-wide configuration files.
295 .It Pa @SYSBUILD_ETCDIR@/default.conf
296 Default configuration file to load if the user does not have a
298 .Pa ~/.sysbuild/default.conf
301 flag is not provided.
303 Directory containing all user-specific configuration files.
304 .It Pa ~/.sysbuild/default.conf
305 Default configuration file to load when the
307 flag is not provided.
311 .Xr sysbuild4cron 1 ,
312 .Xr sysbuild.conf 5 ,
314 .Pa /usr/src/BUILDING
318 utility was developed by
320 .Aq jmmv@NetBSD.org .