Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Devoogdt <thomas@devoogdt.com>
To: buildroot@buildroot.org
Cc: thomas@devoogdt.com, thomas.petazzoni@bootlin.com
Subject: [Buildroot] [PATCH v2] package/libgtk4: bump to 4.18.2
Date: Tue, 25 Mar 2025 11:11:15 +0100	[thread overview]
Message-ID: <20250325101116.791637-2-thomas@devoogdt.com> (raw)
In-Reply-To: <20250325101116.791637-1-thomas@devoogdt.com>

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

Note that libgtk4 never selected BR2_PACKAGE_CAIRO_{PNG,ZLIB} as it is
not needed thanks to [1]. However, we need to select BR2_PACKAGE_LIBPNG [2].
In libgtk3, this was indirectly done as libgtk3 selects BR2_PACKAGE_CAIRO_PNG.

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

[1] https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/7717
[2] https://gitlab.gnome.org/GNOME/gtk/-/blob/4.18.2/meson.build?ref_type=tags#L450
[3] https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/7925
[4] https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/7926

Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
---
v2: bumped to a stable version, and changed the git message a bit
---
 ...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..70bfd11d57
--- /dev/null
+++ b/package/libgtk4/0001-meson.build-add-a-check-for-the-fenv-header.patch
@@ -0,0 +1,26 @@
+From c9739dce443d8fdb2d0e8ad01b62d32d4a905dab 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 a8be83e4dc..9046fb084e 100644
+--- a/meson.build
++++ b/meson.build
+@@ -202,6 +202,7 @@ cdata.set_quoted('GETTEXT_PACKAGE', 'gtk40')
+ 
+ check_headers = [
+   'dev/evdev/input.h',
++  'fenv.h',
+   'ftw.h',
+   'linux/input.h',
+   'linux/memfd.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..02d6a25526
--- /dev/null
+++ b/package/libgtk4/0002-gtk-gtkcssnumbervalue.c-fix-compilation-if-fenv.h-is.patch
@@ -0,0 +1,106 @@
+From e76e2c0c8afad80c6918890e443418e4f78c97c3 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..c9bfad0198
--- /dev/null
+++ b/package/libgtk4/0003-modules-printbackends-gtkprintbackendfile.c-fix-comp.patch
@@ -0,0 +1,96 @@
+From 197bf56cefb9c13e30f00fd4f5e651e87ba85e0b 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..215066c6c9 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.18/gtk-4.18.2.sha256sum
+sha256  cca5677be4c3e501b49f1c50bcafacba8dcf4bd3a2d016388f834eff274dc159  gtk-4.18.2.tar.xz
 
 # Hash for license file:
 sha256  b7993225104d90ddd8024fd838faf300bea5e83d91203eab98e29512acebd69c  COPYING
diff --git a/package/libgtk4/libgtk4.mk b/package/libgtk4/libgtk4.mk
index b00a2facad..31c0da1d0e 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.18
+LIBGTK4_VERSION = $(LIBGTK4_VERSION_MAJOR).2
 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

  reply	other threads:[~2025-03-25 10:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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       ` Thomas Devoogdt [this message]
2025-04-21 21:26         ` [Buildroot] [PATCH v2] package/libgtk4: bump to 4.18.2 Thomas Petazzoni via buildroot
2025-03-25 21:50       ` [Buildroot] [PATCH v2] package/wayland-protocols: bump to 1.42 Julien Olivain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250325101116.791637-2-thomas@devoogdt.com \
    --to=thomas@devoogdt.com \
    --cc=buildroot@buildroot.org \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox