[packages/graphviz] add patch to avoid xlib calls in gtk plugin

atler atler at pld-linux.org
Sat Jul 27 16:35:32 CEST 2024


commit 9641bf743ed3626ab27d16c892a95d22f84bf881
Author: Jan Palus <atler at pld-linux.org>
Date:   Sat Jul 27 15:39:17 2024 +0200

    add patch to avoid xlib calls in gtk plugin
    
    since there are native gdk equivalents it's better anyway. in current
    form while graphviz uses xlib, it does not link with it explicitly.
    graphviz relies on gtk2 to transitively "handle" xlib. however depending
    on whether gtk2 was built with static libs or not it includes x11 in
    pkgconfig required libs or not (improperly, should be private requires).
    since undefined symbols post check effectively requires explicit linking
    with respective library carrying each used function, it will complain
    about unresolved ie XOpenDisplay with gtk2 built without static libs
    
    not submitting upstream as gtk plugin is dropped on main branch already

 graphviz.spec     |  2 ++
 gtk-no-xlib.patch | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+)
---
diff --git a/graphviz.spec b/graphviz.spec
index 97f7749..c1774d5 100644
--- a/graphviz.spec
+++ b/graphviz.spec
@@ -66,6 +66,7 @@ Patch1:		%{name}-link.patch
 Patch2:		%{name}-bad-header.patch
 Patch3:		%{name}-php.patch
 Patch4:		gcc14.patch
+Patch5:		gtk-no-xlib.patch
 Patch7:		%{name}-ruby.patch
 Patch10:	%{name}-ming.patch
 Patch15:	ghostscript918.patch
@@ -512,6 +513,7 @@ Wiązania graphviza dla języka R.
 %patch1 -p1
 %patch3 -p1
 %patch4 -p1
+%patch5 -p1
 %patch7 -p1
 %patch10 -p1
 %patch15 -p1
diff --git a/gtk-no-xlib.patch b/gtk-no-xlib.patch
new file mode 100644
index 0000000..215f886
--- /dev/null
+++ b/gtk-no-xlib.patch
@@ -0,0 +1,60 @@
+--- graphviz-2.50.0/plugin/gtk/gvdevice_gtk.c.orig	2021-12-04 21:10:28.000000000 +0100
++++ graphviz-2.50.0/plugin/gtk/gvdevice_gtk.c	2024-07-27 14:58:45.147397887 +0200
+@@ -18,13 +18,9 @@
+ #include <gvc/gvplugin_device.h>
+ 
+ #ifdef HAVE_GTK
++#include <gdk/gdk.h>
+ #include <gtk/gtk.h>
+ 
+-#include <cairo.h>
+-#ifdef CAIRO_HAS_XLIB_SURFACE
+-#include <X11/Xlib.h>
+-#include <X11/Xutil.h>
+-
+ #include "interface.h"
+ #include "support.h"
+ 
+@@ -54,22 +50,25 @@
+ 
+ static void gtk_initialize(GVJ_t *firstjob)
+ {
+-    Display *dpy;
+-    const char *display_name = NULL;
+-    int scr;
++    GdkDisplay *dpy;
++    GdkScreen *scr;
+ 
+     gtk_set_locale ();
+     gtk_init (NULL, NULL);
+ 
+-    dpy = XOpenDisplay(display_name);
++    dpy = gdk_display_get_default();
+     if (dpy == NULL) {
+-        fprintf(stderr, "Failed to open XLIB display: %s\n",
+-                XDisplayName(NULL));
++        fprintf(stderr, "Failed to open default display\n");
++        return;
++    }
++    scr = gdk_display_get_default_screen(dpy);
++    if (scr == NULL) {
++        fprintf(stderr, "Failed to open default screen for display: %s\n",
++			gdk_display_get_name(dpy));
+         return;
+     }
+-    scr = DefaultScreen(dpy);
+-    firstjob->device_dpi.x = DisplayWidth(dpy, scr) * 25.4 / DisplayWidthMM(dpy, scr);
+-    firstjob->device_dpi.y = DisplayHeight(dpy, scr) * 25.4 / DisplayHeightMM(dpy, scr);
++    firstjob->device_dpi.x = gdk_screen_get_width(scr) * 25.4 / gdk_screen_get_width_mm(scr);
++    firstjob->device_dpi.y = gdk_screen_get_height(scr) * 25.4 / gdk_screen_get_height_mm(scr);
+     firstjob->device_sets_dpi = TRUE;
+ }
+ 
+@@ -129,7 +128,6 @@
+     gtk_finalize,
+ };
+ #endif
+-#endif
+ 
+ gvplugin_installed_t gvdevice_types_gtk[] = {
+ #ifdef HAVE_GTK
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/graphviz.git/commitdiff/9641bf743ed3626ab27d16c892a95d22f84bf881



More information about the pld-cvs-commit mailing list