Skip to end of metadata
Go to start of metadata

This is for version sipXecs 4.4 or greater. If you run into any trouble following these instructions, check the troubleshooting section at the bottom of this document.

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 requires some setup, 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 master branch, at and after sipxecs 4.6

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

If you are running CentOS 5/RHEL 5, you'll need to install rpmforge to install these tools. NOTE: This is only if you are running CentOS or RHEL, not if you're building for CentOS or RHEL

http://rpmrepo.org/RPMforge/Using

rpmforge is used for build tools only, not for any binaries that go into the final product. Therefore I recommend you disable the repo by default and only enable it when you need to install these packages.

Install the tools
sudo yum install git 'mock >= 1.1' thttpd

Step 3 : Install basic packages

sudo yum install make autoconf automake libtool createrepo gcc-c++ rpm-build
sudo yum install cppunit-devel boost-devel openssl-devel pcre-devel enscript
sudo yum install 'java-devel >= 1.6'

Configure /etc/sudoers to permit access by $USER

Step 4 : Get code and initialize

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

Step 5 : setup mock environment.

Add your current user to the mock user group so you can build as non-root. Avoid building as root at all costs.

sudo usermod -a -G mock $USER

You will have to log out, then log back in for perms to take affect.

Step 6 : step-up machine for building source rpms

This is so you do not have to build as root user

Step 7 : Initialize build

We need to create the build chroot jails for each distro.

To initialize the build for CentOS 6 64bit, run:

make distro.centos-6-x86_64.repo-chroot-init

Step 8 : build lib rpms

You need rake installed on your host system to build the source rpm for OpenACD in sipXecs 4.4. You do not need it for OpenACD in sipXecs 4.5 or greater.

CentOS:

Fedora:

To build for CentOS 6 64bit, run:

make distro.centos-6-x86_64.lib.rpm

Type make with no targets to get help test of all the available build targets.

Step 9 : build sipx rpms

Most of the sipX projects won't even build a source package without failing if all the build requirements are not met. In our case, because we're only building the source package on the host and not the binary package (i.e. not compiling), these failures are mostly unnecessary. Until this is changed, you can install the deps on your host system by running. Installing these libraries doesn't mean you'll compile with these version, you're just allowing the source packages to be created.
make sipx.deps-missing-build-list lib.deps-missing-build-list | xargs sudo yum install -y

Sticking with CentOS 6 64bit, let's build the sipXecs rpms:

make distro.centos-6-x86_64.sipx.rpm

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 /var/lib/mock/*/root/ and you'll find the actual build root in /var/lib/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-chroot-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.repoon 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.

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

  • 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 distro.all.{boost,sipXconfig,sipXportLib}.rpm
    • Build boost library and all sipXecs rpms for all CentOS platforms
      make distro.centos-6-{i386,x86_64}.{boost,sipx}.rpm
    • Build boost library and all rpms after sipXcommserverLib
      make distro.all.{boost.rpm,sipXcommserverLib.rpm...}
    • Full build from scratch
      make distro.all.{repo-chroot-init,{lib,sipx}.rpm}

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

References

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

Labels
  • None