%define name linux-igd
%define source_name linuxigd
%define version 1.0
%define release 3%{?_dist_release}

Summary: The Linux UPNP Internet GATEWAY DEVICE
Summary(ja): ユニバーサルプラグアンドプレイゲートウェイデバイス
Name: %{name}
Version: %{version}
Release: %{release}
Source0: %{source_name}-%{version}.tar.gz
Patch0: %{source_name}-%{version}.patch
Patch1: linux-igd-include.patch
License: GPL
Group: System Environment/Daemons
URL: http://linux-igd.sourceforge.net/
Vendor: Project Vine
Distribution: Vine Linux

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: libupnp-devel >= 1.3.1
Requires: libupnp >= 1.3.1

%description
This is a deamon that emulates Microsoft's Internet Connection Service (ICS).
It implements the UPnP Internet Gateway Device specification (IGD) and allows UPnP aware clients, such as MSN Messenger to work properly from behind a Linux NAT firewall.

%prep
%setup -q -n %{source_name}-%{version}
%patch0 -p1
%patch1 -p1

%build
%{__make}

%install
%{__rm} -rf ${RPM_BUILD_ROOT}
%{__make} install DESTDIR="${RPM_BUILD_ROOT}"

%post
if [ $1 = 1 ] ; then
    /sbin/chkconfig --add upnpd
fi

%preun
if [ $1 = 0 ] ; then
    /etc/rc.d/init.d/upnpd stop
    /sbin/chkconfig --del upnpd
fi

%clean
%__rm -rf ${RPM_BUILD_ROOT}

%files
%defattr(-, root, root)
%doc CHANGES LICENSE doc/config_options
%dir %{_sysconfdir}/linuxigd/
%attr(0644, root, root) %{_sysconfdir}/linuxigd/*.xml
%{_sbindir}/upnpd
%{_mandir}/man8/upnpd.8.gz
%attr(0644, root, root) %config %{_sysconfdir}/upnpd.conf
%attr(0755, root, root) %{_sysconfdir}/rc.d/init.d/upnpd
%attr(0644, root, root) %config %{_sysconfdir}/sysconfig/upnpd

%changelog
* Mon Jan 13 2014 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.0-3
- rebuilt with current environment.

* Tue May 01 2012 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.0-2
- rebuilt with current environment.
- added Patch1.

* Sun Mar  1 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0-1vl5
- applied new versioning policy, spec in UTF-8
- fixed Group tag
- added files to %%doc section

* Thu Feb 14 2008 Masahiro INOUE <miyabi.-.inoue@nifty.com> 1.0
- initial build for Vine Linux

* Mon Aug 14 2006 Tim Brody <tdb01r@ecs.soton.ac.uk>
- Version 0.95 Release 1
- first build for version 0.95 (Release)
* Sun Sep 26 2004 Watanabe Keiji <k@elt.ne.jp>
- Version 0.99 Release ELT1
- first build for version 0.92 (CVS Version on Sep 25, 2004.)
