8989c59b94fde164c4b75461527133bd06ebd699
[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 .P
56 .SH OPTIONS
57 .TP
58 .B --clean
59 Remove the build system and reinitialize it from scratch.
60 .TP
61 .B --no-init
62 Skip the build system initialization and start with build immediately.
63 .TP
64 .BI "\-\-repo " dir_or_url
65 Either a directory containing binary packages (optionally with repository
66 metadata), or a url pointing to some remote repository. Multiple
67 \fB--repo\fP options can be used so create a specific repository
68 layering. Note that packages are searched in the specified repository
69 order, i.e. the first repository containing a package with a specific
70 name wins regardless of the version.
71 As a special form, 'zypp://reponame' can be used to specify
72 a system repository. 'zypp://' selects all enabled system
73 repositories. This is also the default if BUILD_RPMS is not
74 set and no \fB--rpms\fP or \fB--repo\fP option is used.
75 .TP
76 .BI "\-\-dist " distribution
77 Set the distribution. If this option is not given, build tries to
78 guess the distribution by looking at the available packages.
79 The specified distribution can either be a string
80 like "11.2" or "sles9", "debian7", or the pathname of the build
81 configuration to use.
82 .TP
83 .BI "\-\-root " buildroot
84 Specifies where the build system is set up. Overrides the
85 BUILD_ROOT enviroment variable.
86 .TP
87 .B --help
88 Print a short help text.
89 .TP
90 .B --norootforbuild
91 Force building with user \fRabuild\fP. Otherwise, \fBbuild\fP searches
92 the recipe file for a "needsrootforbuild" hint to decide what user
93 to use.
94 .TP
95 .B --list-state
96 list packages that would be used to create a fresh build root.
97 Does not create the build root or perform a build.
98 .TP
99 .BI "\-\-rpms " path1 : path2 : path3\fR...\fP
100 Where build can find the packages needed to create the
101 build system. This option overrides the BUILD_RPMS environment
102 variable. This option is deprecated, use \fB--repo\fP instead.
103 .TP
104 .BI "\-\-arch " arch1 : arch2 : arch3\fR...\fP
105 What architectures to select from the RPMs.
106 .B build
107 automatically sets this to a sensible value for your host if you
108 do not specify this option so you should almost never need it.
109
110 .SH RPM BUILD SPECIFIC OPTIONS
111 .TP
112 .B --useusedforbuild
113 Tell build not to do dependency expansion, but to extract the
114 list of packages to install from "# usedforbuild" lines or, if none
115 are found, from all "BuildRequires" lines.  This option is useful
116 if you want to re-build a package from a srcrpm with exactly the
117 same packages used for the srcrpm build.
118 .TP
119 .B --stage
120 Pass a stage option to rpmbuild. The default is \fB-ba\fP.
121 .TP
122 .B --target
123 Call rpmbuild with a target option. This can be used for cross building.
124 .TP
125 .B --verify
126 Verify the files in an existing build system.
127
128 .SH VIRTUAL MACHINE SPECIFIC OPTIONS
129 .TP
130 .B "--xen --kvm --uml --qemu --emulator --zvm --lxc"
131 Sets a specific vm type.
132 .TP
133 .BI "--vm-type " type
134 As above.
135 .TP
136 .BI "--vm-disk " file
137 Specifies the location of the disk image to use. If this option is not
138 given, \fIbuildroot\fP\fB.img\fP is used (e.g. /var/tmp/build-root.img).
139 .TP
140 .BI "--vm-disk-size " size_in_mb
141 Specify the size of the disk image to create.
142 .TP
143 .BI "--vm-disk-filesystem " type
144 Sets the filesystem type to use when creating the disk image. The default
145 is to use the ext3 filesystem.
146 .TP
147 .BI "--vm-swap " file
148 Specifies the location of the swap file to use. If this option is not
149 given, \fIbuildroot\fP\fB.swap\fP is used (e.g. /var/tmp/build-root.swap).
150 .TP
151 .BI "--vm-swap-size " size_in_mb
152 Specify the size of the swap file to create.
153 .TP
154 .BI "--vm-memory " size_in_mb
155 Sets the desired memory size of the virtual machine.
156 .TP
157 .BI "--vm-kernel " kernel_file
158 Set a specific kernel to boot in the virtual machine.
159 .TP
160 .BI "--vm-initrd " initrd_file
161 Set a specific kernel to boot in the virtual machine.
162 .TP
163 .B --vm-disk-clean
164 Force the recreation of the disk image.
165
166 .SH RECIPE FILE OPTIONS
167 The
168 .B build
169 command interprets some special control comments in the recipe file:
170 .TP
171 .B # norootforbuild
172 .TQ
173 .B # needsrootforbuild
174 .B build
175 uses either user
176 .I root
177 or user
178 .I abuild
179 in the build system to do the build.  For non-SUSE distros as well as
180 since SUSE 10.2, the default build user is
181 .I abuild.
182 For 10.2 and before, the default build user is
183 .I root.
184 These two flags in the spec file allow to deviate from the defaults
185 and force-set the build user to
186 .I abuild
187 and
188 .I root
189 .RI "(for " "#\ norootforbuild" " and " "#\ needsrootforbuild" " respectively."
190 .TP
191 .B # needsbinariesforbuild
192 provide the binary rpms that have been used to set up the build root
193 in
194 .I /.build.binaries
195 within the build root.
196 .SH ENVIRONMENT
197 .TP
198 .B BUILD_ROOT
199 The directory where build should install the chrooted build system.
200 "/var/tmp/build-root" is used by default. See the \fB--root\fP option.
201 .TP
202 .B BUILD_RPMS
203 This can be used instead of the \fB--rpms\fP option. Deprecated.
204 .TP
205 .B BUILD_RPM_BUILD_STAGE
206 The rpm build stage (-ba, -bb, ...).  This is just passed through to
207 rpm, check the rpm manpage for a complete list and descriptions.
208 "-ba" is the default. You should probably use the \fB--stage\fP
209 option instead.
210
211 .SH SEE ALSO
212 .BR rpm (8), dpkg (8), pacman (8), kiwi (8)
213 .TP
214 .BR "Maximum RPM":
215 .I http://www.rpm.org/max-rpm/
216 .TP
217 .BR "cross distribution packaging":
218 .I http://en.opensuse.org/openSUSE:Build_Service_cross_distribution_howto
219 .TP
220 .BR "openSUSE packaging standards and guidelines":
221 .I http://en.opensuse.org/Portal:Packaging