%global sname deepin-dock

Name:           dde-dock
Version:        5.6.22
Release:        1%{?dist}.02
Summary:        Deepin desktop-environment - Dock module
License:        GPLv3
URL:            https://github.com/linuxdeepin/dde-dock/
Source0:        %{url}/archive/%{version}/%{name}-%{version}.tar.gz
Patch1:         0001-Mask-intelligent-hiding.patch
Patch2:         0001-Hidden-state.patch
Patch3:         0001-hide-status-box.patch
Patch4:         0001-fix-build-error.patch
Patch5:         0001-fix-dde-trash-error.patch

BuildRequires:  cmake
BuildRequires:  libarchive
BuildRequires:  gcc-c++
BuildRequires:  pkgconfig(dbusmenu-qt5)
#####BuildRequires:  dde-network-core-devel
BuildRequires:  dtkcommon-devel
BuildRequires:  dtkwidget-devel >= 5.4.19
BuildRequires:  dtkcore-devel >= 5.4.14
BuildRequires:  dtkgui-devel >= 5.4.13
BuildRequires:  pkgconfig(dframeworkdbus) 
BuildRequires:  pkgconfig(gsettings-qt)
BuildRequires:  pkgconfig(gtk+-2.0)
BuildRequires:  pkgconfig(Qt5Core)
BuildRequires:  pkgconfig(Qt5Gui)
BuildRequires:  pkgconfig(Qt5DBus)
BuildRequires:  pkgconfig(Qt5X11Extras)
BuildRequires:  pkgconfig(Qt5Svg)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xtst)
BuildRequires:  pkgconfig(xext)
BuildRequires:  pkgconfig(xcb-composite)
BuildRequires:  pkgconfig(xcb-ewmh)
BuildRequires:  pkgconfig(xcb-icccm)
BuildRequires:  pkgconfig(xcb-image)
BuildRequires:  pkgconfig(xcb-damage)
BuildRequires:  qt5-linguist
BuildRequires:  gtest-devel
BuildRequires:  gmock-devel
BuildRequires:  qt5-qtbase-private-devel
BuildRequires:  qt5-qttools-devel
BuildRequires: 	libXtst-devel
BuildRequires:  libxcb
BuildRequires:  dde-control-center-devel >= 5.5.77
BuildRequires:  dde-control-center >= 5.5.77

Requires:       dbusmenu-qt5
######Requires:       dde-network-core
Requires:       dde-qt-dbus-factory
Requires:       xcb-util-wm
Requires:       xcb-util-image
Requires:       libxcb
Requires:       deepin-desktop-schemas
#######Requires:       dde-daemon
Requires:       startdde
Requires:       libqtxdg-devel
Requires:       onboard



%description
Deepin desktop-environment - Dock module.

%package devel
Summary:        Development package for %{sname}
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description devel
Header files and libraries for %{sname}.

%package onboard-plugin
Summary:        deepin desktop-environment - dock plugin
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description onboard-plugin
deepin desktop-environment - dock plugin.

%prep
%setup -q -n %{name}-%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1

find plugins/ -mindepth 2 -maxdepth 2 -type f -name CMakeLists.txt | grep -vE 'dcc-dock-plugin/CMakeLists.txt' | xargs -I '{file_name}' sed -i '/TARGETS/s|lib|%{_lib}|' '{file_name}'

sed -i '/TARGETS/s|lib|%{_lib}|' plugins/plugin-guide/plugins-developer-guide.md

sed -i 's|/lib|/%{_lib}|' frame/controller/dockpluginscontroller.cpp \
                          frame/window/mainpanelcontrol.cpp \
                          plugins/tray/system-trays/systemtrayscontroller.cpp


sed -i 's|/lib|/libexec|g' plugins/show-desktop/showdesktopplugin.cpp \
                           frame/window/mainpanelcontrol.cpp \
                           frame/window/components/desktop_widget.cpp

sed -i 's:libdir.*:libdir=%{_libdir}:' dde-dock.pc.in

sed -i 's|/usr/lib/dde-dock/plugins|%{_libdir}/dde-dock/plugins|' plugins/plugin-guide/plugins-developer-guide.md
sed -i 's|local/lib/dde-dock/plugins|local/%{_lib}/dde-dock/plugins|' plugins/plugin-guide/plugins-developer-guide.md

sed -i 's|lrelease|lrelease-qt5|' translate_generation.sh

%build
export PATH=%{_qt5_bindir}:$PATH
%cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} -DARCHITECTURE=%{_arch} -DCMAKE_INSTALL_SYSCONFDIR=/etc .
%make_build

%install
%make_install INSTALL_ROOT=%{buildroot}
chmod +x %{buildroot}/%{_bindir}/%{name}-wrapper

%ldconfig_scriptlets

%files
%{_datadir}/%{name}/translations/*.qm
%license LICENSE
%{_bindir}/%{name}
%{_bindir}/%{name}-wrapper
%{_libdir}/%{name}/
%{_datarootdir}/glib-2.0/schemas/com.deepin.dde.dock.module.gschema.xml
%{_datarootdir}/polkit-1/actions/com.deepin.dde.dock.overlay.policy
%{_datadir}/dsg/
%{_datadir}/dcc-dock-plugin/
%{_prefix}/lib/dde-control-center/modules/
%{_sysconfdir}/%{name}/
#%{_sysconfdir}/xdg/autostop/clearDumpRecord.sh

%files devel
%doc plugins/plugin-guide
%{_includedir}/%{name}/
%{_libdir}/pkgconfig/%{name}.pc
%{_libdir}/cmake/DdeDock/DdeDockConfig.cmake

%files onboard-plugin
%{_libdir}/dde-dock/plugins/libonboard.so


%changelog
* Thu Dec 28 2023 liuzhilin <liuzhilin@uniontech.com> - 5.6.22-1.02
- fix: fix-dde-trash-error

* Mon Oct 16 2023 liweigang <liweiganga@uniontech.com> - 5.6.22-1.01
- chore: dde-dock-wrapper add +x

* Mon Oct 09 2023 liweigang <liweiganga@uniontech.com> - 5.6.22-1
- update: update to version 5.6.22

* Thu Aug 17 2023 liuzhilin <liuzhilin@uniontech.com> - 5.6.11.1-1
- update: update to 5.6.11.1 and fix build error

* Sat May 06 2023 songmingliang <songmingliangliang@uniontech.com> - 5.5.76-8
- fix: Mask dcc state(bugid:187109)

* Tue Apr 18 2023 mahailiang <mahailiang@uniontech.com> - 5.5.76-7
- fix: Mask state(bugid:187109)

* Tue Apr 11 2023 mahailiang <mahailiang@uniontech.com> - 5.5.76-6
- fix: Mask intelligent hiding(bugid:187109)

* Thu Mar 09 2023 liweiganga <liweiganga@uniontech.com> - 5.5.76-5
- feat: fix show desktop function

* Fri Feb 03 2023 liweiganga <liweiganga@uniontech.com> - 5.5.76-3
- spec: modify dde-control-center plugin path

* Fri Feb 03 2023 liweiganga <liweiganga@uniontech.com> - 5.5.76-2
- spec: dde-network-utils replace for dde-network-core

* Tue Jan 17 2023 liweiganga <liweiganga@uniontech.com> - 5.5.76-1.01
- spec: fix /etc/dde-dock path

* Mon Jan 09 2023 liweiganga <liweiganga@uniontech.com> - 5.5.76-1
- update: update to 5.5.76

* Fri Jun 10 2022 haomimi <haomimi@uniontech.com> - 5.4.56.2-1.02
- Fix the desktop feature displayed in the lower right corner(bugID:112852)

* Fri Jun 10 2022 uoser <uoser@uniontech.com> - 5.4.56.2-1
- package init
