Building as non-root
From SIPfoundry sipx, The Open Source SIP PBX for Linux - Calivia
Sudo and building as non-root
You should normally not be root and you should setup your system to build RPMs as non-root users. For background, see http://fedoranews.org/tchung/rpmbuild/
Having said that, you need to setup sudo in order to follow many commands in these instructions which require root access.
Adding user sipx is recommended since sipx should later run as user sipx.
yum install rpmdevtools useradd -G wheel sipx su - sipx fedora-buildrpmtree
Note: on Fedora 8 the command name changed to "rpmdev-setuptree"
Edit (as root) /etc/sudoers file to add an entry like this for your user (user sipx is shown here):
sipx ALL=(ALL) NOPASSWD: ALL
Installing fedora-rpmdevtools on CentOS is a bit more complex as it is not included in the CentOS repository. Do this:
CentOS 4: yum install gcc-c++ redhat-rpm-config rpm-build 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 useradd sipx su - sipx fedora-buildrpmtree
CentOS 5: yum install gcc-c++ redhat-rpm-config rpm-build wget ftp://mirror.switch.ch/pool/1/mirror/epel/5/i386/rpmdevtools-5.3-1.el5.noarch.rpm rpm -i rpmdevtools-5.3-1.el5.noarch.rpm useradd sipx su - sipx fedora-buildrpmtree
Alternatively, create a file ~/.rpmmacros to tell RPM to use your home directory to build RPMs:
~/.rpmmacros %_topdir %(echo $HOME)/rpmbuild %_smp_mflags -j3 %__arch_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot
Then create the RPM build directory structure under your home directory:
mkdir -p ~/rpmbuild/{BUILD,SOURCES,RPMS,SRPMS,SPECS}
