Tuesday, January 24, 2023

x11/py-gtk2 and clang 15 (was: Re: amd64-clang bulk build report (llvm 15))

On Sun, Jan 08 2023, Jeremie Courreges-Anglas <jca@wxcvbn.org> wrote:
>> https://wxcvbn.org/~jca/build-failures/amd64-clang/2023-01-03/x11/py-gtk2.txt
> pango.c:3986:16: error: incompatible integer to pointer conversion returning 'int' from a function with result type 'PangoFontMetrics *' (aka 'struct _PangoFontMetrics *') [-Wint-conversion]
> return pango_font_metrics_new();
> ^~~~~~~~~~~~~~~~~~~~~~~~

Here's a nasty one, py-gtk2 shows its old age. There are two errors due
to functions not exported any more. For
pango_font_map_get_shape_engine_type() is was easy to decide what to do:
it's only called in a single place, its binding. But
pango_font_metrics_new() is used in a bunch of places. So I went for
a hack and provided a declaration for it in pango.override. If you can
think of a prettier approach, please share it!

ok?


Index: x11/py-gtk2/Makefile
===================================================================
RCS file: /home/cvs/ports/x11/py-gtk2/Makefile,v
retrieving revision 1.76
diff -u -p -r1.76 Makefile
--- x11/py-gtk2/Makefile 5 Nov 2022 17:07:33 -0000 1.76
+++ x11/py-gtk2/Makefile 24 Jan 2023 17:54:06 -0000
@@ -5,7 +5,7 @@ COMMENT= GTK+2 Python bindings
GNOME_PROJECT= pygtk
GNOME_VERSION= 2.24.0
PKGNAME= py-gtk2-${VERSION}
-REVISION= 12
+REVISION= 13

CATEGORIES= x11

Index: x11/py-gtk2/patches/patch-pango_defs
===================================================================
RCS file: /home/cvs/ports/x11/py-gtk2/patches/patch-pango_defs,v
retrieving revision 1.2
diff -u -p -r1.2 patch-pango_defs
--- x11/py-gtk2/patches/patch-pango_defs 11 Mar 2022 20:16:56 -0000 1.2
+++ x11/py-gtk2/patches/patch-pango_defs 14 Jan 2023 22:06:41 -0000
@@ -3,6 +3,8 @@ From: Jordan Petridis <jpetridis@gnome.o
Date: Thu, 24 Oct 2019 22:58:36 +0200
Subject: [PATCH] Drop the PangoFont find_shaper virtual method

+Hunk #2: drop get_shape_engine_type, not exported any more.
+
Index: pango.defs
--- pango.defs.orig
+++ pango.defs
@@ -22,3 +24,16 @@ Index: pango.defs
(define-virtual get_glyph_extents
(of-object "PangoFont")
(return-type "none")
+@@ -1465,12 +1456,6 @@
+ '("PangoFontFamily***" "families")
+ '("int*" "n_families")
+ )
+-)
+-
+-(define-method get_shape_engine_type
+- (of-object "PangoFontMap")
+- (c-name "pango_font_map_get_shape_engine_type")
+- (return-type "const-char*")
+ )
+
+ (define-method create_context
Index: x11/py-gtk2/patches/patch-pango_override
===================================================================
RCS file: x11/py-gtk2/patches/patch-pango_override
diff -N x11/py-gtk2/patches/patch-pango_override
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ x11/py-gtk2/patches/patch-pango_override 14 Jan 2023 23:10:39 -0000
@@ -0,0 +1,15 @@
+Provide decl for pango_font_metrics_new(), not declared in a public header
+any more.
+
+Index: pango.override
+--- pango.override.orig
++++ pango.override
+@@ -27,6 +27,8 @@ headers
+ #include <pygobject.h>
+ #include <pango/pango.h>
+
++PangoFontMetrics *pango_font_metrics_new(void);
++
+ typedef struct {
+ PyObject *func, *data;
+ } PyGtkCustomNotify;


--
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE

No comments:

Post a Comment