Blame SOURCES/0002-Build-against-gtk3-instead-of-gtk2.patch

e9b09d
From ad4ecfd29c29f6895aaf02092e6574299a2b5aa9 Mon Sep 17 00:00:00 2001
e9b09d
From: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
e9b09d
Date: Fri, 10 Jul 2020 03:12:51 +0200
e9b09d
Subject: [PATCH 02/18] Build against gtk3 instead of gtk2
e9b09d
MIME-Version: 1.0
e9b09d
Content-Type: text/plain; charset=UTF-8
e9b09d
Content-Transfer-Encoding: 8bit
e9b09d
e9b09d
Since gtk2 is on life support, it makes sense to build the gui code with
e9b09d
gtk3 nowadays.
e9b09d
e9b09d
I went for 3.24 because that’s the version I have available on my
e9b09d
system, but it is probable that previous versions would also work, I
e9b09d
don’t know.
e9b09d
e9b09d
[lijiang added the following comment]
e9b09d
Note: Because rhel8 uses the cmake, update the CMakeLists instead of
e9b09d
Makefile.
e9b09d
e9b09d
In addition, currently, rhel8 only supports the gtk-3.22 instead of
e9b09d
gtk-3.24, so downgrade to gtk-3.22, otherwise the build will fail.
e9b09d
---
e9b09d
 README.md              | 2 +-
e9b09d
 lshw.spec.in           | 4 ++--
e9b09d
 src/gui/CMakeLists.txt | 6 +++---
e9b09d
 src/gui/gtk-lshw.ui    | 2 +-
e9b09d
 4 files changed, 7 insertions(+), 7 deletions(-)
e9b09d
e9b09d
diff --git a/README.md b/README.md
e9b09d
index 294888c71ff0..cf50e5151228 100644
e9b09d
--- a/README.md
e9b09d
+++ b/README.md
e9b09d
@@ -18,7 +18,7 @@ Installation
e9b09d
    - cmake, GNU make or Ninja
e9b09d
    - an ANSI (or close enough to ANSI compliance) C++ compiler (tested with g++ 2.95.4 and 3.x)
e9b09d
    - for the (optional) GTK+ graphical user interface, you will need a
e9b09d
-	complete GTK+ development environment (gtk2-devel on RedHat/Fedora derivatives) 
e9b09d
+	complete GTK+ development environment (gtk3-devel on RedHat/Fedora derivatives) 
e9b09d
    - for optional SQLite feature install SQLite
e9b09d
    - for optional zlib feature install zlib and gzip
e9b09d
 
e9b09d
diff --git a/lshw.spec.in b/lshw.spec.in
e9b09d
index 3fe23c2ef360..78018211e1af 100644
e9b09d
--- a/lshw.spec.in
e9b09d
+++ b/lshw.spec.in
e9b09d
@@ -31,8 +31,8 @@ http://lshw.ezix.org/
e9b09d
 Summary: HardWare LiSter (GUI version)
e9b09d
 Group: Applications/System
e9b09d
 Requires: %{name} >= %{version}
e9b09d
-Requires: gtk2 >= 2.4
e9b09d
-BuildRequires: gtk2-devel >= 2.4
e9b09d
+Requires: gtk3 >= 3.22
e9b09d
+BuildRequires: gtk3-devel >= 3.22
e9b09d
 
e9b09d
 %description gui
e9b09d
 lshw (Hardware Lister) is a small tool to provide detailed informaton on
e9b09d
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
e9b09d
index 34890535a070..34c9e4383c3e 100644
e9b09d
--- a/src/gui/CMakeLists.txt
e9b09d
+++ b/src/gui/CMakeLists.txt
e9b09d
@@ -4,17 +4,17 @@ if(NOT GUI OR STATIC)
e9b09d
 endif()
e9b09d
 
e9b09d
 find_package(PkgConfig)
e9b09d
-pkg_check_modules(GTK2 REQUIRED gtk+-2.0 gmodule-2.0)
e9b09d
+pkg_check_modules(GTK3 REQUIRED gtk+-3.0 gmodule-2.0)
e9b09d
 
e9b09d
 file(GLOB GTK_SOURCES "*.c*")
e9b09d
 
e9b09d
 include_directories("${PROJECT_BINARY_DIR}")
e9b09d
 include_directories("${PROJECT_SOURCE_DIR}/src/core")
e9b09d
 
e9b09d
-include_directories("${GTK2_INCLUDE_DIRS}")
e9b09d
+include_directories("${GTK3_INCLUDE_DIRS}")
e9b09d
 
e9b09d
 add_executable(gtk-lshw ${GTK_SOURCES})
e9b09d
-target_link_libraries(gtk-lshw ${SQLITE3_LIBRARIES} ${Z_LIBRARIES} ${GTK2_LIBRARIES} core resolv)
e9b09d
+target_link_libraries(gtk-lshw ${SQLITE3_LIBRARIES} ${Z_LIBRARIES} ${GTK3_LIBRARIES} core resolv)
e9b09d
 install(TARGETS gtk-lshw DESTINATION sbin)
e9b09d
 
e9b09d
 if(POLICYKIT)
e9b09d
diff --git a/src/gui/gtk-lshw.ui b/src/gui/gtk-lshw.ui
e9b09d
index 73fc08a58d1e..25ab1ad03349 100644
e9b09d
--- a/src/gui/gtk-lshw.ui
e9b09d
+++ b/src/gui/gtk-lshw.ui
e9b09d
@@ -1,6 +1,6 @@
e9b09d
 
e9b09d
 <interface>
e9b09d
-  <requires lib="gtk+" version="2.22"/>
e9b09d
+  <requires lib="gtk+" version="3.22"/>
e9b09d
   <object class="GtkDialog" id="aboutlshw">
e9b09d
     <property name="can_focus">False</property>
e9b09d
     <property name="title" translatable="yes">About</property>
e9b09d
-- 
e9b09d
2.17.1
e9b09d