%global framework kio

Name:           kf5-%{framework}
Version:        5.55.0
Release:        1
Summary:        KDE Frameworks 5 Tier 3 solution for filesystem abstraction

License:        GPLv2+ and MIT and BSD
URL:            https://cgit.kde.org/%{framework}.git

%global majmin %(echo %{version} | cut -d. -f1-2)
%global revision %(echo %{version} | cut -d. -f3)
%if %{revision} >= 50
%global stable unstable
%else
%global stable stable
%endif
Source0:        http://download.kde.org/%{stable}/frameworks/%{majmin}/%{framework}-%{version}.tar.xz

## upstreamable patches
# revert part of https://cgit.kde.org/kio.git/commit/src/core/slave.cpp?id=e2a4517f099d809bd53c6a10769ebfddc0f28a8b
# can cause kio to try to use 'kioslave' binary from kdelibs3,
# https://bugzilla.redhat.com/show_bug.cgi?id=1512418#c16
# https://bugs.kde.org/show_bug.cgi?id=386859
# https://phabricator.kde.org/D8810
Patch100: kio-slave_path.patch

# filter plugin provides
%global __provides_exclude_from ^(%{_kf5_qtplugindir}/.*\\.so)$

BuildRequires:  extra-cmake-modules >= %{majmin}  kf5-rpm-macros kf5-karchive-devel >= %{majmin}  kf5-kconfig-devel >= %{majmin}  kf5-kcoreaddons-devel >= %{majmin}  kf5-kcrash-devel >= %{majmin}  kf5-kdoctools-devel >= %{majmin}  kf5-kdbusaddons-devel >= %{majmin}  kf5-ki18n-devel >= %{majmin}  kf5-kservice-devel >= %{majmin}  kf5-solid-devel >= %{majmin} kf5-kbookmarks-devel >= %{majmin}  kf5-kcompletion-devel >= %{majmin}  kf5-kconfigwidgets-devel >= %{majmin}  kf5-kiconthemes-devel >= %{majmin}  kf5-kitemviews-devel >= %{majmin}  kf5-kjobwidgets-devel >= %{majmin}  kf5-kwindowsystem-devel >= %{majmin} kf5-knotifications-devel >= %{majmin}  kf5-ktextwidgets-devel >= %{majmin}  kf5-kwallet-devel >= %{majmin}  kf5-kwidgetsaddons-devel >= %{majmin}  kf5-kxmlgui-devel >= %{majmin}  krb5-devel  libacl-devel  qt5-qtbase-devel  qt5-qtscript-devel  qt5-qtx11extras-devel  zlib-devel
%if !0%{?flatpak} 
BuildRequires:  libxml2-devel  libxslt-devel
%endif
%if ! 0%{?bootstrap}
# (apparently?) requires org.kde.klauncher5 service provided by kf5-kinit -- rex
# not versioned to allow update without bootstrap
# <skip!>
BuildRequires:  kf5-kinit-devel
%endif

Requires:       %{name}-core%{?_isa} = %{version}-%{release}       %{name}-widgets%{?_isa} = %{version}-%{release}       %{name}-file-widgets%{?_isa} = %{version}-%{release}       %{name}-ntlm%{?_isa} = %{version}-%{release}       %{name}-gui%{?_isa} = %{version}-%{release}
%description
KDE Frameworks 5 Tier 3 solution for filesystem abstraction

%package        devel
Summary:        Development files for %{name}
Requires:       %{name}%{?_isa} = %{version}-%{release}       kf5-kbookmarks-devel >= %{majmin}       kf5-kcompletion-devel >= %{majmin}       kf5-kconfig-devel >= %{majmin}       kf5-kcoreaddons-devel >= %{majmin}       kf5-kitemviews-devel >= %{majmin}       kf5-kjobwidgets-devel >= %{majmin}       kf5-kservice-devel >= %{majmin}       kf5-solid-devel >= %{majmin}       kf5-kxmlgui-devel >= %{majmin}       qt5-qtbase-devel
%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.

%package        help
Summary:        Documentation files for %{name}
Requires:       %{name}-core = %{version}-%{release}
Obsoletes:      kf5-kio-help < 5.11.0-3
BuildArch:      noarch
%description    help
Documentation for %{name}.

%package        core
Summary:        Core components of the KIO Framework
## org.kde.klauncher5 service referenced from : src/core/slave.cpp
%{?kf5_kinit_requires}
Requires:       %{name}-core-libs%{?_isa} = %{version}-%{release}       %{name}-help = %{version}-%{release}
%description    core
KIOCore library provides core non-GUI components for working with KIO.

%package        core-libs
Summary:        Runtime libraries for KIO Core
Requires:       %{name}-core = %{version}-%{release}
%description    core-libs
%{summary}.

%package        widgets
Summary:        Widgets for KIO Framework
## org.kde.klauncher5 service referenced from : widgets/krun.cpp
## included here for completeness, even those -core already has a dependency.
%{?kf5_kinit_requires}
Requires:       %{name}-core%{?_isa} = %{version}-%{release}
%description    widgets
KIOWidgets contains classes that provide generic job control, progress
reporting, etc.

%package        widgets-libs
Summary:        Runtime libraries for KIO Widgets library
Requires:       %{name}-widgets = %{version}-%{release}
%description    widgets-libs
%{summary}.

%package        file-widgets
Summary:        Widgets for file-handling for KIO Framework
Requires:       %{name}-widgets%{?_isa} = %{version}-%{release}
%description    file-widgets
The KIOFileWidgets library provides the file selection dialog and
its components.

%package        gui
Summary:        Gui components for the KIO Framework
Requires:       %{name}-core%{?_isa} = %{version}-%{release}
%description    gui
%{summary}.

%package        ntlm
Summary:        NTLM support for KIO Framework
%description    ntlm
KIONTLM provides support for NTLM authentication mechanism in KIO


%prep
%autosetup -n %{framework}-%{version} -p1


%build
mkdir %{_target_platform}
pushd %{_target_platform}
%{cmake_kf5} ..
popd

%make_build -C %{_target_platform}


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

%find_lang %{name} --all-name --with-man %{?_with_html}


%files
%license COPYING.LIB
%doc README.md

%files core
%{_kf5_sysconfdir}/xdg/accept-languages.codes
%{_kf5_sysconfdir}/xdg/%{framework}.categories
%{_kf5_libexecdir}/kio_http_cache_cleaner
%{_kf5_libexecdir}/kpac_dhcp_helper
%{_kf5_libexecdir}/kioexec
%{_kf5_libexecdir}/kioslave
%{_kf5_libexecdir}/kiod5
%{_kf5_bindir}/ktelnetservice5
%{_kf5_bindir}/kcookiejar5
%{_kf5_bindir}/ktrash5
%{_kf5_plugindir}/kio/
%{_kf5_plugindir}/kded/
%{_kf5_qtplugindir}/kcm_kio.so
%{_kf5_qtplugindir}/kcm_trash.so
%{_kf5_plugindir}/kiod/
%{_kf5_datadir}/kservices5/cache.desktop
%{_kf5_datadir}/kservices5/cookies.desktop
%{_kf5_datadir}/kservices5/netpref.desktop
%{_kf5_datadir}/kservices5/proxy.desktop
%{_kf5_datadir}/kservices5/smb.desktop
%{_kf5_datadir}/kservices5/useragent.desktop
%{_kf5_datadir}/kservices5/*.protocol
%{_kf5_datadir}/kservices5/http_cache_cleaner.desktop
%{_kf5_datadir}/kservices5/kcmtrash.desktop
%{_kf5_datadir}/kservices5/useragentstrings
%{_kf5_datadir}/knotifications5/proxyscout.*
%{_kf5_datadir}/kf5/kcookiejar/domain_info
%{_kf5_datadir}/applications/*.desktop
%{_kf5_datadir}/kconf_update/*
%{_datadir}/dbus-1/services/org.kde.*.service

## omitted since 5.45, security concerns? -- rex
%if 0
# file_helper
%{_kf5_sysconfdir}/dbus-1/system.d/org.kde.kio.file.conf
%{_kf5_libexecdir}/kauth/file_helper
%{_kf5_datadir}/dbus-1/system-services/org.kde.kio.file.service
%{_kf5_datadir}/polkit-1/actions/org.kde.kio.file.policy
%endif

%ldconfig_scriptlets core-libs

%files core-libs
%{_kf5_libdir}/libKF5KIOCore.so.*

%files help -f %{name}.lang
%{_kf5_mandir}/man8/kcookiejar5.8*
%if !0%{?_with_html:1}
%{_kf5_docdir}/HTML/*/*
%endif

%ldconfig_scriptlets gui

%files gui
%{_kf5_libdir}/libKF5KIOGui.so.*

%files widgets
%config %{_kf5_sysconfdir}/xdg/kshorturifilterrc
%{_kf5_qtplugindir}/kcm_webshortcuts.so
%dir %{_kf5_plugindir}/urifilters/
%{_kf5_plugindir}/urifilters/*.so
%{_kf5_datadir}/kservices5/webshortcuts.desktop
%{_kf5_datadir}/kservices5/searchproviders
%{_kf5_datadir}/kservicetypes5/*.desktop

%ldconfig_scriptlets widgets-libs

%files widgets-libs
%{_kf5_libdir}/libKF5KIOWidgets.so.*

%ldconfig_scriptlets file-widgets

%files file-widgets
%{_kf5_libdir}/libKF5KIOFileWidgets.so.*

%ldconfig_scriptlets ntlm

%files ntlm
%{_kf5_libdir}/libKF5KIONTLM.so.*

%files devel
%{_kf5_includedir}/*
%{_kf5_libdir}/*.so
%{_kf5_libdir}/cmake/KF5KIO/
%{_kf5_archdatadir}/mkspecs/modules/qt_KIOCore.pri
%{_kf5_archdatadir}/mkspecs/modules/qt_KIOFileWidgets.pri
%{_kf5_archdatadir}/mkspecs/modules/qt_KNTLM.pri
%{_kf5_archdatadir}/mkspecs/modules/qt_KIOWidgets.pri
%{_kf5_archdatadir}/mkspecs/modules/qt_KIOGui.pri
%{_datadir}/dbus-1/interfaces/*.xml
%{_kf5_bindir}/protocoltojson


%changelog
* Mon Aug 17 2020 yeqinglong <yeqinglong@uniontech.com> - 5.55.0-1
- Initial release for OpenEuler

