File sipxproxy.spec of Package sipxproxy

%define release_prefix 18434.
Name:     sipxproxy
Version:  4.1.7
Release:  %{buildno}

Summary:  SIP Proxy Server
License:  Pingtel Commercial License
Group:    Productivity/Telephony/SIP/Servers
Vendor:   Pingtel Corp.
Packager: Pingtel <support@pingtel.com>
Url:      http://www.pingtel.com

BuildRequires: automake
BuildRequires: gcc-c++
BuildRequires: cppunit-devel
BuildRequires: doxygen
BuildRequires: pcre-devel >= 4.5
BuildRequires: rubygems
BuildRequires: ruby
BuildRequires: rubygem-rake
BuildRequires: stunnel
BuildRequires: unixODBC-devel
BuildRequires: zip
%if %{_vendor} == suse
BuildRequires: pwdutils
%else
BuildRequires: shadow-utils
%endif
BuildRequires: sipxcommserverlib-devel  >= %version
BuildRequires: sipxportlib-devel        >= %version
BuildRequires: sipxtacklib-devel        >= %version

Source:   %name-%version.tar.gz

%if %{_vendor} == suse
Requires: pwdutils
Requires: cron
%else
Requires: shadow-utils
Requires: vixie-cron
%endif
Requires: sipxcommserverlib >= %version
Requires: sipxpbx >= %version

Prefix:    %_prefix
BuildRoot: %{_tmppath}/%name-%version-root

%define sipxpbxvarlib %{_var}/lib/sipxpbx

%description
RFC 3261 compliant SIP proxy called sipXproxy:
The sipXproxy is used in the sipXpbx project. However it may be used
independently from the PBX as a stand-alone SIP proxy. The sipXregistry
may also be used with the sipXproxy though it is not necessary. The
sipXproxy provides service level routing, parallel and serial forking
and AAA services.

%if %{_vendor} == suse
%debug_package
%endif

%package cdr
Requires: %name >= %version
Requires: postgresql-odbc
Requires: stunnel
Requires: ruby
Requires: ruby-dbi
Requires: rubygems
%if %{_vendor} == suse
Requires: rubygem-postgres
%else
Requires: ruby-libs
Requires: ruby-postgres
%endif

Requires: sipxcommserverlib >= %version
Group:    Productivity/Telephony/SIP/Servers
Vendor: SIPfoundry
Summary: CDR (Call Distribution Record) aggregration

%description cdr
Gather CSE (Call State Events) for one or more proxy servers and generate
postgres database records from data.

%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
%configure --enable-rpmbuild --enable-cdr  --with-distdir=../dist SIPX_PROJECTS=sipxacd sipxbridge sipxcallcontroller sipxcalllib sipxcdrlog sipxcommons sipxcommserverlib sipxconfig sipxecs sipxfreeswitch sipximbot sipxivr sipxmediaadapterlib sipxmedialib sipxopenfire sipxpage sipxpark sipxpbx sipxportlib sipxpresence sipxprovision sipxproxy sipxpublisher sipxrecording sipxregistry sipxrelay sipxrest sipxrls sipxsaa sipxsupervisor sipxtacklib sipxtools sipxecs-doc
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


%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(644,root,root,755)

%doc CONTRIBUTORS ChangeLog %name.configlog
%attr(755,root,root) %{_bindir}/sipXproxy.sh
%attr(755,root,root) %{_bindir}/sipXproxy
%attr(755,root,root) %{_bindir}/%name-config
%attr(644,root,root) %{_datadir}/sipxecs/process.d/sipXproxy-process.xml
%attr(644,root,root) %{_datadir}/sipxecs/process.d/sipxcallresolver-process.xml
%attr(644,root,root) %{_datadir}/sipxecs/process.d/sipxcallresolver-agent-process.xml
%attr(755,root,root) %{_datadir}/sipxecs/schema/forwardingrules.xsd
%attr(755,root,root) %{_datadir}/sipxecs/schema/nattraversalrules.xsd

%attr(755,root,root) %{_libdir}/authplugins/libEnforceAuthRules.la
%attr(755,root,root) %{_libdir}/authplugins/libEnforceAuthRules.a
%attr(755,root,root) %{_libdir}/authplugins/libEnforceAuthRules.so*

%attr(755,root,root) %{_libdir}/authplugins/libRequestLinter.la
%attr(755,root,root) %{_libdir}/authplugins/libRequestLinter.a
%attr(755,root,root) %{_libdir}/authplugins/libRequestLinter.so*

%attr(755,root,root) %{_libdir}/authplugins/libCallerAlias.la
%attr(755,root,root) %{_libdir}/authplugins/libCallerAlias.a
%attr(755,root,root) %{_libdir}/authplugins/libCallerAlias.so*

%attr(755,root,root) %{_libdir}/authplugins/libTransferControl.la
%attr(755,root,root) %{_libdir}/authplugins/libTransferControl.a
%attr(755,root,root) %{_libdir}/authplugins/libTransferControl.so*

%attr(755,root,root) %{_libdir}/authplugins/libCallDestination.la
%attr(755,root,root) %{_libdir}/authplugins/libCallDestination.a
%attr(755,root,root) %{_libdir}/authplugins/libCallDestination.so*

%attr(755,root,root) %{_libdir}/authplugins/libNatTraversalAgent.la
%attr(755,root,root) %{_libdir}/authplugins/libNatTraversalAgent.a
%attr(755,root,root) %{_libdir}/authplugins/libNatTraversalAgent.so*

%attr(755,root,root) %{_libdir}/authplugins/libMSFT_ExchangeTransferHack.la
%attr(755,root,root) %{_libdir}/authplugins/libMSFT_ExchangeTransferHack.a
%attr(755,root,root) %{_libdir}/authplugins/libMSFT_ExchangeTransferHack.so*

%attr(755,root,root) %{_libdir}/authplugins/libSubscriptionAuth.la
%attr(755,root,root) %{_libdir}/authplugins/libSubscriptionAuth.a
%attr(755,root,root) %{_libdir}/authplugins/libSubscriptionAuth.so*

%attr(755,root,root) %{_libdir}/authplugins/libEmergencyNotify.la
%attr(755,root,root) %{_libdir}/authplugins/libEmergencyNotify.a
%attr(755,root,root) %{_libdir}/authplugins/libEmergencyNotify.so*

%files devel
%defattr(644,root,root,755)
%docdir %{_datadir}/doc/sipxecs/%name
%{_datadir}/doc/sipxecs/%name

%pre

%post

%files cdr
%defattr(644,root,root,755)
%attr(755,root,root) %{_libexecdir}/sipXecs/setup.d/sipxcallresolver-setup

%config(noreplace) %attr(644,sipxchange,sipxchange) %{_sysconfdir}/sipxpbx/sipxcallresolver-agent-config
%config(noreplace) %attr(644,sipxchange,sipxchange) %{_sysconfdir}/sipxpbx/cdr/*

%dir %attr(755,sipxchange,sipxchange) %{_sysconfdir}/sipxpbx/cdr
%attr(755,root,root) %{sipxpbxvarlib}/sipxcallresolver-2.0.0.gem
%attr(755,root,root) %{_bindir}/sipxcallresolver.sh
%attr(755,root,root) %{_bindir}/sipxcallresolver-agent.sh

%post cdr

%define gem_dir %(ruby -rrbconfig -e 'puts File::join(Config::CONFIG["libdir"],"/ruby/gems")')
%define rb_ver %(ruby -rrbconfig -e 'puts Config::CONFIG["ruby_version"]')
%define gem_home %{gem_dir}/%{rb_ver}

gem install --no-rdoc --local --install-dir %{gem_home} %{sipxpbxvarlib}/sipxcallresolver-*.gem >/dev/null 2>&1

if [ -f %{_sysconfdir}/cron.daily/callresolver_run ]; then
  rm -f %{_sysconfdir}/cron.daily/callresolver_run
fi

%preun cdr
# Uninstall the sipxcallresolver gem, unless this RPM uninstall is part of
# an upgrade.
#   see http://fedoraproject.org/wiki/Packaging/ScriptletSnippets
if [ "$1" == "0" ] ; then
  gem uninstall sipxcallresolver >/dev/null 2>&1
fi
openSUSE Build Service is sponsored by