Product SiteDocumentation Site

9.4.3. Installing the software

The %install section should install the software built in the %build section. If your Makefile contains all the instructions to install, you can define an %install section as follows:
make install PREFIX=$RPM_BUILD_ROOT/usr
In most cases, you need to pass some parameter to make or install or another command to install all files into the buildroot directory, as shown in this example with the $RPM_BUILD_ROOT environment variable. You need to look within the Makefile to determine if the make variable should be PREFIX, prefix, or something else.
Sometimes, you want to call the install command instead of make to perform the installation. For example:
install -m755 myapp $RPM_BUILD_ROOT/usr/bin/myapp
This example uses a hypothetical application name of myapp.
Many packages use the %makeinstall macro, which runs the make install command. For example:
This example also cleans the files from the buildroot. Use the rpm --eval command to see how the %makeinstall macro expands. For example:
$ rpm --eval '%makeinstall'
make \
prefix=/usr \
exec_prefix=/usr \
bindir=/usr/bin \
sbindir=/usr/sbin \
sysconfdir=/etc \
datadir=/usr/share \
includedir=/usr/include \
libdir=/usr/lib \
libexecdir=/usr/libexec \
localstatedir=/var \
sharedstatedir=/usr/com \
mandir=/usr/share/man \
infodir=/usr/share/info \
RPM 4.2 adds a %check section after the %install.