File sipxproxy.spec of Package sipxproxy
%define SIPXPBXUSER sipx
Name: sipxproxy
Version: 3.8.1
Release: 0
Summary: SIP Proxy Servers
License: LGPL
Group: Productivity/Telephony/SIP/Servers
Vendor: SIPfoundry
Packager: SIPfoundry <sipx-dev@list.sipfoundry.org>
Url: http://www.sipfoundry.org/sipXregistry
Source: %name-%version.tar.bz2
Requires: gawk
Requires: sipxcommserverlib >= %version
Requires: ruby >= 1.8.4
BuildRequires: cppunit-devel
%if 0%{?suse_version} > 0
Requires: rubygems >= 0.8.11
BuildRequires: rubygem-rake
BuildRequires: rubygems >= 0.8.11
%else
Requires: ruby-gems >= 0.8.11
BuildRequires: ruby-gems >= 0.8.11
%endif
BuildRequires: doxygen gcc-c++
BuildRequires: pcre-devel Xerces-c-devel zip
BuildRequires: sipxcommserverlib-devel >= %version
Prefix: %_prefix
BuildRoot: %{_tmppath}/%name-%version-root
# should match sipXlib.m4:SIPX_UPGRADEDIR
%define upgrade_archive_dir %{_localstatedir}/sipxdata/upgrade
%define this_archive %{name}-%{version}-%{release}.tgz
%define sipxcallresolverdir %{_datadir}/sipxpbx/lib
%description
Two RFC 3261 compliant SIP proxies:
* sipForkingProxy
* sipAuthProxy
These proxies are used in the sipXpbx project. However they may be used
independently from the PBX as stand-alone SIP proxies. They may be used
separately or together. The sipXregistry may also be used with the forking
proxy. Though it is not necessary. The forking proxy provides service level
routing as well as parallel and serial forking. The auth proxy provides AAA
services.
%package devel
Requires: %name
Group: Development/Libraries
Vendor: SIPfoundry
Summary: Internal documentation for %name
Requires: sipxcommserverlib-devel >= %version
%description devel
Internal class documentation for the proxy classes
%prep
%setup -q
%build
autoreconf
%configure --enable-rpmbuild SIPXPBXUSER=%SIPXPBXUSER
cp config.log %name.configlog
make
%install
# makeinstall RPM macro doesn't leverage DESTDIR but instead overrides
# libdir, bindir, etc just for make install. This not copesetic w/how
# our makefiles are built, they'd rather preserve libdir, and use
# DESTDIR when copying/moving/creating files. The approach we're taking
# is quite standard, so it's surprising RPM's makeinstall macro is
# the way it is.
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install
%define upgrade_archive_root ${RPM_BUILD_ROOT}%{upgrade_archive_dir}
mkdir -p %{upgrade_archive_root}
tar --directory ${RPM_BUILD_ROOT} \
-czf %{upgrade_archive_root}/%{this_archive} \
etc
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
%doc CONTRIBUTORS ChangeLog %name.configlog
%attr(755,root,root) %{_bindir}/sipproxy.sh
%attr(755,root,root) %{_bindir}/sipproxy
%attr(755,root,root) %{_bindir}/sipauthproxy.sh
%attr(755,root,root) %{_bindir}/sipauthproxy
%attr(755,root,root) %{_bindir}/%name-config
%attr(755,root,root) %{_bindir}/sipxcallresolver.sh
%attr(755,root,root) %{_bindir}/sipxha-distrib.sh
# The configuration directory needs to be writeable because
# config files are generated from templates via config.defs
%dir %attr(755,sipxpbx,sipxpbx) %{_sysconfdir}/sipxpbx
%dir %attr(755,sipxpbx,sipxpbx) %{_sysconfdir}/sipxpbx/cdr
%config(noreplace) %attr(644,sipxpbx,sipxpbx) %{_sysconfdir}/sipxpbx/proxy-config.in
%config(noreplace) %attr(644,sipxpbx,sipxpbx) %{_sysconfdir}/sipxpbx/forwardingrules.xml.in
%config(noreplace) %attr(644,sipxpbx,sipxpbx) %{_sysconfdir}/sipxpbx/authproxy-config.in
%config(noreplace) %attr(644,sipxpbx,sipxpbx) %{_sysconfdir}/sipxpbx/authrules.xml.in
%config(noreplace) %attr(644,sipxpbx,sipxpbx) %{_sysconfdir}/sipxpbx/callresolver-config.in
%config %attr(644,sipxpbx,sipxpbx) %{_sysconfdir}/sipxpbx/cdr/*
%config %attr(644,sipxpbx,sipxpbx) %{_sysconfdir}/sipxpbx/process.d/*.xml
%{upgrade_archive_dir}/%{this_archive}
%{upgrade_archive_dir}/%{name}-previous.tgz
%files devel
%defattr(644,root,root,755)
%doc %{_datadir}/doc/sipx/%name/*
%pre
sipx-upgrade -p sipxproxy -c
%post
sipx-upgrade -p sipxproxy -u --bdir %{_bindir} --ddir %{_datadir} --cdir %{_sysconfdir} --sdir %{_localstatedir}
sipxcallresolver.sh --setup
gem install --no-rdoc --local %{sipxcallresolverdir}/sipxcallresolver-*.gem >/dev/null 2>&1
%define current_archive %{upgrade_archive_dir}/%{name}-current.tgz
%define previous_archive %{upgrade_archive_dir}/%{name}-previous.tgz
if [ -f %{current_archive} ]; then
mv %{current_archive} %{previous_archive}
fi
mv %{upgrade_archive_dir}/%{this_archive} %{current_archive}
pkg-upgrade --previous %{previous_archive} --current %{current_archive}
if [ -f %{_sysconfdir}/cron.daily/callresolver_run ]; then
rm -f %{_sysconfdir}/cron.daily/callresolver_run
fi
%preun
# prevent uninstalling during an upgrade
# see http://www-128.ibm.com/developerworks/library/l-rpm3/
if [ "$1" = "0" ] ; then
gem uninstall sipxcallresolver >/dev/null 2>&1
sipxcallresolver.sh --uninstall
fi