%define snap 20111102git

Name:    kio-upnp-ms
Version: 1.0.0
Release: 8.%{snap}%{?_dist_release}
Summary: UPnP mediaserver kio slave

License: GPLv2+
Group:   System Environment/Libraries
URL:	 https://projects.kde.org/projects/playground/base/kio-upnp-ms
# git clone git://anongit.kde.org/kio-upnp-ms
# git archive --prefix=kio-upnp-ms-%{version}/ master | gzip > ../kio-upnp-ms-%{version}-%{snap}.tar.gz
%if 0%{?snap:1}
Source0: kio-upnp-ms-%{version}-%{snap}.tar.gz
%else
Source0: http://download.kde.org/stable/kio-upnp-ms/%{version}/src/kio-upnp-ms-%{version}.tar.gz
%endif

Source1: SOLID_UPNP.sh

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: kdelibs4-devel
BuildRequires: herqq-devel

# apparently requires both cagibi and SOLID_UPNP backend, the latter is disabled
# by default due to #754530, #758008, kde#259472
Requires: cagibi

%description
This is the UPnP MediaServer KIO-slave for the KDE platform. It supports both
browse and search based MediaServers and is able to perform various tasks on
them, including running queries, listing directories and files and allowing
KDE based applications transparent access to them. Being used for Amarok UPnP
support, the slave features many developer friendly features which allow
faster speed or easier handling while compromising on user-friendliness when
used “under the hood”.

Functionality requires some user-intervention to re-enable the SOLID_UPNP 
backend, which is disabled by default due to many crashes ( see
https://bugs.kde.org/show_bug.cgi?id=259472 ). To re-enable, set
SOLID_UPNP=1 environment variable, or copy the sample SOLID_UPNP.sh to
$HOME/.kde/env/
to do it for you.


%prep
%setup -q

install -m644 %{SOURCE1} .


%build
mkdir -p %{_target_platform}
pushd %{_target_platform}
%cmake \
    -DCMAKE_BUILD_TYPE=release \
    -DDATA_INSTALL_DIR:PATH=%{_datadir}/kde4/apps \
    -DINCLUDE_INSTALL_DIR:PATH=%{_includedir}/kde4 \
    -DLIBEXEC_INSTALL_DIR:PATH=%{_libexecdir}/kde4 \
    ..
popd

make %{?_smp_mflags} -C %{_target_platform}


%install
rm -rf %{buildroot}
make install/fast DESTDIR=%{buildroot} -C %{_target_platform}

# remove unnecessary files 
rm -fv %{buildroot}%{_includedir}/kde4/kio/upnp-ms-types.h
rm -f %{buildroot}%{_bindir}/recursive_upnp
rm -f %{buildroot}%{_bindir}/stattest
rm -f %{buildroot}%{_bindir}/upnpmstest

%clean
rm -rf %{buildroot}


%files
%doc COPYING README* TODO
%doc SOLID_UPNP.sh 
%{_libdir}/kde4/kio_upnp_ms.so
%{_datadir}/kde4/services/kio_upnp_ms.protocol


%changelog
* Fri Sep 02 2016 Toshiaki Ara <ara_t@384.jp> 1.0.0-8.20111102git
- rebuild with gcc-5.4.0

* Wed Feb  4 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> - 1.0.0-7.20111102git
- Initial build for Vine Linux

* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.0-6.20111102git
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.0-5.20111102git
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Wed Aug 07 2013 Rex Dieter <rdieter@fedoraproject.org> 1.0.0-4.20111102git
- don't directly reference %%docdir in %%description (#993814)

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.0-3.20111102git
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.0-2.20111102git
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Fri Sep 14 2012 Rex Dieter <rdieter@fedoraproject.org>  1.0.0-1.20111102git
- 20111102 git snapshot

* Thu Apr 19 2012 Rex Dieter <rdieter@fedoraproject.org> 0.8.0-1
- 0.8.0
