%define name libupnp
%define version 1.6.19
%define release 1%{?_dist_release}

%define docdeveldir %{_docdir}/%{name}-devel-%{version}
%define docdir %{_docdir}/%{name}-%{version}

Summary: Universal Plug and Play (UPnP) SDK
Summary(ja): ユニバーサルプラグアンドプレイ開発キット
Name: %{name}
Version: %{version}
Release: %{release}
Source0: %{name}-%{version}.tar.bz2
Patch0:  makefile.patch
License: BSD
Group: System Environment/Libraries
URL: http://pupnp.sourceforge.net/

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

%description
The Universal Plug and Play (UPnP) SDK for Linux provides 
support for building UPnP-compliant control points, devices, 
and bridges on Linux.

%package devel
Summary: Header files, libraries and development documentation for %{name}.
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}

%description devel
This package contains the header files, static libraries and development
documentation for %{name}. If you like to develop programs using %{name},
you will need to install %{name}-devel.

%prep
%setup -q
%patch0 -p0 -b .makefile

%build
%configure --with-documentation --enable-static=no
%{__make} %{?_smp_mflags}

%install
%{__rm} -rf %{buildroot}
%{__make} install DESTDIR="%{buildroot}"

#create the doc devel dir
%{__mkdir_p} %{buildroot}%{docdeveldir}

#mv examples dir and pdf file to the doc devel dir
%{__mv} %{buildroot}%{docdir}/examples \
        %{buildroot}%{docdeveldir}/
%{__mv} %{buildroot}%{docdir}/UPnP_Programming_Guide.pdf \
        %{buildroot}%{docdeveldir}/
%{__mv} %{buildroot}%{docdir}/IXML_Programming_Guide.pdf \
        %{buildroot}%{docdeveldir}/
%{__mv} %{buildroot}%{docdir}/html \
        %{buildroot}%{docdeveldir}/

%{__rm} %{buildroot}%{_libdir}/{libixml.la,libthreadutil.la,libupnp.la}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%clean
%{__rm} -rf ${RPM_BUILD_ROOT}

%files
%defattr(-, root, root, -)
%doc AUTHORS ChangeLog COPYING INSTALL LICENSE NEWS README THANKS TODO
%{_libdir}/libixml.so.*
%{_libdir}/libthreadutil.so.*
%{_libdir}/libupnp.so.*

%files devel
%defattr(-, root, root, 0755)
%doc %{docdeveldir}
%{_includedir}/upnp/
%{_libdir}/libixml.so
%{_libdir}/libthreadutil.so
%{_libdir}/libupnp.so
%{_libdir}/pkgconfig/libupnp.pc

%changelog
* Mon Jan 13 2014 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 1.6.19-1
- new upstream release.

* Thu Mar 22 2012 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 1.6.13-1
- new upstream release

* Sun Sep 26 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.6.6-2
- rebuild with rpm-4.8.1 for pkg-config file

* Sun Mar 01 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.6.6-1
- new upstream release

* Fri Oct 03 2008 Shu KONNO <owa@bg.wakwak.com> 1.6.5-1vl5
- applied new versioning policy, spec in utf-8

* Thu Feb 14 2008 Masahiro INOUE <miyabi.-.inoue@nifty.com> 1.6.5
- new upstream release

* Tue Jul 31 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.6.0-0vl1
- new upstream release

* Sat May 26 2007 Daisuke SUZUKI <daisuke@linux.or.jp> 1.4.2-0vl1
- initial build for Vine Linux

* Wed Feb 21 2007 Dag Wieers <dag@wieers.com> - 1.4.2-1 - +/
- Initial package. (using DAR)
