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