[Spice-devel] [PATCH spice-common] fixup! meson build

Jonathon Jongsma jjongsma at redhat.com
Thu May 24 15:53:08 UTC 2018


On Thu, 2018-05-24 at 12:41 -0300, Eduardo Lima (Etrunko) wrote:
> On 24/05/18 12:31, Jonathon Jongsma wrote:
> > On Wed, 2018-05-23 at 15:23 -0300, Eduardo Lima (Etrunko) wrote:
> > > On 23/05/18 11:43, Frediano Ziglio wrote:
> > > > > 
> > > > > Signed-off-by: Eduardo Lima (Etrunko) <etrunko at redhat.com>
> > > > > ---
> > > > >  meson.build       | 14 ++++++++++----
> > > > >  meson_options.txt |  5 +++++
> > > > >  2 files changed, 15 insertions(+), 4 deletions(-)
> > > > > 
> > > > > diff --git a/meson.build b/meson.build
> > > > > index 9d44604..cd75c51 100644
> > > > > --- a/meson.build
> > > > > +++ b/meson.build
> > > > > @@ -90,11 +90,14 @@ endforeach
> > > > >  #
> > > > >  # check for mandatory dependencies
> > > > >  #
> > > > > -glib_version_info = '>= 2.46'
> > > > > -glib_encoded_version = 'GLIB_VERSION_2_46'
> > > > >  spice_protocol_version = '>=
> > > > > @0@'.format(get_option('protocol-
> > > > > version'))
> > > > >  
> > > > > -deps = [['spice-protocol', spice_protocol_version],
> > > > > +glib_version = get_option('glib-version')
> > > > > +glib_major_minor = glib_version.split('.')
> > > > > +glib_version_info = '>= @0 at .@1@'.format(glib_major_minor[0],
> > > > > glib_major_minor[1])
> > > > > +glib_encoded_version = 'GLIB_VERSION_ at 0@_ at 1@'.format(glib_ma
> > > > > jor_
> > > > > minor[0],
> > > > > glib_major_minor[1])
> > > > > +
> > > > > +deps = [['spice-protocol', '>=
> > > > > @0@'.format(get_option('protocol-
> > > > > version'))],
> > > > >          ['glib-2.0', glib_version_info],
> > > > >          ['gobject-2.0', glib_version_info],
> > > > >          ['gio-2.0', glib_version_info],
> > > > > @@ -115,8 +118,11 @@ spice_common_global_cflags +=
> > > > > spice_common_glib_cflags
> > > > >  # Non-mandatory/optional dependencies
> > > > >  #
> > > > >  deps = [['opus', '>= 0.9.14', 'HAVE_OPUS'],]
> > > > > -optional_deps = [['celt051', '>= 0.5.1.1', 'HAVE_CELT051'],]
> > > > >  
> > > > > +# Check deps which are optional but enabled by default. This
> > > > > foreach block
> > > > > only
> > > > > +# checks the option, and adds the package to the deps list,
> > > > > while the real
> > > > > check
> > > > > +# for the dependency is done in the foeach block below.
> > > > > +optional_deps = [['celt051', '>= 0.5.1.1', 'HAVE_CELT051'],]
> > > > >  foreach dep : optional_deps
> > > > >    if get_option(dep[0])
> > > > >      deps += [dep]
> > > > > diff --git a/meson_options.txt b/meson_options.txt
> > > > > index 8e27cbf..b2a38e7 100644
> > > > > --- a/meson_options.txt
> > > > > +++ b/meson_options.txt
> > > > > @@ -26,6 +26,11 @@ option('manual',
> > > > >      yield : true,
> > > > >      description : 'Build SPICE manual (default=true)')
> > > > >  
> > > > > +option('glib-version',
> > > > > +    type : 'string',
> > > > > +    value : '2.38',
> > > > > +    description : 'Glib version required (default=2.38)')
> > > > > +
> > > > >  option('protocol-version',
> > > > >      type : 'string',
> > > > >      value : '0.12.12',
> > > > 
> > > > Both glib-version and protocol-version, not clear why we don't
> > > > need this for autoconf but this is needed for Meson.
> > > > I think there were discussions about removing protocol-version
> > > > option too.
> > > 
> > > The reason is that server and client both require different
> > > versions
> > > of
> > > glib, and the check is only done here in spice-common. So we need
> > > some
> > > way to tell which version we require. If none specified, fallback
> > > to
> > > the
> > > default value.
> > 
> > But why can't we just check for glib in the other projects as well?
> > This option seems a bit odd to me.
> 
> We can for sure, but that would mean we will be checking for it
> twice,
> and it could be a bit messy, for instance, the configure phase will
> check for a glib version for spice-common that satisfies the
> requirement
> but when the check is done again for server or gtk, the version
> required
> is higher and it will fail. So, why not fail straight away?
> 
> Doing the check twice, will also mean that the dependencies will be
> added twice, and the command line will add up a lot (not sure if
> meson
> is smart to not add the same flags twice).

Would be interesting to know.

> 
> Finally, if this is done for glib case, for the sake of consistency,
> I
> think we should do the same for all other dependencies that are
> required
> for both server and client.

Well, to me it seems like the right thing to do would be to specify the
dependencies needed within each project. If we rely on subprojects to
drag the dependencies in, then we are susceptible to changes in the
subproject affecting the parent project. That's how we do it for
autotools, right?

Jonathon


More information about the Spice-devel mailing list