Product SiteDocumentation Site

13.2.2.5. Set Up the BuildRoot

A BuildRoot directive sets the location where your code will be built. The convention is for you to define a subdirectory beneath the _tmppath directory. For example:
BuildRoot: %{_tmppath}/%{name}-buildroot
Once set, rpmbuild defines the RPM_BUILD_ROOT environment variable to the value specified for the BuildRoot.
With the rpmbuild command, you can use the --buildroot option to specify a directory to use to override the BuildRoot directive in the spec file.
Using a BuildRoot set to a directory that normal users have write access to allows you to build the package logged in as a normal user. It also helps separate the contents of your package from those of other RPMs.
Always define a BuildRoot.