File siproxd.spec of Package siproxd
#
# spec file for package siproxd
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
#
%define piddir /var/run/siproxd/
%define regdir /var/lib/siproxd/
%define siproxduser siproxd
%define siproxdgroup siproxd
Name: siproxd
Version: 0.8.1
Release: 0
Summary: A SIP masquerading proxy with RTP support
License: GPL-2.0+
Group: Productivity/Networking/Other
Url: http://siproxd.sourceforge.net/
Source0: %{name}-%{version}.tar.bz2
Source1: susefirewall2.%{name}
Source2: %name.init.in
Source3: %name.logrotate
Source4: %name.8.gz
Source5: syslog-ng.conf.addon
# PATCH-FIX-FOR-UPSTREAM -- http://sourceforge.net/tracker/?func=detail&aid=3086321&group_id=60374&atid=493974
#Code to detect libltdl was placed before the code that populates the library locations.
#This caused libltdl to be undetected even after it was installed locally.
#The patch moves the library detection code in front of libltdl detection
#and also adds standard library (and include) locations, ie. /usr/local/lib
#After applying the patch, autogen.sh needs to be run (which, among other things, rebuilds "configure").
Patch0: siproxd-libs.patch
#PATCH-FIX-FROM-DEBIAN use logger not user
Patch1: siproxd-log.c.patch
Patch9: siproxd.plugin_fix_bogus_via.c.patch
BuildRequires: docbook-utils
BuildRequires: libltdl
BuildRequires: libosip2
BuildRequires: libosip2-devel
BuildRequires: libtool
%if %suse_version > 1220
BuildRequires: texlive-courier
BuildRequires: texlive-dvips
BuildRequires: texlive-ec
BuildRequires: texlive-helvetic
BuildRequires: texlive-jadetex
BuildRequires: texlive-times
%endif
Requires: logrotate
PreReq: %_sbindir/groupadd %_sbindir/useradd
Suggests: SuSEfirewall2
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Siproxd is an proxy/masquerading daemon for the SIP protocol. It handles
registrations of SIP clients on a private IP network and performs
rewriting of the SIP message bodies to make SIP connections possible
via an masquerading firewall. It allows SIP clients (like kphone,
linphone) to work behind an IP masquerading firewall or router.
%package doc
Summary: Documentation for %{name}
Group: Documentation/Other
%description doc
HTML and pdf documentation for %{name}
%prep
%setup -q
%patch0 -p1
%patch1
%patch9 -p1
cp %{S:5} .
%build
autoreconf --install --force
CFLAGS="%{optflags} -fno-strict-aliasing" ./configure \
--prefix=%{_prefix} \
--sysconfdir=%{_sysconfdir} \
--disable-static \
--libdir=%{_libdir}\
--docdir=%{_defaultdocdir}
%{__make} %{?_smp_mflags}
%install
%make_install
find %{buildroot} -type f -name "*.la" -delete -print
%{__mkdir} -p %{buildroot}%{_sysconfdir}/%{name}
%{__mv} %{buildroot}%{_sysconfdir}/%{name}.conf.example \
%{buildroot}%{_sysconfdir}/%{name}/%{name}.conf
%{__install} -d %{buildroot}%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/
%{__install} -m 644 %{S:1} %{buildroot}%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/%{name}
%{__install} -d %buildroot/%{_sysconfdir}/logrotate.d/
%{__install} -m 0644 %{S:3} %buildroot/%{_sysconfdir}/logrotate.d/%{name}
%{__install} -d %buildroot/%{_sysconfdir}/init.d
%{__install} %{S:2} %buildroot/%{_sysconfdir}/init.d/%{name}
%{__sed} -i "s#@%{name}_PIDDIR@#%{_localstatedir}/run/%{name}#" %buildroot/%{_sysconfdir}/init.d/%{name}
%{__install} -d %buildroot/%{_sbindir}
%{__ln_s} /%{_sysconfdir}/init.d/%{name} %buildroot/%{_sbindir}/rc%{name}
%{__mkdir} -p %buildroot%_mandir/man8
%__install -m 0644 %{S:4} %{buildroot}%{_mandir}/man8/%name.8.gz
#
sed -i -e "s@nobody@%{siproxduser}@" %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf
sed -i -e "s@nobody@%{siproxduser}@" %buildroot/%{_sysconfdir}/init.d/%{name}
#
# Directory needs to exist for packaging
%if %suse_version > 1120
%{__mkdir} -p %buildroot%{_localstatedir}/run/%{name}
%endif
# cleanup
%{__rm} -f %{buildroot}%{_sysconfdir}/siproxd_passwd.cfg
%{__rm} -f %{buildroot}%{_libdir}/%{name}/*.a
%{__rm} -rf %{buildroot}/usr/share/doc/%{name}
%clean
%{__rm} -rf %{buildroot}
%post -p /sbin/ldconfig
%pre
%_sbindir/groupadd -r %{sipproxdgroup} 2> /dev/null || :
%_sbindir/useradd -r -g %{sipproxdgroup} -s /bin/false -c "Siproxd user" -d %{_localstatedir}/run/%{name} %{siproxduser} 2> /dev/null || :
%postun
/sbin/ldconfig
%restart_on_update %{name}
%insserv_cleanup
%preun
%stop_on_removal %{name}
%files
%defattr(-,root,root)
%doc COPYING README AUTHORS INSTALL ChangeLog syslog-ng.conf.addon
%doc doc/siproxd.conf.example doc/siproxd_passwd.cfg doc/FAQ doc/KNOWN_BUGS doc/sample_*
%attr(0755,root,root) %{_libdir}/%{name}/
%{_sbindir}/rc%name
%{_sbindir}/%name
%attr(0755,root,root) %{_sysconfdir}/init.d/%name
%config %{_sysconfdir}/logrotate.d/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
%config %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/%{name}
%_mandir/man8/%name.8*
%dir %_sysconfdir/%name
%if %suse_version > 1120
#make rpm know about a directory but do not package it
%attr(0750,%{siproxduser},root) %ghost %{_localstatedir}/run/%{name}
%endif
%files doc
%defattr(-,root,root)
%doc doc/html/* doc/pdf/*
%changelog