[Spice-devel] [PATCH spice-gtk 3/3] meson: don't link with all dependencies

Frediano Ziglio fziglio at redhat.com
Wed Jan 2 12:01:36 UTC 2019


> 
> From: Marc-André Lureau <marcandre.lureau at redhat.com>
> 
> Split lib dependencies in 3 groups: glib, gtk, and acl.
> 
> Fixes:
> https://gitlab.freedesktop.org/spice/spice-gtk/issues/77
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
> ---
>  meson.build     | 46 ++++++++++++++++++++++++++--------------------
>  src/meson.build | 10 +++++-----
>  2 files changed, 31 insertions(+), 25 deletions(-)
> 
> diff --git a/meson.build b/meson.build
> index 67149e7..8c3faea 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -31,7 +31,9 @@ spice_gtk_global_cflags = ['-DHAVE_CONFIG_H',
>  compiler = meson.get_compiler('c')
>  spice_gtk_config_data = configuration_data()
>  spice_gtk_include = [include_directories('.')]
> +spice_glib_deps = []
>  spice_gtk_deps = []
> +spice_acl_deps = []
>  spice_gtk_host_system = host_machine.system()
>  
>  #
> @@ -39,7 +41,7 @@ spice_gtk_host_system = host_machine.system()
>  #
>  spice_common = subproject('spice-common', default_options :
>  ['generate-code=client'])
>  spice_gtk_config_data.merge_from(spice_common.get_variable('spice_common_config_data'))
> -spice_gtk_deps += spice_common.get_variable('spice_common_client_dep')
> +spice_glib_deps += spice_common.get_variable('spice_common_client_dep')
>  
>  #
>  # check for system headers
> @@ -85,7 +87,7 @@ deps = {'spice-protocol' : spice_protocol_version,
>          'openssl'        : '>= 1.0.0'}
>  
>  foreach dep, version : deps
> -  spice_gtk_deps += dependency(dep, version : version)
> +  spice_glib_deps += dependency(dep, version : version)
>  endforeach
>  
>  # mandatory dependencies, without specific version requirement
> @@ -98,7 +100,7 @@ else
>  endif
>  
>  foreach dep : deps
> -  spice_gtk_deps += dependency(dep)
> +  spice_glib_deps += dependency(dep)
>  endforeach
>  
>  deps = ['librt', 'libm']
> @@ -107,7 +109,7 @@ if spice_gtk_host_system == 'windows'
>  endif
>  
>  foreach dep : deps
> -  spice_gtk_deps += compiler.find_library(dep)
> +  spice_glib_deps += compiler.find_library(dep)
>  endforeach
>  
>  #
> @@ -118,7 +120,7 @@ optional_deps = {'celt051' : '>= 0.5.1.1',
>  foreach dep, version : optional_deps
>    d = dependency(dep, required : get_option(dep), version : version)
>    if d.found()
> -    spice_gtk_deps += d
> +    spice_glib_deps += d
>      spice_gtk_config_data.set('HAVE_ at 0@'.format(dep.underscorify().to_upper()),
>      '1')
>    endif
>  endforeach
> @@ -138,8 +140,8 @@ endif
>  # webdav
>  spice_gtk_has_phodav = false
>  if get_option('webdav')
> -  spice_gtk_deps += dependency('libphodav-2.0')
> -  spice_gtk_deps += dependency('libsoup-2.4', version : '>= 2.49.91')
> +  spice_glib_deps += dependency('libphodav-2.0')
> +  spice_glib_deps += dependency('libsoup-2.4', version : '>= 2.49.91')
>    spice_gtk_config_data.set('USE_PHODAV', '1')
>    spice_gtk_has_phodav = true
>  endif
> @@ -149,7 +151,7 @@ spice_gtk_has_pulse = false
>  if get_option('pulse')
>    deps = ['libpulse', 'libpulse-mainloop-glib']
>    foreach dep : deps
> -    spice_gtk_deps += dependency(dep)
> +    spice_glib_deps += dependency(dep)
>    endforeach
>    spice_gtk_config_data.set('HAVE_PULSE', '1')
>    spice_gtk_has_pulse = true
> @@ -161,7 +163,7 @@ spice_gtk_has_gstaudio = false
>  if get_option('gstaudio')
>    deps = gst_base_deps + ['gstreamer-audio-1.0']
>    foreach dep : deps
> -    spice_gtk_deps += dependency(dep)
> +    spice_glib_deps += dependency(dep)
>    endforeach
>    spice_gtk_config_data.set('HAVE_GSTAUDIO', '1')
>    spice_gtk_has_gstaudio = true
> @@ -175,7 +177,7 @@ if get_option('gstvideo')
>      deps += gst_base_deps
>    endif
>    foreach dep : deps
> -    spice_gtk_deps += dependency(dep)
> +    spice_glib_deps += dependency(dep)
>    endforeach
>    spice_gtk_config_data.set('HAVE_GSTVIDEO', '1')
>    spice_gtk_has_gstvideo = true
> @@ -199,21 +201,21 @@ if get_option('usbredir')
>    if not usb_dep.found()
>      usb_dep = dependency('libusbredirparser', version : '>= 0.4')
>    endif
> -  spice_gtk_deps += usb_dep
> +  spice_glib_deps += usb_dep
>  
>    deps = {'libusbredirhost' : '>= 0.4.2',
>            'libusb-1.0' : '>= 1.0.9'}
>  
>    foreach dep, version : deps
>      usb_dep = dependency(dep, version : version)
> -    spice_gtk_deps += usb_dep
> +    spice_glib_deps += usb_dep
>    endforeach
>  
>    if spice_gtk_host_system != 'windows'
>      if usb_dep.version().version_compare('>= 1.0.16')
>        spice_gtk_config_data.set('USE_LIBUSB_HOTPLUG', '1')
>      else
> -      spice_gtk_deps += dependency('gudev-1.0')
> +      spice_glib_deps += dependency('gudev-1.0')
>        spice_gtk_config_data.set('USE_GUDEV', '1')
>      endif
>    endif
> @@ -239,11 +241,11 @@ if get_option('polkit')
>        if not compiler.has_function('acl_get_file', dependencies : acl_dep)
>          error('PolicyKit support requested, but some required packages are
>          not available')
>        endif
> -      spice_gtk_deps += acl_dep
> +      spice_acl_deps += acl_dep
>      endif
>    endif
>  
> -  spice_gtk_deps += polkit_dep
> +  spice_acl_deps += polkit_dep

why not adding gio-unix-2.0 dependency here?

>    spice_gtk_config_data.set('USE_POLKIT', '1')
>    spice_gtk_has_polkit = true
>  endif
> @@ -252,6 +254,10 @@ if spice_gtk_has_usbredir and not spice_gtk_has_polkit
>    warning('Building with usbredir support, but *not* building the usb acl
>    helper')
>  endif
>  
> +if spice_gtk_has_polkit
> +  spice_acl_deps += dependency('gio-unix-2.0')
> +endif
> +

from here.

>  # pie
>  spice_gtk_has_pie = false
>  if get_option('pie')
> @@ -303,7 +309,7 @@ endif
>  # introspection
>  spice_gtk_has_introspection = false
>  if get_option('introspection')
> -  spice_gtk_deps += dependency('gobject-introspection-1.0', version : '>=
> 0.94')
> +  spice_glib_deps += dependency('gobject-introspection-1.0', version : '>=
> 0.94')
>    spice_gtk_has_introspection = true
>  endif
>  
> @@ -331,7 +337,7 @@ if get_option('lz4')
>      lz4_dep = dependency('liblz4', version : '>= 1.7.3')
>    endif
>  
> -  spice_gtk_deps += lz4_dep
> +  spice_glib_deps += lz4_dep
>    spice_gtk_config_data.set('USE_LZ4', '1')
>    spice_gtk_has_lz4 = true
>  endif
> @@ -339,7 +345,7 @@ endif
>  # sasl
>  spice_gtk_has_sasl = false
>  if get_option('sasl')
> -  spice_gtk_deps += dependency('libsasl2')
> +  spice_glib_deps += dependency('libsasl2')
>    spice_gtk_config_data.set('HAVE_SASL', '1')
>    spice_gtk_has_sasl = true
>  endif
> @@ -349,12 +355,12 @@ spice_gtk_has_smartcard = false
>  if get_option('smartcard')
>    smartcard_dep = dependency('libcacard', required : false, version : '>=
>    2.5.1')
>    if smartcard_dep.found()
> -    spice_gtk_deps += smartcard_dep
> +    spice_glib_deps += smartcard_dep
>      spice_gtk_config_data.set('USE_SMARTCARD', '1')
>    else
>      smartcard012_dep = dependency('libcacard', required : false, version :
>      '>= 0.1.2')
>      if smartcard012_dep.found()
> -      spice_gtk_deps += smartcard012_dep
> +      spice_glib_deps += smartcard012_dep
>        spice_gtk_config_data.set('USE_SMARTCARD_012', '1')
>      endif
>    endif
> diff --git a/src/meson.build b/src/meson.build
> index a8e1d05..6bbb96b 100644
> --- a/src/meson.build
> +++ b/src/meson.build
> @@ -199,12 +199,12 @@ spice_client_glib_lib =
> library('spice-client-glib-2.0', spice_client_glib_sourc
>                                  include_directories : spice_gtk_include,
>                                  link_args : [spice_gtk_version_script],
>                                  link_depends : spice_client_glib_syms,
> -                                dependencies : spice_gtk_deps)
> +                                dependencies : spice_glib_deps)
>  
>  spice_client_glib_dep = declare_dependency(sources : [spice_marshals[1],
>  spice_client_glib_enums[1]],
>                                             link_with :
>                                             spice_client_glib_lib,
>                                             include_directories :
>                                             spice_gtk_include,
> -                                           dependencies : spice_gtk_deps)
> +                                           dependencies : spice_glib_deps)
>  
>  #
>  # SpiceClientGLib-2.0.gir
> @@ -234,7 +234,7 @@ if spice_gtk_has_polkit
>               install : true,
>               install_dir : spice_gtk_usb_acl_helper_dir,
>               install_mode : ['rwsr-xr-x', 'root', 'root'],
> -             dependencies : spice_gtk_deps,
> +             dependencies : spice_acl_deps,
>               pie : spice_gtk_has_pie
>              )
>  endif
> @@ -340,11 +340,11 @@ if spice_gtk_has_gtk
>                                   install : true,
>                                   link_args : [spice_gtk_version_script],
>                                   link_depends : spice_client_gtk_syms,
> -                                 dependencies : spice_client_glib_dep)
> +                                 dependencies : [spice_client_glib_dep,
> spice_gtk_deps])
>  
>    spice_client_gtk_dep = declare_dependency(sources : spice_widget_enums[1],
>                                              link_with :
>                                              spice_client_gtk_lib,
> -                                            dependencies :
> spice_client_glib_dep)
> +                                            dependencies :
> [spice_client_glib_dep, spice_gtk_deps])
>  
>    #
>    # SpiceClientGtk-3.0.gir

Otherwise it seems good, working and more similar to autoconf.

Frediano


More information about the Spice-devel mailing list