Name:           ukui-kwin
Version:        1.0.4
Release:        2
Summary:        KDE Window Manager for UKUI desktop environment
License:        GPLv2 or GPLv3
URL:            https://github.com/ukui/ukui-kwin     

%global revision %(echo %{version} | cut -d. -f3)
%if %{revision} >= 50
%global majmin_ver %(echo %{version} | cut -d. -f1,2).50
%else
%global majmin_ver %(echo %{version} | cut -d. -f1,2)
%endif

Source0:        ukui-kwin_1.0.4.orig.tar.gz
Patch00:        0001-modify-ukui-kwin-complie-error.patch
BuildRequires:  libxml2 libstdc++ libgcc 
BuildRequires:  cmake extra-cmake-modules 
BuildRequires:  libcap-devel libdrm-devel >= 2.4.62 libepoxy-devel >= 1.2 fontconfig-devel freetype-devel libgbm-devel libICE-devel libinput-devel >= 1.9  kdecoration-devel mesa-libGL-devel  mesa-libEGL-devel  mesa-libgbm-devel pkgconfig(libudev)
BuildRequires:  kf5-kactivities-devel  kf5-kcompletion-devel  kf5-kconfig-devel  kf5-kconfigwidgets-devel  kf5-kcoreaddons-devel  kf5-kcrash-devel  kf5-kdeclarative-devel   kf5-kdoctools-devel  kf5-kglobalaccel-devel  kf5-ki18n-devel  kf5-kiconthemes-devel  kf5-kidletime-devel  kf5-kcmutils-devel  kf5-kio-devel  kf5-knotifications-devel  kf5-kpackage-devel  kf5-kservice-devel  kf5-ktextwidgets-devel  kf5-kwayland-devel  kf5-kwidgetsaddons-devel  kf5-kwindowsystem-devel  kf5-kxmlgui-devel  kf5-kinit-devel  kf5-knewstuff-devel kf5-plasma-devel kf5-kirigami2-devel kf5-kguiaddons-devel
BuildRequires:  libSM-devel wayland-devel  >= 1.2 
BuildRequires:  libX11-devel libxcb-devel xcb-util-cursor xcb-util-wm xcb-util-image xcb-util-keysyms xcb-util-devel
BuildRequires:  libXcursor-devel libXi-devel libxkbcommon-devel >= 0.7.0 pkg-config
BuildRequires:  qt5-qtsensors-devel qt5-qtx11extras-devel qt5-qtbase-private-devel qt5-qtdeclarative-devel  qt5-qtscript-devel  qt5-qttools-devel qt5-qtbase-devel qt5-qtbase-static qt5-qttools-static gsettings-qt-devel qt5-qtwayland-devel 
BuildRequires:  kscreenlocker-devel kwin-devel 
BuildRequires:  plasma-breeze-devel systemd-devel wayland-devel xcb-util-cursor-devel xcb-util-wm-devel xcb-util-image-devel xcb-util-keysyms-devel

%description
Ukui-kwin is the default window manager for UKUI desktop environment, and is forked from kwin.

%package        wayland
Summary:        KDE Window Manager for UKUI desktop environment with experimental Wayland support
Requires:       %{name}-libs%{?_isa} = %{version}-%{release}
Requires:       %{name}-common%{?_isa} = %{version}-%{release}
Requires:       kwayland-integration%{?_isa} >= %{majmin_ver}
%if ! 0%{?bootstrap}
BuildRequires:  xorg-x11-server-Xwayland
%endif
Requires:       xorg-x11-server-Xwayland
%{?_qt5:Requires: %{_qt5}%{?_isa} = %{_qt5_version}}
%{?kf5_kinit_requires}
%description    wayland
%{summary}.

%package        common
Summary:        Common files for UKUI-KWin X11 and UKUI-KWin Wayland
Requires:       %{name}-libs%{?_isa} = %{version}-%{release}
Requires:       kf5-kwayland%{?_isa} >= %{_kf5_version}
%description    common
%{summary}.

%package        libs
Summary:        UKUI-KWin runtime libraries
Conflicts:      kde-workspace-libs%{?_isa} < 4.11.14-2
%description    libs
%{summary}.

%package        devel
Summary:        Development files for %{name}
Requires:       %{name}-libs%{?_isa} = %{version}-%{release}
Requires:       %{name}-common%{?_isa} = %{version}-%{release}
Requires:       kf5-kconfig-devel
Requires:       kf5-kservice-devel
Requires:       kf5-kwindowsystem-devel
Conflicts:      kde-workspace-devel < 5.0.0-1
%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.

%package        doc
Summary:        User manual for %{name}
Requires:       %{name} = %{version}-%{release}
BuildArch:      noarch
%description    doc
%{summary}.

%prep
%autosetup -n %{name} -p1

%build
mkdir %{_target_platform}
pushd %{_target_platform}
%{cmake_kf5} .. \
   -DBUILD_TESTING:BOOL=ON
popd

%make_build -C %{_target_platform}


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

%find_lang %{name} --with-html --all-name
cat %{name}.lang | sort | uniq -u > ukui_kwin5.lang

ln -s ukui-kwin_x11 %{buildroot}%{_bindir}/ukui-kwin
mkdir -p %{buildroot}%{_datadir}/licenses/ukui-kwin
cp  COPYING* %{buildroot}%{_datadir}/licenses/ukui-kwin/

%files
%license COPYING*
%{_bindir}/ukui-kwin
%{_bindir}/ukui-kwin_x11
%{_kf5_libdir}/libkdeinit5_ukui-kwin_x11.so
%{_sysconfdir}/xdg/LowPerformanceCPU.list
%{_sysconfdir}/xdg/LowVgaPci.list
%{_sysconfdir}/xdg/autostart/ukui-kwin.desktop
%{_sysconfdir}/xdg/ukui-kwinrc

%files common -f ukui_kwin5.lang
%{_kf5_libdir}/libkdeinit5_ukui_kwin_rules_dialog.so
%{_datadir}/ukui-kwin
%{_kf5_qtplugindir}/*.so
%{_kf5_qtplugindir}/ukui-kwin/
%{_kf5_qtplugindir}/kcms/
%{_kf5_qtplugindir}/kf5/
%{_kf5_qtplugindir}/org.kde.kdecoration2/*.so
%{_kf5_qtplugindir}/org.ukui.kwin.platforms/
%{_kf5_qtplugindir}/kpackage/packagestructure/ukui_kwin_packagestructure*.so
%{_kf5_qtplugindir}/org.ukui.kwin.scenes/*.so
%{_qt5_qmldir}/org/ukui/kwin
%{_kf5_libdir}/kconf_update_bin/ukui_kwin5_update_default_rules
%{_libexecdir}/ukui_kwin_killer_helper
%{_libexecdir}/ukui_kwin_rules_dialog
%{_datadir}/kconf_update/ukui-kwin.upd
%{_datadir}/kconf_update/ukui-kwin-5.16-auto-bordersize.sh
%{_datadir}/kconf_update/ukui-kwin-5.18-move-animspeed.py
%{_kf5_datadir}/kservices5/*.desktop
%{_kf5_datadir}/kservices5/ukui-kwin
%{_kf5_datadir}/kservicetypes5/*.desktop
%{_kf5_datadir}/kpackage/kcms/kcm_ukuikwin_virtualdesktops/*
%{_kf5_datadir}/kpackage/kcms/kcm_*
%{_kf5_datadir}/knotifications5/ukui-kwin.notifyrc
%{_kf5_datadir}/config.kcfg/ukui-kwin.kcfg
%{_kf5_datadir}/config.kcfg/ukuikwindecorationsettings.kcfg
%{_kf5_datadir}/config.kcfg/ukuivirtualdesktopssettings.kcfg
%{_kf5_datadir}/config.kcfg/ukui-kwin_colorcorrect.kcfg
%{_datadir}/icons/hicolor/*/apps/ukui-kwin.*
%{_datadir}/knsrcfiles/*.knsrc
%{_datadir}/aurorae/themes/*/*

%files wayland
%{_kf5_bindir}/ukui-kwin_wayland
%{_kf5_qtplugindir}/platforms/UKUIKWinQpaPlugin.so
%{_kf5_qtplugindir}/org.ukui.kglobalaccel5.platforms/KF5GlobalAccelPrivateKWin.so
%{_kf5_qtplugindir}/org.ukui.kwin.waylandbackends/KWinWaylandDrmBackend.so
%{_kf5_qtplugindir}/org.ukui.kwin.waylandbackends/KWinWaylandFbdevBackend.so
%{_kf5_qtplugindir}/org.ukui.kwin.waylandbackends/KWinWaylandWaylandBackend.so
%{_kf5_qtplugindir}/org.ukui.kwin.waylandbackends/KWinWaylandX11Backend.so
%{_kf5_qtplugindir}/org.ukui.kwin.waylandbackends/KWinWaylandVirtualBackend.so
%{_kf5_plugindir}/org.ukui.kidletime.platforms/KF5IdleTimeKWinWaylandPrivatePlugin.so

%ldconfig_scriptlets libs

%files libs
%{_kf5_datadir}/qlogging-categories5/org_ukui_kwin.categories
%{_libdir}/libukui-kwin.so.*
%{_libdir}/libukui-kwinxrenderutils.so.*
%{_libdir}/libukui-kwineffects.so.*
%{_libdir}/libukui-kwinglutils.so.*
%{_libdir}/libukui-kwin4_effect_builtins.so.*
%{_libdir}/libkcmukuikwincommon.so.*
%{_qt5_plugindir}/kcms/kcm_ukuikwin_virtualdesktops.so

%files devel
%{_datadir}/dbus-1/interfaces/*.xml
%{_libdir}/cmake/ukui-kwin/KWinDBusInterface
%{_libdir}/libukui-kwinxrenderutils.so
%{_libdir}/libukui-kwineffects.so
%{_libdir}/libukui-kwinglutils.so
%{_libdir}/libukui-kwin4_effect_builtins.so
%{_includedir}/ukui-kwin*.h
%{_includedir}/ukui-kwin/*.h

%changelog
* Fri Feb 25 2022 pei-jiankang<peijiankang@kylinos.cn> - 1.0.4-2
- update to version 1.0.4-2

* Fri Feb 11 2022 pei-jiankang<peijiankang@kylinos.cn> - 1.0.4-1
- Init ukui-kwin 1.0.4-1

