Building Kamailio RPMs for Enterprise Linux and Fedora
------------------------------------------------------

This is a simple process:
1) Create a clean appliance using BoxGrinder (always worth doing as it makes
   sure your build appliance contains only standard versions of packages and
   has all updates applied).
2) Start the appliance and log in.
3) Prepare the appliance for RPM builds
4) Either:
   a) Checkout the version of Kamailio you want to build from GIT (instructions
      available on the Kamailio wiki at http://www.kamailio.org/wiki) and
      create a release tar file, or
   b) Download a release tar file from http://www.kamailio.org/pub/kamailio and
      extract the correct kamailio.spec file from it
5) Run "rpmbuild" to create the RPMs

If you don't have BoxGrinder installed (http://boxgrinder.org/) you can do so in
Fedora using the command:

   # [sudo] yum install rubygem-boxgrinder-build

Note: The host operating system you install BoxGrinder on does not have to be
      same operating system flavour, architecture, or version as the appliance
      you are creating.  It is entirely sensible to use an x86_64 Fedora host to
      build an i386 CentOS appliance and i386 CentOS Kamailio RPMs.

Example: Building Kamailio 3.4.x (master) x86_64 binary RPMs from GIT for
         Fedora 17.

This example assumes:
- You have Internet connectivity
- You have BoxGrinder, and libvirtd (and any management software required for
  it) installed locally.
- You have obtained the kamailio-build.appl file from pkg/kamailio/fedora/17
  (either by download from http://git.sip-router.org/ or from a local
  checkout of the code)
- Your host operating system is x86_64.

If you want to build a different version of Kamailio, a different set of RPMs
(different rpmbuild options), or install and run the appliance on a remote
(or different type of virtual) machine you should only need to make small
changes to the commands in this example.

1) Create a clean Fedora 17 x86_64 appliance using BoxGrinder:
   # mkdir appliance
   # cd appliance
   # [sudo] boxgrinder-build \
       [path to]/pkg/kamailio/fedora/17/kamailio-build.appl -d libvirt \
       --delivery-config connection_uri:qemu:///system,\
       image_delivery_uri:/var/lib/libvirt/images,overwrite:true,\
       domain_type:kvm
2) Start the appliance and log in:
   - I prefer to use virt-manager for this.  The default username and password
     for the appliance is "root" and "kamailio" respectively.
3) Prepare the appliance for RPM builds:
   # mkdir -p rpmbuild/SOURCES
4) Checkout Kamailio 3.4.x (master) and create a release tar file:
   # git clone --depth 1 git://git.sip-router.org/sip-router kamailio
   # cd kamailio
    Note: if not building master you want to do a "git checkout" after this
   # git archive --output ../rpmbuild/SOURCES/kamailio-3.4.0_src.tar.gz \
       --prefix=kamailio-3.4.0/ master
5) Run "rpmbuild" to create the binary RPMs:
   # rpmbuild -bb pkg/kamailio/fedora/17/kamailio.spec

Once the build is complete the RPMs will be in ~/rpmbuild/RPMS/x86_64.
