All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Devoogdt <thomas@devoogdt.com>
To: buildroot@buildroot.org
Cc: Thomas Devoogdt <thomas@devoogdt.com>
Subject: [Buildroot] [PATCH v2] package/libgtk4: bump to 4.17.3
Date: Sat, 25 Jan 2025 22:07:39 +0100	[thread overview]
Message-ID: <20250125210741.378348-1-thomas@devoogdt.com> (raw)
In-Reply-To: <20241116160819.70007-1-thomas@devoogdt.com>

https://gitlab.gnome.org/GNOME/gtk/-/blob/4.17.3/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>
---
! This bump depends on these patches:
- https://patchwork.ozlabs.org/project/buildroot/patch/20250125182148.234260-1-thomas@devoogdt.com/
- https://patchwork.ozlabs.org/project/buildroot/patch/20250120211707.2381182-3-fiona.klute@gmx.de/
!
---
 ...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..d487c5bfe1
--- /dev/null
+++ b/package/libgtk4/0001-meson.build-add-a-check-for-the-fenv-header.patch
@@ -0,0 +1,26 @@
+From 9c248022da794e9422b37554fb9e316ffa71fd7a 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 e4006a3f8f..f9fc0dcb70 100644
+--- a/meson.build
++++ b/meson.build
+@@ -191,6 +191,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..0455df39c8
--- /dev/null
+++ b/package/libgtk4/0002-gtk-gtkcssnumbervalue.c-fix-compilation-if-fenv.h-is.patch
@@ -0,0 +1,106 @@
+From ae4180e3abba9e053cf5b5826df2f6854c3c7256 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..fe83adbc99
--- /dev/null
+++ b/package/libgtk4/0003-modules-printbackends-gtkprintbackendfile.c-fix-comp.patch
@@ -0,0 +1,96 @@
+From 66beb6fa84a1d86e3d607d11e5eab119a95d2a02 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..62dbf903f1 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.3.sha256sum
+sha256  5fada0343e172eb110335d5df7de68d00344332e7e885b04e6755f879c0748a6  gtk-4.17.3.tar.xz
 
 # Hash for license file:
 sha256  b7993225104d90ddd8024fd838faf300bea5e83d91203eab98e29512acebd69c  COPYING
diff --git a/package/libgtk4/libgtk4.mk b/package/libgtk4/libgtk4.mk
index b00a2facad..063cde0370 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).3
 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-01-25 21:07 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 ` Thomas Devoogdt [this message]
2025-02-05 15:37   ` [Buildroot] [PATCH v2] package/libgtk4: bump to 4.17.3 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

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=20250125210741.378348-1-thomas@devoogdt.com \
    --to=thomas@devoogdt.com \
    --cc=buildroot@buildroot.org \
    /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 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.