Use autosetup so WebKitGTK patch actually gets applied, and rewrite the patch to work

Resolves: RHEL-26699
This commit is contained in:
Michael Catanzaro 2024-04-17 09:12:27 -05:00
parent 2875ea67b2
commit 415d8a8898
2 changed files with 59 additions and 51 deletions

View File

@ -1,69 +1,67 @@
diff --git a/meson.build b/meson.build diff --git a/configure.ac b/configure.ac
index be1ccd4..116f145 100644 index 98ce0c2..9d69588 100644
--- a/meson.build --- a/configure.ac
+++ b/meson.build +++ b/configure.ac
@@ -21,7 +21,7 @@ gtk_x11_dep = dependency('gtk+-x11-3.0', required: get_option('X11')) @@ -71,8 +71,7 @@ PKG_CHECK_MODULES(SUSHI,
gtk_wayland_dep = dependency('gtk+-wayland-3.0', version: '>= 3.21.5', required: get_option('wayland')) libmusicbrainz5
gtksourceview_dep = dependency('gtksourceview-4', version: '>=4.0.3') evince-document-3.0
harfbuzz_dep = dependency('harfbuzz', version: '>=0.9.9') evince-view-3.0
-webkit_dep = dependency('webkit2gtk-4.0') - gtksourceview-3.0
+webkit_dep = dependency('webkit2gtk-4.0', required: false) - webkit2gtk-4.0)
+ gtksourceview-3.0)
bindir = join_paths(get_option('prefix'), get_option('bindir')) GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable glib_compile_resources gio-2.0`
datadir = join_paths(get_option('prefix'), get_option('datadir')) AC_SUBST(GLIB_COMPILE_RESOURCES)
diff --git a/src/ui/main.js b/src/ui/main.js diff --git a/src/js/viewers/html.js b/src/js/viewers/html.js
index b0cb7de..2aa0b71 100644 index 5135e2b..c7d078f 100644
--- a/src/ui/main.js --- a/src/js/viewers/html.js
+++ b/src/ui/main.js +++ b/src/js/viewers/html.js
@@ -39,7 +39,6 @@ pkg.require({ @@ -28,12 +28,22 @@ const Gtk = imports.gi.Gtk;
Pango: '1.0', const GLib = imports.gi.GLib;
Soup: '2.4', const Lang = imports.lang;
Sushi: '1.0', const Sushi = imports.gi.Sushi;
- WebKit2: '4.0', -const WebKit = imports.gi.WebKit2;
});
const {Gio, GLib} = imports.gi; const MimeHandler = imports.ui.mimeHandler;
diff --git a/src/viewers/html.js b/src/viewers/html.js const Utils = imports.ui.utils;
index 3de4455..28d34de 100644
--- a/src/viewers/html.js
+++ b/src/viewers/html.js
@@ -23,11 +23,22 @@
*
*/
-const {Gtk, GLib, GObject, Sushi, WebKit2} = imports.gi; -const HTMLRenderer = new Lang.Class({
+const {Gtk, GLib, GObject, Sushi} = imports.gi; +var WebKit;
+
+var WebKit2;
+try { +try {
+ imports.gi.versions.WebKit2 = '4.0'; + imports.gi.versions.WebKit2 = '4.0';
+ WebKit2 = imports.gi.WebKit2; + WebKit = imports.gi.WebKit2;
+} catch(e) { +} catch(e) {
+} +}
+ +
+function _isAvailable() { +function _isAvailable() {
+ return WebKit2 !== undefined; + return WebKit !== undefined;
+} +}
+
+var HTMLRenderer = _isAvailable() ? new Lang.Class({
Name: 'HTMLRenderer',
const Renderer = imports.ui.renderer; _init : function(args) {
@@ -89,13 +99,15 @@ const HTMLRenderer = new Lang.Class({
-var Klass = GObject.registerClass({ return this._toolbarActor;
+var Klass = _isAvailable() ? GObject.registerClass({
Implements: [Renderer.Renderer],
Properties: {
fullscreen: GObject.ParamSpec.boolean('fullscreen', '', '',
@@ -63,8 +74,10 @@ var Klass = GObject.registerClass({
get moveOnClick() {
return false;
} }
-}); -});
+}) : undefined; +}) : undefined;
-var mimeTypes = [ -let handler = new MimeHandler.MimeHandler();
-let renderer = new HTMLRenderer();
+if (_isAvailable()) {
+ let handler = new MimeHandler.MimeHandler();
+ let renderer = new HTMLRenderer();
-let mimeTypes = [
- 'text/html' - 'text/html'
-]; -];
+var mimeTypes = []; + let mimeTypes = [
+if (_isAvailable())
+ mimeTypes = [
+ 'text/html' + 'text/html'
+ ]; + ];
-handler.registerMimeTypes(mimeTypes, renderer);
+ handler.registerMimeTypes(mimeTypes, renderer);
+}

View File

@ -1,6 +1,6 @@
Name: sushi Name: sushi
Version: 3.28.3 Version: 3.28.3
Release: 2%{?dist} Release: 3%{?dist}
Summary: A quick previewer for Nautilus Summary: A quick previewer for Nautilus
License: GPLv2+ with exceptions License: GPLv2+ with exceptions
@ -10,6 +10,10 @@ Source0: https://download.gnome.org/sources/%{name}/3.28/%{name}-%{versio
# https://gitlab.gnome.org/GNOME/sushi/-/merge_requests/53 # https://gitlab.gnome.org/GNOME/sushi/-/merge_requests/53
Patch0: optional-webkitgtk.patch Patch0: optional-webkitgtk.patch
# Build deps for optional-webkitgtk.patch, which modifies configure.ac
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: intltool BuildRequires: intltool
BuildRequires: gjs-devel BuildRequires: gjs-devel
BuildRequires: pkgconfig(clutter-gst-3.0) BuildRequires: pkgconfig(clutter-gst-3.0)
@ -31,7 +35,9 @@ file manager.
%prep %prep
%setup -q %autosetup -p1
# autoreconf is for optional-webkitgtk.patch
autoreconf -fi
%build %build
%configure --disable-static %configure --disable-static
@ -55,6 +61,10 @@ find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
%changelog %changelog
* Mon Apr 15 2024 Michael Catanzaro <mcatanzaro@redhat.com> - 3.28.3-3
- Use autosetup so WebKitGTK patch actually gets applied, and rewrite the patch to work
Resolves: RHEL-26699
* Thu Mar 07 2024 Michael Catanzaro <mcatanzaro@redhat.com> - 3.28.3-2 * Thu Mar 07 2024 Michael Catanzaro <mcatanzaro@redhat.com> - 3.28.3-2
- Allow running with WebKitGTK uninstalled - Allow running with WebKitGTK uninstalled
Resolves: RHEL-26699 Resolves: RHEL-26699