Re: [PATCH spice-gtk 1/3] Add support for building with meson

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey,

So I've experimented with this today, couple of comments/suggested
improvements/fixes/missing things/...
It might be worth to have some short document somewhere describing the
meson/ninja equivalent for (at least)
make CFLAGS="-Wno-error"
./configure (eg meson configure --prefix "/home/foo")
make dist
make check

I noticed "ninja" does not build the tests while "make" does. During the
tests,  test-mock-acl-helper is considered a standalone test which
should be run as part of "ninja test", while it's not supposed to be run
this way, it's a helper for usb-acl-helper.c

I don't know how to skip the error:
"Installing /home/teuf/redhat/spice-gtk/data/org.spice-space.lowlevelusbaccess.policy to /usr/share/polkit-1/actions"
"PermissionError: [Errno 13] Permission denied: '/usr/share/polkit-1/actions/org.spice-space.lowlevelusbaccess.policy'"
(ie is there a 'make -k' equivalent?)
src/meson.build still has:
  # FIXME: provide install script for setuid https://github.com/mesonbuild/meson/issues/3328
  #-chown root $(DESTDIR)$(acldir)/spice-client-glib-usb-acl-helper
  #-chmod u+s  $(DESTDIR)$(acldir)/spice-client-glib-usb-acl-helper

We also lost this bit of magic with meson, -Werror is always enabled,
while with autoconf/automake we had:

    AC_ARG_ENABLE([werror],
                  AS_HELP_STRING([--enable-werror], [Use -Werror (if supported)]),
                  [set_werror="$enableval"],
                  [if test -d $srcdir/.git; then
                     is_git_version=true
                     set_werror=yes
                   else
                     set_werror=no
                   fi])
so that when building release tarballs we don't have -Werror by default.

See attachment for some proposed changes that can be squashed in.

Christophe


On Fri, Apr 27, 2018 at 04:25:41PM -0300, Eduardo Lima (Etrunko) wrote:
> Signed-off-by: Eduardo Lima (Etrunko) <etrunko@xxxxxxxxxx>
> ---
>  Makefile.am                   |   4 +
>  data/Makefile.am              |   1 +
>  data/meson.build              |   4 +
>  doc/Makefile.am               |   2 +
>  doc/meson.build               |   1 +
>  doc/reference/Makefile.am     |   2 +
>  doc/reference/meson.build     |  51 ++++++
>  man/Makefile.am               |   1 +
>  man/meson.build               |  11 ++
>  meson.build                   | 405 ++++++++++++++++++++++++++++++++++++++++++
>  meson_options.txt             |  94 ++++++++++
>  po/meson.build                |   3 +
>  src/Makefile.am               |   1 +
>  src/meson.build               | 371 ++++++++++++++++++++++++++++++++++++++
>  subprojects/spice-common.wrap |   4 +
>  tests/Makefile.am             |   2 +
>  tests/meson.build             |  28 +++
>  tools/Makefile.am             |   2 +
>  tools/meson.build             |  30 ++++
>  vapi/Makefile.am              |   1 +
>  vapi/meson.build              |  13 ++
>  21 files changed, 1031 insertions(+)
>  create mode 100644 data/meson.build
>  create mode 100644 doc/meson.build
>  create mode 100644 doc/reference/meson.build
>  create mode 100644 man/meson.build
>  create mode 100644 meson.build
>  create mode 100644 meson_options.txt
>  create mode 100644 po/meson.build
>  create mode 100644 src/meson.build
>  create mode 100644 subprojects/spice-common.wrap
>  create mode 100644 tests/meson.build
>  create mode 100644 tools/meson.build
>  create mode 100644 vapi/meson.build
> 
> diff --git a/Makefile.am b/Makefile.am
> index 8717cbc..7d7faf4 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -25,6 +25,10 @@ endif
>  DISTCLEANFILES = $(pkgconfig_DATA)
>  
>  EXTRA_DIST =					\
> +	meson.build				\
> +	meson_options.txt			\
> +	po/meson.build				\
> +	subprojects/spice-common.wrap		\
>  	build-aux/git-version-gen		\
>  	gtk-doc.make				\
>  	.version				\
> diff --git a/data/Makefile.am b/data/Makefile.am
> index 59e90f9..457079e 100644
> --- a/data/Makefile.am
> +++ b/data/Makefile.am
> @@ -1,6 +1,7 @@
>  NULL=
>  
>  EXTRA_DIST =						\
> +	meson.build					\
>  	org.spice-space.lowlevelusbaccess.policy	\
>  	$(NULL)
>  
> diff --git a/data/meson.build b/data/meson.build
> new file mode 100644
> index 0000000..ba549eb
> --- /dev/null
> +++ b/data/meson.build
> @@ -0,0 +1,4 @@
> +if spice_gtk_has_polkit
> +  install_data('org.spice-space.lowlevelusbaccess.policy',
> +               install_dir : spice_gtk_policy_dir)
> +endif
> diff --git a/doc/Makefile.am b/doc/Makefile.am
> index 034926c..870cd26 100644
> --- a/doc/Makefile.am
> +++ b/doc/Makefile.am
> @@ -1,3 +1,5 @@
>  SUBDIRS = reference
>  
> +EXTRA_DIST = meson.build
> +
>  -include $(top_srcdir)/git.mk
> diff --git a/doc/meson.build b/doc/meson.build
> new file mode 100644
> index 0000000..ead14c4
> --- /dev/null
> +++ b/doc/meson.build
> @@ -0,0 +1 @@
> +subdir('reference')
> diff --git a/doc/reference/Makefile.am b/doc/reference/Makefile.am
> index 9fda456..0cc26c9 100644
> --- a/doc/reference/Makefile.am
> +++ b/doc/reference/Makefile.am
> @@ -66,6 +66,8 @@ GTKDOC_LIBS = $(top_builddir)/src/libspice-client-glib-2.0.la $(top_builddir)/sr
>  
>  include $(top_srcdir)/gtk-doc.make
>  
> +EXTRA_DIST += meson.build
> +
>  # Comment this out if you want 'make check' to test you doc status
>  # and run some sanity checks
>  if ENABLE_GTK_DOC
> diff --git a/doc/reference/meson.build b/doc/reference/meson.build
> new file mode 100644
> index 0000000..7ac703f
> --- /dev/null
> +++ b/doc/reference/meson.build
> @@ -0,0 +1,51 @@
> +ignore_headers = [
> +  'bio-gio.h',
> +  'channel-display-priv.h',
> +  'channel-usbredir-priv.h',
> +  'client_sw_canvas.h',
> +  'continuation.h',
> +  'coroutine.h',
> +  'decode.h',
> +  'desktop-integration.h',
> +  'display',
> +  'gio-coroutine.h',
> +  'giopipe.h',
> +  'smartcard-manager-priv.h',
> +  'spice-audio-priv.h',
> +  'spice-channel-cache.h',
> +  'spice-channel-priv.h',
> +  'spice-cmdline.h',
> +  'spice-common.h',
> +  'spice-file-transfer-task-priv.h',
> +  'spice-grabsequence-priv.h',
> +  'spice-gstaudio.h',
> +  'spice-gtk-session-priv.h',
> +  'spice-marshal.h',
> +  'spice-pulse.h',
> +  'spice-session-priv.h',
> +  'spice-uri-priv.h',
> +  'spice-util-priv.h',
> +  'spice-widget-priv.h',
> +  'spicy-connect.h',
> +  'usb-acl-helper.h',
> +  'usb-device-manager-priv.h',
> +  'usbdk_api.h',
> +  'usbutil.h',
> +  'vmcstream.h',
> +  'vncdisplaykeymap.h',
> +  'win-usb-dev.h',
> +]
> +
> +spice_gtk_doc_dep = declare_dependency(include_directories: spice_gtk_include,
> +                                       link_args : spice_gtk_link_args,
> +                                       link_with : [spice_client_gtk_lib, spice_client_glib_lib])
> +
> +gnome.gtkdoc('spice-gtk',
> +             content_files : ['spice-gtk-overrides.txt', 'spice-gtk-overrides.txt'],
> +             dependencies : spice_gtk_doc_dep,
> +             main_xml : 'spice-gtk-docs.xml',
> +             gobject_typesfile : files('spice-gtk.types'),
> +             ignore_headers : ignore_headers,
> +             install : true,
> +             scan_args : ['--deprecated-guards="SPICE_DISABLE_DEPRECATED"', '--ignore-decorators="G_GNUC_INTERNAL"'],
> +             src_dir : join_paths(meson.source_root(), 'src'))
> diff --git a/man/Makefile.am b/man/Makefile.am
> index a8f7e3f..7d5341b 100644
> --- a/man/Makefile.am
> +++ b/man/Makefile.am
> @@ -5,6 +5,7 @@ dist_man_MANS =					\
>  	$(NULL)
>  
>  EXTRA_DIST =					\
> +	meson.build				\
>  	spice-client.pod			\
>  	$(NULL)
>  
> diff --git a/man/meson.build b/man/meson.build
> new file mode 100644
> index 0000000..de07ba4
> --- /dev/null
> +++ b/man/meson.build
> @@ -0,0 +1,11 @@
> +pod2man = find_program('pod2man')
> +
> +if pod2man.found()
> +  custom_target('spice-client.1',
> +            output : 'spice-client.1',
> +            input : 'spice-client.pod',
> +            install : true,
> +            install_dir : join_paths(spice_gtk_datadir, 'man', 'man1'),
> +            build_by_default : true,
> +            command : [pod2man, '-c', 'Spice-GTK Documentation', '@INPUT@', '@OUTPUT@'])
> +endif
> diff --git a/meson.build b/meson.build
> new file mode 100644
> index 0000000..082ecae
> --- /dev/null
> +++ b/meson.build
> @@ -0,0 +1,405 @@
> +#
> +# project definition
> +#
> +# TODO: double check meson.project_version()
> +# Ideally we would use the output of git-version-gen as input for meson, because
> +# we can not check the result of the command before declaring project().
> +#
> +project('spice-gtk', 'c',
> +         version : run_command('build-aux/git-version-gen', '.tarball-version').stdout().strip(),
> +         license : 'LGPLv2.1',
> +         meson_version : '>= 0.46.0')
> +
> +#
> +# global C defines
> +#
> +spice_gtk_datadir = join_paths(get_option('prefix'), get_option('datadir'))
> +spice_gtk_locale_dir = join_paths(spice_gtk_datadir, 'locale')
> +spice_gtk_introspection_typelib_dir = join_paths(spice_gtk_datadir, 'girepository-1.0')
> +spice_gtk_libdir = join_paths(get_option('prefix'), get_option('libdir'))
> +spice_gtk_introspection_gir_dir = join_paths(spice_gtk_libdir, 'gir-1.0')
> +spice_gtk_global_cflags = [#'-std=c99', # fails compiling spice-common/bitops.h
> +                           '-DHAVE_CONFIG_H',
> +                           '-DSPICE_COMPILATION',
> +                           '-DG_LOG_DOMAIN="GSpice"',
> +                           '-DLOCALE_DIR="@0@"'.format(spice_gtk_locale_dir),
> +                           #'-Werror',
> +                           '-Wall',
> +                           '-Wextra',
> +                           '-Wno-sign-compare',
> +                           '-Wno-unused-parameter',
> +                           ]
> +
> +foreach arg : spice_gtk_global_cflags
> +  add_project_arguments(arg, language : 'c')
> +endforeach
> +
> +# other global vars
> +compiler = meson.get_compiler('c')
> +spice_gtk_config_data = configuration_data()
> +spice_protocol_min_version='0.12.13'
> +spice_gtk_include = [include_directories('.')]
> +spice_gtk_c_args = []
> +spice_gtk_libs = []
> +spice_gtk_deps = []
> +spice_gtk_link_args = []
> +spice_gtk_host_system = host_machine.system()
> +
> +#
> +# Spice common subproject
> +#
> +spice_common_options = ['protocol-version=@0@'.format(spice_protocol_min_version),
> +                        'generate-code=client']
> +
> +spice_common = subproject('spice-common', default_options : spice_common_options)
> +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')
> +
> +#
> +# check for system headers
> +#
> +headers = ['termios.h',
> +           'X11/XKBlib.h']
> +
> +foreach header : headers
> +  if compiler.has_header(header)
> +    spice_gtk_config_data.set('HAVE_@0@'.format(header.underscorify().to_upper()), '1')
> +  endif
> +endforeach
> +
> +spice_gtk_has_egl = compiler.has_header('epoxy/egl.h')
> +if spice_gtk_has_egl
> +    spice_gtk_config_data.set('HAVE_EPOXY_EGL_H', '1')
> +    spice_gtk_config_data.set('HAVE_EGL', '1') # FIXME: Use single define?
> +endif
> +#
> +# check for system functions
> +#
> +foreach func : ['clearenv', 'strtok_r']
> +  if compiler.has_function(func)
> +    spice_gtk_config_data.set('HAVE_@0@'.format(func.to_upper()), '1')
> +  endif
> +endforeach
> +
> +#
> +# check for mandatory dependencies
> +#
> +deps = ['cairo', 'libjpeg', 'zlib']
> +if spice_gtk_host_system == 'windows'
> +  deps += 'gio-windows-2.0'
> +else
> +  deps += 'gio-unix-2.0'
> +endif
> +
> +foreach dep : deps
> +  spice_gtk_deps += dependency(dep)
> +endforeach
> +
> +deps = ['librt', 'libm']
> +if spice_gtk_host_system == 'windows'
> +  deps += ['libws2_32', 'libgdi32']
> +endif
> +
> +foreach dep : deps
> +  spice_gtk_deps += compiler.find_library(dep)
> +endforeach
> +
> +#
> +# Non-mandatory/optional dependencies
> +#
> +
> +# gtk
> +spice_gtk_has_gtk = false
> +spice_gtk_gtk_version_required = '>= 3.12'
> +if get_option('gtk')
> +  gtk_dep = dependency('gtk+-3.0', version : spice_gtk_gtk_version_required)
> +  gtk_encoded_version='GDK_VERSION_3_12'
> +  spice_gtk_c_args += ['-DGDK_VERSION_MIN_REQUIRED=@0@'.format(gtk_encoded_version),
> +                       '-DGDK_VERSION_MAX_ALLOWED=@0@'.format(gtk_encoded_version)]
> +  if compiler.has_function('gdk_event_get_scancode', dependencies : gtk_dep)
> +    spice_gtk_config_data.set('HAVE_GDK_EVENT_GET_SCANCODE', '1')
> +  endif
> +  spice_gtk_deps += gtk_dep
> +  spice_gtk_deps += dependency('x11')
> +  if spice_gtk_host_system != 'windows'
> +    spice_gtk_deps += dependency('epoxy')
> +  endif
> +  spice_gtk_has_gtk = true
> +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_gtk_config_data.set('USE_PHODAV', '1')
> +  spice_gtk_has_phodav = true
> +endif
> +
> +# pulse
> +spice_gtk_has_pulse = false
> +if get_option('pulse')
> +  deps = ['libpulse', 'libpulse-mainloop-glib']
> +  foreach dep : deps
> +    spice_gtk_deps += dependency(dep)
> +  endforeach
> +  spice_gtk_config_data.set('HAVE_PULSE', '1')
> +  spice_gtk_has_pulse = true
> +endif
> +
> +# gstaudio
> +gst_base_deps = ['gstreamer-1.0', 'gstreamer-base-1.0', 'gstreamer-app-1.0']
> +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)
> +  endforeach
> +  spice_gtk_config_data.set('HAVE_GSTAUDIO', '1')
> +  spice_gtk_has_gstaudio = true
> +endif
> +
> +# gstvideo
> +spice_gtk_has_gstvideo = false
> +if get_option('gstvideo')
> +  deps = ['gstreamer-video-1.0']
> +  if not spice_gtk_has_gstaudio
> +    deps += gst_base_deps
> +  endif
> +  foreach dep : deps
> +    spice_gtk_deps += dependency(dep)
> +  endforeach
> +  spice_gtk_config_data.set('HAVE_GSTVIDEO', '1')
> +  spice_gtk_has_gstvideo = true
> +endif
> +
> +# builtin-mjpeg
> +spice_gtk_has_builtin_mjpeg = false
> +if get_option('builtin-mjpeg')
> +  spice_gtk_config_data.set('HAVE_BUILTIN_MJPEG', '1')
> +  spice_gtk_has_builtin_mjpeg = true
> +endif
> +
> +if not spice_gtk_has_gstvideo and not spice_gtk_has_builtin_mjpeg
> +  warning('No builtin MJPEG or GStreamer decoder, video will not be streamed')
> +endif
> +
> +# usbredir
> +spice_gtk_has_usbredir = false
> +if get_option('usbredir')
> +  usb_dep = dependency('libusbredirparser-0.5', required : false)
> +  if not usb_dep.found()
> +    usb_dep = dependency('libusbredirparser', version : '>= 0.4')
> +  endif
> +  spice_gtk_deps += usb_dep
> +
> +  deps = [['libusbredirhost', '>= 0.4.2'],
> +          ['libusb-1.0', '>= 1.0.9']]
> +
> +  foreach dep : deps
> +    usb_dep = dependency(dep[0], version : dep[1])
> +    spice_gtk_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_gtk_config_data.set('USE_GUDEV', '1')
> +    endif
> +  endif
> +
> +  spice_gtk_config_data.set('USE_USBREDIR', '1')
> +  spice_gtk_has_usbredir = true
> +endif
> +
> +# polkit
> +spice_gtk_has_polkit = false
> +if get_option('polkit')
> +  polkit_dep = dependency('polkit-gobject-1', version : '>= 0.96')# ,required : false)
> +  if polkit_dep.found()
> +    spice_gtk_policy_dir = polkit_dep.get_pkgconfig_variable('policydir')
> +    foreach func : ['polkit_authority_get_sync', 'polkit_authorization_result_get_dismissed']
> +      if compiler.has_function(func, dependencies : polkit_dep)
> +        spice_gtk_config_data.set('HAVE_@0@'.format(func.to_upper()), '1')
> +      endif
> +    endforeach
> +
> +    if not compiler.has_function('acl_get_file')
> +      acl_dep = compiler.find_library('acl')
> +      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
> +    endif
> +  endif
> +
> +  spice_gtk_deps += polkit_dep
> +  spice_gtk_config_data.set('USE_POLKIT', '1')
> +  spice_gtk_has_polkit = true
> +endif
> +
> +if spice_gtk_has_usbredir and not spice_gtk_has_polkit
> +  warning('Building with usbredir support, but *not* building the usb acl helper')
> +endif
> +
> +# pie
> +spice_gtk_has_pie = false
> +if get_option('pie')
> +  spice_gtk_has_pie = true
> +endif
> +
> +# usb-acl-helper-dir
> +spice_gtk_usb_acl_helper_dir = get_option('usb-acl-helper-dir')
> +if spice_gtk_usb_acl_helper_dir.strip() == ''
> +  spice_gtk_usb_acl_helper_dir = join_paths(get_option('prefix'), get_option('bindir'))
> +endif
> +spice_gtk_c_args += '-DACL_HELPER_PATH="@0@"'.format(spice_gtk_usb_acl_helper_dir)
> +
> +# usb-ids-path
> +spice_gtk_usb_ids_path = get_option('usb-ids-path')
> +if spice_gtk_usb_ids_path.strip() == ''
> +  usbutils = dependency('usbutils', required : false)
> +  if usbutils.found()
> +    spice_gtk_usb_ids_path = usbutils.get_pkgconfig_variable('usbids')
> +  endif
> +endif
> +
> +if spice_gtk_usb_ids_path.strip() != ''
> +  spice_gtk_config_data.set('WITH_USBIDS', '1')
> +  spice_gtk_c_args += '-DUSB_IDS="@0@"'.format(spice_gtk_usb_ids_path)
> +endif
> +
> +
> +# coroutine
> +spice_gtk_coroutine = get_option('coroutine')
> +if spice_gtk_coroutine == 'ucontext'
> +  if compiler.has_function('makecontext') and compiler.has_function('swapcontext') and compiler.has_function('getcontext')
> +    spice_gtk_config_data.set('WITH_UCONTEXT', '1')
> +    if spice_gtk_host_system == 'darwin'
> +      spice_gtk_config_data.set('_XOPEN_SOURCE', '1')
> +    endif
> +  else
> +    spice_gtk_coroutine = 'gthread'
> +  endif
> +endif
> +
> +if spice_gtk_coroutine == 'gthread'
> +  spice_gtk_config_data.set('WITH_GTHREAD', '1')
> +endif
> +
> +if spice_gtk_coroutine == 'winfiber'
> +  spice_gtk_config_data.set('WITH_WINFIBER', '1')
> +endif
> +
> +# introspection
> +spice_gtk_has_introspection = false
> +if get_option('introspection')
> +  spice_gtk_deps += dependency('gobject-introspection-1.0', version : '>= 0.94')
> +  spice_gtk_has_introspection = true
> +endif
> +
> +# vala (depends on introspection)
> +spice_gtk_has_vala = false
> +if spice_gtk_has_introspection and get_option('vapi')
> +  vapigen_dep = dependency('vapigen')
> +  vapidir = vapigen_dep.get_pkgconfig_variable('vapidir')
> +  vapigen = dependency('vapigen').get_pkgconfig_variable('vapigen')
> +  spice_gtk_has_vala = true
> +endif
> +
> +# dbus
> +if get_option('dbus')
> +  spice_gtk_config_data.set('USE_GDBUS', '1')
> +else
> +  warning('No D-Bus support, desktop integration and USB redirection may not work properly')
> +endif
> +
> +# lz4 FIXME: Duplicated in spice-server. Move check to spice-common (see smartcard below)?
> +spice_gtk_has_lz4 = false
> +if get_option('lz4')
> +  lz4_dep = dependency('liblz4', required : false, version : '>= 129')
> +  if not lz4_dep.found()
> +    lz4_dep = dependency('liblz4', version : '>= 1.7.3')
> +  endif
> +
> +  spice_gtk_deps += lz4_dep
> +  spice_gtk_config_data.set('USE_LZ4', '1')
> +  spice_gtk_has_lz4 = true
> +endif
> +
> +# sasl FIXME: Duplicated in spice-server. Move check to spice-common (see smartcard below)?
> +spice_gtk_has_sasl = false
> +if get_option('sasl')
> +  spice_gtk_deps += dependency('libsasl2')
> +  spice_gtk_config_data.set('HAVE_SASL', '1')
> +  spice_gtk_has_sasl = true
> +endif
> +
> +# checks for smartcard are done in spice_common
> +spice_gtk_has_smartcard = false
> +if get_option('smartcard')
> +  if not spice_common.get_variable('spice_common_has_smartcard')
> +    error('Building with smartcard support but dependency not found')
> +  else
> +    spice_gtk_has_smartcard = true
> +  endif
> +endif
> +
> +
> +#
> +# Subdirectories
> +#
> +subdir('src')
> +subdir('tools')
> +subdir('tests')
> +subdir('doc')
> +subdir('data')
> +subdir('man')
> +subdir('po')
> +subdir('vapi')
> +
> +#
> +# write config.h
> +#
> +proj_version = meson.project_version()
> +proj_name = meson.project_name()
> +config_data = [['VERSION', proj_version],
> +               ['PACKAGE_VERSION', proj_version],
> +               ['GETTEXT_PACKAGE', proj_name],
> +               ['PACKAGE_STRING', '@0@ @1@'.format(proj_name, proj_version)],
> +               ['PACKAGE_BUGREPORT', 'spice-devel@xxxxxxxxxxxxxxxxxxxxx']]
> +foreach conf : config_data
> +  spice_gtk_config_data.set_quoted(conf[0], conf[1])
> +endforeach
> +
> +configure_file(output : 'config.h',
> +               install : false,
> +               configuration : spice_gtk_config_data)
> +
> +#
> +# write spice-client-glib.pc
> +#
> +pkgconfig = import('pkgconfig')
> +pkgconfig.generate(name : 'spice-client-glib-2.0',
> +    version : meson.project_version(),
> +    description : 'SPICE Client GLib 2.0 library',
> +    subdirs : ['spice-client-glib-2.0'],
> +    libraries : spice_client_glib_lib,
> +    requires : ['spice-protocol >= @0@'.format(spice_protocol_min_version)],
> +    variables : ['exec_prefix=${prefix}'])
> +
> +#
> +# write spice-client-gtk.pc
> +#
> +if spice_gtk_has_gtk
> +  spice_gtk_requires = 'gtk+3.0 @0@ spice-client-glib-2.0'.format(spice_gtk_gtk_version_required)
> +  pkgconfig.generate(name : 'spice-client-gtk-3.0',
> +      version : meson.project_version(),
> +      description : 'SPICE Client Gtk 3.0 library',
> +      subdirs : ['spice-client-gtk-3.0'],
> +      libraries : spice_client_gtk_lib,
> +      requires : spice_gtk_requires,
> +      variables : ['exec_prefix=${prefix}'])
> +  endif
> diff --git a/meson_options.txt b/meson_options.txt
> new file mode 100644
> index 0000000..90ea24b
> --- /dev/null
> +++ b/meson_options.txt
> @@ -0,0 +1,94 @@
> +option('gtk',
> +    type : 'boolean',
> +    value : true,
> +    description: 'Enable gtk+ (default=true)')
> +
> +option('webdav',
> +    type : 'boolean',
> +    value : true,
> +    description: 'Enable webdav support (default=true)')
> +
> +option('pulse',
> +    type : 'boolean',
> +    value : true,
> +    description: 'Enable the PulseAudio backend (default=true)')
> +
> +option('gstaudio',
> +    type : 'boolean',
> +    value : true,
> +    description : 'Enable the GStreamer 1.0 audio backend (default=true)')
> +
> +option('gstvideo',
> +    type : 'boolean',
> +    value : true,
> +    description : 'Enable GStreamer video support (default=true)')
> +
> +option('builtin-mjpeg',
> +    type : 'boolean',
> +    value : true,
> +    description : 'Enable the builtin mjpeg video decoder (default=true)')
> +
> +option('usbredir',
> +    type : 'boolean',
> +    value : true,
> +    description : 'Enable usbredir support (default=true)')
> +
> +option('polkit',
> +    type : 'boolean',
> +    value : true,
> +    description : 'Enable PolicyKit support for the USB acl helper (default=true)')
> +
> +option('pie',
> +    type : 'boolean',
> +    value : true,
> +    description : 'Enable position-independent-executable support for the USB acl helper (default=true)')
> +
> +option('usb-acl-helper-dir',
> +    type : 'string',
> +    value : '',
> +    description : 'Directory where the USB ACL helper binary should be installed')
> +
> +option('usb-ids-path',
> +    type : 'string',
> +    value : '',
> +    description : 'Specify the path to usb.ids')
> +
> +option('coroutine',
> +    type : 'combo',
> +    choices : ['ucontext', 'gthread', 'winfiber'],
> +    description : 'Use ucontext or GThread for coroutines')
> +
> +option('introspection',
> +    type : 'boolean',
> +    value : true,
> +    description: 'Check for GObject instrospection requirements (default=true)')
> +
> +option('vapi',
> +    type : 'boolean',
> +    value : true,
> +    description: 'Check for vala requirements (default=true)')
> +
> +option('dbus',
> +    type : 'boolean',
> +    value : true,
> +    description: 'Enable dbus support for desktop integration (disabling automount) (default=true)')
> +
> +option('alignment-checks',
> +    type : 'boolean',
> +    value : false,
> +    description : 'Enable runtime checks for cast alignment (default=false)')
> +
> +option('lz4',
> +    type : 'boolean',
> +    value : true,
> +    description: 'Enable lz4 compression support (default=true)')
> +
> +option('sasl',
> +    type : 'boolean',
> +    value : true,
> +    description : 'Use cyrus SASL authentication (default=true)')
> +
> +option('smartcard',
> +    type : 'boolean',
> +    value : true,
> +    description : 'Enable smartcard support (default=true)')
> diff --git a/po/meson.build b/po/meson.build
> new file mode 100644
> index 0000000..60c27a7
> --- /dev/null
> +++ b/po/meson.build
> @@ -0,0 +1,3 @@
> +i18n = import('i18n')
> +i18n.gettext(meson.project_name(),
> +             args : '--directory=@0@'.format(meson.source_root()))
> diff --git a/src/Makefile.am b/src/Makefile.am
> index f49c766..d2a749c 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -25,6 +25,7 @@ CLEANFILES = $(GLIBGENS) $(KEYMAPS)
>  BUILT_SOURCES = $(GLIBGENS) $(KEYMAPS)
>  
>  EXTRA_DIST =					\
> +	meson.build				\
>  	decode-glz-tmpl.c			\
>  	$(KEYMAPS)				\
>  	$(KEYMAP_CSV)				\
> diff --git a/src/meson.build b/src/meson.build
> new file mode 100644
> index 0000000..1979e84
> --- /dev/null
> +++ b/src/meson.build
> @@ -0,0 +1,371 @@
> +spice_gtk_include += [include_directories('.')]
> +
> +#
> +# Source files for spice-client-glib
> +#
> +
> +# generate spice-version.h
> +version_info = meson.project_version().split('.')
> +major = '@0@'.format(version_info[0])
> +minor = '@0@'.format(version_info[1])
> +micro = version_info[2].split('-')[0]
> +if micro == ''
> +  micro = '0'
> +endif
> +version_data = configuration_data()
> +version_data.set('SPICE_GTK_MAJOR_VERSION', major)
> +version_data.set('SPICE_GTK_MINOR_VERSION', minor)
> +version_data.set('SPICE_GTK_MICRO_VERSION', micro)
> +spice_version_h = configure_file(input : 'spice-version.h.in',
> +                                 output : 'spice-version.h',
> +                                 configuration : version_data)
> +
> +spice_client_glib_headers = [
> +  spice_version_h,
> +  'channel-cursor.h',
> +  'channel-display.h',
> +  'channel-inputs.h',
> +  'channel-main.h',
> +  'channel-playback.h',
> +  'channel-port.h',
> +  'channel-record.h',
> +  'channel-smartcard.h',
> +  'channel-usbredir.h',
> +  'channel-webdav.h',
> +  'smartcard-manager.h',
> +  'spice-audio.h',
> +  'spice-channel.h',
> +  'spice-client.h',
> +  'spice-file-transfer-task.h',
> +  'spice-option.h',
> +  'spice-session.h',
> +  'spice-types.h',
> +  'spice-uri.h',
> +  'spice-util.h',
> +  'usb-device-manager.h',
> +]
> +
> +install_headers(spice_client_glib_headers, subdir : 'spice-client-glib-2.0')
> +
> +# generate spice-marshal.[ch]
> +gnome = import('gnome')
> +spice_marshals = gnome.genmarshal('spice-marshal', sources : 'spice-marshal.txt')
> +
> +# generate spice-glib-enums.[ch]
> +spice_client_glib_enums = gnome.mkenums_simple('spice-glib-enums',
> +                                               sources : ['spice-channel.h', 'channel-inputs.h', 'spice-session.h'],
> +                                               install_header : true,
> +                                               install_dir : 'spice-client-glib-2.0')
> +
> +spice_client_glib_introspection_sources = [
> +  spice_client_glib_headers,
> +  spice_client_glib_enums,
> +  'channel-cursor.c',
> +  'channel-display.c',
> +  'channel-inputs.c',
> +  'channel-main.c',
> +  'channel-playback.c',
> +  'channel-port.c',
> +  'channel-record.c',
> +  'channel-smartcard.c',
> +  'channel-usbredir.c',
> +  'channel-webdav.c',
> +  'smartcard-manager.c',
> +  'spice-audio.c',
> +  'spice-channel.c',
> +  'spice-client.c',
> +  'spice-option.c',
> +  'spice-session.c',
> +  'spice-util.c',
> +  'usb-device-manager.c',
> +]
> +
> +spice_client_glib_sources = [
> +  spice_marshals,
> +  spice_client_glib_introspection_sources,
> +  'bio-gio.c',
> +  'bio-gio.h',
> +  'channel-base.c',
> +  'channel-display-priv.h',
> +  'channel-playback-priv.h',
> +  'channel-usbredir-priv.h',
> +  'client_sw_canvas.c',
> +  'client_sw_canvas.h',
> +  'coroutine.h',
> +  'decode-glz.c',
> +  'decode.h',
> +  'decode-jpeg.c',
> +  'decode-zlib.c',
> +  'gio-coroutine.c',
> +  'gio-coroutine.h',
> +  'smartcard-manager-priv.h',
> +  'spice-audio-priv.h',
> +  'spice-channel-cache.h',
> +  'spice-channel-priv.h',
> +  'spice-common.h',
> +  'spice-file-transfer-task.c',
> +  'spice-file-transfer-task-priv.h',
> +  'spice-glib-main.c',
> +  'spice-option.h',
> +  'spice-session-priv.h',
> +  'spice-uri.c',
> +  'spice-uri-priv.h',
> +  'spice-util-priv.h',
> +  'usb-device-manager-priv.h',
> +  'usbutil.c',
> +  'usbutil.h',
> +  'vmcstream.c',
> +  'vmcstream.h',
> +]
> +
> +if spice_gtk_has_builtin_mjpeg
> +  spice_client_glib_sources += 'channel-display-mjpeg.c'
> +endif
> +
> +if spice_gtk_has_gstaudio
> +  spice_client_glib_sources += ['spice-gstaudio.c',
> +                                'spice-gstaudio.h']
> +endif
> +
> +if spice_gtk_has_gstvideo
> +  spice_client_glib_sources += 'channel-display-gst.c'
> +endif
> +
> +if spice_gtk_has_polkit
> +  spice_client_glib_sources += ['usb-acl-helper.c',
> +                                'usb-acl-helper.h']
> +endif
> +
> +if spice_gtk_has_phodav
> +  spice_client_glib_sources += ['giopipe.c',
> +                                'giopipe.h']
> +endif
> +
> +if spice_gtk_has_pulse
> +  spice_client_glib_sources += ['spice-pulse.c',
> +                                'spice-pulse.h']
> +endif
> +
> +if spice_gtk_coroutine == 'gthread'
> +  spice_client_glib_sources += 'coroutine_gthread.c'
> +elif spice_gtk_coroutine == 'ucontext'
> +  spice_client_glib_sources += ['continuation.c',
> +                                'continuation.h',
> +                                'coroutine_ucontext.c']
> +elif spice_gtk_coroutine == 'winfiber'
> +  spice_client_glib_sources += 'coroutine_winfibers.c'
> +endif
> +
> +if spice_gtk_has_usbredir and spice_gtk_host_system == 'windows'
> +  spice_client_glib_sources += ['usbdk_api.c',
> +                                'usbdk_api.h',
> +                                'win-usb-dev.c',
> +                                'win-usb-dev.h']
> +endif
> +
> +#
> +# libspice-client-glib-2.0.so
> +#
> +
> +# custom link_args
> +# TODO: Instead of relying on the output of ld, this should be handled
> +#       automatically. For compiler args, there is get_supported_arguments(),
> +#       but nothing for linker args currently.
> +#       https://github.com/mesonbuild/meson/issues/3335
> +ld_cmd = run_command('ld', '--help').stdout().strip()
> +
> +# Check for how to avoid indirect lib deps (--no-copy-dt-needed-entries)
> +# from virt-linker-no-indirect
> +#if ld_cmd.contains('--no-copy-dt-needed-entries')
> +#  spice_server_link_args += '-Wl,--no-copy-dt-needed-entries'
> +#endif
> +
> +# Check for how to force completely read-only GOT table (relro)
> +# from virt-link-relro.m4
> +#if ld_cmd.contains('-z relro')
> +#  spice_server_link_args += ['-Wl,-z', '-Wl,relro']
> +#endif
> +
> +# version-script
> +# TODO: should be done automatically, https://github.com/mesonbuild/meson/issues/3047
> +if ld_cmd.contains('--version-script')
> +  spice_client_glib_syms = files('map-file')
> +  spice_client_glib_syms_path = join_paths(meson.current_source_dir(), 'map-file')
> +  spice_gtk_link_args += '-Wl,--version-script=@0@'.format(spice_client_glib_syms_path)
> +else
> +  spice_client_glib_syms = files('spice-glib-sym-file')
> +  spice_client_glib_syms_path = join_paths(meson.current_source_dir(), 'spice-glib-sym-file')
> +  spice_gtk_link_args += ['-export-symbols', spice_client_glib_syms_path]
> +endif
> +
> +if ld_cmd.contains('-z now')
> +  spice_gtk_link_args += ['-Wl,-z', '-Wl,now']
> +endif
> +
> +spice_client_glib_lib = library('spice-client-glib-2.0', spice_client_glib_sources,
> +                                version : '8.6.0',
> +                                install : true,
> +                                include_directories : spice_gtk_include,
> +                                c_args : spice_gtk_c_args,
> +                                link_args : spice_gtk_link_args,
> +                                link_depends : spice_client_glib_syms,
> +                                link_with : spice_gtk_libs,
> +                                dependencies : spice_gtk_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,
> +                                           compile_args : spice_gtk_c_args,
> +                                           link_args : spice_gtk_link_args,
> +                                           dependencies : spice_gtk_deps)
> +
> +#
> +# SpiceClientGLib-2.0.gir
> +#
> +spice_client_glib_introspection_dep = declare_dependency(include_directories: spice_gtk_include,
> +                                                         link_args : spice_gtk_link_args,
> +                                                         link_with : spice_client_glib_lib)
> +
> +spice_client_glib_gir = gnome.generate_gir(spice_client_glib_lib,
> +                                           build_by_default : spice_gtk_has_introspection,
> +                                           dependencies : spice_client_glib_introspection_dep,
> +                                           export_packages : 'spice-client-glib-2.0',
> +                                           extra_args : ['--accept-unprefixed'],
> +                                           header : 'spice-client.h',
> +                                           includes : ['GObject-2.0', 'Gio-2.0'],
> +                                           identifier_prefix : 'Spice',
> +                                           symbol_prefix : 'spice',
> +                                           install : spice_gtk_has_introspection,
> +                                           install_dir_gir : spice_gtk_introspection_gir_dir,
> +                                           install_dir_typelib : spice_gtk_introspection_typelib_dir,
> +                                           namespace : 'SpiceClientGLib',
> +                                           nsversion : '2.0',
> +                                           sources : spice_client_glib_introspection_sources)
> +
> +#
> +# spice-client-glib-usb-acl-helper
> +#
> +if spice_gtk_has_polkit
> +  executable('spice-client-glib-usb-acl-helper',
> +             'spice-client-glib-usb-acl-helper.c',
> +             include_directories : spice_gtk_include,
> +             install_dir : spice_gtk_usb_acl_helper_dir,
> +             c_args : spice_gtk_c_args,
> +             link_args : spice_gtk_link_args,
> +             dependencies : spice_gtk_deps)
> +  # FIXME: provide install script for setuid https://github.com/mesonbuild/meson/issues/3328
> +  #-chown root $(DESTDIR)$(acldir)/spice-client-glib-usb-acl-helper
> +  #-chmod u+s  $(DESTDIR)$(acldir)/spice-client-glib-usb-acl-helper
> +endif
> +
> +
> +if spice_gtk_has_gtk
> +  #
> +  # Source files for spice-client-gtk
> +  #
> +
> +  spice_client_gtk_headers = [
> +    'spice-client-gtk.h',
> +    'spice-grabsequence.h',
> +    'spice-gtk-session.h',
> +    'spice-widget.h',
> +    'usb-device-widget.h',
> +  ]
> +
> +  install_headers(spice_client_gtk_headers, subdir : 'spice-client-gtk-3.0')
> +
> +  # generate spice-widget-enums.[ch]
> +  spice_widget_enums = gnome.mkenums_simple('spice-widget-enums',
> +                                            sources : 'spice-widget.h',
> +                                            install_header : true,
> +                                            install_dir : 'spice-client-gtk-3.0')
> +
> +  spice_client_gtk_introspection_sources = [
> +    spice_client_gtk_headers,
> +    spice_widget_enums,
> +    'spice-grabsequence.c',
> +    'spice-gtk-session.c',
> +    'spice-widget.c',
> +    'usb-device-widget.c',
> +  ]
> +
> +  spice_client_gtk_sources = [
> +    spice_marshals,
> +    spice_client_gtk_introspection_sources,
> +    'desktop-integration.c',
> +    'desktop-integration.h',
> +    'spice-file-transfer-task.h',
> +    'spice-grabsequence.h',
> +    'spice-grabsequence-priv.h',
> +    'spice-gtk-session-priv.h',
> +    'spice-util.c',
> +    'spice-util-priv.h',
> +    'spice-widget-cairo.c',
> +    'spice-widget-priv.h',
> +    'vncdisplaykeymap.c',
> +    'vncdisplaykeymap.h',
> +  ]
> +
> +  if spice_gtk_has_egl
> +    spice_client_gtk_sources += 'spice-widget-egl.c'
> +  endif
> +
> +  # keymaps
> +  python = import('python3').find_python()
> +  keymapgen = files('./keycodemapdb/tools/keymap-gen')
> +  keymapcsv = files('./keycodemapdb/data/keymaps.csv')
> +  keymaps = ['xorgevdev',
> +             'xorgkbd',
> +             'xorgxquartz',
> +             'xorgxwin',
> +             'osx',
> +             'win32',
> +             'x11']
> +
> +  foreach keymap : keymaps
> +    varname = 'keymap_@0@2xtkbd'.format(keymap)
> +    target = 'vncdisplay@0@.c'.format(varname)
> +    cmd = [python, keymapgen, '--lang', 'glib2', '--varname', varname, 'code-map', keymapcsv, keymap, 'xtkbd']
> +    custom_target(target,
> +                  output : target,
> +                  capture : true,
> +                  build_by_default: true,
> +                  command : cmd)
> +
> +  endforeach
> +
> +  #
> +  # libspice-client-gtk.so
> +  #
> +  spice_client_gtk_lib = library('spice-client-gtk-3.0', spice_client_gtk_sources,
> +                                 version : '5.0.0',
> +                                 install : true,
> +                                 dependencies : spice_client_glib_dep)
> +
> +  spice_client_gtk_dep = declare_dependency(sources : spice_widget_enums[1],
> +                                            link_with : spice_client_gtk_lib,
> +                                            dependencies : spice_client_glib_dep)
> +
> +  #
> +  # SpiceClientGtk-3.0.gir
> +  #
> +  spice_client_gtk_introspection_dep = declare_dependency(include_directories: spice_gtk_include,
> +                                                           link_args : spice_gtk_link_args,
> +                                                           link_with : [spice_client_gtk_lib, spice_client_glib_lib])
> +
> +  spice_client_gtk_gir = gnome.generate_gir(spice_client_gtk_lib,
> +                                            build_by_default : spice_gtk_has_introspection,
> +                                            dependencies : spice_client_gtk_introspection_dep,
> +                                            export_packages : 'spice-client-gtk-3.0',
> +                                            extra_args : ['--accept-unprefixed'],
> +                                            header : 'spice-widget.h',
> +                                            includes : ['GObject-2.0', 'Gtk-3.0', 'SpiceClientGLib-2.0'],
> +                                            identifier_prefix : 'Spice',
> +                                            symbol_prefix : 'spice',
> +                                            install : spice_gtk_has_introspection,
> +                                            install_dir_gir : spice_gtk_introspection_gir_dir,
> +                                            install_dir_typelib : spice_gtk_introspection_typelib_dir,
> +                                            namespace : 'SpiceClientGtk',
> +                                            nsversion : '3.0',
> +                                            sources : spice_client_gtk_introspection_sources)
> +endif
> diff --git a/subprojects/spice-common.wrap b/subprojects/spice-common.wrap
> new file mode 100644
> index 0000000..6117c63
> --- /dev/null
> +++ b/subprojects/spice-common.wrap
> @@ -0,0 +1,4 @@
> +[wrap-git]
> +directory=spice-common
> +url=https://gitlab.com/etrunko/spice-common.git
> +revision=meson
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index 3a0188d..bfa43a3 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -1,5 +1,7 @@
>  NULL =
>  
> +EXTRA_DIST = meson.build
> +
>  noinst_PROGRAMS =
>  TESTS = test-coroutine				\
>  	test-util				\
> diff --git a/tests/meson.build b/tests/meson.build
> new file mode 100644
> index 0000000..321856b
> --- /dev/null
> +++ b/tests/meson.build
> @@ -0,0 +1,28 @@
> +tests_sources = [
> +    'util.c',
> +    'coroutine.c',
> +    'session.c',
> +    'uri.c',
> +    'file-transfer.c',
> +]
> +
> +if spice_gtk_has_phodav
> +  tests_sources += 'pipe.c'
> +endif
> +
> +if spice_gtk_has_polkit
> +  tests_sources += [
> +    'usb-acl-helper.c',
> +    'mock-acl-helper.c',
> +  ]
> +endif
> +
> +foreach src : tests_sources
> +  name = 'test-@0@'.format(src).split('.')[0]
> +  exe = executable(name,
> +                   sources : src,
> +                   c_args : '-DTESTDIR="@0@"'.format(meson.current_build_dir()),
> +                   objects : spice_client_glib_lib.extract_all_objects(),
> +                   dependencies : spice_client_glib_dep)
> +  test(name, exe)
> +endforeach
> diff --git a/tools/Makefile.am b/tools/Makefile.am
> index 1e3deed..18786ae 100644
> --- a/tools/Makefile.am
> +++ b/tools/Makefile.am
> @@ -1,5 +1,7 @@
>  bin_PROGRAMS = spicy-stats spicy-screenshot
>  
> +EXTRA_DIST = meson.build
> +
>  TOOLS_CPPFLAGS =			\
>  	-DSPICE_COMPILATION		\
>  	-I$(top_builddir)/src		\
> diff --git a/tools/meson.build b/tools/meson.build
> new file mode 100644
> index 0000000..19a0e71
> --- /dev/null
> +++ b/tools/meson.build
> @@ -0,0 +1,30 @@
> +spice_cmdline_sources = [
> +  'spice-cmdline.c',
> +  'spice-cmdline.h',
> +]
> +
> +#
> +# spicy-stats and spicy-screenshot
> +#
> +foreach exe : ['spicy-stats', 'spicy-screenshot']
> +  executable(exe,
> +             sources : spice_cmdline_sources + ['@0@.c'.format(exe)],
> +             c_args : '-Wno-deprecated-declarations',
> +             dependencies : spice_client_glib_dep)
> +endforeach
> +
> +#
> +# spicy
> +#
> +if spice_gtk_has_gtk
> +  spicy_sources = [
> +    'spicy.c',
> +    'spicy-connect.c',
> +    'spicy-connect.h',
> +  ]
> +
> +  executable('spicy',
> +             sources : spicy_sources + spice_cmdline_sources,
> +             c_args : '-Wno-deprecated-declarations',
> +             dependencies : spice_client_gtk_dep)
> +endif
> diff --git a/vapi/Makefile.am b/vapi/Makefile.am
> index aaab848..494ad83 100644
> --- a/vapi/Makefile.am
> +++ b/vapi/Makefile.am
> @@ -15,6 +15,7 @@ dist_vapi_DATA += spice-client-gtk-3.0.deps
>  endif
>  
>  EXTRA_DIST =						\
> +	meson.build					\
>  	spice-client-gtk-3.0.deps			\
>  	SpiceClientGLib-2.0.metadata			\
>  	$(NULL)
> diff --git a/vapi/meson.build b/vapi/meson.build
> new file mode 100644
> index 0000000..426ae3a
> --- /dev/null
> +++ b/vapi/meson.build
> @@ -0,0 +1,13 @@
> +if spice_gtk_has_vala
> +  gnome.generate_vapi('spice-client-glib-2.0',
> +                      install : true,
> +                      packages : 'gio-2.0',
> +                      sources : spice_client_glib_gir[0])
> +  if spice_gtk_has_gtk
> +    gnome.generate_vapi('spice-client-gtk-3.0',
> +                        install : true,
> +                        packages : ['gtk+-3.0', 'spice-client-glib-2.0'],
> +                        gir_dirs : join_paths(meson.build_root(), 'src'),
> +                        sources : spice_client_gtk_gir[0])
> +  endif
> +endif
> -- 
> 2.14.3
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
From 0dabed79143e351665130bfab37f96f1a470b64a Mon Sep 17 00:00:00 2001
From: Christophe Fergeau <cfergeau@xxxxxxxxxx>
Date: Wed, 28 Mar 2018 12:53:48 +0200
Subject: [spice-gtk 1/2] Use single spice-common submodule for now

While we keep both an automake-based build system and a meson one, it's
better to keep using a git submodule rather than a .wrap meson file.
This way we only have a single place to update on submodule updates.
---
 build-aux/meson/check_spice-common.sh | 8 ++++++++
 meson.build                           | 4 ++++
 subprojects/spice-common              | 1 +
 subprojects/spice-common.wrap         | 4 ----
 4 files changed, 13 insertions(+), 4 deletions(-)
 create mode 100755 build-aux/meson/check_spice-common.sh
 create mode 120000 subprojects/spice-common
 delete mode 100644 subprojects/spice-common.wrap

diff --git a/build-aux/meson/check_spice-common.sh b/build-aux/meson/check_spice-common.sh
new file mode 100755
index 00000000..a1acce69
--- /dev/null
+++ b/build-aux/meson/check_spice-common.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+if [ ! -f "${MESON_SOURCE_ROOT}/spice-common/meson.build" ]
+then
+    git \
+        --git-dir="${MESON_SOURCE_ROOT}/.git" \
+        submodule update --init --recursive subprojects/spice-common
+fi
diff --git a/meson.build b/meson.build
index 082ecaec..db6879a3 100644
--- a/meson.build
+++ b/meson.build
@@ -10,6 +10,9 @@ project('spice-gtk', 'c',
          license : 'LGPLv2.1',
          meson_version : '>= 0.46.0')
 
+message ('Updating submodules')
+run_command ('build-aux/meson/check_spice-common.sh')
+
 #
 # global C defines
 #
@@ -28,6 +31,7 @@ spice_gtk_global_cflags = [#'-std=c99', # fails compiling spice-common/bitops.h
                            '-Wextra',
                            '-Wno-sign-compare',
                            '-Wno-unused-parameter',
+                           '-Wno-cast-function-type',
                            ]
 
 foreach arg : spice_gtk_global_cflags
diff --git a/subprojects/spice-common b/subprojects/spice-common
new file mode 120000
index 00000000..c21cc896
--- /dev/null
+++ b/subprojects/spice-common
@@ -0,0 +1 @@
+../spice-common
\ No newline at end of file
diff --git a/subprojects/spice-common.wrap b/subprojects/spice-common.wrap
deleted file mode 100644
index 6117c631..00000000
--- a/subprojects/spice-common.wrap
+++ /dev/null
@@ -1,4 +0,0 @@
-[wrap-git]
-directory=spice-common
-url=https://gitlab.com/etrunko/spice-common.git
-revision=meson
-- 
2.17.0


From 3e2e145d670ea6e321c21a1cf56478f39c70df97 Mon Sep 17 00:00:00 2001
From: Christophe Fergeau <cfergeau@xxxxxxxxxx>
Date: Thu, 3 May 2018 16:11:05 +0200
Subject: [spice-gtk 2/2] misc improvements

Mostly installation related (enum files going to wrong dir, binaries not
being installed, gir/typelib files not needing an explicit installation
dir, ...)
Also moves some of the -DXXX="yyy" passed as CPPFLAGS to config.h
---
 man/meson.build   |  2 +-
 meson.build       | 19 ++++++++++---------
 src/meson.build   | 11 +++++------
 tools/meson.build |  2 ++
 4 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/man/meson.build b/man/meson.build
index de07ba44..8dde3804 100644
--- a/man/meson.build
+++ b/man/meson.build
@@ -5,7 +5,7 @@ if pod2man.found()
             output : 'spice-client.1',
             input : 'spice-client.pod',
             install : true,
-            install_dir : join_paths(spice_gtk_datadir, 'man', 'man1'),
+            install_dir : join_paths(datadir, 'man', 'man1'),
             build_by_default : true,
             command : [pod2man, '-c', 'Spice-GTK Documentation', '@INPUT@', '@OUTPUT@'])
 endif
diff --git a/meson.build b/meson.build
index db6879a3..1e2d4804 100644
--- a/meson.build
+++ b/meson.build
@@ -13,19 +13,19 @@ project('spice-gtk', 'c',
 message ('Updating submodules')
 run_command ('build-aux/meson/check_spice-common.sh')
 
+# Directory variables
+bindir = get_option('bindir')
+datadir = get_option('datadir')
+includedir = get_option('includedir')
+prefix = get_option('prefix')
+
 #
 # global C defines
 #
-spice_gtk_datadir = join_paths(get_option('prefix'), get_option('datadir'))
-spice_gtk_locale_dir = join_paths(spice_gtk_datadir, 'locale')
-spice_gtk_introspection_typelib_dir = join_paths(spice_gtk_datadir, 'girepository-1.0')
-spice_gtk_libdir = join_paths(get_option('prefix'), get_option('libdir'))
-spice_gtk_introspection_gir_dir = join_paths(spice_gtk_libdir, 'gir-1.0')
 spice_gtk_global_cflags = [#'-std=c99', # fails compiling spice-common/bitops.h
                            '-DHAVE_CONFIG_H',
                            '-DSPICE_COMPILATION',
                            '-DG_LOG_DOMAIN="GSpice"',
-                           '-DLOCALE_DIR="@0@"'.format(spice_gtk_locale_dir),
                            #'-Werror',
                            '-Wall',
                            '-Wextra',
@@ -257,9 +257,9 @@ endif
 # usb-acl-helper-dir
 spice_gtk_usb_acl_helper_dir = get_option('usb-acl-helper-dir')
 if spice_gtk_usb_acl_helper_dir.strip() == ''
-  spice_gtk_usb_acl_helper_dir = join_paths(get_option('prefix'), get_option('bindir'))
+  spice_gtk_usb_acl_helper_dir = join_paths(prefix, bindir)
 endif
-spice_gtk_c_args += '-DACL_HELPER_PATH="@0@"'.format(spice_gtk_usb_acl_helper_dir)
+spice_gtk_config_data.set('ACL_HELPER_PATH', '"@0@"'.format(spice_gtk_usb_acl_helper_dir))
 
 # usb-ids-path
 spice_gtk_usb_ids_path = get_option('usb-ids-path')
@@ -272,7 +272,7 @@ endif
 
 if spice_gtk_usb_ids_path.strip() != ''
   spice_gtk_config_data.set('WITH_USBIDS', '1')
-  spice_gtk_c_args += '-DUSB_IDS="@0@"'.format(spice_gtk_usb_ids_path)
+  spice_gtk_config_data.set('USB_IDS', spice_gtk_usb_ids_path)
 endif
 
 
@@ -372,6 +372,7 @@ proj_name = meson.project_name()
 config_data = [['VERSION', proj_version],
                ['PACKAGE_VERSION', proj_version],
                ['GETTEXT_PACKAGE', proj_name],
+               ['LOCALE_DIR', join_paths(prefix, get_option('localedir'))],
                ['PACKAGE_STRING', '@0@ @1@'.format(proj_name, proj_version)],
                ['PACKAGE_BUGREPORT', 'spice-devel@xxxxxxxxxxxxxxxxxxxxx']]
 foreach conf : config_data
diff --git a/src/meson.build b/src/meson.build
index 1979e84b..e3dce880 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -54,8 +54,9 @@ spice_marshals = gnome.genmarshal('spice-marshal', sources : 'spice-marshal.txt'
 # generate spice-glib-enums.[ch]
 spice_client_glib_enums = gnome.mkenums_simple('spice-glib-enums',
                                                sources : ['spice-channel.h', 'channel-inputs.h', 'spice-session.h'],
+                                               body_prefix : '#include "config.h"',
                                                install_header : true,
-                                               install_dir : 'spice-client-glib-2.0')
+                                               install_dir : join_paths(includedir, 'spice-client-glib-2.0'))
 
 spice_client_glib_introspection_sources = [
   spice_client_glib_headers,
@@ -236,8 +237,6 @@ spice_client_glib_gir = gnome.generate_gir(spice_client_glib_lib,
                                            identifier_prefix : 'Spice',
                                            symbol_prefix : 'spice',
                                            install : spice_gtk_has_introspection,
-                                           install_dir_gir : spice_gtk_introspection_gir_dir,
-                                           install_dir_typelib : spice_gtk_introspection_typelib_dir,
                                            namespace : 'SpiceClientGLib',
                                            nsversion : '2.0',
                                            sources : spice_client_glib_introspection_sources)
@@ -252,6 +251,7 @@ if spice_gtk_has_polkit
              install_dir : spice_gtk_usb_acl_helper_dir,
              c_args : spice_gtk_c_args,
              link_args : spice_gtk_link_args,
+             install : true,
              dependencies : spice_gtk_deps)
   # FIXME: provide install script for setuid https://github.com/mesonbuild/meson/issues/3328
   #-chown root $(DESTDIR)$(acldir)/spice-client-glib-usb-acl-helper
@@ -276,9 +276,10 @@ if spice_gtk_has_gtk
 
   # generate spice-widget-enums.[ch]
   spice_widget_enums = gnome.mkenums_simple('spice-widget-enums',
+                                            body_prefix : '#include "config.h"',
                                             sources : 'spice-widget.h',
                                             install_header : true,
-                                            install_dir : 'spice-client-gtk-3.0')
+                                            install_dir : join_paths(includedir, 'spice-client-gtk-3.0'))
 
   spice_client_gtk_introspection_sources = [
     spice_client_gtk_headers,
@@ -363,8 +364,6 @@ if spice_gtk_has_gtk
                                             identifier_prefix : 'Spice',
                                             symbol_prefix : 'spice',
                                             install : spice_gtk_has_introspection,
-                                            install_dir_gir : spice_gtk_introspection_gir_dir,
-                                            install_dir_typelib : spice_gtk_introspection_typelib_dir,
                                             namespace : 'SpiceClientGtk',
                                             nsversion : '3.0',
                                             sources : spice_client_gtk_introspection_sources)
diff --git a/tools/meson.build b/tools/meson.build
index 19a0e712..33e53c2a 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -10,6 +10,7 @@ foreach exe : ['spicy-stats', 'spicy-screenshot']
   executable(exe,
              sources : spice_cmdline_sources + ['@0@.c'.format(exe)],
              c_args : '-Wno-deprecated-declarations',
+             install : true,
              dependencies : spice_client_glib_dep)
 endforeach
 
@@ -26,5 +27,6 @@ if spice_gtk_has_gtk
   executable('spicy',
              sources : spicy_sources + spice_cmdline_sources,
              c_args : '-Wno-deprecated-declarations',
+             install : true,
              dependencies : spice_client_gtk_dep)
 endif
-- 
2.17.0

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]