Name:            ark
Summary:         Archive manager
Version:         21.12.2
Release:         1

License:         GPLv2+
URL:             https://www.kde.org/applications/utilities/ark/
%global revision %(echo %{version} | cut -d. -f3)
%if %{revision} >= 50
%global stable unstable
%else
%global stable stable
%endif
Source0:        http://download.kde.org/%{stable}/release-service/%{version}/src/%{name}-%{version}.tar.xz

BuildRequires:  bzip2-devel
BuildRequires:  desktop-file-utils

BuildRequires:  extra-cmake-modules >= 5.71
BuildRequires:  kf5-rpm-macros
BuildRequires:  kf5-karchive-devel
BuildRequires:  kf5-kconfig-devel
BuildRequires:  kf5-kcrash-devel
BuildRequires:  kf5-kdbusaddons-devel
BuildRequires:  kf5-kdoctools-devel
BuildRequires:  kf5-khtml-devel
BuildRequires:  kf5-ki18n-devel
BuildRequires:  kf5-kiconthemes-devel
BuildRequires:  kf5-kio-devel
BuildRequires:  kf5-kpty-devel
BuildRequires:  kf5-kservice-devel
BuildRequires:  kf5-kwidgetsaddons-devel
BuildRequires:  kf5-kitemmodels-devel

BuildRequires:  libappstream-glib
BuildRequires:  pkgconfig(libarchive)
BuildRequires:  pkgconfig(liblzma)
BuildRequires:  pkgconfig(libzip)
BuildRequires:  qt5-qtbase-devel
BuildRequires:  zlib-devel

Conflicts:      kdeutils-common < 6:4.7.80
Conflicts:      kde-l10n < 17.03
Obsoletes:      kdeutils-ark < 6:4.7.80
Provides:       kdeutils-ark = 6:%{version}-%{release}
Requires:       %{name}-libs%{?_isa} = %{version}-%{release}
Requires:       bzip2
Requires:       gzip
Requires:       unzip

%description
Ark is a program for managing various archive formats.
Archives can be viewed, extracted, created and modified from within Ark.
The program can handle various formats such as tar, gzip, bzip2, zip,
rar and lha (if appropriate command-line programs are installed).

%package libs
Summary:        Runtime libraries for %{name}
License:        BSD and GPLv2+
Requires:       %{name} = %{version}-%{release}
Obsoletes:      kdeutils-ark-libs < 6:4.7.80
Provides:       kdeutils-ark-libs = 6:%{version}-%{release}
Provides:       ark-part = %{version}-%{release}
Provides:       ark-part%{?_isa} = %{version}-%{release}
%description libs
%{summary}.

%prep
%autosetup -p1

%build
mkdir %{_target_platform}
pushd %{_target_platform}
%{cmake_kf5} ..
popd
make %{?_smp_mflags} -C %{_target_platform}

%install
make install/fast DESTDIR=%{buildroot} -C %{_target_platform}
%find_lang %{name} --all-name --with-html --with-man
rm -fv %{buildroot}%{_kf5_libdir}/libkerfuffle.so

%check
appstream-util validate-relax --nonet %{buildroot}%{_kf5_metainfodir}/org.kde.ark.appdata.xml ||:
desktop-file-validate %{buildroot}%{_kf5_datadir}/applications/org.kde.ark.desktop

%files -f %{name}.lang
%license COPYING*
%{_kf5_datadir}/qlogging-categories5/%{name}*
%{_kf5_bindir}/ark
%{_kf5_datadir}/config.kcfg/ark.kcfg
%{_kf5_metainfodir}/org.kde.ark.appdata.xml
%{_kf5_datadir}/applications/org.kde.ark.desktop
%{_kf5_datadir}/icons/hicolor/*/apps/ark.*
%{_mandir}/man1/ark.1*
%ldconfig_scriptlets

%files libs
%{_kf5_libdir}/libkerfuffle.so.*
%{_kf5_plugindir}/parts/arkpart.so
%{_kf5_datadir}/kservices5/ark_part.desktop
%{_kf5_qtplugindir}/kerfuffle/
%{_kf5_plugindir}/kio_dnd/extracthere.so
%{_kf5_plugindir}/kfileitemaction/compressfileitemaction.so
%{_kf5_plugindir}/kfileitemaction/extractfileitemaction.so
%{_kf5_datadir}/kservicetypes5/kerfufflePlugin.desktop

%changelog
* Mon Feb 14 2022 pei-jiankang<peijiankang@kylinos.cn> - 21.12.2-1
- update to upstream version 21.12.2

* Mon Jan 24 2022 pei-jiankang<peijiankang@kylinos.cn> - 21.08.3-1
- update to upstream version 21.08.3

* Sat Sep 4 2021 baizhonggui <baizhonggui@huawei.com> - 19.12.2-1
- Package init
