
To build the RPM we need 

1) Spec File (grub.spec) and
2) Source Files 

Source Files:
       Source Files has to be in (/usr/src/redhat/SOURCES) directory.
       Source Files can be archived as a tar.gz file.

Spec File:
     Spec File has few sections.
I) The Header:
   Header uses - Summary,Name,Version,Release,Copyright,Group,Source,Patch.
 
     Name,Version,Release:You can use any Name,Version & Release number.
     Source:This line points at the HOME location of the source file.
            This tar file or any files go in the SOURCES directory.

II) Prep:
      It is used to get the sources ready to build.Here we need to do
      anything necessary to get the sources patched and setup like they
      need to be setup to do a MAKE.It uses SETUP and PATCH macro.
      SETUP simply unpacks the sources and puts in the 
      /usr/src/redhat/BUILD directory and cd's into the source dir.
      PATCH helps automate the process of applying patches to the sources.
      (in grub.spec file I didn't use PREP section because there was no
       tar file and nothing to setup.I just put the whole CLIENT dir in
       the BUILD dir.)

III) Build:
        In this section we just use MAKE command to build the package.
        Before the MAKE command you can cd's to the necessary dir.
        Also before compilation make sure it has
        "./configure --prefix=/usr"(I already put this command in
        the spec file.So,it should work automatically).
        In this section commands execute like sh script.

IV) Install:
        This section installs the object files in the necessary directory.
        You can use MAKE INSTALL if it's available.In the grub.spec file
        we install the object files in the /usr/bin directory.In this 
        section commands also execute like a sh script.

V) Clean:
      It cleans the build root before building a package a second time
      on a system.

VI) Files:
      This is the section where we list the files for the binary package.
      %defattr tag defines the attributes to be applied to each file being
       copied to the user's system.

VII) Changelog:
        This section is to keep track of different changes made to the 
        package.Every new release build of the package should correspond
        to a paragraph in this section as well as an increase in the 
        releasse number(if not in the version number).    

-----------------------------------------------------------------------------

To run the Spec file we use

     $rpm -ba grub.spec

To install

     $rpm -i the whole package name with the path.

if error comes like "failed dependencies" then type

     $rpm -i --nodeps the whole package name with the path.

To test the installation you can erase the package and then
install it again to see if it works.

