File sipxvxml.spec of Package sipxvxml

%define SIPXPBXUSER sipx
Name: sipxvxml
Version: 3.8.1
Release: 0

Summary: Voice XML execution engine
License: LGPL
Group: Productivity/Telephony/SIP/Servers
Vendor: SIPfoundry
Packager: SIPfoundry <sipx-dev@sipfoundry.org>
Url: http://www.sipfoundry.org/sipXvxmlLib

Source: %name-%version.tar.bz2

Requires: sipxcalllib >= %{version}
Requires: sipxcommserverlib >= %{version}
Requires: sipxmedialib >= %{version}
Requires: sipxmediaadapterlib >= %{version}
Requires: sipxtacklib >= %{version}
Requires: sipxportlib >= %{version}

BuildRequires: sipxcalllib-devel >= %{version}
#BuildRequires: sipxcommserverlib-devel >= %{version}
BuildRequires: sipxmedialib-devel >= %{version}
BuildRequires: sipxmediaadapterlib-devel >= %{version}
BuildRequires: sipxtacklib-devel >= %{version}
BuildRequires: sipxportlib-devel >= %{version}
#BuildRequires: doxygen
BuildRequires: gcc-c++
BuildRequires: openssl-devel
BuildRequires: pcre-devel
BuildRequires: w3c-libwww-devel
BuildRequires: Xerces-c-devel

# Httpd is needed to serve VXML applications and execute supporting CGIs.
Requires: httpd >= 2.0, pcre

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

%description
Voice XML processing engine.
With scripts to implement the voicemail and auto-attendant functions of a PBX.

%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 sipXvxml classes

%prep
%setup -q

%build
autoreconf
%configure 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 copacetic 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 INSTALL NEWS README ChangeLog %name.configlog
%attr(4755,root,root) %{_bindir}/sipXvxml
%attr(755,root,root) %{_bindir}/sipXvxml.sh
%attr(755,root,root) %{_bindir}/%name-config
# A lot of these files are installed in ../include/ itself, which needs to be changed.
%{_includedir}

# This config file is reprocessed at start time, so it should be owned
# by SIPXPBXUSER.
%dir %attr(755,sipxpbx,sipxpbx) %{_sysconfdir}/sipxpbx
%config %{_sysconfdir}/sipxpbx/mediaserver-config.in
%config %{_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/*

%post

%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}
openSUSE Build Service is sponsored by