diff mbox series

[bug#67623,1/3] gnu: gtk+: Require zlib in gdk-3.0.pc.

Message ID 20231204133934.3890-1-jean@foundationdevices.com
State New
Headers show
Series : Require zlib in gdk-3.0.pc. | expand

Commit Message

Jean-Pierre De Jesus DIAZ Dec. 4, 2023, 1:39 p.m. UTC
* gnu/packages/gtk.scm (gtk+) <inputs>: Add zlib.

* gnu/packages/gtk.scm (gtk+) <arguments>: Add 'add-zlib-to-gdk-3.0.pc
  phase.

Change-Id: I5efadebded159e0bd495ec07020b431413bd6e10
---
 gnu/packages/gtk.scm | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Comments

Liliana Marie Prikler Dec. 4, 2023, 7:32 p.m. UTC | #1
Am Montag, dem 04.12.2023 um 14:39 +0100 schrieb Jean-Pierre De Jesus
DIAZ:
> * gnu/packages/gtk.scm (gtk+) <inputs>: Add zlib.
> 
> * gnu/packages/gtk.scm (gtk+) <arguments>: Add 'add-zlib-to-gdk-
> 3.0.pc
>   phase.
> 
> Change-Id: I5efadebded159e0bd495ec07020b431413bd6e10
> ---
>  gnu/packages/gtk.scm | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/gnu/packages/gtk.scm b/gnu/packages/gtk.scm
> index 47d4c1808f..752c9f456d 100644
> --- a/gnu/packages/gtk.scm
> +++ b/gnu/packages/gtk.scm
> @@ -1032,7 +1032,9 @@ (define-public gtk+
>             mesa
>             pango
>             wayland
> -           wayland-protocols))
> +           wayland-protocols
> +           ;; When broadway backend is enabled gdk-3.0 requires
> zlib.
> +           zlib))
>      (inputs
>       (list colord-minimal               ;to prevent a cycle with
> inkscape
>             cups
> @@ -1087,6 +1089,15 @@ (define-public gtk+
>            (add-after 'unpack 'generate-gdk-pixbuf-loaders-cache-file
>              (assoc-ref glib-or-gtk:%standard-phases
>                         'generate-gdk-pixbuf-loaders-cache-file))
> +          (add-after 'unpack 'add-zlib-to-gdk-3.0.pc
> +            (lambda _
> +              ;; When -Dbroadway_backend=true zlib is added as a
> dependency to
> +              ;; gdk-3.0 but isn't done correctly and can cause pkg-
> config to
> +              ;; not add the correct -L...-zlib/lib flag.
> +              (substitute* "meson.build"
> +                (("pc_gdk_extra_libs += \\['-lz'\\]") "")
> +                (("^gdk_packages \\+= cairo_packages" all)
> +                 (string-append all "\ngdk_packages += '
> zlib'\n")))))
Is there a good reason to do it this way?  I would hope that
downstreams are already aware of this pkg-config variable.

Cheers
Maxim Cournoyer Jan. 3, 2024, 7:50 p.m. UTC | #2
Hello,

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> Am Montag, dem 04.12.2023 um 14:39 +0100 schrieb Jean-Pierre De Jesus
> DIAZ:
>> * gnu/packages/gtk.scm (gtk+) <inputs>: Add zlib.
>> 
>> * gnu/packages/gtk.scm (gtk+) <arguments>: Add 'add-zlib-to-gdk-
>> 3.0.pc
>>   phase.
>> 
>> Change-Id: I5efadebded159e0bd495ec07020b431413bd6e10
>> ---
>>  gnu/packages/gtk.scm | 13 ++++++++++++-
>>  1 file changed, 12 insertions(+), 1 deletion(-)
>> 
>> diff --git a/gnu/packages/gtk.scm b/gnu/packages/gtk.scm
>> index 47d4c1808f..752c9f456d 100644
>> --- a/gnu/packages/gtk.scm
>> +++ b/gnu/packages/gtk.scm
>> @@ -1032,7 +1032,9 @@ (define-public gtk+
>>             mesa
>>             pango
>>             wayland
>> -           wayland-protocols))
>> +           wayland-protocols
>> +           ;; When broadway backend is enabled gdk-3.0 requires
>> zlib.
>> +           zlib))
>>      (inputs
>>       (list colord-minimal               ;to prevent a cycle with
>> inkscape
>>             cups
>> @@ -1087,6 +1089,15 @@ (define-public gtk+
>>            (add-after 'unpack 'generate-gdk-pixbuf-loaders-cache-file
>>              (assoc-ref glib-or-gtk:%standard-phases
>>                         'generate-gdk-pixbuf-loaders-cache-file))
>> +          (add-after 'unpack 'add-zlib-to-gdk-3.0.pc
>> +            (lambda _
>> +              ;; When -Dbroadway_backend=true zlib is added as a
>> dependency to
>> +              ;; gdk-3.0 but isn't done correctly and can cause pkg-
>> config to
>> +              ;; not add the correct -L...-zlib/lib flag.
>> +              (substitute* "meson.build"
>> +                (("pc_gdk_extra_libs += \\['-lz'\\]") "")
>> +                (("^gdk_packages \\+= cairo_packages" all)
>> +                 (string-append all "\ngdk_packages += '
>> zlib'\n")))))
> Is there a good reason to do it this way?  I would hope that
> downstreams are already aware of this pkg-config variable.

It seems a problem that should be taken to upstream.  Then while
waiting, we could carry that patch, with a reference to the upstream
issue.

Jean-Pierre, could you please check if this issue is known with the GTK
project, else file it on there tracker and reference it as a comment
with your patch?

-- 
Thanks,
Maxim
Jean-Pierre De Jesus DIAZ Jan. 3, 2024, 10:34 p.m. UTC | #3
Hello

On Wed, Jan 3, 2024 at 7:50 PM Maxim Cournoyer
<maxim.cournoyer@gmail.com> wrote:
>
> Hello,
>
> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
>
> > Am Montag, dem 04.12.2023 um 14:39 +0100 schrieb Jean-Pierre De Jesus
> > DIAZ:
> >> * gnu/packages/gtk.scm (gtk+) <inputs>: Add zlib.
> >>
> >> * gnu/packages/gtk.scm (gtk+) <arguments>: Add 'add-zlib-to-gdk-
> >> 3.0.pc
> >>   phase.
> >>
> >> Change-Id: I5efadebded159e0bd495ec07020b431413bd6e10
> >> ---
> >>  gnu/packages/gtk.scm | 13 ++++++++++++-
> >>  1 file changed, 12 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/gnu/packages/gtk.scm b/gnu/packages/gtk.scm
> >> index 47d4c1808f..752c9f456d 100644
> >> --- a/gnu/packages/gtk.scm
> >> +++ b/gnu/packages/gtk.scm
> >> @@ -1032,7 +1032,9 @@ (define-public gtk+
> >>             mesa
> >>             pango
> >>             wayland
> >> -           wayland-protocols))
> >> +           wayland-protocols
> >> +           ;; When broadway backend is enabled gdk-3.0 requires
> >> zlib.
> >> +           zlib))
> >>      (inputs
> >>       (list colord-minimal               ;to prevent a cycle with
> >> inkscape
> >>             cups
> >> @@ -1087,6 +1089,15 @@ (define-public gtk+
> >>            (add-after 'unpack 'generate-gdk-pixbuf-loaders-cache-file
> >>              (assoc-ref glib-or-gtk:%standard-phases
> >>                         'generate-gdk-pixbuf-loaders-cache-file))
> >> +          (add-after 'unpack 'add-zlib-to-gdk-3.0.pc
> >> +            (lambda _
> >> +              ;; When -Dbroadway_backend=true zlib is added as a
> >> dependency to
> >> +              ;; gdk-3.0 but isn't done correctly and can cause pkg-
> >> config to
> >> +              ;; not add the correct -L...-zlib/lib flag.
> >> +              (substitute* "meson.build"
> >> +                (("pc_gdk_extra_libs += \\['-lz'\\]") "")
> >> +                (("^gdk_packages \\+= cairo_packages" all)
> >> +                 (string-append all "\ngdk_packages += '
> >> zlib'\n")))))
> > Is there a good reason to do it this way?  I would hope that
> > downstreams are already aware of this pkg-config variable.
>
> It seems a problem that should be taken to upstream.  Then while
> waiting, we could carry that patch, with a reference to the upstream
> issue.
>
> Jean-Pierre, could you please check if this issue is known with the GTK
> project, else file it on there tracker and reference it as a comment
> with your patch?
>
> --
> Thanks,
> Maxim

I've searched on the GNOME's GitLab instance for related issues but
found none so
instead filed this one:

https://gitlab.gnome.org/GNOME/gtk/-/issues/6306

Thanks,
Liliana Marie Prikler Jan. 4, 2024, 8:12 p.m. UTC | #4
Am Mittwoch, dem 03.01.2024 um 22:34 +0000 schrieb Jean-Pierre De Jesus
Diaz:
> I've searched on the GNOME's GitLab instance for related issues but
> found none so instead filed this one:
> 
> https://gitlab.gnome.org/GNOME/gtk/-/issues/6306
> 
> Thanks,
As reported upstream, this doesn't look like an abuse of the pkg-config
though, more like only zlib missing as propagated input.  Do you have
an instance where the pkg-config variable is not resolved correctly?

Cheers
Jean-Pierre De Jesus DIAZ Jan. 5, 2024, 4:43 p.m. UTC | #5
Hello,

On Thu, Jan 4, 2024 at 8:12 PM Liliana Marie Prikler
<liliana.prikler@gmail.com> wrote:
>
> Am Mittwoch, dem 03.01.2024 um 22:34 +0000 schrieb Jean-Pierre De Jesus
> Diaz:
> > I've searched on the GNOME's GitLab instance for related issues but
> > found none so instead filed this one:
> >
> > https://gitlab.gnome.org/GNOME/gtk/-/issues/6306
> >
> > Thanks,
> As reported upstream, this doesn't look like an abuse of the pkg-config
> though, more like only zlib missing as propagated input.  Do you have
> an instance where the pkg-config variable is not resolved correctly?
>
> Cheers
>

The coq-ide package fails to build because ocaml-lablgtk3-sourceview3 isn't
able to find zlib correctly, I guess adding it to propagated-inputs would also
solve the problems though as libz.so should then be in the search paths.
diff mbox series

Patch

diff --git a/gnu/packages/gtk.scm b/gnu/packages/gtk.scm
index 47d4c1808f..752c9f456d 100644
--- a/gnu/packages/gtk.scm
+++ b/gnu/packages/gtk.scm
@@ -1032,7 +1032,9 @@  (define-public gtk+
            mesa
            pango
            wayland
-           wayland-protocols))
+           wayland-protocols
+           ;; When broadway backend is enabled gdk-3.0 requires zlib.
+           zlib))
     (inputs
      (list colord-minimal               ;to prevent a cycle with inkscape
            cups
@@ -1087,6 +1089,15 @@  (define-public gtk+
           (add-after 'unpack 'generate-gdk-pixbuf-loaders-cache-file
             (assoc-ref glib-or-gtk:%standard-phases
                        'generate-gdk-pixbuf-loaders-cache-file))
+          (add-after 'unpack 'add-zlib-to-gdk-3.0.pc
+            (lambda _
+              ;; When -Dbroadway_backend=true zlib is added as a dependency to
+              ;; gdk-3.0 but isn't done correctly and can cause pkg-config to
+              ;; not add the correct -L...-zlib/lib flag.
+              (substitute* "meson.build"
+                (("pc_gdk_extra_libs += \\['-lz'\\]") "")
+                (("^gdk_packages \\+= cairo_packages" all)
+                 (string-append all "\ngdk_packages += ' zlib'\n")))))
           (add-before 'check 'pre-check
             (lambda _
               ;; Tests require a running X server.