[gvfs/wip/inigomartinez/meson: 1/11] build: Port to meson build system



commit 0718636a07fc09ed2583aac2cc25519eb348db61
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Fri Aug 11 11:45:48 2017 +0200

    build: Port to meson build system
    
    meson is a build system focused on speed an ease of use, which
    helps speeding up the software development. This patch adds meson
    support along autotools.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=786149

 Makefile.am                 |    4 +
 client/Makefile.am          |    2 +
 client/meson.build          |   98 +++++++
 client/symbol.map           |    9 +
 common/Makefile.am          |    5 +-
 common/meson.build          |   99 +++++++
 daemon/Makefile.am          |    1 +
 daemon/meson.build          |  622 +++++++++++++++++++++++++++++++++++++++++++
 daemon/trashlib/Makefile.am |    2 +
 daemon/trashlib/meson.build |   19 ++
 man/Makefile.am             |    1 +
 man/meson.build             |   78 ++++++
 meson.build                 |  552 ++++++++++++++++++++++++++++++++++++++
 meson_options.txt           |   28 ++
 meson_post_install.py       |   14 +
 metadata/Makefile.am        |    1 +
 metadata/meson.build        |  106 ++++++++
 monitor/Makefile.am         |    2 +
 monitor/afc/Makefile.am     |    1 +
 monitor/afc/meson.build     |   58 ++++
 monitor/gdu/Makefile.am     |    1 +
 monitor/gdu/meson.build     |   60 ++++
 monitor/goa/Makefile.am     |    1 +
 monitor/goa/meson.build     |   55 ++++
 monitor/gphoto2/Makefile.am |    1 +
 monitor/gphoto2/meson.build |   59 ++++
 monitor/meson.build         |   25 ++
 monitor/mtp/Makefile.am     |    1 +
 monitor/mtp/meson.build     |   56 ++++
 monitor/proxy/Makefile.am   |    2 +
 monitor/proxy/meson.build   |   65 +++++
 monitor/proxy/symbol.map    |    8 +
 monitor/udisks2/Makefile.am |    1 +
 monitor/udisks2/meson.build |   72 +++++
 po/meson.build              |    1 +
 programs/Makefile.am        |    1 +
 programs/meson.build        |   37 +++
 test/Makefile.am            |    2 +
 test/gvfs-all-tests.in      |    4 +
 test/meson.build            |   79 ++++++
 40 files changed, 2232 insertions(+), 1 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 1bea404..bc6410e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -27,6 +27,10 @@ EXTRA_DIST = \
        m4                      \
        gettext/its/polkit.loc  \
        gettext/its/polkit.its  \
+       meson.build             \
+       meson_options.txt       \
+       meson_post_install.py   \
+       po/meson.build          \
        $(NULL)
 
 distclean-local:
diff --git a/client/Makefile.am b/client/Makefile.am
index c0ac599..bfa5871 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -96,4 +96,6 @@ endif
 
 EXTRA_DIST = \
        gvfsd-fuse-tmpfiles.conf        \
+       meson.build                     \
+       symbol.map                      \
        $(NULL)
diff --git a/client/meson.build b/client/meson.build
new file mode 100644
index 0000000..74ad446
--- /dev/null
+++ b/client/meson.build
@@ -0,0 +1,98 @@
+headers = files(
+  'gvfsurimapper.h',
+  'gvfsuriutils.h'
+)
+
+install_headers(
+  headers,
+  subdir: join_paths('gvfs-client', 'gvfs')
+)
+
+# Dynamic client lib
+uri_parser_sources = files(
+  'afpuri.c',
+  'httpuri.c',
+  'smburi.c'
+)
+
+uri_utils = files('gvfsuriutils.c')
+
+sources = uri_parser_sources + uri_utils + files(
+  'gdaemonmount.c',
+  'gdaemonfile.c',
+  'gdaemonfileenumerator.c',
+  'gdaemonfileinputstream.c',
+  'gdaemonfilemonitor.c',
+  'gdaemonfileoutputstream.c',
+  'gdaemonvfs.c',
+  'gdaemonvolumemonitor.c',
+  'gvfsdaemondbus.c',
+  'gvfsiconloadable.c',
+  'gvfsurimapper.c'
+)
+
+cflags = [
+  '-DG_LOG_DOMAIN="@0@"'.format(gvfs_name.to_upper()),
+  '-DGVFS_LOCALEDIR="@0@"'.format(gvfs_localedir),
+  '-DGVFS_MODULE_DIR="@0@"'.format(join_paths(gvfs_libdir, 'gvfs', 'modules'))
+]
+
+symbol_map = join_paths(meson.current_source_dir(), 'symbol.map')
+
+ldflags = []
+if have_version_script
+  ldflags += '-Wl,--version-script,@0@'.format(symbol_map)
+endif
+
+libgvfsdbus = shared_module(
+  'gvfsdbus',
+  sources: sources,
+  include_directories: top_inc,
+  dependencies: [
+    libgvfscommon_dep,
+    libmetadata_dep
+  ],
+  c_args: cflags,
+  link_args: ldflags,
+  link_depends: symbol_map,
+  install: true,
+  install_rpath: gvfs_rpath,
+  install_dir: gio_module_dir
+)
+
+if enable_devel_utils
+  test_name = 'test-uri-utils'
+
+  executable(
+    test_name,
+    [test_name + '.c'] + uri_utils,
+    include_directories: top_inc,
+    dependencies: glib_deps + [libgvfscommon_dep],
+    c_args: cflags
+  )
+endif
+
+# FUSE daemon
+if enable_fuse
+  # FIXME: reusing USE_LIBSYSTEMD_LOGIN as systemd has no universal header or pkg-config file
+  if enable_libsystemd_login
+    install_data(
+      'gvfsd-fuse-tmpfiles.conf',
+      install_dir: join_paths(gvfs_libdir, 'tmpfiles.d')
+    )
+  endif
+
+  executable(
+    'gvfsd-fuse',
+    'gvfsfusedaemon.c',
+    include_directories: top_inc,
+    dependencies: glib_deps + [
+      fuse_dep,
+      libgvfscommon_dep
+    ],
+    c_args: cflags + ['-UG_LOG_DOMAIN'],
+    install: true,
+    install_rpath: gvfs_rpath,
+    install_dir: gvfs_libexecdir
+  )
+endif
diff --git a/client/symbol.map b/client/symbol.map
new file mode 100644
index 0000000..f62b66f
--- /dev/null
+++ b/client/symbol.map
@@ -0,0 +1,9 @@
+{
+global:
+  g_vfs_*;
+  g_io_module_load;
+  g_io_module_unload;
+  g_io_module_query;
+local:
+  *;
+};
diff --git a/common/Makefile.am b/common/Makefile.am
index 9fff709..67ba37f 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -87,6 +87,9 @@ libgvfscommon_gphoto2_la_LIBADD = \
 endif
 
 
-EXTRA_DIST = org.gtk.vfs.xml
+EXTRA_DIST = \
+       org.gtk.vfs.xml \
+       meson.build \
+       $(NULL)
 
 CLEANFILES = $(dbus_built_sources)
diff --git a/common/meson.build b/common/meson.build
new file mode 100644
index 0000000..5318d7a
--- /dev/null
+++ b/common/meson.build
@@ -0,0 +1,99 @@
+common_inc = include_directories('.')
+
+common_cflags = ['-DG_LOG_DOMAIN="@0@"'.format(gvfs_name.to_upper())]
+
+sources = files(
+  'gmountoperationdbus.c',
+  'gmountsource.c',
+  'gmountspec.c',
+  'gmounttracker.c',
+  'gvfsdaemonprotocol.c',
+  'gvfsfileinfo.c',
+  'gvfsicon.c',
+  'gvfsmonitorimpl.c',
+  'gvfsutils.c'
+)
+
+sources += gnome.gdbus_codegen(
+  'gvfsdbus',
+  gvfs_namespace + '.xml',
+  interface_prefix: gvfs_namespace + '.',
+  namespace: 'GVfsDBus'
+)
+
+cflags = common_cflags + ['-DREMOTE_VOLUME_MONITORS_DIR="@0@"'.format(gvfs_remote_volume_monitors_dir)]
+
+libgvfscommon = shared_library(
+  'gvfscommon',
+  sources: sources,
+  include_directories: top_inc,
+  dependencies: glib_deps,
+  c_args: cflags,
+  install: true,
+  install_dir: gvfs_pkglibdir
+)
+
+libgvfscommon_dep = declare_dependency(
+  link_with: libgvfscommon,
+  include_directories: common_inc
+)
+
+deps = glib_deps
+
+if enable_bluray
+  deps += libbluray_dep
+endif
+
+libgvfscommon_monitor = static_library(
+  'gvfscommon-monitor',
+  sources: 'gvfsmountinfo.c',
+  include_directories: top_inc,
+  dependencies: deps,
+  c_args: common_cflags,
+  link_with: libgvfscommon
+)
+
+libgvfscommon_monitor_dep = declare_dependency(
+  link_with: libgvfscommon_monitor,
+  include_directories: common_inc
+)
+
+if enable_avahi
+  sources = files(
+    'gvfsdnssdresolver.c',
+    'gvfsdnssdutils.c'
+  )
+
+  deps = glib_deps + [
+    avahi_client_dep,
+    avahi_glib_dep
+  ]
+
+  libgvfscommon_dnssd = static_library(
+    'gvfscommon-dnssd',
+    sources: sources,
+    include_directories: top_inc,
+    dependencies: deps,
+    c_args: common_cflags,
+    link_with: libgvfscommon
+  )
+
+  libgvfscommon_dnssd_dep = declare_dependency(
+    link_with: libgvfscommon_dnssd,
+    include_directories: common_inc
+  )
+endif
+
+if enable_libmtp or enable_gphoto2
+  libgvfscommon_gphoto2 = static_library(
+    'gvfscommon-gphoto2',
+    sources: 'gvfsgphoto2utils.c',
+    include_directories: top_inc,
+    dependencies: gudev_dep
+  )
+
+  libgvfscommon_gphoto2_dep = declare_dependency(
+    link_with: libgvfscommon_gphoto2,
+    include_directories: common_inc
+  )
+endif
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index a8b2958..0bdafae 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -149,6 +149,7 @@ EXTRA_DIST =                                \
        $(gsettings_ENUM_FILES)         \
        org.gtk.vfs.file-operations.policy.in.in \
        org.gtk.vfs.file-operations.rules \
+       meson.build                     \
        $(NULL)
 
 DISTCLEANFILES = $(mount_DATA) $(noinst_DATA)
diff --git a/daemon/meson.build b/daemon/meson.build
new file mode 100644
index 0000000..268ad57
--- /dev/null
+++ b/daemon/meson.build
@@ -0,0 +1,622 @@
+subdir('trashlib')
+
+# D-Bus and systemd service files
+service = gvfs_namespace + '.Daemon.service'
+
+daemon_service = configure_file(
+  input: service + '.in',
+  output: service,
+  install: true,
+  install_dir: gvfs_dbus_service_dir,
+  configuration: service_conf
+)
+
+if have_systemd_user_unit
+  service = 'gvfs-daemon.service'
+
+  configure_file(
+    input: service + '.in',
+    output: service,
+    install: true,
+    install_dir: systemd_user_dir,
+    configuration: service_conf
+  )
+endif
+
+gnome.mkenums(
+  'org.gnome.system.gvfs.enums.xml',
+  sources: 'gvfs-enums.h',
+  comments: '<!-- @comment@ -->',
+  fhead: '<schemalist>',
+  vhead: '  <@type@ id="org.gnome.system.gvfs.@EnumName@">',
+  vprod: '    <value nick="@valuenick@" value="@valuenum@"/>',
+  vtail: '  </@type@>',
+  ftail: '</schemalist>',
+  install_header: true,
+  install_dir: gvfs_schema_dir
+)
+
+sources = files(
+  'gvfsbackend.c',
+  'gvfschannel.c',
+  'gvfsdaemon.c',
+  'gvfsdaemonutils.c',
+  'gvfsjob.c',
+  'gvfsjobcloseread.c',
+  'gvfsjobclosewrite.c',
+  'gvfsjobcopy.c',
+  'gvfsjobcreatemonitor.c',
+  'gvfsjobdbus.c',
+  'gvfsjobdelete.c',
+  'gvfsjobenumerate.c',
+  'gvfsjoberror.c',
+  'gvfsjobmakedirectory.c',
+  'gvfsjobmakesymlink.c',
+  'gvfsjobmount.c',
+  'gvfsjobmountmountable.c',
+  'gvfsjobmove.c',
+  'gvfsjobopenforread.c',
+  'gvfsjobopenforwrite.c',
+  'gvfsjobopeniconforread.c',
+  'gvfsjobpollmountable.c',
+  'gvfsjobprogress.c',
+  'gvfsjobpull.c',
+  'gvfsjobpush.c',
+  'gvfsjobqueryattributes.c',
+  'gvfsjobqueryfsinfo.c',
+  'gvfsjobqueryinfo.c',
+  'gvfsjobqueryinforead.c',
+  'gvfsjobqueryinfowrite.c',
+  'gvfsjobread.c',
+  'gvfsjobseekread.c',
+  'gvfsjobseekwrite.c',
+  'gvfsjobsetattribute.c',
+  'gvfsjobsetdisplayname.c',
+  'gvfsjobsource.c',
+  'gvfsjobstartmountable.c',
+  'gvfsjobstopmountable.c',
+  'gvfsjobtrash.c',
+  'gvfsjobtruncate.c',
+  'gvfsjobunmount.c',
+  'gvfsjobunmountmountable.c',
+  'gvfsjobwrite.c',
+  'gvfskeyring.c',
+  'gvfsmonitor.c',
+  'gvfsreadchannel.c',
+  'gvfswritechannel.c'
+)
+
+deps = glib_deps + socket_deps + [libgvfscommon_dep]
+
+if enable_gcr
+  deps += gcr_dep
+endif
+
+if enable_keyring
+  deps += libsecret_dep
+endif
+
+cflags = [
+  '-DLIBEXEC_DIR="@0@"'.format(gvfs_libexecdir),
+  '-DMOUNTABLE_DIR="@0@"'.format(gvfs_mountdir),
+  '-DGVFS_LOCALEDIR="@0@"'.format(gvfs_localedir)
+]
+
+libgvfsdaemon = shared_library(
+  'gvfsdaemon',
+  sources: sources,
+  include_directories: top_inc,
+  dependencies: deps,
+  c_args: cflags,
+  install: true,
+  install_dir: gvfs_pkglibdir
+)
+
+libgvfsdaemon_dep = declare_dependency(
+  link_with: libgvfsdaemon,
+  include_directories: include_directories('.'),
+  dependencies: deps,
+  compile_args: cflags
+)
+
+sources = files(
+  'main.c',
+  'mount.c'
+)
+
+executable(
+  'gvfsd',
+  sources,
+  include_directories: top_inc,
+  dependencies: libgvfsdaemon_dep,
+  install: true,
+  install_rpath: gvfs_rpath,
+  install_dir: gvfs_libexecdir
+)
+
+daemon_main_sources = files(
+  'daemon-main.c',
+  'daemon-main-generic.c'
+)
+
+programs = []
+mounts = []
+schema_data = []
+convert_data = []
+
+sources = files('gvfsbackendlocaltest.c')
+
+cflags = [
+  '-DBACKEND_HEADER=gvfsbackendlocaltest.h',
+  '-DDEFAULT_BACKEND_TYPE=localtest',
+  '-DBACKEND_TYPES="localtest", G_VFS_TYPE_BACKEND_LOCALTEST,'
+]
+
+programs += [['gvfsd-localtest', sources, [], cflags]]
+mounts += ['localtest']
+
+sources = files(
+  'gvfsbackendftp.c',
+  'gvfsftpconnection.c',
+  'gvfsftpdircache.c',
+  'gvfsftpfile.c',
+  'gvfsftptask.c',
+  'ParseFTPList.c'
+)
+
+cflags = [
+  '-DBACKEND_HEADER=gvfsbackendftp.h',
+  '-DDEFAULT_BACKEND_TYPE=ftp',
+  '-DBACKEND_TYPES="ftp", G_VFS_TYPE_BACKEND_FTP, "ftps", G_VFS_TYPE_BACKEND_FTP,',
+  '-DMAX_JOB_THREADS=10'
+]
+
+programs += [['gvfsd-ftp', sources, [], cflags]]
+mounts += ['ftp', 'ftps']
+
+sources = files('gvfsbackendtrash.c')
+
+deps = [libtrash_dep]
+
+cflags = [
+  '-DBACKEND_HEADER=gvfsbackendtrash.h',
+  '-DDEFAULT_BACKEND_TYPE=trash',
+  '-DBACKEND_TYPES="trash", G_VFS_TYPE_BACKEND_TRASH,',
+  '-DMAX_JOB_THREADS=10'
+]
+
+programs += [['gvfsd-trash', sources, deps, cflags]]
+mounts += ['trash']
+
+sources = files('gvfsbackendrecent.c')
+
+cflags = [
+  '-DBACKEND_HEADER=gvfsbackendrecent.h',
+  '-DDEFAULT_BACKEND_TYPE=recent',
+  '-DBACKEND_TYPES="recent", G_VFS_TYPE_BACKEND_RECENT,',
+  '-DBACKEND_USES_GVFS=1',
+  '-DMAX_JOB_THREADS=10'
+]
+
+programs += [['gvfsd-recent', sources, [], cflags]]
+mounts += ['recent']
+
+sources = files('gvfsbackendcomputer.c')
+
+cflags = [
+  '-DBACKEND_HEADER=gvfsbackendcomputer.h',
+  '-DDEFAULT_BACKEND_TYPE=computer',
+  '-DBACKEND_TYPES="computer", G_VFS_TYPE_BACKEND_COMPUTER,',
+  '-DBACKEND_USES_GVFS=1',
+  '-DMAX_JOB_THREADS=1'
+]
+
+programs += [['gvfsd-computer', sources, [], cflags]]
+mounts += ['computer']
+
+sources = files('gvfsbackendnetwork.c')
+
+cflags = [
+  '-DBACKEND_HEADER=gvfsbackendnetwork.h',
+  '-DDEFAULT_BACKEND_TYPE=network',
+  '-DBACKEND_TYPES="network", G_VFS_TYPE_BACKEND_NETWORK,',
+  '-DBACKEND_USES_GVFS=1',
+  '-DMAX_JOB_THREADS=1'
+]
+
+programs += [['gvfsd-network', sources, [], cflags]]
+mounts += ['network']
+
+sources = files('gvfsbackendburn.c')
+
+cflags = [
+  '-DBACKEND_HEADER=gvfsbackendburn.h',
+  '-DDEFAULT_BACKEND_TYPE=burn',
+  '-DBACKEND_TYPES="burn", G_VFS_TYPE_BACKEND_BURN,',
+  '-DMAX_JOB_THREADS=1'
+]
+
+programs += [['gvfsd-burn', sources, [], cflags]]
+mounts += ['burn']
+
+sources = files(
+  'gvfsbackendsftp.c',
+  'pty_open.c'
+)
+
+deps = socket_deps + [util_dep]
+
+cflags = [
+  '-DBACKEND_HEADER=gvfsbackendsftp.h',
+  '-DDEFAULT_BACKEND_TYPE=sftp',
+  '-DBACKEND_TYPES="sftp", G_VFS_TYPE_BACKEND_SFTP,',
+  '-DMAX_JOB_THREADS=1',
+  '-DSSH_PROGRAM="@0@"'.format(find_program('ssh').path())
+]
+
+programs += [['gvfsd-sftp', sources, deps, cflags]]
+mounts += ['sftp']
+
+if enable_samba
+  sources = files('gvfsbackendsmb.c')
+
+  deps = [smbclient_dep]
+
+  cflags = [
+    '-DBACKEND_HEADER=gvfsbackendsmb.h',
+    '-DDEFAULT_BACKEND_TYPE=smb',
+    '-DBACKEND_TYPES="smb-share", G_VFS_TYPE_BACKEND_SMB,',
+    '-DMAX_JOB_THREADS=1'
+  ]
+
+  programs += [['gvfsd-smb', sources, deps, cflags]]
+  mounts += ['smb']
+  schema_data += files('org.gnome.system.smb.gschema.xml')
+  convert_data += files('gvfs-smb.convert')
+
+  sources += files('gvfsbackendsmbbrowse.c')
+
+  cflags = [
+    '-DBACKEND_HEADER=gvfsbackendsmbbrowse.h',
+    '-DDEFAULT_BACKEND_TYPE=smb-network',
+    '-DBACKEND_TYPES="smb-network", G_VFS_TYPE_BACKEND_SMB_BROWSE, "smb-server",  
G_VFS_TYPE_BACKEND_SMB_BROWSE,',
+    '-DMAX_JOB_THREADS=1',
+    '-DMOUNTABLE_DBUS_NAME=' + gvfs_namespace + '.mountpoint_smb_browse'
+  ]
+
+  programs += [['gvfsd-smb-browse', sources, deps, cflags]]
+  mounts += ['smb-browse']
+endif
+
+if enable_avahi
+  sources = files('gvfsbackenddnssd.c')
+
+  deps = [
+    avahi_client_dep,
+    avahi_glib_dep,
+    libgvfscommon_dnssd_dep
+  ]
+
+  cflags = [
+    '-DBACKEND_HEADER=gvfsbackenddnssd.h',
+    '-DDEFAULT_BACKEND_TYPE=dns-sd',
+    '-DBACKEND_TYPES="dns-sd", G_VFS_TYPE_BACKEND_DNS_SD,',
+    '-DMAX_JOB_THREADS=1',
+    '-DMOUNTABLE_DBUS_NAME=' + gvfs_namespace + '.mountpoint_dnssd'
+  ]
+
+  programs += [['gvfsd-dnssd', sources, deps, cflags]]
+  mounts += ['dns-sd']
+  schema_data += files('org.gnome.system.dns_sd.gschema.xml')
+  convert_data += files('gvfs-dns-sd.convert')
+endif
+
+if enable_archive
+  sources = files('gvfsbackendarchive.c')
+
+  deps = [libarchive_dep]
+
+  cflags = [
+    '-DBACKEND_HEADER=gvfsbackendarchive.h',
+    '-DDEFAULT_BACKEND_TYPE=archive',
+    '-DBACKEND_TYPES="archive", G_VFS_TYPE_BACKEND_ARCHIVE,',
+    '-DMAX_JOB_THREADS=1',
+    '-DBACKEND_USES_GVFS=1'
+  ]
+
+  programs += [['gvfsd-archive', sources, deps, cflags]]
+  mounts += ['archive']
+endif
+
+if enable_cdda
+  sources = files('gvfsbackendcdda.c')
+
+  deps = [
+    gudev_dep,
+    libcdio_paranoia_dep
+  ]
+
+  cflags = [
+    '-DBACKEND_HEADER=gvfsbackendcdda.h',
+    '-DDEFAULT_BACKEND_TYPE=cdda',
+    '-DBACKEND_TYPES="cdda", G_VFS_TYPE_BACKEND_CDDA,',
+    '-DMAX_JOB_THREADS=1'
+  ]
+
+  programs += [['gvfsd-cdda', sources, deps, cflags]]
+  mounts += ['cdda']
+endif
+
+if enable_admin
+  sources = files('gvfsbackendadmin.c')
+
+  deps = [
+    libcap_dep,
+    polkit_gobject_dep
+  ]
+
+  cflags = [
+    '-DBACKEND_HEADER=gvfsbackendadmin.h',
+    '-DDEFAULT_BACKEND_TYPE=admin',
+    '-DBACKEND_TYPES="admin", G_VFS_TYPE_BACKEND_ADMIN,'
+  ]
+
+  programs += [['gvfsd-admin', sources, deps, cflags]]
+  mounts += ['admin']
+
+  policy = gvfs_namespace + '.file-operations.policy'
+
+  policy_in = configure_file(
+    input: policy + '.in.in',
+    output: policy + '.in',
+    configuration: service_conf
+  )
+
+  i18n.merge_file(
+    policy,
+    input: policy_in,
+    output: policy,
+    po_dir: po_dir,
+    install: true,
+    install_dir: join_paths(gvfs_datadir, 'polkit-1', 'actions')
+  )
+
+  install_data(
+    gvfs_namespace + '.file-operations.rules',
+    install_dir: join_paths(gvfs_datadir, 'polkit-1', 'rules.d')
+  )
+endif
+
+if enable_google
+  sources = files('gvfsbackendgoogle.c')
+
+  deps = [
+    goa_dep,
+    libgdata_dep
+  ]
+
+  cflags = [
+    '-DBACKEND_HEADER=gvfsbackendgoogle.h',
+    '-DDEFAULT_BACKEND_TYPE=google-drive',
+    '-DBACKEND_TYPES="google-drive", G_VFS_TYPE_BACKEND_GOOGLE,'
+  ]
+
+  programs += [['gvfsd-google', sources, deps, cflags]]
+  mounts += ['google']
+endif
+
+if enable_gphoto2
+  sources = files('gvfsbackendgphoto2.c')
+
+  deps = [
+    gudev_dep,
+    libgphoto2_dep,
+    libgvfscommon_gphoto2_dep
+  ]
+
+  cflags = [
+    '-DBACKEND_HEADER=gvfsbackendgphoto2.h',
+    '-DDEFAULT_BACKEND_TYPE=gphoto2',
+    '-DBACKEND_TYPES="gphoto2", G_VFS_TYPE_BACKEND_GPHOTO2,',
+    '-DMAX_JOB_THREADS=1'
+  ]
+
+  programs += [['gvfsd-gphoto2', sources, deps, cflags]]
+  mounts += ['gphoto2']
+endif
+
+if enable_libmtp
+  sources = files('gvfsbackendmtp.c')
+
+  deps = [
+    gudev_dep,
+    libgvfscommon_gphoto2_dep,
+    libmtp_dep
+  ]
+
+  cflags = [
+    '-DBACKEND_HEADER=gvfsbackendmtp.h',
+    '-DDEFAULT_BACKEND_TYPE=mtp',
+    '-DBACKEND_TYPES="mtp", G_VFS_TYPE_BACKEND_MTP,',
+    '-DMAX_JOB_THREADS=1'
+  ]
+
+  if enable_libusb
+    deps += libusb_dep
+  endif
+
+  programs += [['gvfsd-mtp', sources, deps, cflags]]
+  mounts += ['mtp']
+endif
+
+if enable_http
+  sources = files(
+    'gvfsbackendhttp.c',
+    'gvfshttpinputstream.c'
+  )
+
+  deps = [
+    libsoup_dep,
+    libxml_dep
+  ]
+
+  cflags = [
+    '-DBACKEND_HEADER=gvfsbackendhttp.h',
+    '-DDEFAULT_BACKEND_TYPE=http',
+    '-DBACKEND_TYPES="http", G_VFS_TYPE_BACKEND_HTTP,',
+    '-DMAX_JOB_THREADS=1',
+    '-DMOUNTABLE_DBUS_NAME=' + gvfs_namespace + '.mountpoint_http'
+  ]
+
+  programs += [['gvfsd-http', sources, deps, cflags]]
+  mounts += ['http']
+
+  sources = sources + files('gvfsbackenddav.c')
+
+  cflags = [
+    '-DBACKEND_HEADER=gvfsbackenddav.h',
+    '-DDEFAULT_BACKEND_TYPE=dav',
+    '-DMAX_JOB_THREADS=1'
+  ]
+
+  if enable_avahi
+    deps += libgvfscommon_dnssd_dep
+
+    cflags += '-DBACKEND_TYPES="dav", G_VFS_TYPE_BACKEND_DAV, "dav+sd", G_VFS_TYPE_BACKEND_DAV, "davs+sd", 
G_VFS_TYPE_BACKEND_DAV,'
+
+    mounts += ['dav+sd']
+  else
+    cflags += '-DBACKEND_TYPES="dav", G_VFS_TYPE_BACKEND_DAV,'
+  endif
+
+  programs += [['gvfsd-dav', sources, deps, cflags]]
+  mounts += ['dav']
+endif
+
+if enable_afc
+  sources = files('gvfsbackendafc.c')
+
+  deps = [
+    libimobiledevice_dep,
+    libplist_dep
+  ]
+
+  cflags = [
+    '-DBACKEND_HEADER=gvfsbackendafc.h',
+    '-DDEFAULT_BACKEND_TYPE=afc',
+    '-DBACKEND_TYPES="afc", G_VFS_TYPE_BACKEND_AFC,',
+    '-DMAX_JOB_THREADS=1',
+    '-DBACKEND_USES_GVFS=1'
+  ]
+
+  programs += [['gvfsd-afc', sources, deps, cflags]]
+  mounts += ['afc']
+endif
+
+if enable_afp
+  common_sources = files(
+    'gvfsafptypes.h',
+    'gvfsafputils.c',
+    'gvfsafpconnection.c',
+    'gvfsafpserver.c',
+    'gvfsafpvolume.c'
+  )
+
+  sources = common_sources + files('gvfsbackendafp.c')
+
+  deps = []
+  if have_gcrypt
+    deps += libgcrypt_dep
+  endif
+
+  cflags = [
+    '-DBACKEND_HEADER=gvfsbackendafp.h',
+    '-DDEFAULT_BACKEND_TYPE=afp-volume',
+    '-DBACKEND_TYPES="afp-volume", G_VFS_TYPE_BACKEND_AFP,',
+    '-DMAX_JOB_THREADS=1'
+  ]
+
+  programs += [['gvfsd-afp', sources, deps, cflags]]
+  mounts += ['afp']
+
+  sources = common_sources + files('gvfsbackendafpbrowse.c')
+
+  cflags = [
+    '-DBACKEND_HEADER=gvfsbackendafpbrowse.h',
+    '-DDEFAULT_BACKEND_TYPE=afp-server',
+    '-DBACKEND_TYPES="afp-server", G_VFS_TYPE_BACKEND_AFP_BROWSE,',
+    '-DMAX_JOB_THREADS=1'
+  ]
+
+  programs += [['gvfsd-afp-browse', sources, deps, cflags]]
+  mounts += ['afp-browse']
+endif
+
+if enable_nfs
+  sources = files('gvfsbackendnfs.c')
+
+  deps = [libnfs_dep]
+
+  cflags = [
+    '-DBACKEND_HEADER=gvfsbackendnfs.h',
+    '-DDEFAULT_BACKEND_TYPE=nfs',
+    '-DBACKEND_TYPES="nfs", G_VFS_TYPE_BACKEND_NFS,',
+    '-DMAX_JOB_THREADS=1'
+  ]
+
+  programs += [['gvfsd-nfs', sources, deps, cflags]]
+  mounts += ['nfs']
+endif
+
+foreach program: programs
+  executable(
+    program[0],
+    daemon_main_sources + program[1],
+    include_directories: top_inc,
+    dependencies: [libgvfsdaemon_dep] + program[2],
+    c_args: program[3],
+    install: true,
+    install_rpath: gvfs_rpath,
+    install_dir: gvfs_libexecdir
+  )
+endforeach
+
+foreach mount: mounts
+  name = mount + '.mount'
+
+  configure_file(
+    input: name + '.in',
+    output: name,
+    install: true,
+    install_dir: gvfs_mountdir,
+    configuration: service_conf
+  )
+endforeach
+
+if enable_devel_utils
+  sources = daemon_main_sources + files('gvfsbackendtest.c')
+
+  cflags = [
+    '-DBACKEND_HEADER=gvfsbackendtest.h',
+    '-DDEFAULT_BACKEND_TYPE=test',
+    '-DBACKEND_TYPES="test", G_VFS_TYPE_BACKEND_TEST,'
+  ]
+
+  executable(
+    'gvfsd-test',
+    sources,
+    include_directories: top_inc,
+    dependencies: libgvfsdaemon_dep,
+    c_args: cflags
+  )
+endif
+
+install_data(
+  schema_data,
+  install_dir: gvfs_schema_dir
+)
+
+install_data(
+  convert_data,
+  install_dir: join_paths(gvfs_datadir, 'GConf', 'gsettings')
+)
diff --git a/daemon/trashlib/Makefile.am b/daemon/trashlib/Makefile.am
index 323c942..e92a321 100644
--- a/daemon/trashlib/Makefile.am
+++ b/daemon/trashlib/Makefile.am
@@ -13,3 +13,5 @@ libtrash_a_SOURCES = \
        trashwatcher.c  \
        trashexpunge.h  \
        trashexpunge.c
+
+EXTRA_DIST = meson.build
diff --git a/daemon/trashlib/meson.build b/daemon/trashlib/meson.build
new file mode 100644
index 0000000..610bb62
--- /dev/null
+++ b/daemon/trashlib/meson.build
@@ -0,0 +1,19 @@
+sources = files(
+  'dirwatch.c',
+  'trashdir.c',
+  'trashitem.c',
+  'trashwatcher.c',
+  'trashexpunge.c'
+)
+
+libtrash = static_library(
+  'trash',
+  sources: sources,
+  include_directories: top_inc,
+  dependencies: glib_deps
+)
+
+libtrash_dep = declare_dependency(
+  link_with: libtrash,
+  include_directories: include_directories('.')
+)
diff --git a/man/Makefile.am b/man/Makefile.am
index 2488925..086ecb6 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -94,6 +94,7 @@ EXTRA_DIST = \
        gvfsd.xml \
        gvfs-less.xml \
        gvfs.xml \
+       meson.build \
        $(NULL)
 
 CLEANFILES = \
diff --git a/man/meson.build b/man/meson.build
new file mode 100644
index 0000000..870d16d
--- /dev/null
+++ b/man/meson.build
@@ -0,0 +1,78 @@
+xsltproc = find_program('xsltproc', required: false)
+assert(xsltproc.found(), 'xsltproc is required for enable-man')
+
+xsltproc_cmd = [
+  xsltproc,
+  '--output', '@OUTPUT@',
+  '--nonet',
+  '--stringparam', 'man.output.quietly', '1',
+  '--stringparam', 'funcsynopsis.style', 'ansi',
+  '--stringparam', 'man.th.extra1.suppress', '1',
+  '--stringparam', 'man.authors.section.enabled', '0',
+  '--stringparam', 'man.copyright.section.enabled', '0',
+  'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
+  '@INPUT@'
+]
+
+mans = [
+  ['gvfs-cat', 'gio cat'],
+  ['gvfs-copy', 'gio copy'],
+  ['gvfs-info', 'gio info'],
+  ['gvfs-less', ''],
+  ['gvfs-ls', 'gio list'],
+  ['gvfs-mime', 'gio mime'],
+  ['gvfs-mkdir', 'gio mkdir'],
+  ['gvfs-monitor-dir', 'gio monitor'],
+  ['gvfs-monitor-file', 'gio monitor'],
+  ['gvfs-mount', 'gio mount'],
+  ['gvfs-move', 'gio move'],
+  ['gvfs-open', 'gio open'],
+  ['gvfs-rename', 'gio rename'],
+  ['gvfs-rm', 'gio remove'],
+  ['gvfs-save', 'gio save'],
+  ['gvfs-set-attribute', 'gio set'],
+  ['gvfs-trash', 'gio trash'],
+  ['gvfs-tree', 'gio tree'],
+  ['gvfsd', ''],
+  ['gvfsd-fuse', ''],
+  ['gvfsd-metadata', '']
+]
+
+foreach man: mans
+  if man[1].strip() == ''
+    xml = man[0] + '.xml'
+  else
+    conf = configuration_data()
+    conf.set('original', man[0])
+    conf.set('replacement', man[1])
+
+    xml = configure_file(
+      input: 'deprecated.xml.in',
+      output: man[0] + '.xml',
+      configuration: conf
+    )
+  endif
+
+  output = man[0] + '.1'
+
+  custom_target(
+    output,
+    input: xml,
+    output: output,
+    command: xsltproc_cmd,
+    install: true,
+    install_dir: join_paths(gvfs_mandir, 'man1')
+  )
+endforeach
+
+man = 'gvfs'
+output = man + '.7'
+
+custom_target(
+  output,
+  input: man + '.xml',
+  output: output,
+  command: xsltproc_cmd,
+  install: true,
+  install_dir: join_paths(gvfs_mandir, 'man7')
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..1326646
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,552 @@
+project(
+  'gvfs', 'c',
+  version: '1.35.2',
+  license: 'LGPL2+',
+  default_options: [
+    'b_lundef=true',
+    'buildtype=debugoptimized',
+    'warning_level=1'
+  ],
+  meson_version: '>= 0.43.0'
+)
+
+gvfs_name = meson.project_name()
+gvfs_version = meson.project_version()
+
+gvfs_prefix = get_option('prefix')
+gvfs_bindir = join_paths(gvfs_prefix, get_option('bindir'))
+gvfs_datadir = join_paths(gvfs_prefix, get_option('datadir'))
+gvfs_includedir = join_paths(gvfs_prefix, get_option('includedir'))
+gvfs_libdir = join_paths(gvfs_prefix, get_option('libdir'))
+gvfs_libexecdir = join_paths(gvfs_prefix, get_option('libexecdir'))
+gvfs_localedir = join_paths(gvfs_prefix, get_option('localedir'))
+gvfs_mandir = join_paths(gvfs_prefix, get_option('mandir'))
+
+gvfs_pkgdatadir = join_paths(gvfs_datadir, gvfs_name)
+gvfs_pkglibdir = join_paths(gvfs_libdir, gvfs_name)
+
+gvfs_rpath = gvfs_pkglibdir
+
+gvfs_dbus_service_dir = join_paths(gvfs_datadir, 'dbus-1', 'services')
+gvfs_remote_volume_monitors_dir = join_paths(gvfs_pkgdatadir, 'remote-volume-monitors')
+
+gio_module_dir = join_paths(gvfs_libdir, 'gio', 'modules')
+gvfs_mountdir = join_paths(gvfs_pkgdatadir, 'mounts')
+gvfs_schema_dir = join_paths(gvfs_datadir, 'glib-2.0', 'schemas')
+
+gvfs_namespace = 'org.gtk.vfs'
+
+gvfs_debug = get_option('buildtype').contains('debug')
+
+cc = meson.get_compiler('c')
+
+config_h = configuration_data()
+
+# defines
+set_defines = [
+  # package
+  ['PACKAGE', gvfs_name],
+  ['PACKAGE_BUGREPORT', 'http://bugzilla.gnome.org/enter_bug.cgi?product=' + gvfs_name],
+  ['PACKAGE_NAME', gvfs_name],
+  ['PACKAGE_STRING', '@0@ @1@'.format(gvfs_name, gvfs_version)],
+  ['PACKAGE_TARNAME', gvfs_name],
+  ['PACKAGE_URL', ''],
+  ['PACKAGE_VERSION', gvfs_version],
+  ['VERSION', gvfs_version],
+  # i18n
+  ['GETTEXT_PACKAGE', gvfs_name]
+]
+
+foreach define: set_defines
+  config_h.set_quoted(define[0], define[1])
+endforeach
+
+# Globally define_GNU_SOURCE and therefore enable the GNU extensions
+config_h.set('_GNU_SOURCE', true)
+
+# Pull in the right libraries for various functions which might not be
+# bundled into an exploded libc.
+have_socketpair = cc.has_function('socketpair')
+socket_deps = []
+
+if not have_socketpair
+  socket_dep = cc.find_library('socket', required: false)
+  have_socketpair = socket_dep.found() and cc.has_function('socketpair', dependencies: socket_dep)
+
+  if have_socketpair
+    socket_deps += socket_dep
+  endif
+endif
+
+config_h.set('HAVE_SOCKETPAIR', have_socketpair,
+             description: 'Define if you have the socketpair function.')
+
+util_dep = cc.find_library('util', required: false)
+config_h.set('HAVE_UTIL_H', cc.has_header('util.h', dependendencies: util_dep))
+
+have_openpty = cc.has_function('openpty')
+if not have_openpty
+  have_openpty = util_dep.found() and cc.has_function('openpty', dependencies: util_dep)
+endif
+
+config_h.set('HAVE_OPENPTY', have_openpty,
+             description: 'Define if you have the openpty function.')
+
+config_h.set('HAVE_LOGIN_TTY', util_dep.found() and cc.has_function('login_tty', dependencies: util_dep),
+             description: 'Whether login_tty is available')
+
+# if statfs() takes 2 arguments (Posix) or 4 (Solaris)
+statfs_code = '''
+  #include <sys/statfs.h>
+  #include <sys/vfs.h>
+  int main() {
+    struct statfs st;
+    @0@;
+  };
+'''
+
+if cc.compiles(statfs_code.format('statfs("/", &st)'))
+  config_h.set('STATFS_ARGS', 2)
+elif cc.compiles(statfs_code.format('statfs("/", &st, sizeof (st), 0)'))
+  config_h.set('STATFS_ARGS', 4)
+else
+  error('unable to determine number of arguments to statfs()')
+endif
+
+# headers
+check_headers = [
+  ['HAVE_DLFCN_H', 'dlfcn.h'],
+  ['HAVE_INTTYPES_H', 'inttypes.h'],
+  ['HAVE_MEMORY_H', 'memory.h'],
+  ['HAVE_STDINT_H', 'stdint.h'],
+  ['HAVE_STDLIB_H', 'stdlib.h'],
+  ['HAVE_STRINGS_H', 'strings.h'],
+  ['HAVE_STRING_H', 'string.h'],
+  ['HAVE_SYS_STAT_H', 'sys/stat.h'],
+  ['HAVE_SYS_TYPES_H', 'sys/types.h'],
+  ['HAVE_UNISTD_H', 'unistd.h'],
+  # fs + pty
+  ['HAVE_SYS_PARAM_H', 'sys/param.h'],
+  # fs
+  ['HAVE_SYS_MOUNT_H', 'sys/mount.h'],
+  ['HAVE_SYS_STATFS_H', 'sys/statfs.h'],
+  ['HAVE_SYS_STATVFS_H', 'sys/statvfs.h'],
+  ['HAVE_SYS_VFS_H', 'sys/vfs.h']
+]
+
+foreach header: check_headers
+  config_h.set10(header[0], cc.has_header(header[1]))
+endforeach
+
+# pty
+check_headers = [
+  ['HAVE_STROPTS_H', 'stropts.h'],
+  ['HAVE_SYS_UIO_H', 'sys/uio.h'],
+  ['HAVE_SYS_UN_H', 'sys/un.h'],
+  ['HAVE_TERMIOS_H', 'termios.h'],
+  ['HAVE_UTMP_H', 'utmp.h']
+]
+
+foreach header: check_headers
+  config_h.set(header[0], cc.has_header(header[1]))
+endforeach
+
+# functions
+check_functions = [
+  # i18n
+  ['HAVE_DCGETTEXT', 'dcgettext'],
+  ['HAVE_GETTEXT', 'gettext'],
+  ['HAVE_ICONV', 'iconv'],
+  # pty
+  ['HAVE_GETPT', 'getpt'],
+  ['HAVE_GRANTPT', 'grantpt'],
+  ['HAVE_POSIX_OPENPT', 'posix_openpt'],
+  ['HAVE_PTSNAME', 'ptsname'],
+  ['HAVE_PTSNAME_R', 'ptsname_r'],
+  ['HAVE_UNLOCKPT', 'unlockpt'],
+  # fs
+  ['HAVE_STATFS', 'statfs'],
+  ['HAVE_STATVFS', 'statvfs']
+]
+
+if host_machine.system().contains('darwin')
+  check_functions += [
+    ['HAVE_CFLOCALECOPYCURRENT', 'CFLocaleCopyCurrent'],
+    ['HAVE_CFPREFERENCESCOPYAPPVALUE', 'CFPreferencesCopyAppValue']
+  ]
+endif
+
+foreach func: check_functions
+  config_h.set(func[0], cc.has_function(func[1]))
+endforeach
+
+# symbols
+check_symbols = [
+  # i18n
+  ['HAVE_NL_ADDRESS_LANG_TERM', 'langinfo.h', '_NL_ADDRESS_LANG_TERM'],
+  ['HAVE_NL_ADDRESS_COUNTRY_AB3', 'langinfo.h', '_NL_ADDRESS_COUNTRY_AB3']
+]
+
+foreach symbol: check_symbols
+  config_h.set(symbol[0], cc.has_header_symbol(symbol[1], symbol[2]))
+endforeach
+
+# fs, check major, minor and makedev functions
+check_major_functions = ['major', 'minor', 'makedev']
+
+check_major_headers = [
+  ['MAJOR_IN_MKDEV', 'sys/mkdev.h'],
+  ['MAJOR_IN_SYSMACROS', 'sys/sysmacros.h']
+]
+
+foreach header: check_major_headers
+  have_major = true
+  foreach function: check_major_functions
+    have_major = have_major and cc.has_header_symbol(header[1], function)
+  endforeach
+
+  config_h.set10(header[0], have_major)
+endforeach
+
+# types
+check_types = [
+  # type, header, fallback type
+  ['gid_t', 'sys/types.h', 'int'],
+  ['pid_t', 'sys/types.h', 'int'],
+  ['size_t', 'sys/types.h', 'unsigned int'],
+  ['uid_t', 'sys/types.h', 'int']
+]
+
+foreach type: check_types
+  if not cc.has_type(type[0], prefix: '#include<@0@>'.format(type[1]))
+    config_h.set(type[0], type[2])
+  endif
+endforeach
+
+# members
+check_members = [
+  # define, typename, membername, prefix
+  ['HAVE_STRUCT_STATFS_F_BAVAIL', 'struct statfs', 'f_bavail', 'sys/statfs.h'],
+  ['HAVE_STRUCT_STATFS_F_FSTYPENAME', 'struct statfs', 'f_fstypename', 'sys/statfs.h'],
+  ['HAVE_STRUCT_STATVFS_F_BASETYPE', 'struct statvfs', 'f_basetype', 'sys/statvfs.h'],
+  ['HAVE_STRUCT_STAT_ST_ATIMENSEC', 'struct stat', 'st_atimensec', 'sys/stat.h'],
+  ['HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC', 'struct stat', 'st_atim.tv_nsec', 'sys/stat.h'],
+  ['HAVE_STRUCT_STAT_ST_CTIMENSEC', 'struct stat', 'st_ctimensec', 'sys/stat.h'],
+  ['HAVE_STRUCT_STAT_ST_CTIM_TV_NSEC', 'struct stat', 'st_ctim.tv_nsec', 'sys/stat.h'],
+  ['HAVE_STRUCT_STAT_ST_MTIMENSEC', 'struct stat', 'st_mtimensec', 'sys/stat.h'],
+  ['HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC', 'struct stat', 'st_mtim.tv_nsec', 'sys/stat.h']
+]
+
+foreach member: check_members
+  config_h.set(member[0], cc.has_members(member[1], member[2], prefix: '#include<@0@>'.format(member[3])))
+endforeach
+
+# compiler flags
+common_flags = ['-DHAVE_CONFIG_H']
+
+if gvfs_debug
+  test_cflags = [
+    '-Wcast-align',
+    '-Wmissing-declarations',
+    '-Wmissing-prototypes',
+    '-Wnested-externs',
+    '-Wno-sign-compare',
+    '-Wno-strict-aliasing'
+  ]
+
+  common_flags += cc.get_supported_arguments(test_cflags)
+endif
+
+add_project_arguments(common_flags, language: 'c')
+
+ldflag = '-Wl,--version-script'
+have_version_script = host_machine.system().contains('linux') and cc.has_argument(ldflag)
+
+glib_deps = [
+  dependency('gio-2.0'),
+  dependency('gio-unix-2.0'),
+  dependency('glib-2.0', version: '>= 2.51.0'),
+  dependency('gmodule-no-export-2.0'),
+  dependency('gobject-2.0')
+]
+
+# *** Check for libXML ***
+libxml_dep = dependency('libxml-2.0', required: false)
+have_libxml = libxml_dep.found()
+
+# *** Check for libgcrypt ***
+libgcrypt_config = find_program('libgcrypt-config')
+libgcrypt_version = run_command(libgcrypt_config, '--version').stdout().strip()
+
+libgcrypt_cflags = run_command(libgcrypt_config, '--cflags').stdout().strip().split()
+libgcrypt_libs = run_command(libgcrypt_config, '--libs').stdout().strip().split()
+
+libgcrypt_dep = declare_dependency(
+  compile_args: libgcrypt_cflags,
+  link_args: libgcrypt_libs,
+  version: libgcrypt_version
+)
+
+have_gcrypt = libgcrypt_version.version_compare('>= 1.2.2')
+config_h.set('HAVE_GCRYPT', have_gcrypt)
+
+# *** Check for dbus service dir ***
+dbus_service_dir = get_option('with-dbus-service-dir')
+if dbus_service_dir == ''
+  dbus_service_dir = join_paths(gvfs_datadir, 'dbus-1', 'services')
+endif
+
+# *** Check for systemd user units ***
+systemd_user_dir = get_option('with-systemduserunitdir')
+have_systemd_user_unit = (systemd_user_dir != 'no')
+
+if have_systemd_user_unit
+  systemd_dep = dependency('systemd', version: '>= 206')
+
+  if systemd_user_dir == ''
+    systemd_user_dir = join_paths(gvfs_libdir, 'systemd', 'user')
+  endif
+endif
+
+# *** Check for gcr ***
+enable_gcr = get_option('enable-gcr')
+if enable_gcr
+  gcr_dep = dependency('gcr-base-3')
+endif
+
+# *** Check if we should build with admin backend ***
+enable_admin = get_option('enable-admin')
+if enable_admin
+  libcap_dep = dependency('libcap')
+  polkit_gobject_dep = dependency('polkit-gobject-1')
+endif
+
+# *** Check if we should build with http backend ***
+enable_http = get_option('enable-http')
+if enable_http
+  assert(have_libxml, 'http required but libxml-2.0 not found')
+  libsoup_dep = dependency('libsoup-2.4', version: '>= 2.42.0')
+endif
+
+# *** Check if we should build with DNS-SD backend ***
+enable_avahi = get_option('enable-avahi')
+if enable_avahi
+  avahi_client_dep = dependency('avahi-client', version: '>= 0.6')
+  avahi_glib_dep = dependency('avahi-glib', version: '>= 0.6')
+endif
+config_h.set('HAVE_AVAHI', enable_avahi)
+
+# *** Check for libudev ***
+enable_udev = get_option('enable-udev')
+if enable_udev
+  libudev_dep = dependency('libudev', version: '>= 138')
+endif
+config_h.set('HAVE_LIBUDEV', enable_udev)
+
+# *** Check for gudev ***
+enable_gudev = get_option('enable-gudev')
+if enable_gudev
+  gudev_dep = dependency('gudev-1.0', version: '>= 147')
+endif
+config_h.set('HAVE_GUDEV', enable_gudev)
+
+# *** Check for FUSE ***
+enable_fuse = get_option('enable-fuse')
+if enable_fuse
+  fuse_dep = dependency('fuse', version: '>= 2.8.0')
+endif
+config_h.set('HAVE_FUSE', enable_fuse)
+
+# *** Check for gnome-disk-utility ***
+enable_gdu = get_option('enable-gdu')
+if enable_gdu
+  gdu_dep = dependency('gdu', version: '>= 3.0.2')
+endif
+
+# *** Check for udisks2 ***
+enable_udisks2 = get_option('enable-udisks2')
+if enable_udisks2
+  udisks2_dep = dependency('udisks2', version: '>= 1.97')
+endif
+
+# *** Check for libsystemd-login ***
+enable_libsystemd_login = get_option('enable-libsystemd-login')
+if enable_libsystemd_login
+  libsystemd_login_dep = dependency('libsystemd', required: false)
+  if not libsystemd_login_dep.found()
+    libsystemd_login_dep = dependency('libsystemd-login', version: '>= 44')
+  endif
+endif
+config_h.set('HAVE_LIBSYSTEMD_LOGIN', enable_libsystemd_login)
+
+# *** Check if we should build with AFC backend ***
+enable_afc = get_option('enable-afc')
+if enable_afc
+  libimobiledevice_dep = dependency('libimobiledevice-1.0', version: '>= 1.2')
+  libplist_dep = dependency('libplist', version: '>= 0.15')
+endif
+
+# *** Check if we should build with GOA volume monitor ***
+enable_goa = get_option('enable-goa')
+if enable_goa
+  goa_dep = dependency('goa-1.0', version: '>= 3.17.1')
+endif
+
+# *** Check for GNOME Keyring ***
+enable_keyring = get_option('enable-keyring')
+if enable_keyring
+  libsecret_dep = dependency('libsecret-unstable')
+endif
+config_h.set('HAVE_KEYRING', enable_keyring)
+
+# *** Check if we should build with libbluray ***
+enable_bluray = get_option('enable-bluray')
+if enable_bluray
+  libbluray_dep = dependency('libbluray')
+endif
+config_h.set('HAVE_BLURAY', enable_bluray)
+
+# *** Check if we should build with libusb-1.0 ***
+enable_libusb = get_option('enable-libusb')
+if enable_libusb
+  libusb_dep = dependency('libusb-1.0', version: '>= 1.0.21')
+endif
+config_h.set10('HAVE_LIBUSB', enable_libusb)
+
+# *** Check for samba ***
+enable_samba = get_option('enable-samba')
+if enable_samba
+  smbclient_dep = dependency('smbclient')
+endif
+
+# *** Check for libarchive ***
+enable_archive = get_option('enable-archive')
+if enable_archive
+  libarchive_dep = dependency('libarchive')
+endif
+
+# *** Check if we should build with CDDA backend ***
+enable_cdda = get_option('enable-cdda')
+if enable_cdda
+  assert(enable_gudev, 'CDDA backend requested but gudev is required')
+
+  libcdio_paranoia_dep = dependency('libcdio_paranoia', version: '>= 0.78.2')
+  config_h.set('HAVE_PARANOIA_NEW_INCLUDES', cc.has_header('cdio/paranoia/paranoia.h', dependencies: 
libcdio_paranoia_dep))
+endif
+
+# *** Check if we should build with Google backend ***
+enable_google = get_option('enable-google')
+if enable_google
+  assert(enable_goa, 'Google backend requested but GOA is required')
+
+  libgdata_dep = dependency('libgdata', version: '>= 0.17.3')
+  config_h.set10('HAVE_LIBGDATA_0_17_7', libgdata_dep.version().version_compare('>= 0.17.7'))
+  config_h.set10('HAVE_LIBGDATA_0_17_9', libgdata_dep.version().version_compare('>= 0.17.9'))
+endif
+
+# *** Check for gphoto2 ***
+enable_gphoto2 = get_option('enable-gphoto2')
+if enable_gphoto2
+  assert(enable_gudev, 'gphoto2 requested but gudev is required')
+  assert(host_machine.system().contains('linux') or host_machine.system().contains('bsd'),
+         'Cannot build with gphoto2 support. Need OS tweaks in volume monitor.')
+
+  libgphoto2_dep = dependency('libgphoto2', version: '>= 2.4.0')
+  config_h.set('HAVE_GPHOTO25', libgphoto2_dep.version().version_compare('>= 2.5.0'))
+endif
+
+# *** Check for libmtp ***
+enable_libmtp = get_option('enable-libmtp')
+if enable_libmtp
+  assert(enable_gudev, 'libmtp requested but gudev is required')
+
+  libmtp_dep = dependency('libmtp', version: '>= 1.1.0')
+  config_h.set10('HAVE_LIBMTP_1_1_5', libmtp_dep.version().version_compare('>= 1.1.5'))
+  config_h.set10('HAVE_LIBMTP_1_1_6', libmtp_dep.version().version_compare('>= 1.1.6'))
+  config_h.set10('HAVE_LIBMTP_1_1_9', libmtp_dep.version().version_compare('>= 1.1.9'))
+  config_h.set10('HAVE_LIBMTP_1_1_12', libmtp_dep.version().version_compare('>= 1.1.12'))
+endif
+config_h.set('HAVE_LIBMTP', enable_libmtp)
+
+# *** AFP backend ***
+enable_afp = get_option('enable-afp')
+msg_afp = 'false'
+if enable_afp
+  msg_afp = (have_gcrypt ? 'true' : 'partial (crypt support missing! Only anonymous logins)')
+endif
+
+# *** NFS backend ***
+enable_nfs = get_option('enable-nfs')
+if enable_nfs
+  libnfs_dep = dependency('libnfs', version: '>= 1.9.8')
+endif
+
+# *** Enable development utils ***
+enable_devel_utils = get_option('enable-devel-utils')
+enable_installed_tests = get_option('enable-installed-tests')
+
+gnome = import('gnome')
+i18n = import('i18n')
+pkg = import('pkgconfig')
+
+service_conf = configuration_data()
+service_conf.set('libexecdir', gvfs_libexecdir)
+
+po_dir = join_paths(meson.source_root(), 'po')
+
+top_inc = include_directories('.')
+
+subdir('common')
+subdir('metadata')
+subdir('client')
+subdir('daemon')
+subdir('monitor')
+subdir('po')
+subdir('programs')
+
+enable_man = get_option('enable-man')
+if enable_man
+  subdir('man')
+endif
+
+subdir('test')
+
+configure_file(
+  output: 'config.h',
+  configuration: config_h
+)
+
+meson.add_install_script(
+  'meson_post_install.py',
+  gvfs_datadir,
+  gvfs_libdir
+)
+
+output = '\ngvfs configuration summary:\n\n'
+output += '        gio module directory:         ' + gio_module_dir + '\n\n'
+output += '        Blu-ray metadata support:     ' + enable_bluray.to_string() + '\n'
+output += '        Google support:               ' + enable_google.to_string() + '\n'
+output += '        HTTP/WebDAV support:          ' + enable_http.to_string() + '\n'
+output += '        Samba support:                ' + enable_samba.to_string() + '\n'
+output += '        FUSE support:                 ' + enable_fuse.to_string() + '\n'
+output += '        CDDA support:                 ' + enable_cdda.to_string() + '\n'
+output += '        Gphoto2 support:              ' + enable_gphoto2.to_string() + '\n'
+output += '        MTP support:                  ' + enable_libmtp.to_string() + '\n'
+output += '        Polkit support:               ' + enable_admin.to_string() + '\n'
+output += '        USB support:                  ' + enable_libusb.to_string() + '\n'
+output += '        archive support:              ' + enable_archive.to_string() + '\n'
+output += '        AFC support:                  ' + enable_afc.to_string() + '\n'
+output += '        AFP support:                  ' + msg_afp + '\n'
+output += '        NFS support:                  ' + enable_nfs.to_string() + '\n'
+output += '        DNS-SD support:               ' + enable_avahi.to_string() + '\n'
+output += '        Build GDU volume monitor:     ' + enable_gdu.to_string() + '\n'
+output += '        Build udisks2 volume monitor: ' + enable_udisks2.to_string() + '\n'
+output += '        Build GOA volume monitor:     ' + enable_goa.to_string() + '\n'
+output += '        Use systemd user unit:        ' + have_systemd_user_unit.to_string() + '\n'
+output += '        Use libsystemd-login:         ' + enable_libsystemd_login.to_string() + '\n'
+output += '        Use GCR:                      ' + enable_gcr.to_string() + '\n'
+output += '        GNOME Keyring support:        ' + enable_keyring.to_string() + '\n\n'
+output += '        Generate man pages:           ' + enable_man.to_string() + '\n'
+output += '        Generate utility programs:    ' + enable_devel_utils.to_string() + '\n'
+output += '        Installed tests:              ' + enable_installed_tests.to_string()
+message(output)
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..ea48b4d
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,28 @@
+option('with-dbus-service-dir', type: 'string', value: '', description: 'choose directory for dbus service 
files [default=PREFIX/share/dbus-1/services]')
+option('with-systemduserunitdir', type: 'string', value: '', description: 'choose directory for systemd user 
units, or \'no\' to disable [default=PREFIX/lib/systemd/user]')
+option('enable-gcr', type: 'boolean', value: true, description: 'build with gcr')
+option('enable-admin', type: 'boolean', value: true, description: 'build with admin backend')
+option('enable-http', type: 'boolean', value: true, description: 'build with http/dav backend')
+option('enable-avahi', type: 'boolean', value: true, description: 'build with avahi backend')
+option('enable-udev', type: 'boolean', value: true, description: 'build with libudev')
+option('enable-gudev', type: 'boolean', value: true, description: 'build with gudev support')
+option('enable-fuse', type: 'boolean', value: true, description: 'build with FUSE support')
+option('enable-gdu', type: 'boolean', value: true, description: 'build with GDU volume monitor')
+option('enable-udisks2', type: 'boolean', value: true, description: 'build with libudisks2')
+option('enable-libsystemd-login', type: 'boolean', value: true, description: 'build with libsystemd-login')
+option('enable-afc', type: 'boolean', value: true, description: 'build with AFC backend')
+option('enable-goa', type: 'boolean', value: true, description: 'build with GOA volume monitor')
+option('enable-keyring', type: 'boolean', value: true, description: 'build with GNOME Keyring support')
+option('enable-bluray', type: 'boolean', value: true, description: 'build with bluray metadata support')
+option('enable-libusb', type: 'boolean', value: true, description: 'build with libusb support')
+option('enable-samba', type: 'boolean', value: true, description: 'build with samba support')
+option('enable-archive', type: 'boolean', value: true, description: 'build with archive support')
+option('enable-nfs', type: 'boolean', value: true, description: 'build with NFS support')
+option('enable-cdda', type: 'boolean', value: true, description: 'build with CDDA backend')
+option('enable-google', type: 'boolean', value: true, description: 'build with Google backend')
+option('enable-gphoto2', type: 'boolean', value: true, description: 'build with gphoto2 support')
+option('enable-libmtp', type: 'boolean', value: true, description: 'build with libmtp support')
+option('enable-afp', type: 'boolean', value: true, description: 'build with AFP support')
+option('enable-man', type: 'boolean', value: false, description: 'generate man pages')
+option('enable-devel-utils', type: 'boolean', value: false, description: 'generate development utility 
programs')
+option('enable-installed-tests', type: 'boolean', value: false, description: 'enable installed unit tests')
diff --git a/meson_post_install.py b/meson_post_install.py
new file mode 100644
index 0000000..4232625
--- /dev/null
+++ b/meson_post_install.py
@@ -0,0 +1,14 @@
+#!/usr/bin/env python3
+
+import os
+import subprocess
+import sys
+
+if not os.environ.get('DESTDIR'):
+  schemadir = os.path.join(sys.argv[1], 'glib-2.0', 'schemas')
+  print('Compiling gsettings schemas...')
+  subprocess.call(['glib-compile-schemas', schemadir])
+
+  giomoduledir = os.path.join(sys.argv[2], 'gio', 'modules')
+  print('GIO module cache creation...')
+  subprocess.call(['gio-querymodules', giomoduledir])
diff --git a/metadata/Makefile.am b/metadata/Makefile.am
index b38d01b..9acc213 100644
--- a/metadata/Makefile.am
+++ b/metadata/Makefile.am
@@ -81,6 +81,7 @@ EXTRA_DIST =                          \
        $(service_in_files)             \
        $(systemd_user_in_files)        \
        dbus-interface.xml              \
+       meson.build                     \
        $(NULL)
 
 CLEANFILES =                           \
diff --git a/metadata/meson.build b/metadata/meson.build
new file mode 100644
index 0000000..303280f
--- /dev/null
+++ b/metadata/meson.build
@@ -0,0 +1,106 @@
+service = gvfs_namespace + '.Metadata.service'
+
+metadata_service = configure_file(
+  input: service + '.in',
+  output: service,
+  install: true,
+  install_dir: gvfs_dbus_service_dir,
+  configuration: service_conf
+)
+
+if have_systemd_user_unit
+  service = 'gvfs-metadata.service'
+
+  configure_file(
+    input: service + '.in',
+    output: service,
+    install: true,
+    install_dir: systemd_user_dir,
+    configuration: service_conf
+  )
+endif
+
+metadata_dbus = gnome.gdbus_codegen(
+  'metadata-dbus',
+  'dbus-interface.xml',
+  interface_prefix: gvfs_namespace + '.',
+  namespace: 'GVfs'
+)
+
+sources = files(
+  'crc32.c',
+  'metabuilder.c',
+  'metatree.c'
+)
+
+cflags = [
+  '-DDBUS_API_SUBJECT_TO_CHANGE',
+  '-DG_LOG_DOMAIN="@0@"'.format(gvfs_name.to_upper()),
+  '-DGVFS_LOCALEDIR="@0@"'.format(gvfs_localedir)
+]
+
+libmetadata = static_library(
+  'metadata',
+  sources: sources + [metadata_dbus],
+  include_directories: [top_inc, common_inc],
+  dependencies: glib_deps,
+  c_args: cflags,
+  pic: true
+)
+
+libmetadata_dep = declare_dependency(
+  sources: metadata_dbus,
+  link_with: libmetadata,
+  include_directories: include_directories('.'),
+  dependencies: glib_deps
+)
+
+executable(
+  'gvfsd-metadata',
+  'meta-daemon.c',
+  include_directories: top_inc,
+  dependencies: [
+    libgvfscommon_dep,
+    libmetadata_dep,
+    libudev_dep
+  ],
+  c_args: cflags,
+  install: true,
+  install_rpath: gvfs_rpath,
+  install_dir: gvfs_libexecdir
+)
+
+if enable_devel_utils
+  apps = [
+    'meta-ls',
+    'meta-get',
+    'meta-set',
+    'meta-get-tree'
+  ]
+
+  foreach app: apps
+    executable(
+      app,
+      app + '.c',
+      include_directories: top_inc,
+      dependencies: [
+        libgvfscommon_dep,
+        libmetadata_dep
+      ],
+      c_args: cflags
+    )
+  endforeach
+
+  if have_libxml
+    executable(
+      'convert-nautilus-metadata',
+      'metadata-nautilus.c',
+      include_directories: top_inc,
+      dependencies: [
+        libmetadata_dep,
+        libxml_dep
+      ],
+      c_args: cflags
+    )
+  endif
+endif
diff --git a/monitor/Makefile.am b/monitor/Makefile.am
index 10df398..3a8481a 100644
--- a/monitor/Makefile.am
+++ b/monitor/Makefile.am
@@ -24,3 +24,5 @@ endif
 if USE_GOA
 SUBDIRS += goa
 endif
+
+EXTRA_DIST = meson.build
diff --git a/monitor/afc/Makefile.am b/monitor/afc/Makefile.am
index 48c7978..2a1821d 100644
--- a/monitor/afc/Makefile.am
+++ b/monitor/afc/Makefile.am
@@ -55,6 +55,7 @@ CLEANFILES = \
        $(NULL)
 
 EXTRA_DIST = \
+       meson.build \
        $(service_in_files) \
        $(systemd_user_in_files) \
        $(remote_volume_monitors_DATA) \
diff --git a/monitor/afc/meson.build b/monitor/afc/meson.build
new file mode 100644
index 0000000..776341f
--- /dev/null
+++ b/monitor/afc/meson.build
@@ -0,0 +1,58 @@
+afc_monitor = files('afc.monitor')
+
+install_data(
+  afc_monitor,
+  install_dir: gvfs_remote_volume_monitors_dir
+)
+
+service = gvfs_namespace + '.AfcVolumeMonitor.service'
+
+afc_service = configure_file(
+  input: service + '.in',
+  output: service,
+  install: true,
+  install_dir: gvfs_dbus_service_dir,
+  configuration: service_conf
+)
+
+if have_systemd_user_unit
+  service = 'gvfs-afc-volume-monitor.service'
+
+  configure_file(
+    input: service + '.in',
+    output: service,
+    install: true,
+    install_dir: systemd_user_dir,
+    configuration: service_conf
+  )
+endif
+
+sources = files(
+  'afcvolumemonitordaemon.c',
+  'afcvolume.c',
+  'afcvolumemonitor.c'
+)
+
+deps = glib_deps + [
+  libimobiledevice_dep,
+  libplist_dep,
+  libgvfscommon_dep,
+  libgvfsproxyvolumemonitordaemon_noin_dep
+]
+
+cflags = [
+  '-DG_LOG_DOMAIN="GVFS-AFC"',
+  '-DGIO_MODULE_DIR="@0@"'.format(gio_module_dir),
+  '-DGVFS_LOCALEDIR="@0@"'.format(gvfs_localedir)
+]
+
+executable(
+  'gvfs-afc-volume-monitor',
+  sources,
+  include_directories: top_inc,
+  dependencies: deps,
+  c_args: cflags,
+  install: true,
+  install_rpath: gvfs_rpath,
+  install_dir: gvfs_libexecdir
+)
diff --git a/monitor/gdu/Makefile.am b/monitor/gdu/Makefile.am
index 175d739..4ba128f 100644
--- a/monitor/gdu/Makefile.am
+++ b/monitor/gdu/Makefile.am
@@ -63,6 +63,7 @@ CLEANFILES = \
        $(NULL)
 
 EXTRA_DIST = \
+       meson.build \
        $(service_in_files) \
        $(systemd_user_in_files) \
        $(remote_volume_monitors_DATA) \
diff --git a/monitor/gdu/meson.build b/monitor/gdu/meson.build
new file mode 100644
index 0000000..86ddd3d
--- /dev/null
+++ b/monitor/gdu/meson.build
@@ -0,0 +1,60 @@
+gdu_monitor = files('gdu.monitor')
+
+install_data(
+  gdu_monitor,
+  install_dir: gvfs_remote_volume_monitors_dir
+)
+
+gdu_service = configure_file(
+  input: service + '.in',
+  output: service,
+  install: true,
+  install_dir: gvfs_dbus_service_dir,
+  configuration: service_conf
+)
+
+if have_systemd_user_unit
+  service = 'gvfs-gdu-volume-monitor.service'
+
+  configure_file(
+    input: service + '.in',
+    output: service,
+    install: true,
+    install_dir: systemd_user_dir,
+    configuration: service_conf
+  )
+endif
+
+sources = files(
+  'gdu-volume-monitor-daemon.c',
+  'ggdudrive.c',
+  'ggdumount.c',
+  'ggduvolume.c',
+  'ggduvolumemonitor.c'
+)
+
+deps = glib_deps + [
+  gdu_dep,
+  gudev_dep,
+  libgvfscommon_dep,
+  libgvfscommon_monitor_dep,
+  libgvfsproxyvolumemonitordaemon_noin_dep
+]
+
+cflags = [
+  '-DG_LOG_DOMAIN="GVFS-Gdu"',
+  '-DGDU_API_IS_SUBJECT_TO_CHANGE',
+  '-DGIO_MODULE_DIR="@0@"'.format(gio_modules_dir),
+  '-DGVFS_LOCALEDIR="@0@"'.format(gvfs_localedir)
+]
+
+executable(
+  'gvfs-gdu-volume-monitor',
+  sources,
+  include_directories: top_inc,
+  dependencies: deps,
+  c_args: cflags,
+  install: true,
+  install_rpath: gvfs_rpath,
+  install_dir: gvfs_libexecdir
+)
diff --git a/monitor/goa/Makefile.am b/monitor/goa/Makefile.am
index af7845e..9a85d04 100644
--- a/monitor/goa/Makefile.am
+++ b/monitor/goa/Makefile.am
@@ -55,6 +55,7 @@ CLEANFILES = \
        $(NULL)
 
 EXTRA_DIST = \
+       meson.build \
        $(service_in_files) \
        $(systemd_user_in_files) \
        $(remote_volume_monitors_DATA) \
diff --git a/monitor/goa/meson.build b/monitor/goa/meson.build
new file mode 100644
index 0000000..111d8d4
--- /dev/null
+++ b/monitor/goa/meson.build
@@ -0,0 +1,55 @@
+install_data(
+  'goa.monitor',
+  install_dir: gvfs_remote_volume_monitors_dir
+)
+
+service = gvfs_namespace + '.GoaVolumeMonitor.service'
+
+configure_file(
+  input: service + '.in',
+  output: service,
+  install: true,
+  install_dir: gvfs_dbus_service_dir,
+  configuration: service_conf
+)
+
+if have_systemd_user_unit
+  service = 'gvfs-goa-volume-monitor.service'
+
+  configure_file(
+    input: service + '.in',
+    output: service,
+    install: true,
+    install_dir: systemd_user_dir,
+    configuration: service_conf
+  )
+endif
+
+sources = files(
+  'goavolumemonitordaemon.c',
+  'goavolume.c',
+  'goavolumemonitor.c'
+)
+
+deps = glib_deps + [
+  goa_dep,
+  libgvfscommon_dep,
+  libgvfsproxyvolumemonitordaemon_noin_dep
+]
+
+cflags = [
+  '-DG_LOG_DOMAIN="GVFS-GOA"',
+  '-DGIO_MODULE_DIR="@0@"'.format(gio_module_dir),
+  '-DGVFS_LOCALEDIR="@0@"'.format(gvfs_localedir)
+]
+
+executable(
+  'gvfs-goa-volume-monitor',
+  sources,
+  include_directories: top_inc,
+  dependencies: deps,
+  c_args: cflags,
+  install: true,
+  install_rpath: gvfs_rpath,
+  install_dir: gvfs_libexecdir
+)
diff --git a/monitor/gphoto2/Makefile.am b/monitor/gphoto2/Makefile.am
index b13fd98..2beb08f 100644
--- a/monitor/gphoto2/Makefile.am
+++ b/monitor/gphoto2/Makefile.am
@@ -59,6 +59,7 @@ CLEANFILES = \
        $(NULL)
 
 EXTRA_DIST = \
+       meson.build \
        $(service_in_files) \
        $(systemd_user_in_files) \
        $(remote_volume_monitors_DATA) \
diff --git a/monitor/gphoto2/meson.build b/monitor/gphoto2/meson.build
new file mode 100644
index 0000000..2cb3128
--- /dev/null
+++ b/monitor/gphoto2/meson.build
@@ -0,0 +1,59 @@
+gphoto2_monitor = files('gphoto2.monitor')
+
+install_data(
+  gphoto2_monitor,
+  install_dir: gvfs_remote_volume_monitors_dir
+)
+
+service = gvfs_namespace + '.GPhoto2VolumeMonitor.service'
+
+gphoto2_service = configure_file(
+  input: service + '.in',
+  output: service,
+  install: true,
+  install_dir: gvfs_dbus_service_dir,
+  configuration: service_conf
+)
+
+if have_systemd_user_unit
+  service = 'gvfs-gphoto2-volume-monitor.service'
+
+  configure_file(
+    input: service + '.in',
+    output: service,
+    install: true,
+    install_dir: systemd_user_dir,
+    configuration: service_conf
+  )
+endif
+
+sources = files(
+  'gphoto2-volume-monitor-daemon.c',
+  'ggphoto2volume.c',
+  'ggphoto2volumemonitor.c'
+)
+
+deps = glib_deps + [
+  libgphoto2_dep,
+  gudev_dep,
+  libgvfscommon_dep,
+  libgvfscommon_gphoto2_dep,
+  libgvfsproxyvolumemonitordaemon_noin_dep
+]
+
+cflags = [
+  '-DG_LOG_DOMAIN="GVFS-GPhoto2"',
+  '-DGIO_MODULE_DIR="@0@"'.format(gio_module_dir),
+  '-DGVFS_LOCALEDIR="@0@"'.format(gvfs_localedir)
+]
+
+executable(
+  'gvfs-gphoto2-volume-monitor',
+  sources,
+  include_directories: top_inc,
+  dependencies: deps,
+  c_args: cflags,
+  install: true,
+  install_rpath: gvfs_rpath,
+  install_dir: gvfs_libexecdir
+)
diff --git a/monitor/meson.build b/monitor/meson.build
new file mode 100644
index 0000000..b02c291
--- /dev/null
+++ b/monitor/meson.build
@@ -0,0 +1,25 @@
+subdir('proxy')
+
+if enable_gdu
+  subdir('gdu')
+endif
+
+if enable_udisks2
+  subdir('udisks2')
+endif
+
+if enable_gphoto2
+  subdir('gphoto2')
+endif
+
+if enable_afc
+  subdir('afc')
+endif
+
+if enable_libmtp
+  subdir('mtp')
+endif
+
+if enable_goa
+  subdir('goa')
+endif
diff --git a/monitor/mtp/Makefile.am b/monitor/mtp/Makefile.am
index 2a7e9de..af0d10e 100644
--- a/monitor/mtp/Makefile.am
+++ b/monitor/mtp/Makefile.am
@@ -63,4 +63,5 @@ EXTRA_DIST = \
        $(service_in_files) \
        $(systemd_user_in_files) \
        $(remote_volume_monitors_DATA) \
+       meson.build \
        $(NULL)
diff --git a/monitor/mtp/meson.build b/monitor/mtp/meson.build
new file mode 100644
index 0000000..21eb427
--- /dev/null
+++ b/monitor/mtp/meson.build
@@ -0,0 +1,56 @@
+install_data(
+  'mtp.monitor',
+  install_dir: gvfs_remote_volume_monitors_dir
+)
+
+service = gvfs_namespace + '.MTPVolumeMonitor.service'
+
+configure_file(
+  input: service + '.in',
+  output: service,
+  install: true,
+  install_dir: gvfs_dbus_service_dir,
+  configuration: service_conf
+)
+
+if have_systemd_user_unit
+  service = 'gvfs-mtp-volume-monitor.service'
+
+  configure_file(
+    input: service + '.in',
+    output: service,
+    install: true,
+    install_dir: systemd_user_dir,
+    configuration: service_conf
+  )
+endif
+
+sources = files(
+  'mtp-volume-monitor-daemon.c',
+  'gmtpvolume.c',
+  'gmtpvolumemonitor.c'
+)
+
+deps = glib_deps + [
+  gudev_dep,
+  libgvfscommon_dep,
+  libgvfscommon_gphoto2_dep,
+  libgvfsproxyvolumemonitordaemon_noin_dep
+]
+
+cflags = [
+  '-DG_LOG_DOMAIN="GVFS-MTP"',
+  '-DGIO_MODULE_DIR="@0@"'.format(gio_module_dir),
+  '-DGVFS_LOCALEDIR="@0@"'.format(gvfs_localedir)
+]
+
+executable(
+  'gvfs-mtp-volume-monitor',
+  sources,
+  include_directories: top_inc,
+  dependencies: deps,
+  c_args: cflags,
+  install: true,
+  install_rpath: gvfs_rpath,
+  install_dir: gvfs_libexecdir
+)
diff --git a/monitor/proxy/Makefile.am b/monitor/proxy/Makefile.am
index 3b3c8db..cf449c4 100644
--- a/monitor/proxy/Makefile.am
+++ b/monitor/proxy/Makefile.am
@@ -81,6 +81,8 @@ install-data-local:
 
 EXTRA_DIST =                                                   \
        dbus-interfaces.xml                                     \
+       meson.build                                             \
+       symbol.map                                              \
        $(NULL)
 
 CLEANFILES =                                                   \
diff --git a/monitor/proxy/meson.build b/monitor/proxy/meson.build
new file mode 100644
index 0000000..b728eb8
--- /dev/null
+++ b/monitor/proxy/meson.build
@@ -0,0 +1,65 @@
+dbus_sources = gnome.gdbus_codegen(
+  'gvfsvolumemonitordbus',
+  'dbus-interfaces.xml',
+  interface_prefix: 'org.gtk.Private.',
+  namespace: 'GVfs'
+)
+
+sources = files(
+  'remote-volume-monitor-module.c',
+  'gproxydrive.c',
+  'gproxymount.c',
+  'gproxymountoperation.c',
+  'gproxyshadowmount.c',
+  'gproxyvolume.c',
+  'gproxyvolumemonitor.c'
+)
+
+deps = glib_deps + [libgvfscommon_dep]
+
+cflags = [
+  '-DG_LOG_DOMAIN="GVFS-RemoteVolumeMonitor"',
+  '-DGIO_MODULE_DIR="@0@"'.format(gio_module_dir),
+  '-DGVFS_LOCALEDIR="@0@"'.format(gvfs_localedir),
+  '-DREMOTE_VOLUME_MONITORS_DIR="@0@"'.format(gvfs_remote_volume_monitors_dir)
+]
+
+symbol_map = join_paths(meson.current_source_dir(), 'symbol.map')
+
+ldflags = []
+if have_version_script
+  ldflags += '-Wl,--version-script,@0@'.format(symbol_map)
+endif
+
+libgioremove_volume_monitor = shared_module(
+  'gioremote-volume-monitor',
+  sources: sources + [dbus_sources],
+  include_directories: top_inc,
+  dependencies: deps,
+  c_args: cflags,
+  link_args: ldflags,
+  link_depends: symbol_map,
+  install: true,
+  install_rpath: gvfs_rpath,
+  install_dir: gio_module_dir
+)
+
+sources = files('gvfsproxyvolumemonitordaemon.c')
+
+cflags = [
+  '-DG_LOG_DOMAIN="GVFS-RemoteVolumeMonitorDaemon"',
+  '-DGVFS_LOCALEDIR="@0@"'.format(gvfs_localedir)
+]
+
+libgvfsproxyvolumemonitordaemon_noin = static_library(
+  'gvfsproxyvolumemonitordaemon-noin',
+  sources: sources + [dbus_sources],
+  include_directories: top_inc,
+  dependencies: deps,
+  c_args: cflags
+)
+
+libgvfsproxyvolumemonitordaemon_noin_dep = declare_dependency(
+  link_with: libgvfsproxyvolumemonitordaemon_noin,
+  include_directories: include_directories('.')
+)
diff --git a/monitor/proxy/symbol.map b/monitor/proxy/symbol.map
new file mode 100644
index 0000000..43ed5a7
--- /dev/null
+++ b/monitor/proxy/symbol.map
@@ -0,0 +1,8 @@
+{
+global:
+  g_io_module_load;
+  g_io_module_unload;
+  g_io_module_query;
+local:
+  *;
+};
diff --git a/monitor/udisks2/Makefile.am b/monitor/udisks2/Makefile.am
index 052fac5..304b9c1 100644
--- a/monitor/udisks2/Makefile.am
+++ b/monitor/udisks2/Makefile.am
@@ -69,6 +69,7 @@ CLEANFILES = \
 
 EXTRA_DIST = \
        what-is-shown.txt \
+       meson.build \
        $(service_in_files) \
        $(systemd_user_in_files) \
        $(remote_volume_monitors_DATA) \
diff --git a/monitor/udisks2/meson.build b/monitor/udisks2/meson.build
new file mode 100644
index 0000000..44e4923
--- /dev/null
+++ b/monitor/udisks2/meson.build
@@ -0,0 +1,72 @@
+udisks2_monitor = files('udisks2.monitor')
+
+install_data(
+  udisks2_monitor,
+  install_dir: gvfs_remote_volume_monitors_dir
+)
+
+service = gvfs_namespace + '.UDisks2VolumeMonitor.service'
+
+udisks2_service = configure_file(
+  input: service + '.in',
+  output: service,
+  install: true,
+  install_dir: gvfs_dbus_service_dir,
+  configuration: service_conf
+)
+
+if have_systemd_user_unit
+  service = 'gvfs-udisks2-volume-monitor.service'
+
+  configure_file(
+    input: service + '.in',
+    output: service,
+    install: true,
+    install_dir: systemd_user_dir,
+    configuration: service_conf
+  )
+endif
+
+sources = files(
+  'udisks2volumemonitordaemon.c',
+  'gvfsudisks2drive.c',
+  'gvfsudisks2mount.c',
+  'gvfsudisks2utils.c',
+  'gvfsudisks2volume.c',
+  'gvfsudisks2volumemonitor.c'
+)
+
+deps = glib_deps + [
+  udisks2_dep,
+  gudev_dep,
+  libgvfscommon_dep,
+  libgvfscommon_monitor_dep,
+  libgvfsproxyvolumemonitordaemon_noin_dep
+]
+
+if enable_libsystemd_login
+  deps += libsystemd_login_dep
+endif
+
+if enable_keyring
+  deps += libsecret_dep
+endif
+
+cflags = [
+  '-DG_LOG_DOMAIN="GVFS-UDisks2"',
+  '-DG_DISABLE_DEPRECATED',
+  '-DGIO_MODULE_DIR="@0@"'.format(gio_module_dir),
+  '-DGVFS_LOCALEDIR="@0@"'.format(gvfs_localedir),
+  '-DUDISKS_API_IS_SUBJECT_TO_CHANGE'
+]
+
+executable(
+  'gvfs-udisks2-volume-monitor',
+  sources,
+  include_directories: top_inc,
+  dependencies: deps,
+  c_args: cflags,
+  install: true,
+  install_rpath: gvfs_rpath,
+  install_dir: gvfs_libexecdir
+)
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..3e88e78
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext(gvfs_name, preset: 'glib')
diff --git a/programs/Makefile.am b/programs/Makefile.am
index d7e22e2..0eb074b 100644
--- a/programs/Makefile.am
+++ b/programs/Makefile.am
@@ -75,6 +75,7 @@ gvfs-mime: deprecated.in Makefile
 EXTRA_DIST = \
        deprecated.in \
        gvfs-less \
+       meson.build \
        $(NULL)
 
 CLEANFILES = \
diff --git a/programs/deprecated.in b/programs/deprecated.in
old mode 100644
new mode 100755
diff --git a/programs/meson.build b/programs/meson.build
new file mode 100644
index 0000000..1dea6b7
--- /dev/null
+++ b/programs/meson.build
@@ -0,0 +1,37 @@
+script_names = [
+  ['mount', 'mount'],
+  ['cat', 'cat'],
+  ['open', 'open'],
+  ['save', 'save'],
+  ['ls', 'list'],
+  ['tree', 'tree'],
+  ['info', 'info'],
+  ['set-attribute', 'set'],
+  ['trash', 'trash'],
+  ['rename', 'rename'],
+  ['rm', 'remove'],
+  ['copy', 'copy'],
+  ['move', 'move'],
+  ['monitor-file', 'monitor'],
+  ['monitor-dir', 'monitor'],
+  ['mkdir', 'mkdir'],
+  ['mime', 'mime']
+]
+
+foreach name: script_names
+  conf = configuration_data()
+  conf.set('command', name[1])
+
+  configure_file(
+    input: 'deprecated.in',
+    output: 'gvfs-' + name[0],
+    install: true,
+    install_dir: gvfs_bindir,
+    configuration: conf
+  )
+endforeach
+
+install_data(
+  'gvfs-less',
+  install_dir: gvfs_bindir
+)
diff --git a/test/Makefile.am b/test/Makefile.am
index 3c169e6..3142ce1 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -119,4 +119,6 @@ EXTRA_DIST += \
        files/testcert.pem              \
        files/powershot.ioctl           \
        files/powershot.umockdev        \
+       meson.build                     \
+       gvfs-all-tests.in               \
        $(NULL)
diff --git a/test/gvfs-all-tests.in b/test/gvfs-all-tests.in
new file mode 100644
index 0000000..357b5d6
--- /dev/null
+++ b/test/gvfs-all-tests.in
@@ -0,0 +1,4 @@
+[Test]
+Type=session
+Exec=@testdir@/gvfs-test
+Output=TAP
diff --git a/test/meson.build b/test/meson.build
new file mode 100644
index 0000000..f323c1b
--- /dev/null
+++ b/test/meson.build
@@ -0,0 +1,79 @@
+if enable_installed_tests
+  installed_tests_execdir = join_paths(gvfs_libexecdir, 'installed-tests', gvfs_name)
+  installed_tests_metadir = join_paths(gvfs_datadir, 'installed-tests', gvfs_name)
+
+  tests_conf = configuration_data()
+  tests_conf.set('testdir', installed_tests_execdir)
+
+  session = 'session.conf'
+
+  configure_file(
+    input: session + '.in',
+    output: session,
+    install: true,
+    install_dir: installed_tests_execdir,
+    configuration: tests_conf
+  )
+
+  all_tests = 'gvfs-all-tests'
+
+  configure_file(
+    input: all_tests + '.in',
+    output: all_tests + '.test',
+    install: true,
+    install_dir: installed_tests_metadir,
+    configuration: tests_conf
+  )
+
+  install_subdir(
+    'files',
+    install_dir: installed_tests_execdir
+  )
+
+  gvfs_test = files('gvfs-test')
+
+  test_data = gvfs_test + [
+    daemon_service,
+    metadata_service
+  ]
+
+  if enable_afc
+    test_data += [afc_monitor, afc_service]
+  endif
+
+  if enable_gdu
+    test_data += [gdu_monitor, gdu_service]
+  endif
+
+  if enable_gphoto2
+    test_data += [gphoto2_monitor, gphoto2_service]
+  endif
+
+  if enable_udisks2
+    test_data += [udisks2_monitor, udisks2_service]
+  endif
+
+  install_data(
+    test_data,
+    install_dir: installed_tests_execdir
+  )
+endif
+
+if enable_devel_utils
+  tests = [
+    'benchmark-gvfs-big-files',
+    'benchmark-gvfs-small-files',
+    'benchmark-posix-big-files',
+    'benchmark-posix-small-files',
+    'test-query-info-stream'
+  ]
+
+  foreach test: tests
+    executable(
+      test,
+      test + '.c',
+      include_directories: top_inc,
+      dependencies: glib_deps
+    )
+  endforeach
+endif


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