Building RPMs
From SIPfoundry sipx, The Open Source SIP PBX for Linux - Calivia
Contents |
Prerequisite
- Building from source - Follow instructions for setting up a development environment, replacing the final building step,
make build, with the intructions you'll find in this document.
Sudo and building as non-root
You should not be root and you should setup your system to build RPMs as non-root users. For more information see http://fedoranews.org/tchung/rpmbuild/
Having said that, there is one step that requires root access so you need to set up sudo.
Typical setup for sudo
Add youself to the wheel group (append your user to the line wheel in /etc/group), then uncomment the following line in the /etc/sudoers file like this (edit as root):
%wheel ALL=(ALL) NOPASSWD: ALL
Installing RPM development tools
Execute this as root to install the rpmdevtools RPM:
yum install rpmdevtools
Note: On older Fedora systems this package might be called "fedora-rpmdevtools"
Installing fedora-rpmdevtools on CentOS is a bit more complex as it is not included in the CentOS repository. Do this:
yum install gcc-c++ redhat-rpm-config wget http://download.fedora.redhat.com/pub/fedora/linux/extras/4/i386/fedora-rpmdevtools-1.6-1.fc4.noarch.rpm rpm -i fedora-rpmdevtools-1.6-1.fc4.noarch.rpm
Building RPMs
Execute this as a user to create a suitable ~/.rpmmacros file. If you have a current .rpmmacros file, rename it first, as it may interact badly with the values generated by rpmdev-setuptree.
mv ~/.rpmmacros ~/.rpmmacros.old rpmdev-setuptree # or fedora-buildrpmtree if you installed fedora-rpmdevtools
This will create the directory ~/rpmbuild, into which the RPMs will be stored.
To build RPMs, start with a clean source tree. Doing ordinary development builds leaves built files in the source tree that the RPM build process does not handle well. And make distclean is not sufficient to clean the source tree; check out a new copy. If you have set TMPDIR, un-set it, as otherwise brp-java-repack-jars will fail. Go to the root directory of the source tree and use these commands:
autoreconf -fi mkdir RPMBUILD cd RPMBUILD unset TMPDIR ../configure --cache-file=`pwd`/ac-cache-file --with-distdir=`pwd`/../dist make rpm
Note: Compilation of sipXportLib, sipXtackLib, sipXmediaLib, and sipXmediaAdapterLib use strict mode, which means that compiler warnings are treated as errors that abort compilation. And on some distributions, compiles within RPM builds produce more warnings than ordinary compiles. You can add the --disable-compile-strict switch to ../configure to turn strict mode off.
The binary RPMs will be stored in ~/rpmbuild/RPMS, and the source RPMs will be stored in ~/rpmbuild/SRPMS.
On CentOS 4/5 the dependency w3c-libwww needs to be rebuilt with SSL enabled. The new library created by building sipX dependencies is called sipx-w3c-libwww in order to not conflict with the one included with CentOS 4/5. The configure option --enable-sipx-w3c-libwww-rpm needs to be specified so that the correct dependencies are created.
Note: The RPM build process will install the RPMs as it builds them because the build of each RPM must be able to find the files of its dependency RPMs in their proper places. After the RPMs are built, you can remove them by running
rpm -qa | grep sipx | xargs sudo rpm -e --noscripts
Tips
For more detailed information, see Building RPM tips.
