File kde-cli-tools5.spec of Package mingw32-kde-cli-tools5

#
# spec file for package mingw32-kde-cli-tools5
#
# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%define kf5_version 5.54.0
%bcond_without lang
%define _name   kde-cli-tools5
Name:           mingw32-%{_name}
Version:        5.17.5
Release:        0
Summary:        Additional CLI tools for KDE applications
License:        GPL-2.0-or-later
Group:          System/GUI/KDE
Url:            http://www.kde.org
Source:         https://download.kde.org/stable/plasma/%{version}/kde-cli-tools-%{version}.tar.xz
%if %{with lang}
Source1:        https://download.kde.org/stable/plasma/%{version}/kde-cli-tools-%{version}.tar.xz.sig
Source2:        plasma.keyring
%endif
# PATCH-FIX-OPENSUSE kdesu-add-some-i18n-love.patch -- boo#852256
Patch0:         kdesu-add-some-i18n-love.patch
BuildRequires:  mingw32-extra-cmake-modules >= 1.3.0
BuildRequires:  mingw32-kf5-filesystem
BuildRequires:  xz
BuildRequires:  mingw32(cmake:KF5Activities) >= %{kf5_version}
BuildRequires:  mingw32(cmake:KF5Config) >= %{kf5_version}
BuildRequires:  mingw32(cmake:KF5Declarative) >= %{kf5_version}
BuildRequires:  mingw32(cmake:KF5DocTools) >= %{kf5_version}
BuildRequires:  mingw32(cmake:KF5I18n) >= %{kf5_version}
BuildRequires:  mingw32(cmake:KF5IconThemes) >= %{kf5_version}
BuildRequires:  mingw32(cmake:KF5Init) >= %{kf5_version}
BuildRequires:  mingw32(cmake:KF5KCMUtils) >= %{kf5_version}
BuildRequires:  mingw32(cmake:KF5KDELibs4Support) >= %{kf5_version}
BuildRequires:  mingw32(cmake:KF5KIO) >= %{kf5_version}
#BuildRequires:  mingw32(cmake:KF5Su) >= %{kf5_version}
BuildRequires:  mingw32(cmake:KF5WindowSystem) >= %{kf5_version}
# Needs KWorkSpace::detectPlatform
#BuildRequires:  mingw32(cmake:LibKWorkspace) >= 5.12.4
BuildRequires:  mingw32(cmake:Qt5DBus) >= 5.4.0
BuildRequires:  mingw32(cmake:Qt5Svg) >= 5.4.0
BuildRequires:  mingw32(cmake:Qt5Test) >= 5.4.0
BuildRequires:  mingw32(cmake:Qt5Widgets) >= 5.4.0
# BuildRequires:  cmake(Qt5X11Extras) >= 5.4.0
# BuildRequires:  pkgconfig(x11)
# BuildRequires:  pkgconfig(xcb)
# for kquitapp5
Requires:       mingw32-kdbusaddons-tools
%if %{with lang}
Recommends:     %{name}-lang
%endif
Requires(post):     update-alternatives
Requires(postun):   update-alternatives
%_mingw32_package_header_debug
BuildArch:      noarch

%description
Additional CLI tools for KDE applications and workspaces.


%_mingw32_debug_package
%lang_package
%prep
%setup -q -n kde-cli-tools-%{version}
%autopatch -p1
# downgrade to Qt 5.11
sed -i 's,5.12,5.11,g' CMakeLists.txt

%build
  %_mingw32_cmake_kf5 -d build
  %make_jobs

%install
  %_mingw32_kf5_makeinstall -C build
%if %{with lang}
  %_mingw32_find_lang %{_name} --with-man --all-name
  %kf5_find_htmldocs
%endif

  # create a dummy target for /etc/alternatives/kdesu
  install -d -m 755 %{buildroot}%{_mingw32_sysconfdir}/alternatives/
  touch %{buildroot}%{_mingw32_sysconfdir}/alternatives/kdesu
  chmod +x %{buildroot}%{_mingw32_sysconfdir}/alternatives/kdesu
  ln -s -f %{_mingw32_sysconfdir}/alternatives/kdesu %{buildroot}%{_kf5_bindir}/kdesu.exe
  touch %{buildroot}%{_mingw32_sysconfdir}/alternatives/kdesu.1%{?ext_man}
  mv %{buildroot}%{_mingw32_kf5_mandir}/man1/kdesu.1 %{buildroot}%{_kf5_mandir}/man1/kdesu-5.1
  ln -s -f %{_mingw32_sysconfdir}/alternatives/kdesu.1%{?ext_man} %{buildroot}%{_kf5_mandir}/man1/kdesu.1%{?ext_man}

%post
/sbin/ldconfig
%if 0%{?suse_version} > 1320 || 0%{?is_opensuse}
%{_sbindir}/update-alternatives \
    --install %{_mingw32_kf5_bindir}/kdesu kdesu %{_kf5_libexecdir}/kdesu 25 \.exe
    --slave %{_mingw32_kf5_mandir}/man1/kdesu.1.gz kdesu.1%{?ext_man} %{_kf5_mandir}/man1/kdesu-5.1%{?ext_man}
%else
%{_sbindir}/update-alternatives \
    --install %{_mingw32_kf5_bindir}/kdesu kdesu %{_kf5_libexecdir}/kdesu 15 \.exe
    --slave %{_mingw32_kf5_mandir}/man1/kdesu.1.gz kdesu.1%{?ext_man} %{_kf5_mandir}/man1/kdesu-5.1%{?ext_man}
%endif

%postun
/sbin/ldconfig
if [ $1 -eq 0 ]; then
    %{_sbindir}/update-alternatives --remove kdesu \
        %{_mingw32_kf5_libexecdir}/kdesu.exe
fi

%files
%license COPYING*
%{_mingw32_kf5_bindir}/kdesu.exe
%{_mingw32_kf5_bindir}/kcmshell5.exe
%{_mingw32_kf5_bindir}/kdecp5.exe
%{_mingw32_kf5_bindir}/kdemv5.exe
%{_mingw32_kf5_bindir}/kde-open5.exe
%{_mingw32_kf5_bindir}/keditfiletype5.exe
%{_mingw32_kf5_bindir}/kioclient5.exe
%{_mingw32_kf5_bindir}/kmimetypefinder5.exe
%{_mingw32_kf5_bindir}/ksvgtopng5.exe
%{_mingw32_kf5_bindir}/kstart5.exe
%{_mingw32_kf5_bindir}/ktraderclient5.exe
%{_mingw32_kf5_bindir}/kbroadcastnotification.exe
%{_mingw32_kf5_servicesdir}/
%{_mingw32_kf5_libexecdir}/.exe
%ghost %{_mingw32_sysconfdir}/alternatives/kdesu
%{_mingw32_kf5_plugindir}/
%ghost %{_mingw32_sysconfdir}/alternatives/kdesu.1%{?ext_man}
%doc %{_mingw32_kf5_htmldir}/en
%{_mingw32_kf5_mandir}/man1/kdesu*.*

%if %{with lang}
%files lang -f %{_name}.lang
%endif

%changelog
openSUSE Build Service is sponsored by