mbox series

[bug#50627,0/2] Make wayland-protocols dependency native-input.

Message ID 20210916192331.29606-1-mail@muradm.net
Headers show
Series Make wayland-protocols dependency native-input. | expand

Message

muradm Sept. 16, 2021, 7:23 p.m. UTC
wayland-protocols is not runtime dependency and only build time
dependency for applications that directly using wayland.

Initially I tought that making wayland-protocols a native-inputs
dependency as it should, it would reduce number of dependants on
it. But it turns out other way around. With this patchset we are
fixing gtk+ to not advertise it as dependency in its .pc files,
and moving wayland-protocols to native-inputs where it should be.

Patch provided for gtk+ also merged with upstream.

Patchset prepared from core-updates-frozen. While it seems that
it will impact many other packages, actually this patch reduces
number of packages that touches wayland-protocols and probably
avoids it at runtime.

muradm (2):
  gnu: gtk: Move wayland-protocols to native-inputs.
  gnu: Fix wayland-protocols dependency to be in native-inputs.

 gnu/packages/arcan.scm                        |  6 ++--
 gnu/packages/enlightenment.scm                | 10 +++----
 gnu/packages/fcitx5.scm                       |  4 +--
 gnu/packages/freedesktop.scm                  | 14 +++++-----
 gnu/packages/gl.scm                           | 10 +++----
 gnu/packages/gtk.scm                          |  7 +++--
 gnu/packages/image.scm                        | 12 ++++----
 gnu/packages/julia-jll.scm                    |  2 +-
 gnu/packages/kde-frameworks.scm               |  6 ++--
 gnu/packages/kodi.scm                         |  4 ++-
 gnu/packages/language.scm                     |  2 +-
 .../gtk3-wayland-protocols-dependency.patch   | 23 +++++++++++++++
 gnu/packages/sdl.scm                          |  5 ++--
 gnu/packages/video.scm                        | 28 +++++++++----------
 gnu/packages/wm.scm                           |  4 +--
 gnu/packages/xdisorg.scm                      | 20 ++++++-------
 gnu/packages/xorg.scm                         |  4 ++-
 17 files changed, 95 insertions(+), 66 deletions(-)
 create mode 100644 gnu/packages/patches/gtk3-wayland-protocols-dependency.patch

Comments

Liliana Marie Prikler Sept. 16, 2021, 7:57 p.m. UTC | #1
Hi,

Am Donnerstag, den 16.09.2021, 22:23 +0300 schrieb muradm:
> wayland-protocols is not runtime dependency and only build time
> dependency for applications that directly using wayland.
Guix does not distinguish between "build time" and run time
dependencies.

> Initially I tought that making wayland-protocols a native-inputs
> dependency as it should, it would reduce number of dependants on
> it. But it turns out other way around. With this patchset we are
> fixing gtk+ to not advertise it as dependency in its .pc files,
> and moving wayland-protocols to native-inputs where it should be.
That's not what native-inputs are used for.  native-inputs provide
binaries that the host/build machine needs to run in order to compile a
package.  It doesn't seem to be the case that wayland-protocols is such
a package, is it?

> Patch provided for gtk+ also merged with upstream.
> 
> Patchset prepared from core-updates-frozen. While it seems that
> it will impact many other packages, actually this patch reduces
> number of packages that touches wayland-protocols and probably
> avoids it at runtime.
But it still impacts a large number of packages in ways that could
potentially break and haven't been tested, right?  While reducing
closure size is generally a good thing, I think we do need to be
careful whenever "build time vs. run time" and native vs. non-native
are confused.

Regards
muradm Sept. 17, 2021, 2:35 a.m. UTC | #2
Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> Hi,
>
> Am Donnerstag, den 16.09.2021, 22:23 +0300 schrieb muradm:
>> wayland-protocols is not runtime dependency and only build time
>> dependency for applications that directly using wayland.
> Guix does not distinguish between "build time" and run time
> dependencies.
True, here issue could be related to miss wording, but same 
wording
is used in the manual as well, so do I.

>> Initially I tought that making wayland-protocols a 
>> native-inputs
>> dependency as it should, it would reduce number of dependants 
>> on
>> it. But it turns out other way around. With this patchset we 
>> are
>> fixing gtk+ to not advertise it as dependency in its .pc files,
>> and moving wayland-protocols to native-inputs where it should 
>> be.
> That's not what native-inputs are used for.  native-inputs 
> provide
> binaries that the host/build machine needs to run in order to 
> compile a
> package.  It doesn't seem to be the case that wayland-protocols 
> is such
> a package, is it?
wayland-protocols is different package. It does not include any 
binaries
only protocol specifications (some xml files), which are used for 
code
generation. We could consider them as a kind of autoconf/bison 
like
inputs, but tightly scoped for wayland needs, although they are 
not so
and not binaries.

>> Patch provided for gtk+ also merged with upstream.
>>
>> Patchset prepared from core-updates-frozen. While it seems that
>> it will impact many other packages, actually this patch reduces
>> number of packages that touches wayland-protocols and probably
>> avoids it at runtime.
> But it still impacts a large number of packages in ways that 
> could
> potentially break and haven't been tested, right?
Technically, this package does not change anything in terms of 
binary
producing. wayland-protocols remains to be an input as it was 
before.
I.e. wayland compositor, wayland application, wayland using 
library,
application which uses wayland using library, binary output is not
impacted. If binary output is the same, is there any thing else to
test?

There are two things which are being changed. First as you 
pointing
out is the way Guix treats it, i.e. reducing closure, etc. Second 
is
propagation of inputs. Currently (without this patch), since it is
listed in propagated-inputs (and also advertised in .pc files),
wayland-protocols as requirement, needlessly, getting pushed down
then hierarchy.

Let's take 4 cases that we have here (I do not pretend to be 
complete,
of course, there are might be more levels/combinations, just 
attempting
to illustrate current case in simple words/terms):

1. wayland compositor (weston, wlroots/sway, etc.)
2. wayland client application (grim, mpv, etc. applications 
directly
interacting with wayland interfaces)
3. wayland client library (qt or gtk+ in this case, also directly
interacts with wayland to abstract it for user applications)
4. user application of wayland client library (in this case some 
gtk+
based application)

For 1 and 2, both types should have to specify wayland in inputs 
(or
propagated-inputs), and wayland-protocols in native-inputs.

One of purposes to have layer 3, is to abstract from 1 and 2.
i.e. when I write gtk application, as user I should not be aware 
of
where/how this application is going to run, via xorg or wayland. 
Then
why I should be aware of wayland/wayland-protocols and make sure 
that
it is provided as build input for my application?

More over, if I will have some other unrelated package that 
depends
on my gtk application (item 4 above), i still will see
wayland-protocols among my inputs.

Currently, thanks to Guix, it is getting resolved by having it 
listed
in propagated-inputs.

For the long run, it was also fixed in gtk, so that 
wayland-protocols
is not going to be advertised in gtk's .pc files any more
(https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/3960 and
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/3961).

I suppose that, initially wayland-protocols was listed in
propagated-inputs for this same reason, because gtk was 
advertising
it in .pc files.

> While reducing
> closure size is generally a good thing, I think we do need to be
> careful whenever "build time vs. run time" and native vs. 
> non-native
> are confused.
I'm using terminology as per documentation :) may be it should be
reworded in some other way to avoid confusion. 8.2.1 package 
reference:

          ‘native-inputs’ is typically used to list tools needed 
          at
          build time, but not at run time...

Thanks in advance,
muradm
Liliana Marie Prikler Sept. 17, 2021, 7:46 a.m. UTC | #3
Hi

Am Freitag, den 17.09.2021, 05:35 +0300 schrieb muradm:
> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
> 
> > Hi,
> > 
> > Am Donnerstag, den 16.09.2021, 22:23 +0300 schrieb muradm:
> > > wayland-protocols is not runtime dependency and only build time
> > > dependency for applications that directly using wayland.
> > Guix does not distinguish between "build time" and run time
> > dependencies.
> True, here issue could be related to miss wording, but same 
> wording is used in the manual as well, so do I.
I'll respond to that in your quote below.

> > > Initially I tought that making wayland-protocols a 
> > > native-inputs dependency as it should, it would reduce number of
> > > dependants on it. But it turns out other way around. With this
> > > patchset we are fixing gtk+ to not advertise it as dependency in
> > > its .pc files, and moving wayland-protocols to native-inputs
> > > where it should be.
> > That's not what native-inputs are used for.  native-inputs 
> > provide binaries that the host/build machine needs to run in order
> > to compile a package.  It doesn't seem to be the case that wayland-
> > protocols is such a package, is it?
> wayland-protocols is different package. It does not include any 
> binaries only protocol specifications (some xml files), which are
> used for code generation. We could consider them as a kind of
> autoconf/bison like inputs, but tightly scoped for wayland needs,
> although they are not so and not binaries.
And what kind of code is generated from them?  I would assume it's
target code.  And since wayland-protocols is no tool to process those
XML files, but the files themselves, I'd hazard a guess that it should
rather be built for the target.  While currently this appears to make
no difference, there might well be a time in which those files differ
for some two architectures, which then would cause problems in cross-
compiling contexts were it a native input.

> > > Patch provided for gtk+ also merged with upstream.
> > > 
> > > Patchset prepared from core-updates-frozen. While it seems that
> > > it will impact many other packages, actually this patch reduces
> > > number of packages that touches wayland-protocols and probably
> > > avoids it at runtime.
> > But it still impacts a large number of packages in ways that 
> > could
> > potentially break and haven't been tested, right?
> Technically, this package does not change anything in terms of 
> binary producing. wayland-protocols remains to be an input as it was 
> before. I.e. wayland compositor, wayland application, wayland using 
> library, application which uses wayland using library, binary output
> is not impacted. If binary output is the same, is there any thing
> else to test?
In that case I'd hazard a guess that it's fine, but the phrase
"wayland-protocols remains to be an input" is perhaps a bit weird given
the change to native-input.

> There are two things which are being changed. First as you 
> pointing out is the way Guix treats it, i.e. reducing closure, etc.
> Second is propagation of inputs. Currently (without this patch),
> since it is listed in propagated-inputs (and also advertised in .pc
> files), wayland-protocols as requirement, needlessly, getting pushed
> down then hierarchy.
We ought to move it from propagated-inputs to inputs and either (if we
can) ignore pkg-config or patch the pkg-config files.  W.r.t. pkg-
config I do wonder whether Requires.private needs propagation, though,
it normally should be just Requires.

> Let's take 4 cases that we have here (I do not pretend to be 
> complete, of course, there are might be more levels/combinations,
> just attempting to illustrate current case in simple words/terms):
> 
> 1. wayland compositor (weston, wlroots/sway, etc.)
> 2. wayland client application (grim, mpv, etc. applications 
> directly interacting with wayland interfaces)
> 3. wayland client library (qt or gtk+ in this case, also directly
> interacts with wayland to abstract it for user applications)
> 4. user application of wayland client library (in this case some 
> gtk+ based application)
> 
> For 1 and 2, both types should have to specify wayland in inputs 
> (or propagated-inputs), and wayland-protocols in native-inputs.
Why?

> One of purposes to have layer 3, is to abstract from 1 and 2.
> i.e. when I write gtk application, as user I should not be aware 
> of where/how this application is going to run, via xorg or wayland. 
> Then why I should be aware of wayland/wayland-protocols and make
> sure that it is provided as build input for my application?
IIUC you don't need to be aware when gtk propagates the input?  It's
similar to how you still need an Xorg server to test your GTK
application.

> More over, if I will have some other unrelated package that 
> depends on my gtk application (item 4 above), i still will see
> wayland-protocols among my inputs.
> 
> Currently, thanks to Guix, it is getting resolved by having it 
> listed in propagated-inputs.
> 
> For the long run, it was also fixed in gtk, so that 
> wayland-protocols is not going to be advertised in gtk's .pc files
> any more (https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/3960
> and https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/3961).
Which is fine in and of its own, but not the right thing w.r.t. native-
inputs.

> I suppose that, initially wayland-protocols was listed in
> propagated-inputs for this same reason, because gtk was 
> advertising it in .pc files.
Probably.

> > While reducing closure size is generally a good thing, I think we
> > do need to be careful whenever "build time vs. run time" and native
> > vs. non-native are confused.
> I'm using terminology as per documentation :) may be it should be
> reworded in some other way to avoid confusion. 8.2.1 package 
> reference:
> 
>           ‘native-inputs’ is typically used to list tools needed 
>           at build time, but not at run time...
You're quoting the manual out-of-context and (accidentally) misuse the
word tool.

>           When cross-compiling, dependencies listed in ‘inputs’ are
>           built for the _target_ architecture; conversely, 
>           dependencies listed in ‘native-inputs’ are built for the 
>           architecture of the _build_ machine.
This is the distinction to make here.  "Typically used to list tools" 
here means that the package provides a tool (i.e. a binary) that you
invoke at some point of your recipe.  This can be a compiler like GCC,
a tool to create Makefiles like automake, or an X server to launch
tests in.  The only thing in that regard when talking about wayland
would be the wayland-scanner tool provided by the wayland package.  

Notice the contrast to what you said before with wayland being an input
and wayland-protocols being a native one.  If you need wayland-scanner
for you build, it should be a native-input (as well as an input,
probably).  If this does become a problem later on, a bin/lib split for
wayland might make sense.

Regards
muradm Sept. 17, 2021, 8:20 a.m. UTC | #4
Regardless of comments below, I understand what you are trying to 
point
out. It is fine with me to use 'inputs instead of 'native-inputs, 
as the
final result won't change. Just in my opinion, what I found it 
that, it
need/should not be in 'propagated-inputs. I will be updating the 
patch
to make sure that wayland-protocols are listed among 'inputs 
without
propagating. It is also fine with me to close this issue and don't 
do
anything if you say that it is unnecessary, I don't mind :)

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

> Hi
>
> Am Freitag, den 17.09.2021, 05:35 +0300 schrieb muradm:
>> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
>>
>> > Hi,
>> >
>> > Am Donnerstag, den 16.09.2021, 22:23 +0300 schrieb muradm:
>> > > wayland-protocols is not runtime dependency and only build 
>> > > time
>> > > dependency for applications that directly using wayland.
>> > Guix does not distinguish between "build time" and run time
>> > dependencies.
>> True, here issue could be related to miss wording, but same
>> wording is used in the manual as well, so do I.
> I'll respond to that in your quote below.
>
>> > > Initially I tought that making wayland-protocols a
>> > > native-inputs dependency as it should, it would reduce 
>> > > number of
>> > > dependants on it. But it turns out other way around. With 
>> > > this
>> > > patchset we are fixing gtk+ to not advertise it as 
>> > > dependency in
>> > > its .pc files, and moving wayland-protocols to 
>> > > native-inputs
>> > > where it should be.
>> > That's not what native-inputs are used for.  native-inputs
>> > provide binaries that the host/build machine needs to run in 
>> > order
>> > to compile a package.  It doesn't seem to be the case that 
>> > wayland-
>> > protocols is such a package, is it?
>> wayland-protocols is different package. It does not include any
>> binaries only protocol specifications (some xml files), which 
>> are
>> used for code generation. We could consider them as a kind of
>> autoconf/bison like inputs, but tightly scoped for wayland 
>> needs,
>> although they are not so and not binaries.
> And what kind of code is generated from them?  I would assume 
> it's
> target code.  And since wayland-protocols is no tool to process 
> those
> XML files, but the files themselves, I'd hazard a guess that it 
> should
> rather be built for the target.  While currently this appears to 
> make
> no difference, there might well be a time in which those files 
> differ
> for some two architectures, which then would cause problems in 
> cross-
> compiling contexts were it a native input.
As with any other kind of protocol, you can implement platform 
specific
encoder/decoder, but protocol remains the same. Suppose, 
connecting from
arm, to x86 or vice versa in the context of wayland, should 
protocol
change? As you mentioned wayland-scanner below, that would be its 
task
to interpret protocol specification in platform specific way. So I 
would
speculate that in future these specifications would remain the 
same.
Otherwise, that would defeat the point of having protocol.

>> > > Patch provided for gtk+ also merged with upstream.
>> > >
>> > > Patchset prepared from core-updates-frozen. While it seems 
>> > > that
>> > > it will impact many other packages, actually this patch 
>> > > reduces
>> > > number of packages that touches wayland-protocols and 
>> > > probably
>> > > avoids it at runtime.
>> > But it still impacts a large number of packages in ways that
>> > could
>> > potentially break and haven't been tested, right?
>> Technically, this package does not change anything in terms of
>> binary producing. wayland-protocols remains to be an input as 
>> it was
>> before. I.e. wayland compositor, wayland application, wayland 
>> using
>> library, application which uses wayland using library, binary 
>> output
>> is not impacted. If binary output is the same, is there any 
>> thing
>> else to test?
> In that case I'd hazard a guess that it's fine, but the phrase
> "wayland-protocols remains to be an input" is perhaps a bit 
> weird given
> the change to native-input.
Probably, I'd better put single quote in front of the word when it
means symbol, and don't put one when it is human word :) in this 
context
it was meaning literal input (regardless of type, be it 'inputs,
'native-inputs or 'propagated-inputs).

>> There are two things which are being changed. First as you
>> pointing out is the way Guix treats it, i.e. reducing closure, 
>> etc.
>> Second is propagation of inputs. Currently (without this 
>> patch),
>> since it is listed in propagated-inputs (and also advertised in 
>> .pc
>> files), wayland-protocols as requirement, needlessly, getting 
>> pushed
>> down then hierarchy.
> We ought to move it from propagated-inputs to inputs and either 
> (if we
> can) ignore pkg-config or patch the pkg-config files.  W.r.t. 
> pkg-
> config I do wonder whether Requires.private needs propagation, 
> though,
> it normally should be just Requires.
I suppose, it is not in Guix's hands to control how pkg-config 
files are
authored by software owners and/or interpreted by build tools. 
What
Guix's can do, it to fix what is already there. This patch 
illustrates
this point.

>> Let's take 4 cases that we have here (I do not pretend to be
>> complete, of course, there are might be more 
>> levels/combinations,
>> just attempting to illustrate current case in simple 
>> words/terms):
>>
>> 1. wayland compositor (weston, wlroots/sway, etc.)
>> 2. wayland client application (grim, mpv, etc. applications
>> directly interacting with wayland interfaces)
>> 3. wayland client library (qt or gtk+ in this case, also 
>> directly
>> interacts with wayland to abstract it for user applications)
>> 4. user application of wayland client library (in this case 
>> some
>> gtk+ based application)
>>
>> For 1 and 2, both types should have to specify wayland in 
>> inputs
>> (or propagated-inputs), and wayland-protocols in native-inputs.
> Why?
One implements the protocol, the other uses it. I.e. both need 
stubs
generated from specification to agree. Which is not the case for
anything beyond 4. Otherwise, we would defeat whole point of
introducing abstractions.

>> One of purposes to have layer 3, is to abstract from 1 and 2.
>> i.e. when I write gtk application, as user I should not be 
>> aware
>> of where/how this application is going to run, via xorg or 
>> wayland.
>> Then why I should be aware of wayland/wayland-protocols and 
>> make
>> sure that it is provided as build input for my application?
> IIUC you don't need to be aware when gtk propagates the input? 
> It's
> similar to how you still need an Xorg server to test your GTK
> application.
From application using gtk stand point, it does not matter what is
behind gtk. As you point out, of course me, as user launching
application, I have to provide some environment which could be
either xorg or wayland. But application's source should not be
aware of that fact.

>> More over, if I will have some other unrelated package that
>> depends on my gtk application (item 4 above), i still will see
>> wayland-protocols among my inputs.
>>
>> Currently, thanks to Guix, it is getting resolved by having it
>> listed in propagated-inputs.
>>
>> For the long run, it was also fixed in gtk, so that
>> wayland-protocols is not going to be advertised in gtk's .pc 
>> files
>> any more 
>> (https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/3960
>> and https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/3961).
> Which is fine in and of its own, but not the right thing w.r.t. 
> native-
> inputs.
>
>> I suppose that, initially wayland-protocols was listed in
>> propagated-inputs for this same reason, because gtk was
>> advertising it in .pc files.
> Probably.
>
>> > While reducing closure size is generally a good thing, I 
>> > think we
>> > do need to be careful whenever "build time vs. run time" and 
>> > native
>> > vs. non-native are confused.
>> I'm using terminology as per documentation :) may be it should 
>> be
>> reworded in some other way to avoid confusion. 8.2.1 package
>> reference:
>>
>>           ‘native-inputs’ is typically used to list tools 
>>           needed
>>           at build time, but not at run time...
> You're quoting the manual out-of-context and (accidentally) 
> misuse the
> word tool.
>
>>           When cross-compiling, dependencies listed in ‘inputs’ 
>>           are
>>           built for the _target_ architecture; conversely,
>>           dependencies listed in ‘native-inputs’ are built for 
>>           the
>>           architecture of the _build_ machine.
> This is the distinction to make here.  "Typically used to list 
> tools"
> here means that the package provides a tool (i.e. a binary) that 
> you
> invoke at some point of your recipe.  This can be a compiler 
> like GCC,
> a tool to create Makefiles like automake, or an X server to 
> launch
> tests in.  The only thing in that regard when talking about 
> wayland
> would be the wayland-scanner tool provided by the wayland 
> package.
>
> Notice the contrast to what you said before with wayland being 
> an input
> and wayland-protocols being a native one.  If you need 
> wayland-scanner
> for you build, it should be a native-input (as well as an input,
> probably).  If this does become a problem later on, a bin/lib 
> split for
> wayland might make sense.
I understand what you are saying, however as far as I am aware, 
people
being or not on the same page, tend to use simpler definitions for
referencing something. I was assuming that in this mailing list we
are on the same page, and free to choose to how reference things.
I suppose it would be fine to say "not runtime dependency", "build 
time"
or "dependency for host platform when crosscompiling" in reference 
to
'native-inputs. For instance when explaining this to one who sees 
Guix
for the first time, I would say "run time" for 'inputs and "build 
time"
for 'native-inputs, not mentioning "crosscompiling" at all on day 
one.
Any way, I beleive it is more like phylosophical subject, than 
technical.

> Regards
Liliana Marie Prikler Sept. 17, 2021, 1:01 p.m. UTC | #5
Hi,

Am Freitag, den 17.09.2021, 11:20 +0300 schrieb muradm:
> Regardless of comments below, I understand what you are trying to 
> point out. It is fine with me to use 'inputs instead of 'native-
> inputs, as the final result won't change. Just in my opinion, what I
> found it that, it need/should not be in 'propagated-inputs. I will be
> updating the patch to make sure that wayland-protocols are listed
> among 'inputs without propagating. It is also fine with me to close
> this issue and don't do anything if you say that it is unnecessary, I
> don't mind :)
I agree that reducing propagated-inputs is a good thing, it should just
be moved to inputs.  When you update the patch, please do use the
upstream version of gtk3-wayland-protocols-dependency.patch.

> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
> 
> > And what kind of code is generated from them?  I would assume 
> > it's target code.  And since wayland-protocols is no tool to
> > process those XML files, but the files themselves, I'd hazard a
> > guess that it should rather be built for the target.  While
> > currently this appears to make no difference, there might well be a
> > time in which those files differ for some two architectures, which
> > then would cause problems in cross-compiling contexts were it a
> > native input.
> As with any other kind of protocol, you can implement platform 
> specific encoder/decoder, but protocol remains the same. Suppose, 
> connecting from arm, to x86 or vice versa in the context of wayland,
> should protocol change? As you mentioned wayland-scanner below, that
> would be its task to interpret protocol specification in platform
> specific way. So I would speculate that in future these
> specifications would remain the same.
> Otherwise, that would defeat the point of having protocol.
You are probably correct in that those files will likely stay the same
for all platforms, but there could be scenarios where for the sake of
performance or whatever else you might want to have some protocol
extensions.  Platforms that don't support those then wouldn't ship said
protocol extensions.

> > In that case I'd hazard a guess that it's fine, but the phrase
> > "wayland-protocols remains to be an input" is perhaps a bit 
> > weird given the change to native-input.
> Probably, I'd better put single quote in front of the word when it
> means symbol, and don't put one when it is human word :) in this 
> context it was meaning literal input (regardless of type, be it
> 'inputs, 'native-inputs or 'propagated-inputs).
In my personal experience people don't pronounce quotes, so it's better
to be explicit rather than implicit.

> > > There are two things which are being changed. First as you
> > > pointing out is the way Guix treats it, i.e. reducing closure, 
> > > etc.  Second is propagation of inputs. Currently (without this 
> > > patch), since it is listed in propagated-inputs (and also
> > > advertised in .pc files), wayland-protocols as requirement,
> > > needlessly, getting pushed down then hierarchy.
> > We ought to move it from propagated-inputs to inputs and either 
> > (if we can) ignore pkg-config or patch the pkg-config
> > files.  W.r.t. pkg-config I do wonder whether Requires.private
> > needs propagation, though, it normally should be just Requires.
> I suppose, it is not in Guix's hands to control how pkg-config 
> files are authored by software owners and/or interpreted by build
> tools. 
> What Guix's can do, it to fix what is already there. This patch 
> illustrates this point.
The point of authoring is a weird one when Guix can absolutely still
patch the file *and* you supplied a patch that was accepted upstream. 
A patch, which mind you is arguably more correct than the one you've
supplied for Guix, patching the build files themselves rather than
generated sources.

For other packages with similar issues without an upstream fix, you
could on the other hand simply substitute* the .pc file.

> > > Let's take 4 cases that we have here (I do not pretend to be
> > > complete, of course, there are might be more levels/combinations,
> > > just attempting to illustrate current case in
> > > simple words/terms):
> > > 
> > > 1. wayland compositor (weston, wlroots/sway, etc.)
> > > 2. wayland client application (grim, mpv, etc. applications
> > > directly interacting with wayland interfaces)
> > > 3. wayland client library (qt or gtk+ in this case, also 
> > > directly
> > > interacts with wayland to abstract it for user applications)
> > > 4. user application of wayland client library (in this case 
> > > some
> > > gtk+ based application)
> > > 
> > > For 1 and 2, both types should have to specify wayland in 
> > > inputs (or propagated-inputs), and wayland-protocols in native-
> > > inputs.
> > Why?
> One implements the protocol, the other uses it. I.e. both need 
> stubs generated from specification to agree. Which is not the case
> for anything beyond 4. Otherwise, we would defeat whole point of
> introducing abstractions.
This still doesn't explain the *native*-inputs assertion.

> > > One of purposes to have layer 3, is to abstract from 1 and 2.
> > > i.e. when I write gtk application, as user I should not be 
> > > aware of where/how this application is going to run, via xorg or 
> > > wayland. Then why I should be aware of wayland/wayland-protocols
> > > and make sure that it is provided as build input for my
> > > application?
> > IIUC you don't need to be aware when gtk propagates the input? 
> > It's similar to how you still need an Xorg server to test your GTK
> > application.
> From application using gtk stand point, it does not matter what is
> behind gtk. As you point out, of course me, as user launching
> application, I have to provide some environment which could be
> either xorg or wayland. But application's source should not be
> aware of that fact.
This and that are different matters.  Application source code continues
to be blissfully unaware of the fact, but the toolchains to build your
application are not.  Think of it like this: When you use pkg-config
(or older -config binaries), they spit out a number of compiler and
linker flags to supply to gcc or ld.  You as the application programmer
are typically unaware of those flags and their values, especially if
you turn down the verbosity of your build system, but that doesn't mean
they're not supplied.

> [...]
> > >           When cross-compiling, dependencies listed in ‘inputs’ 
> > >           are built for the _target_ architecture; conversely,
> > >           dependencies listed in ‘native-inputs’ are built for 
> > >           the architecture of the _build_ machine.
> > This is the distinction to make here.  "Typically used to list 
> > tools" here means that the package provides a tool (i.e. a binary)
> > that you invoke at some point of your recipe.  This can be a
> > compiler like GCC, a tool to create Makefiles like automake, or an
> > X server to launch tests in.  The only thing in that regard when
> > talking about wayland would be the wayland-scanner tool provided by
> > the wayland package.
> > 
> > Notice the contrast to what you said before with wayland being 
> > an input and wayland-protocols being a native one.  If you need 
> > wayland-scanner for you build, it should be a native-input (as well
> > as an input, probably).  If this does become a problem later on, a
> > bin/lib split for wayland might make sense.
> I understand what you are saying, however as far as I am aware, 
> people being or not on the same page, tend to use simpler definitions
> for referencing something. I was assuming that in this mailing list
> we are on the same page, and free to choose to how reference things.
> I suppose it would be fine to say "not runtime dependency", "build 
> time" or "dependency for host platform when crosscompiling" in
> reference to 'native-inputs. For instance when explaining this to one
> who sees Guix for the first time, I would say "run time" for 'inputs
> and "build time" for 'native-inputs, not mentioning "crosscompiling"
> at all on day one.
> Any way, I believe it is more like philosophical subject, than 
> technical.
I think it is important to acknowledge that people come from different
backgrounds, and knowing that to do our best to curb misunderstandings.
Comparing Guix' package definitions to other package managers makes it
obvious as to why that is the case.  Let me pick Gentoo ebuilds as an
example (it's quicker to explain than whatever Debian has).
There are five (as opposed to three in Guix) kinds of dependencies:
- DEPEND, aka build-time dependencies,
- RDEPEND, aka run-time dependencies,
- BDEPEND, aka native build-time dependencies,
- IDEPEND, aka native install-time dependenices, and
- PDEPEND, aka what the fuck, I think I just introduced a cycle
somewhere.  
When you say "build-time dependencies go into native inputs", someone
with a shallow understanding might think that *all* build time
dependencies are native inputs, when in fact only build time tools
(i.e. BDEPEND in Gentoo parlance) would go there.

In other systems, it might be acceptable to have a package depend on
some other package without said dependency being present at build time.
Consider a shell script that wraps youtube-dl.  Since youtube-dl exists
at some point between installation and first use, your shell script
works™ whether or not youtube-dl is present at build.  Some packages in
Guix do work that way, though it's a pretty rare occurrence.  GStreamer
is one with a legitimate excuse, for example.  Other than that, *all*
"dependencies" (actually inputs) are present at build time, so it makes
no sense to distinguish between build time and run time.  Guix knows
which packages it can delete from the store by tracking references. 
What Guix needs to distinguish is whether the package is invoked at
build time (native-inputs) or whether it needs to be installed
alongside the package being built (propagated-inputs) against none of
the two (regular inputs).

So the next time you try to explain things to a first-timer, be clear
that native-inputs is for tools like compilers, linkers, code
generators *invoked* at build time.  It will be less confusing to learn
it correctly the first time round rather than having to argue in the
mailing lists when submitting some patch.  I understand that keeping
one piece of extra information in mind can be hard at times and the
temptation to simplify is always there, but in the long term no one
benefits from oversimplification.

Sorry for making you read this huge wall of text and happy hacking :)
muradm Sept. 17, 2021, 2:11 p.m. UTC | #6
Apart of comments, I updated the patch, in the way that for now it
only touches gtk+ package. There are two suspect packages remain
who propagate, is wlroots, and enlightenment. enlightenment is 
most
likely to remain leaf package, wlroots is different, we may look 
at
it later when updating it.

Thanks in advance,
muradm

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

> Hi,
>
> Am Freitag, den 17.09.2021, 11:20 +0300 schrieb muradm:
>> Regardless of comments below, I understand what you are trying 
>> to
>> point out. It is fine with me to use 'inputs instead of 
>> 'native-
>> inputs, as the final result won't change. Just in my opinion, 
>> what I
>> found it that, it need/should not be in 'propagated-inputs. I 
>> will be
>> updating the patch to make sure that wayland-protocols are 
>> listed
>> among 'inputs without propagating. It is also fine with me to 
>> close
>> this issue and don't do anything if you say that it is 
>> unnecessary, I
>> don't mind :)
> I agree that reducing propagated-inputs is a good thing, it 
> should just
> be moved to inputs.  When you update the patch, please do use 
> the
> upstream version of gtk3-wayland-protocols-dependency.patch.
I suppose it is impossible, upstream patches are for source in 
git, gtk+
package is being built from post-processed source tarball. When 
patching
upstream target is configure.ac and meson.build, when patching 
source
tarball, configure script it self.

[...]
>> As with any other kind of protocol, you can implement platform
>> specific encoder/decoder, but protocol remains the same. 
>> Suppose,
>> connecting from arm, to x86 or vice versa in the context of 
>> wayland,
>> should protocol change? As you mentioned wayland-scanner below, 
>> that
>> would be its task to interpret protocol specification in 
>> platform
>> specific way. So I would speculate that in future these
>> specifications would remain the same.
>> Otherwise, that would defeat the point of having protocol.
> You are probably correct in that those files will likely stay 
> the same
> for all platforms, but there could be scenarios where for the 
> sake of
> performance or whatever else you might want to have some 
> protocol
> extensions.  Platforms that don't support those then wouldn't 
> ship said
> protocol extensions.
Btw, gtk+'s native-inputs are interesting tho.. :)

[...]
>> > > There are two things which are being changed. First as you
>> > > pointing out is the way Guix treats it, i.e. reducing 
>> > > closure,
>> > > etc.  Second is propagation of inputs. Currently (without 
>> > > this
>> > > patch), since it is listed in propagated-inputs (and also
>> > > advertised in .pc files), wayland-protocols as requirement,
>> > > needlessly, getting pushed down then hierarchy.
>> > We ought to move it from propagated-inputs to inputs and 
>> > either
>> > (if we can) ignore pkg-config or patch the pkg-config
>> > files.  W.r.t. pkg-config I do wonder whether 
>> > Requires.private
>> > needs propagation, though, it normally should be just 
>> > Requires.
>> I suppose, it is not in Guix's hands to control how pkg-config
>> files are authored by software owners and/or interpreted by 
>> build
>> tools.
>> What Guix's can do, it to fix what is already there. This patch
>> illustrates this point.
> The point of authoring is a weird one when Guix can absolutely 
> still
> patch the file *and* you supplied a patch that was accepted 
> upstream.
> A patch, which mind you is arguably more correct than the one 
> you've
> supplied for Guix, patching the build files themselves rather 
> than
> generated sources.
>
> For other packages with similar issues without an upstream fix, 
> you
> could on the other hand simply substitute* the .pc file.
Please, see reason mentioned above, on why patch is different.

>> > > Let's take 4 cases that we have here (I do not pretend to 
>> > > be
>> > > complete, of course, there are might be more 
>> > > levels/combinations,
>> > > just attempting to illustrate current case in
>> > > simple words/terms):
>> > >
>> > > 1. wayland compositor (weston, wlroots/sway, etc.)
>> > > 2. wayland client application (grim, mpv, etc. applications
>> > > directly interacting with wayland interfaces)
>> > > 3. wayland client library (qt or gtk+ in this case, also
>> > > directly
>> > > interacts with wayland to abstract it for user 
>> > > applications)
>> > > 4. user application of wayland client library (in this case
>> > > some
>> > > gtk+ based application)
>> > >
>> > > For 1 and 2, both types should have to specify wayland in
>> > > inputs (or propagated-inputs), and wayland-protocols in 
>> > > native-
>> > > inputs.
>> > Why?
>> One implements the protocol, the other uses it. I.e. both need
>> stubs generated from specification to agree. Which is not the 
>> case
>> for anything beyond 4. Otherwise, we would defeat whole point 
>> of
>> introducing abstractions.
> This still doesn't explain the *native*-inputs assertion.
As you point out below: "... the package is invoked at build time
(native-inputs) ...", in cases 1, 2 and 3 above, wayland-protocols
package is needed once, when 1, 2 or 3 target is being built. No 
other
time wayland-protocols package is needed. This is the reason why I
decided initially to keep it in (native-inputs), because 
definition
of (native-inputs) as you explaining in this conversation and as
explained in Guix manual, best matches with nature of
wayland-protocols, at least in my understanding :)

>> > > One of purposes to have layer 3, is to abstract from 1 and 
>> > > 2.
>> > > i.e. when I write gtk application, as user I should not be
>> > > aware of where/how this application is going to run, via 
>> > > xorg or
>> > > wayland. Then why I should be aware of 
>> > > wayland/wayland-protocols
>> > > and make sure that it is provided as build input for my
>> > > application?
>> > IIUC you don't need to be aware when gtk propagates the 
>> > input?
>> > It's similar to how you still need an Xorg server to test 
>> > your GTK
>> > application.
>> From application using gtk stand point, it does not matter what 
>> is
>> behind gtk. As you point out, of course me, as user launching
>> application, I have to provide some environment which could be
>> either xorg or wayland. But application's source should not be
>> aware of that fact.
> This and that are different matters.  Application source code 
> continues
> to be blissfully unaware of the fact, but the toolchains to 
> build your
> application are not.  Think of it like this: When you use 
> pkg-config
> (or older -config binaries), they spit out a number of compiler 
> and
> linker flags to supply to gcc or ld.  You as the application 
> programmer
> are typically unaware of those flags and their values, 
> especially if
> you turn down the verbosity of your build system, but that 
> doesn't mean
> they're not supplied.
I don't know about typical programmer, for me as programmer, when 
I
write, I do look at every dependency and how it is included. This 
case
just make uncomfortable when there is dependency which is required
but unused.

[...]
>> I understand what you are saying, however as far as I am aware,
>> people being or not on the same page, tend to use simpler 
>> definitions
>> for referencing something. I was assuming that in this mailing 
>> list
>> we are on the same page, and free to choose to how reference 
>> things.
>> I suppose it would be fine to say "not runtime dependency", 
>> "build
>> time" or "dependency for host platform when crosscompiling" in
>> reference to 'native-inputs. For instance when explaining this 
>> to one
>> who sees Guix for the first time, I would say "run time" for 
>> 'inputs
>> and "build time" for 'native-inputs, not mentioning 
>> "crosscompiling"
>> at all on day one.
>> Any way, I believe it is more like philosophical subject, than
>> technical.
> I think it is important to acknowledge that people come from 
> different
> backgrounds, and knowing that to do our best to curb 
> misunderstandings.
> Comparing Guix' package definitions to other package managers 
> makes it
> obvious as to why that is the case.  Let me pick Gentoo ebuilds 
> as an
> example (it's quicker to explain than whatever Debian has).
> There are five (as opposed to three in Guix) kinds of 
> dependencies:
> - DEPEND, aka build-time dependencies,
> - RDEPEND, aka run-time dependencies,
> - BDEPEND, aka native build-time dependencies,
> - IDEPEND, aka native install-time dependenices, and
> - PDEPEND, aka what the fuck, I think I just introduced a cycle
> somewhere.
> When you say "build-time dependencies go into native inputs", 
> someone
> with a shallow understanding might think that *all* build time
> dependencies are native inputs, when in fact only build time 
> tools
> (i.e. BDEPEND in Gentoo parlance) would go there.
>
> In other systems, it might be acceptable to have a package 
> depend on
> some other package without said dependency being present at 
> build time.
> Consider a shell script that wraps youtube-dl.  Since youtube-dl 
> exists
> at some point between installation and first use, your shell 
> script
> works™ whether or not youtube-dl is present at build.  Some 
> packages in
> Guix do work that way, though it's a pretty rare occurrence. 
> GStreamer
> is one with a legitimate excuse, for example.  Other than that, 
> *all*
> "dependencies" (actually inputs) are present at build time, so 
> it makes
> no sense to distinguish between build time and run time.  Guix 
> knows
> which packages it can delete from the store by tracking 
> references.
> What Guix needs to distinguish is whether the package is invoked 
> at
> build time (native-inputs) or whether it needs to be installed
> alongside the package being built (propagated-inputs) against 
> none of
> the two (regular inputs).
IMHO, this kind of judgement arises from one's experience, 
demands,
intuition etc. I.e. personal perception. One could just make it 
working
somehow, another could have experience in what is being done, 
another
could stress things to the limits. If it would be up to me, I 
would put
everything into (native-inputs) and then gradually move things to
(inputs) and (propagated-inputs) as needed (of course I'm not 
doing
that, I just want to show the point, that everybody's judgement is
not the same :)). From what you are saying, if it is really 
requires
such level of control, I suppose that there should be a chapter in
a guide on how to measure dependencies, with examples and 
reasoning
behind them, just like you mentioned GStreamer case, probably 
updated
with time from discussions like this. This could help to bring 
people
more or less on the same page.

> So the next time you try to explain things to a first-timer, be 
> clear
> that native-inputs is for tools like compilers, linkers, code
> generators *invoked* at build time.  It will be less confusing 
> to learn
> it correctly the first time round rather than having to argue in 
> the
> mailing lists when submitting some patch.  I understand that 
> keeping
> one piece of extra information in mind can be hard at times and 
> the
> temptation to simplify is always there, but in the long term no 
> one
> benefits from oversimplification.
IMHO, for one it is unfair and/or unwise to treat everybody in the 
same
way, there could be one who barely saw compiler (if at all), and 
one
who did kernel development on embedded hardware :) I believe that,
especially with new comers, it is always depends on case by case 
basis.

> Sorry for making you read this huge wall of text and happy 
> hacking :)
No issue, always good for practice, and history :)
Liliana Marie Prikler Sept. 17, 2021, 5:01 p.m. UTC | #7
Hi,

Am Freitag, den 17.09.2021, 17:11 +0300 schrieb muradm:
> [...]
> I suppose it is impossible, upstream patches are for source in 
> git, gtk+ package is being built from post-processed source tarball.
> When patching upstream target is configure.ac and meson.build, when
> patching source tarball, configure script it self.
You can simply delete the generated configure file and Guix will
bootstrap it again.  So yes, you should be able to apply the upstream
patch.

> [...]
> Btw, gtk+'s native-inputs are interesting tho.. :)
In which way?

> [...]
> > This still doesn't explain the *native*-inputs assertion.
> As you point out below: "... the package is invoked at build time
> (native-inputs) ...", in cases 1, 2 and 3 above, wayland-protocols
> package is needed once, when 1, 2 or 3 target is being built. No 
> other time wayland-protocols package is needed. This is the reason
> why I decided initially to keep it in (native-inputs), because 
> definition of (native-inputs) as you explaining in this conversation
> and as explained in Guix manual, best matches with nature of
> wayland-protocols, at least in my understanding :)
This might be a bit pedantic, but *invoking* and *needing* are
different verbs, particularly in computing.  So no, you're just
confused and trying to justify your confusion.

> [...]
> > In other systems, it might be acceptable to have a package 
> > depend on some other package without said dependency being present
> > at build time. Consider a shell script that wraps youtube-
> > dl.  Since youtube-dl exists at some point between installation and
> > first use, your shell script works™ whether or not youtube-dl is
> > present at build.  Some packages in Guix do work that way, though
> > it's a pretty rare occurrence.  GStreamer is one with a legitimate
> > excuse, for example.  Other than that, *all* "dependencies"
> > (actually inputs) are present at build time, so it makes
> > no sense to distinguish between build time and run time.  Guix 
> > knows which packages it can delete from the store by tracking 
> > references.  What Guix needs to distinguish is whether the package
> > is invoked at build time (native-inputs) or whether it needs to be
> > installed alongside the package being built (propagated-inputs)
> > against none of the two (regular inputs).
> IMHO, this kind of judgement arises from one's experience, 
> demands, intuition etc. I.e. personal perception. One could just make
> it working somehow, another could have experience in what is being
> done, another could stress things to the limits. If it would be up to
> me, I would put everything into (native-inputs) and then gradually
> move things to (inputs) and (propagated-inputs) as needed (of course
> I'm not doing that, I just want to show the point, that everybody's
> judgement is not the same :)). 
This reasoning is dangerously close to the "From my point of view" line
from a prequel to a famous space opera.

While yes, you do get an understanding of what belongs where over time,
the manual does provide guidelines that prohibit the "everything is
native" approach.

> From what you are saying, if it is really requires such level of
> control, I suppose that there should be a chapter in a guide on how
> to measure dependencies, with examples and reasoning behind them,
> just like you mentioned GStreamer case, probably updated with time
> from discussions like this. This could help to bring people more or
> less on the same page.
GStreamer doesn't even concern the native-input vs. input dispute.  It
concerns the having something as an input vs. not having it.

> > So the next time you try to explain things to a first-timer, be 
> > clear that native-inputs is for tools like compilers, linkers, code
> > generators *invoked* at build time.  It will be less confusing 
> > to learn it correctly the first time round rather than having to
> > argue in the mailing lists when submitting some patch.  I
> > understand that keeping one piece of extra information in mind can
> > be hard at times and the temptation to simplify is always there,
> > but in the long term no one benefits from oversimplification.
> IMHO, for one it is unfair and/or unwise to treat everybody in the 
> same way, there could be one who barely saw compiler (if at all),
> and one who did kernel development on embedded hardware :) I believe
> that, especially with new comers, it is always depends on case by
> case basis.
I think when it comes to the point that you're packaging software for
any distro, you ought to be able to distinguish tools from things that
are not tools.  While I'm pretty sure that there are some entities out
there claiming that a bunch of XML files are a tool, I for one don't
think wayland-protocols does that.

Regards
Maxime Devos Oct. 6, 2022, 8:18 a.m. UTC | #8
Hi,

Removing a propagated input from gtk (by moving it to native-inputs) 
sounds good, but I don't see the point of the inputs->native-inputs 
changes.  Now I see there is a revised patch at

<https://issues.guix.gnu.org/50627#8>

(albeit named v1 instead of v2).

Some comments on the new patch:

> diff --git a/gnu/packages/patches/gtk3-wayland-protocols-dependency.patch b/gnu/packages/patches/gtk3-wayland-protocols-dependency.patch
> new file mode 100644
> index 0000000000..03196713bc
> --- /dev/null
> +++ b/gnu/packages/patches/gtk3-wayland-protocols-dependency.patch
> @@ -0,0 +1,23 @@
> +diff --git a/configure b/configure
> +index edd41ad..cb36877 100755
> +--- a/configure
> ++++ b/configure
> [...]

'configure' is generated stuff, not source code, so now the result of 
"guix build --source" is missing some source code (i.e., the revisions 
to configure.ac).

Proposal: modify configure.ac instead, add autotools inputs and delete 
'configure' such that Guix will automatically run autoreconf, see 
<https://lists.gnu.org/archive/html/guix-devel/2022-04/msg00009.html>.

Greetings,
Maxime