All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2] package/libgtk4: bump to 4.17.0
@ 2024-11-16 16:08 Thomas Devoogdt
  2025-01-25 21:07 ` [Buildroot] [PATCH v2] package/libgtk4: bump to 4.17.3 Thomas Devoogdt
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Devoogdt @ 2024-11-16 16:08 UTC (permalink / raw)
  To: buildroot; +Cc: Thomas Devoogdt

https://gitlab.gnome.org/GNOME/gtk/-/blob/4.17.0/NEWS

Note that libgtk4 never selected BR2_PACKAGE_CAIRO_{PNG,ZLIB},
this is also not needed since [1]. Instead, we have to select
BR2_PACKAGE_LIBPNG ourselves, which libgtk3 indirectly did
by including BR2_PACKAGE_CAIRO_PNG.

Also, add patches for:
 - toolchains without fenv.h. [2]
 - when cairo has been compiled without surfaces. [3]

[1] https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/7717
[2] https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/7925
[3] https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/7926

Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
---
v2:
- update patches
- reword commit message
---
 ...uild-add-a-check-for-the-fenv-header.patch |  26 +++++
 ...value.c-fix-compilation-if-fenv.h-is.patch | 106 ++++++++++++++++++
 ...kends-gtkprintbackendfile.c-fix-comp.patch |  96 ++++++++++++++++
 package/libgtk4/Config.in                     |   1 +
 package/libgtk4/libgtk4.hash                  |   4 +-
 package/libgtk4/libgtk4.mk                    |   5 +-
 6 files changed, 234 insertions(+), 4 deletions(-)
 create mode 100644 package/libgtk4/0001-meson.build-add-a-check-for-the-fenv-header.patch
 create mode 100644 package/libgtk4/0002-gtk-gtkcssnumbervalue.c-fix-compilation-if-fenv.h-is.patch
 create mode 100644 package/libgtk4/0003-modules-printbackends-gtkprintbackendfile.c-fix-comp.patch

diff --git a/package/libgtk4/0001-meson.build-add-a-check-for-the-fenv-header.patch b/package/libgtk4/0001-meson.build-add-a-check-for-the-fenv-header.patch
new file mode 100644
index 0000000000..6a15748086
--- /dev/null
+++ b/package/libgtk4/0001-meson.build-add-a-check-for-the-fenv-header.patch
@@ -0,0 +1,26 @@
+From 67cf230a85dcde61ba335cb8de52c4ea2e19caf2 Mon Sep 17 00:00:00 2001
+From: Thomas Devoogdt <thomas@devoogdt.com>
+Date: Fri, 15 Nov 2024 08:22:23 +0100
+Subject: [PATCH] meson.build: add a check for the fenv header
+
+Upstream: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/7925
+Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
+---
+ meson.build | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/meson.build b/meson.build
+index 2bb6f7c299..5f51aeb8a7 100644
+--- a/meson.build
++++ b/meson.build
+@@ -180,6 +180,7 @@ check_headers = [
+   'crt/externs.h',
+   'dev/evdev/input.h',
+   'dlfcn.h',
++  'fenv.h',
+   'ftw.h',
+   'inttypes.h',
+   'linux/input.h',
+-- 
+2.43.0
+
diff --git a/package/libgtk4/0002-gtk-gtkcssnumbervalue.c-fix-compilation-if-fenv.h-is.patch b/package/libgtk4/0002-gtk-gtkcssnumbervalue.c-fix-compilation-if-fenv.h-is.patch
new file mode 100644
index 0000000000..c7dd8e1b9f
--- /dev/null
+++ b/package/libgtk4/0002-gtk-gtkcssnumbervalue.c-fix-compilation-if-fenv.h-is.patch
@@ -0,0 +1,106 @@
+From 4fb5e414b627d9c5c35ea85d467b06b56f5c7ee1 Mon Sep 17 00:00:00 2001
+From: Thomas Devoogdt <thomas@devoogdt.com>
+Date: Fri, 15 Nov 2024 08:22:40 +0100
+Subject: [PATCH] gtk/gtkcssnumbervalue.c: fix compilation if fenv.h is missing
+
+../gtk/gtkcssnumbervalue.c:29:10: fatal error: fenv.h: No such file or directory
+   29 | #include <fenv.h>
+      |
+
+Upstream: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/7925
+Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
+---
+ gtk/gtkcssnumbervalue.c | 59 ++++++++++++++++++++++++++++++++---------
+ 1 file changed, 47 insertions(+), 12 deletions(-)
+
+diff --git a/gtk/gtkcssnumbervalue.c b/gtk/gtkcssnumbervalue.c
+index 1181c1a802..03cf30262a 100644
+--- a/gtk/gtkcssnumbervalue.c
++++ b/gtk/gtkcssnumbervalue.c
+@@ -26,7 +26,9 @@
+ #include "gtkcssstyleprivate.h"
+ #include "gtkprivate.h"
+ 
++#ifdef HAVE_FENV_H
+ #include <fenv.h>
++#endif
+ 
+ #define RAD_TO_DEG(x) ((x) * 180.0 / G_PI)
+ #define DEG_TO_RAD(x) ((x) * G_PI / 180.0)
+@@ -1846,13 +1848,25 @@ gtk_css_dimension_value_is_zero (const GtkCssValue *value)
+   return value->dimension.value == 0;
+ }
+ 
+-static double
+-_round (guint mode, double a, double b)
++#ifdef HAVE_FENV_H
++static inline double
++_round_fenv (int mode, double a, double b)
+ {
+-  int old_mode;
+-  int modes[] = { FE_TONEAREST, FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO };
+   double result;
++  int old_mode;
+ 
++  old_mode = fegetround ();
++  fesetround (mode);
++  result = nearbyint (a/b) * b;
++  fesetround (old_mode);
++
++  return result;
++}
++#endif
++
++static double
++_round (guint mode, double a, double b)
++{
+   if (b == 0)
+     return NAN;
+ 
+@@ -1880,14 +1894,35 @@ _round (guint mode, double a, double b)
+         }
+     }
+ 
+-  old_mode = fegetround ();
+-  fesetround (modes[mode]);
+-
+-  result = nearbyint (a/b) * b;
+-
+-  fesetround (old_mode);
+-
+-  return result;
++  switch (mode)
++    {
++    case ROUND_NEAREST:
++#ifdef FE_TONEAREST
++      return _round_fenv (FE_TONEAREST, a, b);
++#else
++      return round (a/b) * b;
++#endif
++    case ROUND_UP:
++#ifdef FE_UPWARD
++      return _round_fenv (FE_UPWARD, a, b);
++#else
++      return (((a/b) >= 0) ? ceil (a/b) : floor (a/b)) * b;
++#endif
++    case ROUND_DOWN:
++#ifdef FE_DOWNWARD
++      return _round_fenv (FE_DOWNWARD, a, b);
++#else
++      return (((a/b) >= 0) ? floor (a/b) : ceil (a/b)) * b;
++#endif
++    case ROUND_TO_ZERO:
++#ifdef FE_TOWARDZERO
++      return _round_fenv (FE_TOWARDZERO, a, b);
++#else
++      return (((a/b) >= 0) ? floor (a/b) : ceil (a/b)) * b;
++#endif
++    default:
++      g_assert_not_reached ();
++    }
+ }
+ 
+ static double
+-- 
+2.43.0
+
diff --git a/package/libgtk4/0003-modules-printbackends-gtkprintbackendfile.c-fix-comp.patch b/package/libgtk4/0003-modules-printbackends-gtkprintbackendfile.c-fix-comp.patch
new file mode 100644
index 0000000000..728e719047
--- /dev/null
+++ b/package/libgtk4/0003-modules-printbackends-gtkprintbackendfile.c-fix-comp.patch
@@ -0,0 +1,96 @@
+From b60bee17ddce7c44a455fa533e23aebebbfeea59 Mon Sep 17 00:00:00 2001
+From: Thomas Devoogdt <thomas@devoogdt.com>
+Date: Fri, 15 Nov 2024 13:42:58 +0100
+Subject: [PATCH] modules/printbackends/gtkprintbackendfile.c: fix compilation
+ if no cairo surfaces are present
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+../modules/printbackends/gtkprintbackendfile.c: In function ‘output_file_from_settings’:
+../modules/printbackends/gtkprintbackendfile.c:241:20: error: label at end of compound statement
+  241 |               case N_FORMATS:
+      |                    ^~~~~~~~~
+../modules/printbackends/gtkprintbackendfile.c: In function ‘file_printer_create_cairo_surface’:
+../modules/printbackends/gtkprintbackendfile.c:363:12: error: label at end of compound statement
+  363 |       case N_FORMATS:
+      |            ^~~~~~~~~
+
+Upstream: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/7926
+Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
+---
+ modules/printbackends/gtkprintbackendfile.c | 16 +++++++++++++++-
+ 1 file changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/modules/printbackends/gtkprintbackendfile.c b/modules/printbackends/gtkprintbackendfile.c
+index ddfd8d4425..436c767e4f 100644
+--- a/modules/printbackends/gtkprintbackendfile.c
++++ b/modules/printbackends/gtkprintbackendfile.c
+@@ -55,6 +55,12 @@ typedef struct _GtkPrintBackendFileClass GtkPrintBackendFileClass;
+ 
+ #define _STREAM_MAX_CHUNK_SIZE 8192
+ 
++#if defined(CAIRO_HAS_PDF_SURFACE) || \
++    defined(CAIRO_HAS_PS_SURFACE) || \
++    defined(CAIRO_HAS_SVG_SURFACE)
++#define _CAIRO_HAS_SURFACE 1
++#endif
++
+ struct _GtkPrintBackendFileClass
+ {
+   GtkPrintBackendClass parent_class;
+@@ -237,8 +243,10 @@ output_file_from_settings (GtkPrintSettings *settings,
+           format = format_from_settings (settings);
+           switch (format)
+             {
++#ifdef _CAIRO_HAS_SURFACE
+               default:
+               case N_FORMATS:
++#endif
+ #ifdef CAIRO_HAS_PDF_SURFACE
+               case FORMAT_PDF:
+                 extension = "pdf";
+@@ -359,8 +367,10 @@ file_printer_create_cairo_surface (GtkPrinter       *printer,
+ 
+   switch (format)
+     {
++#ifdef _CAIRO_HAS_SURFACE
+       default:
+       case N_FORMATS:
++#endif
+ #ifdef CAIRO_HAS_PDF_SURFACE
+       case FORMAT_PDF:
+         surface = cairo_pdf_surface_create_for_stream (_cairo_write, cache_io, width, height);
+@@ -727,8 +737,10 @@ file_printer_get_options (GtkPrinter           *printer,
+     {
+       switch (format)
+         {
++#ifdef _CAIRO_HAS_SURFACE
+           default:
+           case N_FORMATS:
++#endif
+ #ifdef CAIRO_HAS_PDF_SURFACE
+           case FORMAT_PDF:
+             current_format = FORMAT_PDF;
+@@ -741,7 +753,7 @@ file_printer_get_options (GtkPrinter           *printer,
+ #endif
+ #ifdef CAIRO_HAS_SVG_SURFACE
+           case FORMAT_SVG:
+-            current_format = FORMAT_SVG;            
++            current_format = FORMAT_SVG;
+             break;
+ #endif
+         }
+@@ -854,7 +866,9 @@ file_printer_prepare_for_print (GtkPrinter       *printer,
+ #ifdef CAIRO_HAS_PDF_SURFACE
+       case FORMAT_PDF:
+ #endif
++#ifdef _CAIRO_HAS_SURFACE
+       case N_FORMATS:
++#endif
+ 	gtk_print_job_set_rotate (print_job, FALSE);
+         break;
+       default:
+-- 
+2.43.0
+
diff --git a/package/libgtk4/Config.in b/package/libgtk4/Config.in
index 99553fc44e..2f597ea872 100644
--- a/package/libgtk4/Config.in
+++ b/package/libgtk4/Config.in
@@ -27,6 +27,7 @@ config BR2_PACKAGE_LIBGTK4
 	select BR2_PACKAGE_GRAPHENE
 	select BR2_PACKAGE_LIBEPOXY
 	select BR2_PACKAGE_LIBGLIB2
+	select BR2_PACKAGE_LIBPNG
 	select BR2_PACKAGE_PANGO
 	select BR2_PACKAGE_TIFF
 	# At least one backend is required
diff --git a/package/libgtk4/libgtk4.hash b/package/libgtk4/libgtk4.hash
index 636b675d15..98afaddfe9 100644
--- a/package/libgtk4/libgtk4.hash
+++ b/package/libgtk4/libgtk4.hash
@@ -1,5 +1,5 @@
-# From https://download.gnome.org/sources/gtk/4.14/gtk-4.14.5.sha256sum
-sha256  5547f2b9f006b133993e070b87c17804e051efda3913feaca1108fa2be41e24d  gtk-4.14.5.tar.xz
+# From https://download.gnome.org/sources/gtk/4.17/gtk-4.17.0.sha256sum
+sha256  efcef355b5d903fc62a70934b1c644f39661e3c2ff44c8c53a8fcdb70c7dd97e  gtk-4.17.0.tar.xz
 
 # Hash for license file:
 sha256  b7993225104d90ddd8024fd838faf300bea5e83d91203eab98e29512acebd69c  COPYING
diff --git a/package/libgtk4/libgtk4.mk b/package/libgtk4/libgtk4.mk
index b00a2facad..d33ccc5e05 100644
--- a/package/libgtk4/libgtk4.mk
+++ b/package/libgtk4/libgtk4.mk
@@ -4,8 +4,8 @@
 #
 ################################################################################
 
-LIBGTK4_VERSION_MAJOR = 4.14
-LIBGTK4_VERSION = $(LIBGTK4_VERSION_MAJOR).5
+LIBGTK4_VERSION_MAJOR = 4.17
+LIBGTK4_VERSION = $(LIBGTK4_VERSION_MAJOR).0
 LIBGTK4_SOURCE = gtk-$(LIBGTK4_VERSION).tar.xz
 LIBGTK4_SITE = https://download.gnome.org/sources/gtk/$(LIBGTK4_VERSION_MAJOR)
 LIBGTK4_LICENSE = LGPL-2.0+
@@ -21,6 +21,7 @@ LIBGTK4_DEPENDENCIES = \
 	graphene \
 	libepoxy \
 	libglib2 \
+	libpng \
 	pango \
 	$(TARGET_NLS_DEPENDENCIES)
 
-- 
2.43.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-04-21 21:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-16 16:08 [Buildroot] [PATCH v2] package/libgtk4: bump to 4.17.0 Thomas Devoogdt
2025-01-25 21:07 ` [Buildroot] [PATCH v2] package/libgtk4: bump to 4.17.3 Thomas Devoogdt
2025-02-05 15:37   ` Thomas Petazzoni via buildroot
2025-03-25 10:11     ` [Buildroot] [PATCH v2] package/wayland-protocols: bump to 1.42 Thomas Devoogdt
2025-03-25 10:11       ` [Buildroot] [PATCH v2] package/libgtk4: bump to 4.18.2 Thomas Devoogdt
2025-04-21 21:26         ` Thomas Petazzoni via buildroot
2025-03-25 21:50       ` [Buildroot] [PATCH v2] package/wayland-protocols: bump to 1.42 Julien Olivain

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.