12.07.2015 Views

Red Hat Enterprise Linux 5 Administration Unleashed

Red Hat Enterprise Linux 5 Administration Unleashed

Red Hat Enterprise Linux 5 Administration Unleashed

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

140CHAPTER 5Working with RPM SoftwareBuildRootBuildArchRequires%description%prepDirectory location of where to build the package. As code is compiled, it is set upin this directory so the RPM package can be built. Be sure to use the macro%{_tmppath} for the temporary directory to make sure the correct directory isused on the build server. As shown in Listing 5.9, be sure to include the nameand version of the package in the build root directory to ensure the package isbuilt in a unique directory that another package build is not using.Architecture from Table 5.1 for which the package should be built. In ourexample, the BuildArch is noarch because the bash script can be run on anyarchitecture.If additional software needs to be installed for the software to run, list the packagesthat provide the additional software with this field. List each package onseparate lines with this keyword. If additional software is necessary to build thesource code while building the package, use the BuildRequires field instead.Description of the package. It shouldn’t be more than 10 to 15 lines. This descriptionis displayed when the rpm -qi command is executed.How to unpack the source code from the source files listed with Source0,Source1, and so on. Usually done with the %setup macro in quiet mode:%setup -q%installInstructions for installing the files in the package. It is a good idea to clean outthe build root just in case a previous build left files in it:rm -rf $RPM_BUILD_ROOTIf using make to install the files, be sure to specify the RPM build root as theINSTROOT for it:make INSTROOT=$RPM_BUILD_ROOT install%cleanThe install target of the Makefile creates the /usr/local/bin/ directory in theINSTROOT and then installs the script in the directory. Because the name of thescript file is the same as the package name, the ${PKGNAME} macro is used.Command to clean up the build root. Usually the following will work:rm -rf $RPM_BUILD_ROOT

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!