%define _qt4_ver 4.8.0
%define _qt4_version %(pkg-config --modversion --silence-errors Qt 2>/dev/null || echo %{qt4_ver})
%define _qt4_prefix %(pkg-config --variable prefix --silence-errors Qt 2>/dev/null || echo %{_libdir}/qt4)
%define _qt4_libdir %(pkg-config --variable libdir --silence-errors Qt 2>/dev/null || echo %{_qt4_prefix}/lib)
%define _qt4_headerdir %(pkg-config --variable headerdir --silence-errors Qt 2>/dev/null || echo %{_qt4_prefix}/plugins)


Name:           herqq
Summary:        A software library for building UPnP devices and control points
Version:        1.0.0
Release:        3%{?_dist_release}

# test application is GPLv3 but we do not ship it
License:        LGPLv3+
URL:            http://herqq.org/
Source0:        http://downloads.sourceforge.net/project/hupnp/hupnp/%{name}-%{version}.zip
Patch2:         herqq-1.0.0-qtsoap-library.patch

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires:  desktop-file-utils
BuildRequires:  qt4-devel
BuildRequires:  qtsoap-devel
Requires: qt4 >= %{_qt4_version}

%description
Herqq UPnP (HUPnP) is a software library for building UPnP 
devices and control points conforming to the UPnP Device 
Architecture version 1.1. 

%package devel
Summary:  Development files for %{name}
Requires: %{name} = %{version}-%{release}
Requires: qt4-devel >= %{_qt4_version}

%description devel
Header files for developing applications using %{name}.

%prep
%setup -q

# lQtSolutions to lqtsoap
%patch2 -p1 -b .qtsoap-library

%build
# we have to disable bundled QtSOAP library
qmake PREFIX=%{_prefix} -config DISABLE_QTSOAP \
    -config DISABLE_TESTAPP -config USE_QT_INSTALL_LOC
make %{?_smp_mflags}

%install
make INSTALL_ROOT=%{buildroot} install


%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig


%files
%doc hupnp/ChangeLog hupnp/LICENSE_LGPLv3.txt
%{_qt4_libdir}/libHUpnp.so.1*

%files devel
%{_qt4_libdir}/libHUpnp.so
%{_qt4_headerdir}/HUpnpCore/

%changelog
* Sun Jan  8 2012 Ryoiochi INAGAKI <ryo1@bc.wakwak.com> - 1.0.0-3
- rebuilt with qt-4.8.0

* Sat Jul 31 2011 Ryoiochi INAGAKI <ryo1@bc.wakwak.com> - 1.0.0-2
- Initial build for Vine Linux

* Wed Jul 20 2011 Jaroslav Reznik <jreznik@redhat.com> - 1.0.0-1
- post-review update to 1.0.0

* Wed Jul 20 2011 Jaroslav Reznik <jreznik@redhat.com> - 0.9.1-3
- fix license to LGPLv3+
- qt4 header dir for consistency
- shlib soname tracked in %files
- -devel should not duplicate COPYING

* Tue Jul 19 2011 Jaroslav Reznik <jreznik@redhat.com> - 0.9.1-2
- qtsoap library
- cleanup SPEC file

* Tue Feb 22 2011 Jaroslav Reznik <jreznik@redhat.com> - 0.9.1-1
- Initial spec file