Building RPMS on CentOS or Fedora

This is for version sipXecs 4.6 or greater. If you run into any trouble following these instructions, check the troubleshooting section at the bottom of this document. If you're looking for instructions on building older versions of sipxecs, check this page or other pages in page history .

Note about using "mock" tool to build RPMs

Building sipXecs RPMs for Fedora and CentOS/RHEL requires using the mock tool. This is necessary because sipXecs is made up of many RPMs that depend on each other for compiling.

Although using mock adds a layer of complexity if you build RPMs often, you'll appreciate some of it's advantages:

  1. You can build for different distributions than the build machine, including building 32 bit RPMs on a 64 bit build machine.
  2. You can test RPM installation scripts w/o actually installing them on your build machine
  3. If you follow these instructions, your build machine can also act as a yum repository available on your network. So you can point your test/production systems directly to your build machine to pull in updates.

Step 1 : Setting up build machine

You can use CentOS or Fedora for build machine but the latest 64 bit version of Fedora is recommended. A single build machine will safely compile for all target CentOS and Fedora versions, both 32 and 64 bit.

A build machine of at least CentOS 6 is required to build the sipxecs 4.6 or later versions

You'll want to build as non-root user and you may not even want to give the user sudo permissions. That is up to you. The build process itself does not require root permissions.

You will need a system with a reasonable (50GB) amount of disk space available in /var/ directory.

Step 2 : Install preliminary packages

You'll need to be root in install these basic packages.

yum install git make autoconf automake rpm-build libxslt

Step 3 : Get code and initialize

git clone git://github.com/SIPfoundry/sipxecs.git
cd sipxecs
autoreconf -if
mkdir build
cd build
../configure --enable-rpm

This can take a while as the archive is not small. As of 31 Jan 2012, the repository is 1.5 GB

Step 4 : Setup environment.

We can generate a shell script custom to your machine that will set the machine up for building.  It would be a good idea to review the setup.sh script to understand what it does, and to adjust script to your preference by editing it.   You should be able to regenerate and rerun setup.sh script anytime you think it's necessary. 

make setup.sh

sudo ./setup.sh

Step 5 : Building rpms

You can build any single RPM on many distributions or architectures from this single directory. Remember, just because your machine is running Fedora 30 for the Atari 2600, doesn't mean you cannot build RPMs for any other distribution.  In fact the default distribution at the time I write this documentation is CentOS 6 64bit.

Here are some standard targets:

makes just sipXconfig rpm for RHEL/CentOS 6 64bit
make sipXconfig.rpm
Make all sipXecs rpms for RHEL/CentOS 64bit
make sipx.rpm
makes rpms not found on RHEL/CentOS 6 64 bit repos but are need to run or build sipXecs
 make lib.rpm
make all sipXecs rpms for Fedora 19 64bit
 make fedora-19-x86_64.sipx.rpm
Help on available targets
 make

Tips, Tricks and Troubleshooting

  • Not all build errors will be sent to stdout, Check in ./repo/*/build.log after you get a build error.
  • If you want to look at files on chroot system, look in mock/*/root/ and you'll find the actual build root in mock/*/root/builddir/build/BUILD
  • If you want to jump into the build environment run
    mock --configdir=mak/mock -r fedora-14-x86_64 --shell
  • Setup squid as a downloading proxy to dramatically decrease build time and bandwidth downloading rpms.
  • If you only want to build on the same platform you are running on, you can drop distro.* from all targets. So you can just type make lib.rpm for example.
  • Don't forget, if you get a failure and you want pickup where you left off, use the ellipsis targets. For example make distro.centos-6-x86_64.sipXtackLib.rpm... will start building sipXtackLib RPM and then proceed to sipXcallLib until it finishes with sipXecs
  • Sometimes yum cache is wrong on host, to clear it
    sudo yum clean --disablerepo='*' --enablerepo=build metadata
  • Sometimes yum cache is wrong in chroot, you can clear entire chroot system by running. make repo-init
  • You build is using a local web server to feed builds back to the chroot'ed build system. Although strange, but effective. You can leverage this fact to install your build from any other machine on your network. Just create a file /etc/yum.repos.d/build.repo on any machine in your network and install the build results at any moment. Installing during a build would not be wise as repo metedata is contantly being rebuilt.

    [build]
    name=build
    baseurl=http://your-build-machine:40100/CentOS_$releasever/$basearch
    gpgcheck=0
    

    On subsequent restarts of the build machine you need to cd to repo directory and start thttpd by issuing:

    thttpd -p 40100
    
  • bash shell will expand lists between { and } characters. When combined with make's ability to accept multiple targets this can create some useful commands.
    Here's some examples:
    • Build boost, sipXconfig and sipXportLib for all platforms
      make distros.{boost,sipXconfig,sipXportLib}.rpm
    • Build boost library and all sipXecs rpms for all CentOS platforms
      make centos-6-{i386,x86_64}.{boost,sipx}.rpm
    • Build boost library and all rpms after sipXcommserverLib
      make distros.{boost.rpm,sipXcommserverLib.rpm...}
    • Full build from scratch
      make distros.{repo-init,{lib,sipx}.rpm}

Be sure to check out Release Engineering Notes section for more useful information

References

http://wiki.centos.org/TipsAndTricks/YumAndRPM