Fix build failure with gcc-10

This commit is contained in:
weidong 2021-08-11 14:25:26 +08:00
parent 36135e7b15
commit 052d6d36fc
2 changed files with 58 additions and 2 deletions

View File

@ -0,0 +1,52 @@
From 3f17a452b635bae79ceff14a8a66cdf433fe8626 Mon Sep 17 00:00:00 2001
From: weidong <weidong@uniontech.com>
Date: Wed, 11 Aug 2021 13:57:28 +0800
Subject: [PATCH] Fix build failure with gcc-10
---
src/event_monitor.cpp | 7 ++++++-
src/screen_shot_event.cpp | 4 ++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/event_monitor.cpp b/src/event_monitor.cpp
index 2b72f18..95c4259 100755
--- a/src/event_monitor.cpp
+++ b/src/event_monitor.cpp
@@ -22,14 +22,19 @@
*/
#include "event_monitor.h"
+#include "keydefine.h"
#include <X11/Xlibint.h>
+// gcc 版本大于10时取消min 宏定义
+#if __GNUC__ == 10
+#undef min
+#endif
#include <X11/Xutil.h>
#include <X11/cursorfont.h>
#include <X11/keysymdef.h>
#include <X11/keysym.h>
#include <X11/extensions/XTest.h>
-#include "keydefine.h"
#include <iostream>
+#include <dlfcn.h>
EventMonitor::EventMonitor(QObject *parent) : QThread(parent)
{
diff --git a/src/screen_shot_event.cpp b/src/screen_shot_event.cpp
index 05dfbb5..02e9ab8 100755
--- a/src/screen_shot_event.cpp
+++ b/src/screen_shot_event.cpp
@@ -1,5 +1,9 @@
#include "screen_shot_event.h"
#include <X11/Xlibint.h>
+// gcc 版本大于10时取消min 宏定义
+#if __GNUC__ == 10
+#undef min
+#endif
#include <X11/Xutil.h>
#include <X11/cursorfont.h>
#include <X11/keysymdef.h>
--
2.20.1

View File

@ -1,10 +1,11 @@
Name: deepin-screen-recorder
Version: 5.8.0.52
Release: 1
Release: 2
Summary: Deepin Screen Recorder
License: GPLv3+
URL: https://github.com/linuxdeepin/deepin-screen-recorder
Source0: %{name}_%{version}.orig.tar.xz
Patch0: Fix-build-failure-with-gcc-10.patch
BuildRequires: gcc-c++ qt5-devel dtkwidget-devel dtkcore-devel procps-ng-devel
BuildRequires: pkgconfig(dframeworkdbus) pkgconfig(x11) pkgconfig(xext) pkgconfig(xtst) pkgconfig(xcb) pkgconfig(xcb-util) pkgconfig(xcursor)
@ -20,7 +21,7 @@ Obsoletes: deepin-screenshot
%{summary}.
%prep
%autosetup
%autosetup -p1
%build
export PATH=%{_qt5_bindir}:$PATH
@ -49,5 +50,8 @@ popd
%{_datarootdir}/dbus-1/services/com.deepin.Screenshot.service
%changelog
* Wed Aug 11 2021 weidong <weidong@uniontech.com> - 5.8.0.52-2
- Fix build failure with gcc-10.
* Sat May 08 2021 weidong <weidong@uniontech.com> - 5.8.0.52-1
- Initial package.