[gnome-online-accounts/wip/inigomartinez/meson: 132/134] build: Port to meson build system



commit c71a976d08f8e71d353ac231dfc4e0a92526f881
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Mon Sep 11 11:41:58 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=787634

 data/icons/meson.build      |   34 ++++
 data/meson.build            |   28 +++
 doc/meson.build             |   46 +++++
 meson.build                 |  394 +++++++++++++++++++++++++++++++++++++++++++
 meson_options.txt           |   46 +++++
 meson_post_install.py       |   18 ++
 po/meson.build              |    1 +
 src/daemon/meson.build      |   29 +++
 src/examples/meson.build    |   22 +++
 src/goa/goaconfig.h.in      |   17 ++
 src/goa/meson.build         |  121 +++++++++++++
 src/goabackend/meson.build  |  152 +++++++++++++++++
 src/goaidentity/meson.build |   75 ++++++++
 src/meson.build             |   15 ++
 14 files changed, 998 insertions(+), 0 deletions(-)
---
diff --git a/data/icons/meson.build b/data/icons/meson.build
new file mode 100644
index 0000000..866e2f9
--- /dev/null
+++ b/data/icons/meson.build
@@ -0,0 +1,34 @@
+icon_data = [
+  'goa-account-facebook.png',
+  'goa-account-flickr.png',
+  'goa-account-foursquare.png',
+  'goa-account-google.png',
+  'goa-account-msn.png',
+  'goa-account-owncloud.png',
+  'goa-account.png',
+  'goa-account-pocket.png',
+  'goa-account-todoist.png'
+]
+
+icon_data_256 = ['goa-account.png']
+
+icons = [
+  ['16x16', icon_data],
+  ['22x22', icon_data],
+  ['24x24', icon_data],
+  ['32x32', icon_data],
+  ['48x48', icon_data],
+  ['96x96', icon_data],
+  ['256x256', icon_data_256]
+]
+
+foreach icon: icons
+  icon_dir = join_paths(goa_datadir, 'icons', 'hicolor', icon[0], 'apps')
+
+  foreach data: icon[1]
+    install_data(
+      join_paths(icon[0], data),
+      install_dir: icon_dir
+    )
+  endforeach
+endforeach
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..ff05185
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,28 @@
+subdir('icons')
+
+services = ['org.gnome.OnlineAccounts.service']
+if enable_kerberos
+  services += 'org.gnome.Identity.service'
+endif
+
+service_conf = configuration_data()
+service_conf.set('libexecdir', goa_libexecdir)
+
+foreach service: services
+  configure_file(
+    input: service + '.in',
+    output: service,
+    configuration: service_conf,
+    install: true,
+    install_dir: dbus_service_dir
+  )
+endforeach
+
+dbus_ifaces = files('dbus-interfaces.xml')
+
+if enable_goabackend
+  install_data(
+    'org.gnome.online-accounts.gschema.xml',
+    install_dir: join_paths(goa_datadir, 'glib-2.0', 'schemas')
+  )
+endif
diff --git a/doc/meson.build b/doc/meson.build
new file mode 100644
index 0000000..18a7e53
--- /dev/null
+++ b/doc/meson.build
@@ -0,0 +1,46 @@
+if enable_gtk_doc
+  version_conf = configuration_data()
+  version_conf.set('VERSION', goa_version)
+
+  version_xml = 'version.xml'
+
+  configure_file(
+    input: version_xml + '.in',
+    output: version_xml,
+    configuration: version_conf
+  )
+
+  gnome.gtkdoc(
+    goa_name,
+    main_xml: goa_name + '-docs.xml',
+    src_dir: [goa_inc, goabackend_inc],
+    dependencies: libgoa_backend_dep,
+    mkdb_args: '--name-space=' + goa_name,
+    fixxref_args: '--html-dir=' + join_paths(goa_prefix, gnome.gtkdoc_html_dir(goa_name)),
+    gobject_typesfile: files(goa_name + '.types'),
+    install: true
+  )
+endif
+
+if enable_man
+  xsltproc_cmd = [
+    find_program('xsltproc'),
+    '--output', '@OUTPUT@',
+    '--nonet',
+    '--stringparam', 'man.output.quietly', '1',
+    '--stringparam', 'funcsynopsis.style', 'ansi',
+    'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
+    '@INPUT@'
+  ]
+
+  man = 'goa-daemon'
+
+  custom_target(
+    man + '.8',
+    input: man + '.xml',
+    output: man + '.8',
+    command: xsltproc_cmd,
+    install: true,
+    install_dir: join_paths(goa_mandir, 'man8')
+  )
+endif
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..a54e517
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,394 @@
+project(
+  'GNOME Online Accounts', 'c',
+  version: '3.29.1',
+  license: 'LGPL2+',
+  default_options: 'buildtype=debugoptimized',
+  meson_version: '>= 0.46.0'
+)
+
+goa_long_name = 'gnome-online-accounts'
+goa_name = 'goa'
+
+goa_version = meson.project_version()
+version_array = goa_version.split('.')
+goa_major_version = version_array[0].to_int()
+goa_minor_version = version_array[1].to_int()
+goa_micro_version = version_array[2].to_int()
+
+goa_ns = 'Goa'
+
+goa_api_version = '1.0'
+goa_api_name = '@0@-@1@'.format(goa_name, goa_api_version)
+goa_backend_api_name = '@0@-backend-@1@'.format(goa_name, goa_api_version)
+
+goa_gir_version = '1.0'
+
+goa_prefix = get_option('prefix')
+goa_datadir = join_paths(goa_prefix, get_option('datadir'))
+goa_includedir = join_paths(goa_prefix, get_option('includedir'))
+goa_libdir = join_paths(goa_prefix, get_option('libdir'))
+goa_libexecdir = join_paths(goa_prefix, get_option('libexecdir'))
+goa_localedir = join_paths(goa_prefix, get_option('localedir'))
+goa_mandir = join_paths(goa_prefix, get_option('mandir'))
+
+goa_pkgdatadir = join_paths(goa_datadir, goa_long_name)
+goa_pkgincludedir = join_paths(goa_includedir, goa_api_name)
+goa_pkglibdir = join_paths(goa_libdir, goa_api_name)
+
+# Before making a release, the LT_VERSION string should be modified.
+# The string is of the form C:R:A.
+# - If interfaces have been changed or added, but binary compatibility has
+#   been preserved, change to C+1:0:A+1
+# - If binary compatibility has been broken (eg removed or changed interfaces)
+#   change to C+1:0:0
+# - If the interface is the same as the previous version, change to C:R+1:A
+#
+# libversion = '@0@.@1@.@2@'.format(soversion, current, revision)
+goa_libversion = '0.0.0'
+goa_backend_libversion = '1.0.0'
+
+goa_buildtype = get_option('buildtype')
+cc = meson.get_compiler('c')
+
+config_h = configuration_data()
+
+# quoted defines
+config_h.set_quoted('PACKAGE_VERSION', goa_version)
+# i18n
+config_h.set_quoted('GETTEXT_PACKAGE', goa_long_name)
+
+# version values
+config_h.set('GOA_MAJOR_VERSION', goa_major_version)
+config_h.set('GOA_MINOR_VERSION', goa_minor_version)
+config_h.set('GOA_MICRO_VERSION', goa_micro_version)
+
+# compiler flags
+common_flags = [
+  '-DHAVE_CONFIG_H',
+  '-D_POSIX_PTHREAD_SEMANTICS',
+  '-D_REENTRANT'
+]
+compiler_flags = []
+
+if goa_buildtype.contains('debug')
+  test_cflags = [
+    '-Werror=format=2',
+    '-Werror=implicit-function-declaration',
+    '-Werror=init-self',
+    '-Werror=missing-include-dirs',
+    '-Werror=missing-prototypes',
+    '-Werror=pointer-arith',
+    '-Werror=return-type',
+    '-Wnested-externs',
+    '-Wstrict-prototypes'
+  ]
+
+  compiler_flags += cc.get_supported_arguments(test_cflags)
+endif
+
+add_project_arguments(common_flags + compiler_flags, language: 'c')
+
+glib_req_version = '>= 2.52'
+
+gio_dep = dependency('gio-2.0', version: glib_req_version)
+gio_unix_dep = dependency('gio-unix-2.0', version: glib_req_version)
+glib_dep = dependency('glib-2.0', version: glib_req_version)
+
+# Check for dbus service dir
+dbus_dep = dependency('dbus-1')
+dbus_service_dir = dbus_dep.get_pkgconfig_variable('session_bus_services_dir', define_variable: ['datadir', 
goa_datadir])
+
+# Libraries
+# introspection support
+enable_introspection = get_option('introspection')
+if enable_introspection
+  # Check do enough recent version
+  dependency('gobject-introspection-1.0', version: '>= 0.6.2')
+endif
+
+enable_goabackend = get_option('goabackend')
+if enable_goabackend
+  gtk_dep = dependency('gtk+-3.0', version: '>= 3.19.12')
+  json_glib_dep = dependency('json-glib-1.0')
+  libsecret_dep = dependency('libsecret-1')
+  libsoup_dep = dependency('libsoup-2.4', version: '>= 2.42')
+  libxml_dep = dependency('libxml-2.0')
+  rest_dep = dependency('rest-0.7')
+  webkit_gtk_dep = dependency('webkit2gtk-4.0', version: '>= 2.12.0')
+endif
+config_h.set('GOA_BACKEND_ENABLED', enable_goabackend)
+
+enable_inspector = get_option('inspector')
+config_h.set('GOA_INSPECTOR_ENABLED', enable_inspector)
+
+template_file = get_option('template_file')
+config_h.set_quoted('GOA_TEMPLATE_FILE', template_file)
+
+enable_vapi = get_option('vapi')
+
+# Microsoft Exchange
+enable_exchange = get_option('exchange')
+if enable_exchange
+  config_h.set_quoted('GOA_EXCHANGE_NAME', 'exchange')
+endif
+config_h.set('GOA_EXCHANGE_ENABLED', enable_exchange)
+
+# Facebook
+enable_facebook = get_option('facebook')
+if enable_facebook
+  config_h.set_quoted('GOA_FACEBOOK_NAME', 'facebook')
+
+  facebook_client_id = get_option('facebook_client_id')
+  config_h.set_quoted('GOA_FACEBOOK_CLIENT_ID', facebook_client_id)
+endif
+config_h.set('GOA_FACEBOOK_ENABLED', enable_facebook)
+
+# Flickr
+enable_flickr = get_option('flickr')
+if enable_flickr
+  config_h.set_quoted('GOA_FLICKR_NAME', 'flickr')
+
+  flickr_consumer_key = get_option('flickr_consumer_key')
+  config_h.set_quoted('GOA_FLICKR_CONSUMER_KEY', flickr_consumer_key)
+
+  flickr_consumer_secret = get_option('flickr_consumer_secret')
+  config_h.set_quoted('GOA_FLICKR_CONSUMER_SECRET', flickr_consumer_secret)
+endif
+config_h.set('GOA_FLICKR_ENABLED', enable_flickr)
+
+# Foursquare
+enable_foursquare = get_option('foursquare')
+if enable_foursquare
+  config_h.set_quoted('GOA_FOURSQUARE_NAME', 'foursquare')
+
+  foursquare_client_id = get_option('foursquare_client_id')
+  config_h.set_quoted('GOA_FOURSQUARE_CLIENT_ID', foursquare_client_id)
+endif
+config_h.set('GOA_FOURSQUARE_ENABLED', enable_foursquare)
+
+# Google
+enable_google = get_option('google')
+if enable_google
+  config_h.set_quoted('GOA_GOOGLE_NAME', 'google')
+
+  google_client_id = get_option('google_client_id')
+  config_h.set_quoted('GOA_GOOGLE_CLIENT_ID', google_client_id)
+
+  google_client_secret = get_option('google_client_secret')
+  config_h.set_quoted('GOA_GOOGLE_CLIENT_SECRET', google_client_secret)
+endif
+config_h.set('GOA_GOOGLE_ENABLED', enable_google)
+
+# IMAP/SMTP
+enable_imap_smtp = get_option('imap_smtp')
+if enable_imap_smtp
+  config_h.set_quoted('GOA_IMAP_SMTP_NAME', 'imap_smtp')
+endif
+config_h.set('GOA_IMAP_SMTP_ENABLED', enable_imap_smtp)
+
+# Kerberos
+enable_kerberos = get_option('kerberos')
+if enable_kerberos
+  krb5_dep = dependency('krb5')
+  gcr_dep = dependency('gcr-3')
+
+  config_h.set_quoted('GOA_KERBEROS_NAME', 'kerberos')
+  config_h.set('GCR_API_SUBJECT_TO_CHANGE', true)
+endif
+config_h.set('GOA_KERBEROS_ENABLED', enable_kerberos)
+
+# Media Server
+enable_media_server = get_option('media_server')
+if enable_media_server
+  config_h.set_quoted('GOA_MEDIA_SERVER_NAME', 'media-server')
+endif
+config_h.set('GOA_MEDIA_SERVER_ENABLED', enable_media_server)
+
+# Last.fm
+enable_lastfm = get_option('lastfm')
+if enable_lastfm
+  config_h.set_quoted('GOA_LASTFM_NAME', 'lastfm')
+
+  lastfm_client_id = get_option('lastfm_client_id')
+  config_h.set_quoted('GOA_LASTFM_CLIENT_ID', lastfm_client_id)
+
+  lastfm_client_secret = get_option('lastfm_client_secret')
+  config_h.set_quoted('GOA_LASTFM_CLIENT_SECRET', lastfm_client_secret)
+endif
+config_h.set('GOA_LASTFM_ENABLED', enable_lastfm)
+
+# ownCloud
+enable_owncloud = get_option('owncloud')
+if enable_owncloud
+  config_h.set_quoted('GOA_OWNCLOUD_NAME', 'owncloud')
+endif
+config_h.set('GOA_OWNCLOUD_ENABLED', enable_owncloud)
+
+# Pocket
+enable_pocket = get_option('pocket')
+if enable_pocket
+  config_h.set_quoted('GOA_POCKET_NAME', 'pocket')
+
+  pocket_client_id = get_option('pocket_client_id')
+  config_h.set_quoted('GOA_POCKET_CLIENT_ID', pocket_client_id)
+endif
+config_h.set('GOA_POCKET_ENABLED', enable_pocket)
+
+# Todoist
+enable_todoist = get_option('todoist')
+if enable_todoist
+  config_h.set_quoted('GOA_TODOIST_NAME', 'todoist')
+
+  todoist_client_id = get_option('todoist_client_id')
+  config_h.set_quoted('GOA_TODOIST_CLIENT_ID', todoist_client_id)
+
+  todoist_client_secret = get_option('todoist_client_secret')
+  config_h.set_quoted('GOA_TODOIST_CLIENT_SECRET', todoist_client_secret)
+endif
+config_h.set('GOA_TODOIST_ENABLED', enable_todoist)
+
+# Windows Live
+enable_windows_live = get_option('windows_live')
+if enable_windows_live
+  config_h.set_quoted('GOA_WINDOWS_LIVE_NAME', 'windows_live')
+
+  windows_live_client_id = get_option('windows_live_client_id')
+  config_h.set_quoted('GOA_WINDOWS_LIVE_CLIENT_ID', windows_live_client_id)
+endif
+config_h.set('GOA_WINDOWS_LIVE_ENABLED', enable_windows_live)
+
+# Optional timerfd support
+timerfd_support_src = '''
+  #include <sys/timerfd.h>
+  #include <unistd.h>
+  int
+  main (void)
+  {
+    struct itimerspec timer_spec = { 0 };
+    timerfd_settime (timerfd_create (CLOCK_MONOTONIC, TFD_CLOEXEC),
+                     TFD_TIMER_ABSTIME,
+                     &timer_spec,
+                     NULL);
+
+    return 0;
+  };
+'''
+
+have_timerfd = cc.compiles(timerfd_support_src, name: 'timerfd support')
+config_h.set('HAVE_TIMERFD', have_timerfd)
+
+if have_timerfd
+  # libc headers tend to trail kernel support
+  # so compensate if necessary
+  timerfd_cancel_on_set_support_src = '''
+    #include <sys/timerfd.h>
+    #include <unistd.h>
+    int
+    main (void)
+    {
+      struct itimerspec timer_spec = { 0 };
+      timerfd_settime (timerfd_create (CLOCK_MONOTONIC, TFD_CLOEXEC),
+                       TFD_TIMER_ABSTIME | TFD_TIMER_CANCEL_ON_SET,
+                       &timer_spec,
+                       NULL);
+
+      return 0;
+    };
+  '''
+
+  # FIXME: what if TFD_TIMER_CANCEL_ON_SET is not defined?
+  if not cc.compiles(timerfd_cancel_on_set_support_src, name: 'timerfd cancel-on-set support')
+    config_h.set('TFD_TIMER_CANCEL_ON_SET', '(1 << 1)')
+  endif
+endif
+
+configure_file(
+  output: 'config.h',
+  configuration: config_h
+)
+
+gnome = import('gnome')
+i18n = import('i18n')
+pkg = import('pkgconfig')
+
+top_inc = include_directories('.')
+
+subdir('data')
+subdir('src')
+
+enable_gtk_doc = get_option('gtk_doc')
+enable_man = get_option('man')
+if enable_goabackend and (enable_gtk_doc or enable_man)
+  subdir('doc')
+endif
+
+subdir('po')
+
+meson.add_install_script(
+  'meson_post_install.py',
+  goa_datadir,
+  enable_goabackend ? 'compile-schemas' : ''
+)
+
+output = '\n        gnome-online-accounts ' + goa_version + '\n'
+output += '        =============================\n'
+output += '        prefix:                         ' + goa_prefix + '\n'
+output += '        libdir:                         ' + goa_libdir + '\n'
+output += '        libexecdir:                     ' + goa_libexecdir + '\n'
+output += '        datadir:                        ' + goa_datadir + '\n'
+output += '        compiler:                       ' + cc.get_id() + '\n'
+output += '        cflags:                         ' + ' '.join(compiler_flags) + '\n\n'
+output += '        goabackend:                     ' + enable_goabackend.to_string() + '\n'
+output += '        inspector:                      ' + enable_inspector.to_string() + '\n'
+output += '        introspection:                  ' + enable_introspection.to_string() + '\n'
+output += '        template file:                  ' + template_file + '\n\n'
+output += '        Facebook provider:              ' + enable_facebook.to_string()
+if enable_facebook
+  output += ' (OAuth 2.0, id:@0@)'.format(facebook_client_id)
+endif
+output += '\n'
+output += '        Flickr provider:                ' + enable_flickr.to_string()
+if enable_flickr
+  output += ' (OAuth 1.0, key:@0@)'.format(flickr_consumer_key)
+endif
+output += '\n'
+output += '        Foursquare provider:            ' + enable_foursquare.to_string()
+if enable_foursquare
+  output += ' (id:@0@)'.format(foursquare_client_id)
+endif
+output += '\n'
+output += '        Google provider:                ' + enable_google.to_string()
+if enable_google
+  output += ' (OAuth 2.0, id:@0@ secret:@1@)'.format(google_client_id, google_client_secret)
+endif
+output += '\n'
+output += '        IMAP/SMTP provider:             ' + enable_imap_smtp.to_string() + '\n'
+output += '        Kerberos provider:              ' + enable_kerberos.to_string() + '\n'
+output += '        Last.fm provider:               ' + enable_lastfm.to_string()
+if enable_lastfm
+  output += ' (id:@0@ secret:@1@)'.format(lastfm_client_id, lastfm_client_secret)
+endif
+output += '\n'
+output += '        Media Server provider:          ' + enable_media_server.to_string() + '\n'
+output += '        Microsoft Exchange provider:    ' + enable_exchange.to_string() + '\n'
+output += '        ownCloud provider:              ' + enable_owncloud.to_string() + '\n'
+output += '        Pocket provider:                ' + enable_pocket.to_string()
+if enable_pocket
+  output += ' (id:@0@)'.format(pocket_client_id)
+endif
+output += '\n'
+output += '        Todoist provider:               ' + enable_todoist.to_string()
+if enable_todoist
+  output += ' (OAuth 2.0, id:@0@ secret:@1@)'.format(todoist_client_id, todoist_client_secret)
+endif
+output += '\n'
+output += '        Windows Live provider:          ' + enable_windows_live.to_string()
+if enable_windows_live
+  output += ' (OAuth 2.0, id:@0@)'.format(windows_live_client_id)
+endif
+output += '\n\n'
+output += '        Build type:                     ' + goa_buildtype + '\n'
+output += '        Vala:                           ' + enable_vapi.to_string() + '\n'
+output += '        Build api docs:                 ' + enable_gtk_doc.to_string() + '\n'
+output += '        Build man:                      ' + enable_man.to_string()
+message(output)
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..f0cd538
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,46 @@
+option('goabackend', type: 'boolean', value: false, description: 'Enable goabackend library')
+option('inspector', type: 'boolean', value: false, description: 'Enable a WebKitWebInspector for the 
embedded web view')
+
+option('exchange', type: 'boolean', value: true, description: 'Enable Microsoft Exchange provider')
+
+option('facebook', type: 'boolean', value: true, description: 'Enable Facebook provider')
+option('facebook_client_id', type: 'string', value: '297654143624603', description: 'Facebook OAuth 2.0 
client id')
+
+option('flickr', type: 'boolean', value: true, description: 'Enable Flickr provider')
+option('flickr_consumer_key', type: 'string', value: 'ed00ad7e0869897506e23c0d18e34d01', description: 
'Flickr OAuth 1.0 consumer key')
+option('flickr_consumer_secret', type: 'string', value: 'ebd556dd187188b1', description: 'Flickr OAuth 1.0 
consumer secret')
+
+option('foursquare', type: 'boolean', value: true, description: 'Enable Foursquare provider')
+option('foursquare_client_id', type: 'string', value: 'MBNU2NES5HASNDQJ25YPFGG2UGRZHPI3IYTNJGE0KIWT2HCF', 
description: 'Foursquare OAuth 2.0 client id')
+
+option('google', type: 'boolean', value: true, description: 'Enable Google provider')
+option('google_client_id', type: 'string', value: 
'44438659992-7kgjeitenc16ssihbtdjbgguch7ju55s.apps.googleusercontent.com', description: 'Google OAuth 2.0 
client id')
+option('google_client_secret', type: 'string', value: '-gMLuQyDiI0XrQS_vx_mhuYF', description: 'Google OAuth 
2.0 client secret')
+
+option('imap_smtp', type: 'boolean', value: true, description: 'Enable IMAP/SMTP provider')
+
+option('kerberos', type: 'boolean', value: true, description: 'Enable kerberos provider')
+
+option('lastfm', type: 'boolean', value: true, description: 'Enable Last.fm provider')
+option('lastfm_client_id', type: 'string', value: '7a2461fe34c9c8124fb28ac750ba12fa', description: 'Last.fm 
client id')
+option('lastfm_client_secret', type: 'string', value: '49ec391644459c417f3afe57ca246c5a', description: 
'Last.fm client secret')
+
+option('media_server', type: 'boolean', value: true, description: 'Enable Media Server provider')
+
+option('owncloud', type: 'boolean', value: true, description: 'Enable ownCloud provider')
+
+option('pocket', type: 'boolean', value: true, description: 'Enable Pocket provider')
+option('pocket_client_id', type: 'string', value: '16630-40b25246b56e8ad5310b2883', description: 'Pocket 
OAuth 2.0 client id')
+
+option('todoist', type: 'boolean', value: true, description: 'Enable Todoist provider')
+option('todoist_client_id', type: 'string', value: '2e41575c1dd74f98ad7cfb178e1ba3dd', description: 'Todoist 
OAuth 2.0 client id')
+option('todoist_client_secret', type: 'string', value: '3e59831ffdd64633918d19aa0a1efd2b', description: 
'Todoist client secret')
+
+option('windows_live', type: 'boolean', value: true, description: 'Enable Windows Live provider')
+option('windows_live_client_id', type: 'string', value: '0000000044067703', description: 'Windows Live OAuth 
2.0 client id')
+
+option('gtk_doc', type: 'boolean', value: false, description: 'use gtk_doc to build documentation')
+option('introspection', type: 'boolean', value: true, description: 'Enable GObject Introspection (depends on 
GObject)')
+option('man', type: 'boolean', value: false, description: 'enable man pages and HTML')
+option('template_file', type: 'string', value: '', description: 'Path to the template file')
+option('vapi', type: 'boolean', value: true, description: 'build Vala binding')
diff --git a/meson_post_install.py b/meson_post_install.py
new file mode 100644
index 0000000..eceb500
--- /dev/null
+++ b/meson_post_install.py
@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+
+import glob
+import os
+import subprocess
+import sys
+
+if not os.environ.get('DESTDIR'):
+  datadir = sys.argv[1]
+
+  icondir = os.path.join(datadir, 'icons', 'hicolor')
+  print('Update icon cache...')
+  subprocess.call(['gtk-update-icon-cache', '-f', '-t', icondir])
+
+  if sys.argv[2] == 'compile-schemas':
+    schemadir = os.path.join(datadir, 'glib-2.0', 'schemas')
+    print('Compiling gsettings schemas...')
+    subprocess.call(['glib-compile-schemas', schemadir])
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..91cc7cf
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext(goa_long_name, preset: 'glib')
diff --git a/src/daemon/meson.build b/src/daemon/meson.build
new file mode 100644
index 0000000..1d4db9b
--- /dev/null
+++ b/src/daemon/meson.build
@@ -0,0 +1,29 @@
+name = 'goa-daemon'
+
+sources = files(
+  'goadaemon.c',
+  'main.c'
+)
+
+deps = [
+  libgoa_backend_dep,
+  rest_dep
+]
+
+cflags = [
+  '-DG_LOG_DOMAIN="@0@"'.format(name),
+  '-DGOA_API_IS_SUBJECT_TO_CHANGE',
+  '-DGOA_BACKEND_API_IS_SUBJECT_TO_CHANGE',
+  '-DGOA_BACKEND_COMPILATION',
+  '-DPACKAGE_LOCALE_DIR="@0@"'.format(goa_localedir),
+]
+
+executable(
+  name,
+  sources,
+  include_directories: common_incs,
+  dependencies: deps,
+  c_args: cflags,
+  install: true,
+  install_dir: goa_libexecdir
+)
diff --git a/src/examples/meson.build b/src/examples/meson.build
new file mode 100644
index 0000000..6edd9f1
--- /dev/null
+++ b/src/examples/meson.build
@@ -0,0 +1,22 @@
+programs = [
+  # program name, deps
+  ['list-accounts', libgoa_dep],
+  ['lastfm-shout', [libgoa_dep, rest_dep]]
+]
+
+if enable_goabackend
+  programs += [
+    ['introspect-providers', libgoa_backend_dep],
+    ['list-providers', libgoa_backend_dep],
+    ['add-pocket', [libgoa_dep, rest_dep]]
+  ]
+endif
+
+foreach program: programs
+  executable(
+    program[0],
+    program[0] + '.c',
+    include_directories: common_incs,
+    dependencies: program[1]
+  )
+endforeach
diff --git a/src/goa/goaconfig.h.in b/src/goa/goaconfig.h.in
new file mode 100644
index 0000000..65f800c
--- /dev/null
+++ b/src/goa/goaconfig.h.in
@@ -0,0 +1,17 @@
+/* goaconfig.h
+ *
+ * This is a generated file.  Please modify 'goaconfig.h.in'
+ */
+
+#ifndef __GOA_CONFIG_H__
+#define __GOA_CONFIG_H__
+
+G_BEGIN_DECLS
+
+#define GOA_MAJOR_VERSION @GOA_MAJOR_VERSION@
+#define GOA_MINOR_VERSION @GOA_MINOR_VERSION@
+#define GOA_MICRO_VERSION @GOA_MICRO_VERSION@
+
+G_END_DECLS
+
+#endif /* __GOA_CONFIG_H__ */
diff --git a/src/goa/meson.build b/src/goa/meson.build
new file mode 100644
index 0000000..d91ed19
--- /dev/null
+++ b/src/goa/meson.build
@@ -0,0 +1,121 @@
+goa_inc = include_directories('.')
+
+enum_headers = files('goaenums.h')
+
+headers = enum_headers + files(
+  'goaclient.h',
+  'goaerror.h',
+  'goa.h',
+  'goaversion.h'
+)
+
+install_headers(
+  headers,
+  install_dir: join_paths(goa_pkgincludedir, goa_name)
+)
+
+goaconfig_conf = configuration_data()
+goaconfig_conf.set('GOA_MAJOR_VERSION', goa_major_version)
+goaconfig_conf.set('GOA_MINOR_VERSION', goa_minor_version)
+goaconfig_conf.set('GOA_MICRO_VERSION', goa_micro_version)
+
+goaconfig = 'goaconfig.h'
+
+goaconfig_h = configure_file(
+  input: goaconfig + '.in',
+  output: goaconfig,
+  configuration: goaconfig_conf,
+  install: true,
+  install_dir: join_paths(goa_pkglibdir, 'include')
+)
+
+dbus = 'goa-generated'
+
+dbus_sources = gnome.gdbus_codegen(
+  dbus,
+  dbus_ifaces,
+  interface_prefix: 'org.gnome.OnlineAccounts.',
+  namespace: goa_ns,
+  object_manager: true,
+  docbook: dbus + '-doc',
+  install_header: true,
+  install_dir: join_paths(goa_pkgincludedir, goa_name)
+)
+
+enum = 'goaenumtypes'
+
+enum_sources = gnome.mkenums(
+  enum,
+  sources: enum_headers,
+  c_template: enum + '.c.template',
+  h_template: enum + '.h.template',
+  install_header: true,
+  install_dir: join_paths(goa_pkgincludedir, goa_name)
+)
+
+sources = [goaconfig_h] + dbus_sources + enum_sources + files(
+  'goaclient.c',
+  'goaerror.c',
+  'goaversion.c'
+)
+
+deps = [
+  gio_dep,
+  glib_dep
+]
+
+cflags = [
+  '-DG_LOG_DOMAIN="@0@"'.format(goa_ns),
+  '-DGOA_COMPILATION'
+]
+
+libgoa = shared_library(
+  goa_api_name,
+  sources: sources,
+  version: goa_libversion,
+  include_directories: common_incs,
+  dependencies: deps + [gio_unix_dep],
+  c_args: cflags,
+  install: true
+)
+
+libgoa_dep = declare_dependency(
+  sources: [goaconfig_h, dbus_sources[1], enum_sources[1]],
+  include_directories: goa_inc,
+  dependencies: deps,
+  link_with: libgoa
+)
+
+pkg.generate(
+  libraries: libgoa,
+  version: goa_version,
+  name: goa_ns,
+  description: 'GNOME Online Accounts Library',
+  filebase: goa_api_name,
+  subdirs: goa_api_name,
+  requires: 'gio-2.0',
+  variables: 'exec_prefix=${prefix}'
+)
+
+if enable_introspection
+  libgoa_gir = gnome.generate_gir(
+    libgoa,
+    sources: sources + headers,
+    includes: 'Gio-2.0',
+    nsversion: goa_api_version,
+    namespace: goa_ns,
+    export_packages: goa_api_name,
+    extra_args: '-DGOA_COMPILATION',
+    header: join_paths(goa_name, 'goa.h'),
+    install: true
+  )
+
+  if enable_vapi
+    gnome.generate_vapi(
+      goa_api_name,
+      sources: libgoa_gir[0],
+      packages: 'gio-2.0',
+      install: true
+    )
+  endif
+endif
diff --git a/src/goabackend/meson.build b/src/goabackend/meson.build
new file mode 100644
index 0000000..3fb7fc1
--- /dev/null
+++ b/src/goabackend/meson.build
@@ -0,0 +1,152 @@
+goabackend_inc = include_directories('.')
+
+enum_headers = files('goabackendenums.h')
+
+headers = enum_headers + files(
+  'goabackend.h',
+  'goaprovider.h'
+)
+
+install_headers(
+  headers,
+  install_dir: join_paths(goa_pkgincludedir, 'goabackend')
+)
+
+enum = 'goabackendenumtypes'
+
+enum_sources = gnome.mkenums(
+  enum,
+  sources: enum_headers,
+  c_template: enum + '.c.template',
+  h_template: enum + '.h.template',
+  install_header: true,
+  install_dir: join_paths(goa_pkgincludedir, 'goabackend')
+)
+
+sources = enum_sources + files(
+  'goaoauth2provider.c',
+  'goaoauthprovider.c',
+  'goabackendinit.c',
+  'goadlnaservermanager.c',
+  'goaewsclient.c',
+  'goaexchangeprovider.c',
+  'goafacebookprovider.c',
+  'goaflickrprovider.c',
+  'goafoursquareprovider.c',
+  'goagoogleprovider.c',
+  'goahttpclient.c',
+  'goaimapauthlogin.c',
+  'goaimapsmtpprovider.c',
+  'goalastfmprovider.c',
+  'goamailauth.c',
+  'goamailclient.c',
+  'goamediaserverprovider.c',
+  'goaobjectskeletonutils.c',
+  'goaowncloudprovider.c',
+  'goapocketprovider.c',
+  'goaprovider.c',
+  'goarestproxy.c',
+  'goasmtpauth.c',
+  'goasouplogger.c',
+  'goatodoistprovider.c',
+  'goautils.c',
+  'goawebview.c',
+  'goawindowsliveprovider.c',
+  'nautilus-floating-bar.c'
+)
+
+dbus = 'goadleynaservermanager'
+
+sources += gnome.gdbus_codegen(
+  dbus,
+  dbus + '.xml',
+  interface_prefix: 'com.intel.dLeynaServer.',
+  namespace: 'DleynaServer'
+)
+
+dbus = 'goadleynaservermediadevice'
+
+sources += gnome.gdbus_codegen(
+  dbus,
+  dbus + '.xml',
+  interface_prefix: 'com.intel.dLeynaServer.',
+  namespace: 'DleynaServer'
+)
+
+incs = common_incs
+
+deps = [
+  gtk_dep,
+  json_glib_dep,
+  libgoa_dep,
+  libsecret_dep,
+  libsoup_dep,
+  libxml_dep,
+  rest_dep,
+  webkit_gtk_dep
+]
+
+cflags = [
+  '-DG_LOG_DOMAIN="GoaBackend"',
+  '-DGOA_API_IS_SUBJECT_TO_CHANGE',
+  '-DGOA_BACKEND_COMPILATION',
+  '-DPACKAGE_LOCALE_DIR="@0@"'.format(goa_localedir),
+  '-DPACKAGE_WEB_EXTENSIONS_DIR="@0@"'.format(join_paths(goa_pkglibdir, 'web-extensions'))
+]
+
+if enable_kerberos
+  sources += identity_dbus_sources + identity_manager_error_src + files('goakerberosprovider.c')
+
+  incs += goaidentity_inc
+
+  deps += [gcr_dep]
+endif
+
+libgoa_backend = shared_library(
+  goa_backend_api_name,
+  sources,
+  version: goa_backend_libversion,
+  include_directories: incs,
+  dependencies: deps,
+  c_args: cflags,
+  install: true
+)
+
+libgoa_backend_dep = declare_dependency(
+  sources: enum_sources[1],
+  include_directories: goabackend_inc,
+  dependencies: [gtk_dep, libgoa_dep],
+  link_with: libgoa_backend
+)
+
+pkg.generate(
+  libraries: libgoa_backend,
+  version: goa_version,
+  name: 'Goa Backends',
+  description: 'Backends for GNOME Online Accounts Library',
+  filebase: goa_backend_api_name,
+  subdirs: goa_api_name,
+  requires: [goa_api_name, 'gtk+-3.0'],
+  variables: 'exec_prefix=${prefix}'
+)
+
+sources = files(
+  'goawebextension.c',
+  'goawebextensionmain.c'
+)
+
+deps = [
+  rest_dep,
+  webkit_gtk_dep
+]
+
+libgoa_web_extension = shared_module(
+  'goawebextension',
+  sources + [goaconfig_h, enum_sources[1]],
+  include_directories: common_incs + [goa_inc],
+  dependencies: deps,
+  c_args: cflags,
+  link_with: libgoa_backend,
+  install: true,
+  install_dir: join_paths(goa_pkglibdir, 'web-extensions')
+)
diff --git a/src/goaidentity/meson.build b/src/goaidentity/meson.build
new file mode 100644
index 0000000..0cd6ad1
--- /dev/null
+++ b/src/goaidentity/meson.build
@@ -0,0 +1,75 @@
+goaidentity_inc = include_directories('.')
+
+headers = files(
+  'goaalarm.h',
+  'goaidentity.h',
+  'goaidentityinquiry.h',
+  'goaidentityinquiryprivate.h',
+  'goaidentityservice.h',
+  'goaidentitymanagerprivate.h',
+  'goaidentitymanager.h',
+  'goaidentitymanagererror.h',
+  'goaidentityutils.h',
+  'goakerberosidentity.h',
+  'goakerberosidentityinquiry.h',
+  'goakerberosidentitymanager.h'
+)
+
+dbus = 'org.gnome.Identity'
+
+identity_dbus_sources = gnome.gdbus_codegen(
+  dbus,
+  dbus + '.xml',
+  interface_prefix: dbus + '.',
+  namespace: 'GoaIdentityService',
+  object_manager: true,
+  annotations: [dbus, 'org.gtk.GDBus.C.Name', 'Identity']
+)
+
+identity_manager_error_src = files('goaidentitymanagererror.c')
+
+sources = identity_manager_error_src + files(
+  'goaalarm.c',
+  'goaidentity.c',
+  'goaidentityinquiry.c',
+  'goaidentityservice.c',
+  'goaidentitymanager.c',
+  'goaidentityutils.c',
+  'goakerberosidentity.c',
+  'goakerberosidentityinquiry.c',
+  'goakerberosidentitymanager.c',
+  'main.c'
+)
+
+enum = 'goaidentityenumtypes'
+
+sources += gnome.mkenums(
+  enum,
+  sources: headers,
+  c_template: enum + '.c.in',
+  h_template: enum + '.h.in'
+)
+
+deps = [
+  gcr_dep,
+  krb5_dep,
+  libgoa_dep
+]
+
+cflags = [
+  '-DG_LOG_DOMAIN="libgoaidentity"',
+  '-DGOA_COMPILATION',
+  '-DGOA_API_IS_SUBJECT_TO_CHANGE',
+  '-DGOA_BACKEND_API_IS_SUBJECT_TO_CHANGE',
+  '-DPACKAGE_LOCALE_DIR="@0@"'.format(goa_localedir),
+]
+
+executable(
+  'goa-identity-service',
+  sources + [identity_dbus_sources],
+  include_directories: common_incs,
+  dependencies: deps,
+  c_args: cflags,
+  install: true,
+  install_dir: goa_libexecdir
+)
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..3181c66
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,15 @@
+src_inc = include_directories('.')
+
+common_incs = [top_inc, src_inc]
+
+subdir('goa')
+
+if enable_goabackend
+  if enable_kerberos
+    subdir('goaidentity')
+  endif
+
+  subdir('goabackend')
+  subdir('daemon')
+  subdir('examples')
+endif


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