rpm/docs/buildroot

67 lines
1.4 KiB
Plaintext

BUILD ROOT
==========
The build root is very similar to Root: (which will be deprecated
soon). By using Buildroot: in your spec file you are indicating
that your package can be built (installed into and packaged from)
a user-definable directory. This helps package building by normal
users.
The Spec File
-------------
Simply use
Buildroot: <dir>
in your spec file. The acutal buildroot used by RPM during the
build will be available to you (and your %prep, %build, and %install
sections) as the environment variable RPM_BUILD_ROOT. You must
make sure that the files for the package are installed into the
proper buildroot. As with Root:, the files listed in the %files
section should *not* contain the buildroot. For example, the
following hypothetical spec file:
Name: foo
...
Root: /tmp
%prep
...
%build
...
%install
install -m755 fooprog /tmp/usr/bin/fooprog
%files
/usr/bin/fooprog
would be changed to:
Name: foo
...
Buildroot: /tmp
%prep
...
%build
...
%install
install -m755 fooprog $RPM_BUILD_ROOT/usr/bin/fooprog
%files
/usr/bin/fooprog
Building With a Build Root
--------------------------
RPM will use the buildroot listed in the spec file as the default
buildroot. There are two ways to override this. First, you can
have "buildroot: <dir>" in your rpmrc. Second, you can override
the default, and any entry in an rpmrc by using "--buildroot <dir>"
on the RPM command line.