Update to upstream 20160629
[tools/build.git] / build.1
1 .de TQ \"follow a TP item with several TQ items to define several
2 .      \"entities with one shared description.
3 .br
4 .ns
5 .TP \\$1
6 ..
7 .TH build 1 "(c) 1997-2008 SuSE Linux AG Nuernberg, Germany"
8 .SH NAME
9 build \- build SuSE Linux RPMs in a chroot environment
10 .SH SYNOPSIS
11 .B build
12 .RB [ --clean | --no-init]
13 .RB [ --repo
14 .IR dir_or_url ]
15 .RB [ --repo ...]
16 .RB [ --root
17 .IR buildroot ]
18 .RB [ recipefile ]
19 .br
20 .B build
21 .B --help
22 .br
23 .B build
24 .B --verify
25 .SH DESCRIPTION
26 \fBbuild\fR is a tool to build binary packages in a safe and reproducible
27 way.
28 The default is to build in a chroot sandbox, but \fBbuild\fP also supports
29 building in a virtual machine for better security.
30 .P
31 If a recipe file is specified on the command line,
32 .B build
33 will use this file and all other files in the directory for building
34 the package. If no recipe argument is provided, build will search the
35 current directory for a file.
36 .P
37 The
38 .B build
39 tool understands the following recipe file types:
40 .TP
41 .B spec
42 A specfile used to generate rpms.
43 .TP
44 .B src.rpm
45 A source rpm, which will be unpacked for the build.
46 .TP
47 .B kiwi
48 A kiwi config file used to generate a kiwi image.
49 .TP
50 .B dsc
51 A dsc file used to generate Debian binary packages.
52 .TP
53 .B PKGBUILD
54 A file used to generate Arch Linux binary packages.
55 .TP
56 .B build.collax
57 A shell script used to generate a Collax binary package.
58 .P
59 .SH OPTIONS
60 .TP
61 .B --clean
62 Remove the build system and reinitialize it from scratch.
63 .TP
64 .B --no-init
65 Skip the build system initialization and start with build immediately.
66 .TP
67 .BI "\-\-repo " dir_or_url
68 Either a directory containing binary packages (optionally with repository
69 metadata), or a url pointing to some remote repository. Multiple
70 \fB--repo\fP options can be used so create a specific repository
71 layering. Note that packages are searched in the specified repository
72 order, i.e. the first repository containing a package with a specific
73 name wins regardless of the version.
74 As a special form, 'zypp://reponame' can be used to specify
75 a system repository. 'zypp://' selects all enabled system
76 repositories. This is also the default if BUILD_RPMS is not
77 set and no \fB--rpms\fP or \fB--repo\fP option is used.
78 .TP
79 .BI "\-\-dist " distribution
80 Set the distribution. If this option is not given, build tries to
81 guess the distribution by looking at the available packages.
82 The specified distribution can either be a string
83 like "11.2" or "sles9", "debian7", or the pathname of the build
84 configuration to use.
85 .TP
86 .BI "\-\-root " buildroot
87 Specifies where the build system is set up. Overrides the
88 BUILD_ROOT enviroment variable.
89 .TP
90 .B --help
91 Print a short help text.
92 .TP
93 .B --norootforbuild
94 Force building with user \fRabuild\fP. Otherwise, \fBbuild\fP searches
95 the recipe file for a "needsrootforbuild" hint to decide what user
96 to use.
97 .TP
98 .B --list-state
99 list packages that would be used to create a fresh build root.
100 Does not create the build root or perform a build.
101 .TP
102 .BI "\-\-rpms " path1 : path2 : path3\fR...\fP
103 Where build can find the packages needed to create the
104 build system. This option overrides the BUILD_RPMS environment
105 variable. This option is deprecated, use \fB--repo\fP instead.
106 .TP
107 .BI "\-\-arch " arch1 : arch2 : arch3\fR...\fP
108 What architectures to select from the RPMs.
109 .B build
110 automatically sets this to a sensible value for your host if you
111 do not specify this option so you should almost never need it.
112
113 .SH RPM BUILD SPECIFIC OPTIONS
114 .TP
115 .B --useusedforbuild
116 Tell build not to do dependency expansion, but to extract the
117 list of packages to install from "# usedforbuild" lines or, if none
118 are found, from all "BuildRequires" lines.  This option is useful
119 if you want to re-build a package from a srcrpm with exactly the
120 same packages used for the srcrpm build.
121 .TP
122 .B --stage
123 Pass a stage option to rpmbuild. The default is \fB-ba\fP.
124 .TP
125 .B --target
126 Call rpmbuild with a target option. This can be used for cross building.
127 .TP
128 .B --verify
129 Verify the files in an existing build system.
130
131 .SH VIRTUAL MACHINE SPECIFIC OPTIONS
132 .TP
133 .B "--xen --kvm --uml --qemu --emulator --zvm --lxc"
134 Sets a specific vm type.
135 .TP
136 .BI "--vm-type " type
137 As above.
138 .TP
139 .BI "--vm-disk " file
140 Specifies the location of the disk image to use. If this option is not
141 given, \fIbuildroot\fP\fB.img\fP is used (e.g. /var/tmp/build-root.img).
142 .TP
143 .BI "--vm-disk-size " size_in_mb
144 Specify the size of the disk image to create.
145 .TP
146 .BI "--vm-disk-filesystem " type
147 Sets the filesystem type to use when creating the disk image. The default
148 is to use the ext3 filesystem.
149 .TP
150 .BI "--vm-swap " file
151 Specifies the location of the swap file to use. If this option is not
152 given, \fIbuildroot\fP\fB.swap\fP is used (e.g. /var/tmp/build-root.swap).
153 .TP
154 .BI "--vm-swap-size " size_in_mb
155 Specify the size of the swap file to create.
156 .TP
157 .BI "--vm-memory " size_in_mb
158 Sets the desired memory size of the virtual machine.
159 .TP
160 .BI "--vm-kernel " kernel_file
161 Set a specific kernel to boot in the virtual machine.
162 .TP
163 .BI "--vm-initrd " initrd_file
164 Set a specific kernel to boot in the virtual machine.
165 .TP
166 .B --vm-disk-clean
167 Force the recreation of the disk image.
168 .TP
169 .B "--vm-telnet" PORT
170 Is forwarding PORT to a telnet session inside of the VM.
171 Specify also needed extra packages via -x parameter, usually:
172 .I   --vm-telnet 1234 -x telnet-server -x net-tools
173    And connect from the host via:
174 .I   telnet localhost 1234
175    NOTE: The telnet server gets started after all packages got installed.
176
177
178 .SH RECIPE FILE OPTIONS
179 The
180 .B build
181 command interprets some special control comments in the recipe file:
182 .TP
183 .B # norootforbuild
184 .TQ
185 .B # needsrootforbuild
186 .B build
187 uses either user
188 .I root
189 or user
190 .I abuild
191 in the build system to do the build.  For non-SUSE distros as well as
192 since SUSE 10.2, the default build user is
193 .I abuild.
194 For 10.2 and before, the default build user is
195 .I root.
196 These two flags in the spec file allow to deviate from the defaults
197 and force-set the build user to
198 .I abuild
199 and
200 .I root
201 .RI "(for " "#\ norootforbuild" " and " "#\ needsrootforbuild" " respectively."
202 .TP
203 .B # needsbinariesforbuild
204 provide the binary rpms that have been used to set up the build root
205 in
206 .I /.build.binaries
207 within the build root.
208 .SH ENVIRONMENT
209 .TP
210 .B BUILD_ROOT
211 The directory where build should install the chrooted build system.
212 "/var/tmp/build-root" is used by default. See the \fB--root\fP option.
213 .TP
214 .B BUILD_RPMS
215 This can be used instead of the \fB--rpms\fP option. Deprecated.
216 .TP
217 .B BUILD_RPM_BUILD_STAGE
218 The rpm build stage (-ba, -bb, ...).  This is just passed through to
219 rpm, check the rpm manpage for a complete list and descriptions.
220 "-ba" is the default. You should probably use the \fB--stage\fP
221 option instead.
222
223 .SH SEE ALSO
224 .BR rpm (8), dpkg (8), pacman (8), kiwi (8)
225 .TP
226 .BR "Maximum RPM":
227 .I http://www.rpm.org/max-rpm/
228 .TP
229 .BR "cross distribution packaging":
230 .I http://en.opensuse.org/openSUSE:Build_Service_cross_distribution_howto
231 .TP
232 .BR "openSUSE packaging standards and guidelines":
233 .I http://en.opensuse.org/Portal:Packaging