[gnome-keyring/wip/nielsdg/meson] Support Meson build system



commit 4a89eb9b035b7bbaa337e82d0a56ce3fe238e815
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Sat Jul 22 11:02:27 2017 +0200

    Support Meson build system
    
    See https://mesonbuild.com/ for more info.

 .gitlab-ci.yml                  |  13 ++++
 daemon/control/meson.build      |  34 +++++++++
 daemon/dbus/meson.build         | 157 ++++++++++++++++++++++++++++++++++++++++
 daemon/login/meson.build        |  22 ++++++
 daemon/meson.build              | 101 ++++++++++++++++++++++++++
 daemon/ssh-agent/meson.build    |  46 ++++++++++++
 docs/meson.build                |  30 ++++++++
 egg/meson.build                 |  80 ++++++++++++++++++++
 meson.build                     | 103 ++++++++++++++++++++++++++
 meson_options.txt               |  29 ++++++++
 pam/meson.build                 |  59 +++++++++++++++
 pkcs11/gkm/meson.build          | 130 +++++++++++++++++++++++++++++++++
 pkcs11/gnome2-store/meson.build |  78 ++++++++++++++++++++
 pkcs11/meson.build              |   7 ++
 pkcs11/rpc-layer/meson.build    |  68 +++++++++++++++++
 pkcs11/secret-store/meson.build | 112 ++++++++++++++++++++++++++++
 pkcs11/ssh-store/meson.build    |  69 ++++++++++++++++++
 pkcs11/wrap-layer/meson.build   |  93 ++++++++++++++++++++++++
 pkcs11/xdg-store/meson.build    |  82 +++++++++++++++++++++
 po/meson.build                  |   3 +
 schema/meson.build              |   8 ++
 tool/meson.build                |  20 +++++
 22 files changed, 1344 insertions(+)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0b5b52ab..fd79ba55 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -5,6 +5,19 @@ stages:
 variables:
   DEPENDENCIES: dbus-x11 gcc gnome-common gtk-doc make openssh python redhat-rpm-config
 
+fedora:meson:
+  image: fedora:latest
+  stage: build
+  before_script:
+    - dnf install -y 'dnf-command(builddep)'
+    - dnf builddep -y gnome-keyring
+    - dnf install -y $DEPENDENCIES meson ninja
+    - dbus-uuidgen --ensure
+  script:
+    - meson _build
+    - eval `dbus-launch --sh-syntax`
+    - ninja -C _build test
+
 fedora:Werror:
   image: fedora:latest
   stage: build
diff --git a/daemon/control/meson.build b/daemon/control/meson.build
new file mode 100644
index 00000000..82c637dd
--- /dev/null
+++ b/daemon/control/meson.build
@@ -0,0 +1,34 @@
+libgkd_control_sources = files(
+  'gkd-control-server.c',
+  'gkd-control-client.c',
+)
+
+libgkd_control_deps = [
+  glib_dep,
+  libegg_dep,
+]
+
+libgkd_control = static_library('gkd-control',
+  libgkd_control_sources,
+  dependencies: libgkd_control_deps,
+  include_directories: config_h_inc,
+)
+
+libgkd_control_dep = declare_dependency(
+  link_with: libgkd_control,
+)
+
+# Tests
+libgkd_control_tests = [
+  'frob-control-change',
+  'frob-control-init',
+  'frob-control-unlock',
+  'frob-control-quit',
+]
+
+foreach test_name : libgkd_control_tests
+  test_bin = executable(test_name,
+    '@0@.c'.format(test_name),
+    dependencies: [ libgkd_control_dep, libgkd_control_deps ],
+  )
+endforeach
diff --git a/daemon/dbus/meson.build b/daemon/dbus/meson.build
new file mode 100644
index 00000000..1a139e96
--- /dev/null
+++ b/daemon/dbus/meson.build
@@ -0,0 +1,157 @@
+libgkd_dbus_secrets_gen = gnome.gdbus_codegen('gkd-secrets-generated',
+  sources: 'org.freedesktop.Secrets.xml',
+  interface_prefix: 'org.freedesktop.Secrets.',
+  namespace: 'Gkd',
+  annotations: [
+    [ 'org.freedesktop.Secret.Service',    'org.gtk.GDBus.C.Name', 'ExportedService'    ],
+    [ 'org.freedesktop.Secret.Collection', 'org.gtk.GDBus.C.Name', 'ExportedCollection' ],
+    [ 'org.freedesktop.Secret.Item',       'org.gtk.GDBus.C.Name', 'ExportedItem'       ],
+    [ 'org.freedesktop.Secret.Session',    'org.gtk.GDBus.C.Name', 'ExportedSession'    ],
+    [ 'org.freedesktop.Secret.Prompt',     'org.gtk.GDBus.C.Name', 'ExportedPrompt'     ],
+  ],
+  autocleanup: 'all',
+)
+
+libgkd_dbus_daemon_gen = gnome.gdbus_codegen('gkd-daemon-generated',
+  sources: 'org.gnome.keyring.Daemon.xml',
+  interface_prefix: 'org.gnome.keyring.Daemon',
+  namespace: 'Gkd',
+  annotations: [
+    [ 'org.gnome.keyring.Daemon', 'org.gtk.GDBus.C.Name', 'ExportedDaemon' ],
+  ],
+  autocleanup: 'all',
+)
+
+libgkd_dbus_internal_gen = gnome.gdbus_codegen('gkd-internal-generated',
+  sources: 'org.gnome.keyring.InternalUnsupportedGuiltRiddenInterface.xml',
+  interface_prefix: 'org.gnome.keyring.InternalUnsupportedGuiltRiddenInterface',
+  namespace: 'Gkd',
+  annotations: [
+    [ 'org.gnome.keyring.InternalUnsupportedGuiltRiddenInterface', 'org.gtk.GDBus.C.Name', 
'ExportedInternal' ],
+  ],
+  autocleanup: 'all',
+)
+
+libgkd_dbus_portal_gen = gnome.gdbus_codegen('gkd-portal-generated',
+  sources: 'org.freedesktop.impl.portal.Secret.xml',
+  interface_prefix: 'org.freedesktop.impl.portal.Secret.',
+  namespace: 'Gkd',
+  annotations: [
+    [ 'org.freedesktop.impl.portal.Secret', 'org.gtk.GDBus.C.Name', 'ExportedPortal' ],
+  ],
+  autocleanup: 'all',
+)
+
+libgkd_dbus_portalreq_gen = gnome.gdbus_codegen('gkd-portal-request-generated',
+  sources: 'org.freedesktop.impl.portal.Request.xml',
+  interface_prefix: 'org.freedesktop.impl.portal.Request.',
+  namespace: 'Gkd',
+  annotations: [
+    [ 'org.freedesktop.impl.portal.Request', 'org.gtk.GDBus.C.Name', 'ExportedPortalRequest' ],
+  ],
+  autocleanup: 'all',
+)
+
+libgkd_dbus_sources = [
+  'gkd-dbus.c',
+  'gkd-dbus-environment.c',
+  'gkd-dbus-secrets.c',
+  'gkd-dbus-session.c',
+  'gkd-secret-change.c',
+  'gkd-secret-create.c',
+  'gkd-secret-dispatch.c',
+  'gkd-secret-error.c',
+  'gkd-secret-exchange.c',
+  'gkd-secret-lock.c',
+  'gkd-secret-objects.c',
+  'gkd-secret-portal.c',
+  'gkd-secret-property.c',
+  'gkd-secret-prompt.c',
+  'gkd-secret-secret.c',
+  'gkd-secret-service.c',
+  'gkd-secret-session.c',
+  'gkd-secret-unlock.c',
+  'gkd-secret-util.c',
+
+  libgkd_dbus_secrets_gen,
+  libgkd_dbus_daemon_gen,
+  libgkd_dbus_internal_gen,
+  libgkd_dbus_portal_gen,
+  libgkd_dbus_portalreq_gen,
+]
+
+libgkd_dbus_deps = [
+  glib_dep,
+  gio_dep,
+  gio_unix_dep,
+  gobject_dep,
+  gck_dep,
+  gcr_base_dep,
+  libegg_dep,
+]
+
+libgkd_dbus_lib = static_library('gkd-dbus',
+  libgkd_dbus_sources,
+  dependencies: libgkd_dbus_deps,
+  include_directories: config_h_inc,
+)
+
+libgkd_dbus_dep = declare_dependency(
+  link_with: libgkd_dbus_lib,
+)
+
+# Tests
+libgkd_dbus_testservice_deps = [
+  glib_dep,
+  gio_dep,
+  gobject_dep,
+  libegg_dep,
+  libgcrypt_dep,
+  libgkd_test_dep,
+]
+
+libgkd_dbus_testservice_cflags = [
+  '-DSRCDIR="@0@"'.format(source_root),
+  # BUILDDIR here refers to the location of the built gnome-keyring-daemon
+  '-DBUILDDIR="@0@"'.format(build_root / 'daemon'),
+]
+
+libgkd_dbus_testservice = library('gkr-daemon-test-service',
+  'test-service.c',
+  dependencies: libgkd_dbus_testservice_deps,
+  c_args: libgkd_dbus_testservice_cflags,
+  include_directories: config_h_inc,
+)
+
+libgkd_dbus_tests = [
+  'test-dbus-util',
+  'test-dbus-search',
+  'test-dbus-items',
+  'test-dbus-signals',
+  'test-dbus-lock',
+  'test-dbus-portal',
+]
+
+libgkd_dbus_tests_deps = [
+  libgkd_test_dep,
+  libgkd_dbus_dep,
+  libgkd_dbus_deps,
+]
+
+libgkd_dbus_tests_cflags = [
+  #'-DBUILDDIR="@0@"'.format(meson.current_build_dir()),
+]
+
+foreach test_name : libgkd_dbus_tests
+  test_bin = executable(test_name,
+    '@0@.c'.format(test_name),
+    dependencies: libgkd_dbus_tests_deps,
+    link_with: libgkd_dbus_testservice,
+    c_args: libgkd_dbus_tests_cflags,
+    include_directories: config_h_inc,
+  )
+
+  test(test_name, test_bin,
+    suite: 'gkr-daemon-dbus',
+  )
+endforeach
diff --git a/daemon/login/meson.build b/daemon/login/meson.build
new file mode 100644
index 00000000..e56b6505
--- /dev/null
+++ b/daemon/login/meson.build
@@ -0,0 +1,22 @@
+libgkd_login_sources = files(
+  'gkd-login.c',
+  'gkd-login-interaction.c',
+  'gkd-login-password.c',
+)
+
+libgkd_login_deps = [
+  glib_dep,
+  gio_dep,
+  gck_dep,
+  gcr_base_dep,
+]
+
+libgkd_login_lib = static_library('gkd-login',
+  libgkd_login_sources,
+  dependencies: libgkd_login_deps,
+  include_directories: config_h_inc,
+)
+
+libgkd_login_dep = declare_dependency(
+  link_with: libgkd_login_lib,
+)
diff --git a/daemon/meson.build b/daemon/meson.build
new file mode 100644
index 00000000..610f0184
--- /dev/null
+++ b/daemon/meson.build
@@ -0,0 +1,101 @@
+subdir('control')
+subdir('dbus')
+subdir('login')
+if get_option('ssh-agent')
+  subdir('ssh-agent')
+endif
+
+# The daemon executable
+gkr_daemon_sources = files(
+  'gkd-glue.c',
+  'gkd-main.c',
+  'gkd-capability.c',
+  'gkd-pkcs11.c',
+  'gkd-util.c',
+)
+
+gkr_daemon_deps = [
+  gio_dep,
+  gio_unix_dep,
+  glib_dep,
+  gobject_dep,
+  libgcrypt_dep,
+
+  libegg_dep,
+  libgkm_dep,
+  libgkm_gnome2_store_dep,
+  libgkm_rpc_layer_dep,
+  libgkm_secret_store_dep,
+  libgkm_ssh_store_dep,
+  libgkm_wrap_layer_dep,
+  libgkm_xdg_store_dep,
+  libgkd_control_dep,
+  libgkd_dbus_dep,
+  libgkd_login_dep,
+]
+
+if get_option('ssh-agent')
+  gkr_daemon_deps += libgkd_ssh_dep
+endif
+
+if libcap_ng_dep.found()
+  gkr_daemon_deps += libcap_ng_dep
+endif
+
+gkr_daemon = executable('gnome-keyring-daemon',
+  gkr_daemon_sources,
+  dependencies: gkr_daemon_deps,
+  include_directories: config_h_inc,
+  install: true,
+)
+
+# The desktop files
+desktop_input_files = [
+  'gnome-keyring-pkcs11.desktop.in.in',
+  'gnome-keyring-secrets.desktop.in.in',
+  'gnome-keyring-ssh.desktop.in.in',
+]
+
+foreach desktop_input_file : desktop_input_files
+  i18n.merge_file(
+    input: configure_file(
+      input: desktop_input_file,
+      output: '@BASENAME@',
+      configuration: {
+        'bindir': gkr_prefix / get_option('bindir'),
+        'VERSION': meson.project_version(),
+      },
+    ),
+    output: '@BASENAME@',
+    type: 'desktop',
+    po_dir: po_dir,
+    install: true,
+    install_dir: get_option('datadir') / 'applications',
+  )
+endforeach
+
+# The service files TODO
+
+# Tests
+gkr_daemon_tests = [
+  'test-startup',
+  'test-shutdown',
+]
+
+gkr_daemon_tests_cflags = [
+  '-DSRCDIR="@0@"'.format(source_root),
+  '-DBUILDDIR="@0@"'.format(meson.current_build_dir()),
+]
+
+foreach test_name : gkr_daemon_tests
+  test_bin = executable(test_name,
+    '@0@.c'.format(test_name),
+    dependencies: [ gkr_daemon_deps, libgkd_test_dep ],
+    c_args: gkr_daemon_tests_cflags,
+    include_directories: config_h_inc,
+  )
+
+  test(test_name, test_bin,
+    suite: 'gkr-daemon',
+  )
+endforeach
diff --git a/daemon/ssh-agent/meson.build b/daemon/ssh-agent/meson.build
new file mode 100644
index 00000000..fcc7723c
--- /dev/null
+++ b/daemon/ssh-agent/meson.build
@@ -0,0 +1,46 @@
+libgkd_ssh_sources = [
+  'gkd-ssh-agent-interaction.c',
+  'gkd-ssh-agent-process.c',
+  'gkd-ssh-agent-preload.c',
+  'gkd-ssh-agent-service.c',
+  'gkd-ssh-agent-util.c',
+]
+
+libgkd_ssh_deps = [
+  glib_dep,
+  gio_dep,
+  gio_unix_dep,
+  gcr_base_dep,
+]
+
+libgkd_ssh_lib = static_library('gkd-ssh',
+  libgkd_ssh_sources,
+  dependencies: libgkd_ssh_deps,
+  include_directories: config_h_inc,
+)
+
+libgkd_ssh_dep = declare_dependency(
+  link_with: libgkd_ssh_lib,
+)
+
+# Tests
+libgkd_ssh_tests = [
+]
+
+libgkd_ssh_tests_cflags = [
+  #'-DBUILDDIR="@0@"'.format(meson.current_build_dir()),
+]
+
+foreach test_name : libgkd_ssh_tests
+  test_bin = executable(test_name,
+    '@0@.c'.format(test_name),
+    dependencies: [ libgkd_ssh_dep, libgkd_ssh_deps ],
+    link_with: libgkd_ssh_testservice,
+    c_args: libgkd_ssh_tests_cflags,
+    include_directories: config_h_inc,
+  )
+
+  test(test_name, test_bin,
+    suite: 'gkr-daemon-ssh',
+  )
+endforeach
diff --git a/docs/meson.build b/docs/meson.build
new file mode 100644
index 00000000..8b2e6abf
--- /dev/null
+++ b/docs/meson.build
@@ -0,0 +1,30 @@
+if get_option('manpage')
+  install_man('gnome-keyring-3.1')
+
+  xml_manfiles = [
+    'gnome-keyring-daemon.xml',
+    'gnome-keyring.xml',
+  ]
+
+  xsltproc = find_program('xsltproc')
+  foreach xml_man : xml_manfiles
+    custom_target('manpage-@0@'.format(xml_man),
+      input: xml_man,
+      output: '@BASENAME@.1',
+      install: true,
+      install_dir: get_option('mandir') / 'man1',
+      command: [
+        xsltproc,
+        '--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',
+        '-o', '@OUTPUT@',
+        'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
+        '@INPUT@'
+      ]
+    )
+  endforeach
+endif
diff --git a/egg/meson.build b/egg/meson.build
new file mode 100644
index 00000000..8a12dcf2
--- /dev/null
+++ b/egg/meson.build
@@ -0,0 +1,80 @@
+libegg_sources = files(
+  'dotlock.c',
+  'egg-armor.c',
+  'egg-asn1-defs.c',
+  'egg-asn1x.c',
+  'egg-buffer.c',
+  'egg-byte-array.c',
+  'egg-cleanup.c',
+  'egg-dh.c',
+  'egg-dn.c',
+  'egg-file-tracker.c',
+  'egg-hex.c',
+  'egg-hkdf.c',
+  'egg-libgcrypt.c',
+  'egg-oid.c',
+  'egg-openssl.c',
+  'egg-padding.c',
+  'egg-secure-memory.c',
+  'egg-symkey.c',
+  'egg-testing.c',
+  'egg-timegm.c',
+  'egg-unix-credentials.c',
+)
+
+libegg_deps = [
+  glib_dep,
+  gck_dep,
+  gobject_dep,
+  libgcrypt_dep,
+]
+
+libegg_cflags = [
+  '-DHAVE_CONFIG_H',
+]
+
+libegg = static_library('egg',
+  libegg_sources,
+  dependencies: libegg_deps,
+  c_args: libegg_cflags,
+  include_directories: config_h_inc,
+)
+
+libegg_dep = declare_dependency(
+  link_with: libegg,
+  include_directories: include_directories('..'),
+)
+
+libegg_tests = [
+  'test-asn1',
+  'test-asn1x',
+  'test-dn',
+  'test-cleanup',
+  'test-hex',
+  'test-hkdf',
+  'test-oid',
+  'test-secmem',
+  'test-padding',
+  'test-symkey',
+  'test-armor',
+  'test-openssl',
+  'test-dh',
+  'test-file-tracker',
+]
+
+libegg_tests_cflags = [
+  '-DSRCDIR="@0@"'.format(source_root),
+]
+
+foreach test_name : libegg_tests
+  test_bin = executable(test_name,
+    '@0@.c'.format(test_name),
+    dependencies: [ libegg_deps, libegg_dep ],
+    c_args: libegg_tests_cflags,
+    include_directories: config_h_inc,
+  )
+
+  test(test_name, test_bin,
+    suite: 'egg',
+  )
+endforeach
diff --git a/meson.build b/meson.build
new file mode 100644
index 00000000..5575f201
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,103 @@
+project('gnome-keyring', 'c',
+  version: '3.34.0',
+  meson_version: '>= 0.49',
+)
+
+gnome = import('gnome')
+i18n = import('i18n')
+
+# Version
+gkr_major_version = meson.project_version().split('.')[0]
+
+# Common variables
+cc = meson.get_compiler('c')
+gkr_prefix = get_option('prefix')
+config_h_inc = include_directories('.')
+po_dir = meson.current_source_dir() / 'po'
+source_root = meson.current_source_dir()
+build_root = meson.current_build_dir()
+
+# Dependencies
+glib_dep = dependency('glib-2.0', version: '>= 2.44')
+gio_dep = dependency('gio-2.0')
+gio_unix_dep = dependency('gio-unix-2.0')
+gmodule_dep = dependency('gmodule-no-export-2.0')
+gobject_dep = dependency('gobject-2.0')
+threads_dep = dependency('threads')
+gck_dep = dependency('gck-1', version: '>= 3.3.4')
+gcr_ui_dep = dependency('gcr-ui-3', version: '>= 3.5.3')
+gcr_base_dep = dependency('gcr-base-3', version: '>= 3.5.3')
+libgcrypt_dep = dependency('libgcrypt', version: '>= 1.2.2')
+libcap_ng_dep = dependency('libcap-ng', required: false)
+p11_kit_dep = dependency('p11-kit-1')
+
+selinux_dep = dependency('selinux', required: get_option('selinux'))
+
+if get_option('ssh-agent')
+  ssh_agent_bin = find_program('ssh-agent')
+  ssh_add_bin = find_program('ssh-add')
+endif
+
+if get_option('pam')
+  libpam_dep = cc.find_library('pam')
+endif
+
+# Project-wide defines
+add_project_arguments([
+  '-D_GNU_SOURCE',
+  '-DGCK_API_SUBJECT_TO_CHANGE',
+  '-DGCR_API_SUBJECT_TO_CHANGE',
+], language: 'c')
+
+# Configuration
+conf = configuration_data()
+
+conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
+conf.set_quoted('LOCALE_DIR', gkr_prefix / get_option('localedir'))
+conf.set_quoted('VERSION', meson.project_version())
+conf.set_quoted('LIBGCRYPT_VERSION', libgcrypt_dep.version())
+conf.set('HAVE_LIBCAPNG', libcap_ng_dep.found())
+conf.set('WITH_SELINUX', selinux_dep.found())
+if get_option('ssh-agent')
+  conf.set('WITH_SSH', true)
+  conf.set_quoted('SSH_AGENT', ssh_agent_bin.path())
+  conf.set_quoted('SSH_ADD', ssh_add_bin.path())
+endif
+conf.set('DOTLOCK_USE_PTHREAD', true)
+conf.set('DOTLOCK_GLIB_LOGGING', true)
+conf.set('DOTLOCK_EXT_SYM_PREFIX', '_gkm_')
+conf.set('HAVE_SOCKLEN_T', true)
+conf.set('HAVE_GETPEERUCRED', cc.has_function('getpeerucred'))
+conf.set('HAVE_GETPEEREID', cc.has_function('getpeereid'))
+conf.set('HAVE_FLOCK', cc.has_function('flock'))
+conf.set('HAVE_MLOCK', cc.has_function('mlock'))
+conf.set('HAVE_TIMEGM', cc.has_function('timegm'))
+
+configure_file(output: 'config.h', configuration: conf)
+config_h_dir = include_directories('.')
+
+# Build libegg (helper module)
+subdir('egg')
+
+# Daemon launch lib (needed for tests)
+libgkd_test = library('gkd-test',
+  files('daemon/gkd-test.c'),
+  dependencies: [glib_dep, libegg_dep ],
+  # BUILDDIR here refers to the location of the built gnome-keyring-daemon
+  c_args: [ '-DBUILDDIR="@0@"'.format(build_root / 'daemon') ],
+)
+
+libgkd_test_dep = declare_dependency(
+  link_with: libgkd_test,
+)
+
+# Other subdirectories
+subdir('po')
+subdir('pkcs11')
+subdir('daemon')
+subdir('schema')
+subdir('tool')
+if get_option('pam')
+  subdir('pam')
+endif
+subdir('docs')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 00000000..025ade5e
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,29 @@
+option('ssh-agent',
+  type: 'boolean',
+  value: true,
+  description: 'Include SSH agent in gnome-keyring',
+)
+
+option('selinux',
+  type: 'feature',
+  value: 'auto',
+  description: 'Add support for SELinux',
+)
+
+option('pam',
+  type: 'boolean',
+  value: true,
+  description: 'Build GNOME keyring PAM helper',
+)
+
+option('pkcs11-config',
+  type: 'string',
+  value: '',
+  description: 'Directory to install PKCS#11 config (if empty, the default value for p11-kit will be used)',
+)
+
+option('manpage',
+  type: 'boolean',
+  value: true,
+  description: 'Build manpage',
+)
diff --git a/pam/meson.build b/pam/meson.build
new file mode 100644
index 00000000..66eeb13c
--- /dev/null
+++ b/pam/meson.build
@@ -0,0 +1,59 @@
+libpam_gkr_sources = files(
+  'gkr-pam-client.c',
+  'gkr-pam-module.c',
+  'gkr-pam-stubs.c',
+)
+
+libpam_gkr_deps = [
+  libpam_dep,
+  libegg_dep,
+]
+
+if selinux_dep.found()
+  libpam_gkr_deps += selinux_dep
+endif
+
+libpam_gkr_cflags = [
+  '-DGNOME_KEYRING_DAEMON="@0@"'.format(gkr_prefix / get_option('bindir') / 'gnome-keyring-daemon'),
+]
+
+libpam_gkr = shared_library('pam_gnome_keyring',
+  libpam_gkr_sources,
+  c_args: libpam_gkr_cflags,
+  dependencies: libpam_gkr_deps,
+  include_directories: config_h_inc,
+  install: true,
+  install_dir: get_option('libdir') / 'security',
+)
+
+libpam_gkr_dep = declare_dependency(
+  link_with: libpam_gkr,
+)
+
+# Tests
+libpam_gkr_test_deps = [
+  glib_dep,
+  gio_dep,
+  libpam_dep,
+
+  libegg_dep,
+  libgkd_test_dep,
+  libgkd_control_dep,
+]
+
+libpam_gkr_test_cflags = [
+  '-DSRCDIR="@0@"'.format(source_root),
+  '-DBUILDDIR="@0@"'.format(build_root),
+  '-DSYSCONFDIR="@0@"'.format(get_option('sysconfdir')),
+]
+
+libpam_gkr_test_bin = executable('test-pam',
+  'test-pam.c',
+  dependencies: libpam_gkr_test_deps,
+  c_args: libpam_gkr_test_cflags,
+  include_directories: config_h_inc,
+)
+
+test('test-pam', libpam_gkr_test_bin,
+  suite: 'pam',
+)
diff --git a/pkcs11/gkm/meson.build b/pkcs11/gkm/meson.build
new file mode 100644
index 00000000..00749016
--- /dev/null
+++ b/pkcs11/gkm/meson.build
@@ -0,0 +1,130 @@
+libgkm_sources = files(
+  'gkm-aes-key.c',
+  'gkm-aes-mechanism.c',
+  'gkm-assertion.c',
+  'gkm-attributes.c',
+  'gkm-certificate.c',
+  'gkm-certificate-key.c',
+  'gkm-credential.c',
+  'gkm-crypto.c',
+  'gkm-data-asn1.c',
+  'gkm-data-der.c',
+  'gkm-debug.c',
+  'gkm-dh-key.c',
+  'gkm-dh-mechanism.c',
+  'gkm-dh-private-key.c',
+  'gkm-dh-public-key.c',
+  'gkm-dsa-mechanism.c',
+  'gkm-ecdsa-mechanism.c',
+  'gkm-factory.c',
+  'gkm-generic-key.c',
+  'gkm-hkdf-mechanism.c',
+  'gkm-log.c',
+  'gkm-manager.c',
+  'gkm-memory-store.c',
+  'gkm-mock.c',
+  'gkm-module.c',
+  'gkm-null-key.c',
+  'gkm-null-mechanism.c',
+  'gkm-object.c',
+  'gkm-private-xsa-key.c',
+  'gkm-public-xsa-key.c',
+  'gkm-rsa-mechanism.c',
+  'gkm-secret.c',
+  'gkm-secret-key.c',
+  'gkm-serializable.c',
+  'gkm-session.c',
+  'gkm-sexp.c',
+  'gkm-sexp-key.c',
+  'gkm-store.c',
+  'gkm-test.c',
+  'gkm-timer.c',
+  'gkm-transaction.c',
+  'gkm-trust.c',
+  'gkm-util.c',
+)
+
+gkm_marshal = gnome.genmarshal('gkm-marshal',
+  sources: 'gkm-marshal.list',
+  prefix: 'gkm_marshal',
+  valist_marshallers: true,
+)
+
+libgkm_deps = [
+  glib_dep,
+  gobject_dep,
+  libgcrypt_dep,
+
+  libegg_dep,
+]
+
+libgkm = library('gkm',
+  [ libgkm_sources, gkm_marshal, ],
+  dependencies: libgkm_deps,
+  include_directories: config_h_inc,
+)
+
+libgkm_dep = declare_dependency(
+  link_with: libgkm,
+  include_directories: [
+    include_directories('.'),
+    include_directories('..'), # for gkm-marshal.h
+  ]
+)
+
+# Tests
+libgkm_mock_sources = files(
+  'mock-module.c',
+  'mock-locked-object.c',
+)
+
+libgkm_mock_deps = [
+  glib_dep,
+  gobject_dep,
+
+  libgkm_dep,
+]
+
+libgkm_mock_cflags = [
+  '-DSRCDIR="@0@"'.format(source_root),
+]
+
+libgkm_mock = library('gkm-mock',
+  libgkm_mock_sources,
+  dependencies: libgkm_mock_deps,
+  c_args: libgkm_mock_cflags,
+  include_directories: config_h_inc,
+)
+
+libgkm_tests = [
+  'test-attributes',
+  'test-credential',
+  'test-data-asn1',
+  'test-data-der',
+  'test-memory-store',
+  'test-object',
+  'test-certificate',
+  'test-secret',
+  'test-sexp',
+  'test-store',
+  'test-timer',
+  'test-transaction',
+]
+
+libgkm_tests_cflags = [
+  '-DSRCDIR="@0@"'.format(source_root),
+]
+
+foreach test_name : libgkm_tests
+  test_bin = executable(test_name,
+    '@0@.c'.format(test_name),
+    dependencies: [ libgkm_dep, libgkm_deps ],
+    link_with: libgkm_mock,
+    c_args: libgkm_tests_cflags,
+    include_directories: config_h_inc,
+  )
+
+  test(test_name, test_bin,
+    suite: 'gkm',
+  )
+endforeach
diff --git a/pkcs11/gnome2-store/meson.build b/pkcs11/gnome2-store/meson.build
new file mode 100644
index 00000000..8cca5910
--- /dev/null
+++ b/pkcs11/gnome2-store/meson.build
@@ -0,0 +1,78 @@
+libgkm_gnome2_store_sources = files(
+  'gkm-gnome2-file.c',
+  'gkm-gnome2-module.c',
+  'gkm-gnome2-private-key.c',
+  'gkm-gnome2-public-key.c',
+  'gkm-gnome2-storage.c',
+)
+
+libgkm_gnome2_store_deps = [
+  glib_dep,
+  gobject_dep,
+  libgcrypt_dep,
+
+  libegg_dep,
+  libgkm_dep,
+]
+
+libgkm_gnome2_store = library('gkm-gnome2-store',
+  libgkm_gnome2_store_sources,
+  dependencies: libgkm_gnome2_store_deps,
+  include_directories: config_h_inc,
+)
+
+libgkm_gnome2_store_dep = declare_dependency(
+  link_with: libgkm_gnome2_store,
+)
+
+# Tests
+libgkm_gnome2_store_tests = [
+  {
+    'name': 'test-gnome2-file',
+    'needs-mock': false,
+  },
+  {
+    'name': 'test-gnome2-storage',
+    'needs-mock': true,
+  },
+  {
+    'name': 'test-gnome2-private-key',
+    'needs-mock': true,
+  },
+  {
+    'name': 'test-import',
+    'needs-mock': false,
+  },
+]
+
+libgkm_gnome2_store_tests_deps = [
+  gck_dep,
+  gcr_base_dep,
+
+  libgkm_gnome2_store_deps,
+  libgkm_gnome2_store_dep,
+]
+
+libgkm_gnome2_store_tests_cflags = [
+  '-DSRCDIR="@0@"'.format(source_root),
+]
+
+foreach _test : libgkm_gnome2_store_tests
+  test_name = _test['name']
+
+  test_sources = [ '@0@.c'.format(test_name) ]
+  if _test['needs-mock']
+    test_sources += 'mock-gnome2-module.c'
+  endif
+
+  test_bin = executable(test_name,
+    test_sources,
+    dependencies: libgkm_gnome2_store_tests_deps,
+    c_args: libgkm_gnome2_store_tests_cflags,
+    include_directories: config_h_inc,
+  )
+
+  test(test_name, test_bin,
+    suite: 'gkm::gnome2-store',
+  )
+endforeach
diff --git a/pkcs11/meson.build b/pkcs11/meson.build
new file mode 100644
index 00000000..c118dc70
--- /dev/null
+++ b/pkcs11/meson.build
@@ -0,0 +1,7 @@
+subdir('gkm')
+subdir('gnome2-store')
+subdir('rpc-layer')
+subdir('secret-store')
+subdir('ssh-store')
+subdir('wrap-layer')
+subdir('xdg-store')
diff --git a/pkcs11/rpc-layer/meson.build b/pkcs11/rpc-layer/meson.build
new file mode 100644
index 00000000..4b3253cb
--- /dev/null
+++ b/pkcs11/rpc-layer/meson.build
@@ -0,0 +1,68 @@
+libgkm_rpc_layer_sources = files(
+  'gkm-rpc-dispatch.c',
+  'gkm-rpc-message.c',
+  'gkm-rpc-util.c',
+)
+
+libgkm_rpc_layer_deps = [
+  glib_dep,
+  gobject_dep,
+  libgcrypt_dep,
+
+  libegg_dep,
+  libgkm_dep,
+]
+
+libgkm_rpc_layer = library('gkm-rpc-layer',
+  libgkm_rpc_layer_sources,
+  dependencies: libgkm_rpc_layer_deps,
+  include_directories: config_h_inc,
+)
+
+libgkm_rpc_layer_dep = declare_dependency(
+  link_with: libgkm_rpc_layer,
+)
+
+# This is the configuration file that p11-kit uses to load the module
+p11_system_config_module = get_option('pkcs11-config')
+if p11_system_config_module == ''
+  p11_system_config_module = p11_kit_dep.get_pkgconfig_variable('p11_system_config_modules')
+endif
+configure_file(
+  input: 'gnome-keyring.module.in',
+  output: '@BASENAME@',
+  copy: true,
+  install_dir: p11_system_config_module,
+)
+
+# Tests
+libgkm_rpc_layer_tests = [
+  'test-initialize',
+]
+
+libgkm_rpc_layer_tests_deps = [
+  gck_dep,
+  gcr_base_dep,
+
+  libgkd_test_dep,
+  libgkm_rpc_layer_deps,
+  libgkm_rpc_layer_dep,
+]
+
+libgkm_rpc_layer_tests_cflags = [
+  '-DSRCDIR="@0@"'.format(source_root),
+  '-DBUILDDIR="@0@"'.format(meson.current_build_dir()),
+]
+
+foreach test_name : libgkm_rpc_layer_tests
+  test_bin = executable(test_name,
+    '@0@.c'.format(test_name),
+    dependencies: libgkm_rpc_layer_tests_deps,
+    c_args: libgkm_rpc_layer_tests_cflags,
+    include_directories: config_h_inc,
+  )
+
+  test(test_name, test_bin,
+    suite: 'gkm::rpc-layer',
+  )
+endforeach
diff --git a/pkcs11/secret-store/meson.build b/pkcs11/secret-store/meson.build
new file mode 100644
index 00000000..df60ac00
--- /dev/null
+++ b/pkcs11/secret-store/meson.build
@@ -0,0 +1,112 @@
+libgkm_secret_store_sources = files(
+  'gkm-secret-binary.c',
+  'gkm-secret-collection.c',
+  'gkm-secret-compat.c',
+  'gkm-secret-data.c',
+  'gkm-secret-fields.c',
+  'gkm-secret-item.c',
+  'gkm-secret-module.c',
+  'gkm-secret-object.c',
+  'gkm-secret-search.c',
+  'gkm-secret-textual.c',
+)
+
+libgkm_secret_store_deps = [
+  glib_dep,
+  gobject_dep,
+  libgcrypt_dep,
+
+  libegg_dep,
+  libgkm_dep,
+]
+
+libgkm_secret_store = library('gkm-secret-store',
+  libgkm_secret_store_sources,
+  dependencies: libgkm_secret_store_deps,
+  include_directories: config_h_inc,
+)
+
+libgkm_secret_store_dep = declare_dependency(
+  link_with: libgkm_secret_store,
+)
+
+# Tests
+dump_keyring0_format = executable('dump-keyring0-format',
+  'dump-keyring0-format.c',
+  dependencies: libgkm_secret_store_deps,
+)
+
+libgkm_secret_store_tests = [
+  {
+    'name': 'test-secret-compat',
+    'needs-mock': false,
+  },
+  {
+    'name': 'test-secret-fields',
+    'needs-mock': false,
+  },
+  {
+    'name': 'test-secret-data',
+    'needs-mock': false,
+  },
+  {
+    'name': 'test-secret-object',
+    'needs-mock': true,
+  },
+  {
+    'name': 'test-secret-collection',
+    'needs-mock': true,
+  },
+  {
+    'name': 'test-secret-item',
+    'needs-mock': true,
+  },
+  {
+    'name': 'test-secret-schema',
+    'needs-mock': true,
+  },
+  {
+    'name': 'test-secret-search',
+    'needs-mock': true,
+  },
+  {
+    'name': 'test-secret-textual',
+    'needs-mock': true,
+  },
+  {
+    'name': 'test-secret-binary',
+    'needs-mock': true,
+  },
+]
+
+libgkm_secret_store_tests_deps = [
+  gck_dep,
+  gcr_base_dep,
+
+  libgkm_secret_store_deps,
+  libgkm_secret_store_dep,
+]
+
+libgkm_secret_store_tests_cflags = [
+  '-DSRCDIR="@0@"'.format(source_root),
+]
+
+foreach _test : libgkm_secret_store_tests
+  test_name = _test['name']
+
+  test_sources = [ '@0@.c'.format(test_name) ]
+  if _test['needs-mock']
+    test_sources += 'mock-secret-module.c'
+  endif
+
+  test_bin = executable(test_name,
+    test_sources,
+    dependencies: libgkm_secret_store_tests_deps,
+    c_args: libgkm_secret_store_tests_cflags,
+    include_directories: config_h_inc,
+  )
+
+  test(test_name, test_bin,
+    suite: 'gkm::secret-store',
+  )
+endforeach
diff --git a/pkcs11/ssh-store/meson.build b/pkcs11/ssh-store/meson.build
new file mode 100644
index 00000000..dda1d389
--- /dev/null
+++ b/pkcs11/ssh-store/meson.build
@@ -0,0 +1,69 @@
+libgkm_ssh_store_sources = files(
+  'gkm-ssh-module.c',
+  'gkm-ssh-openssh.c',
+  'gkm-ssh-private-key.c',
+  'gkm-ssh-public-key.c',
+)
+
+libgkm_ssh_store_deps = [
+  glib_dep,
+  gobject_dep,
+  libgcrypt_dep,
+
+  libegg_dep,
+  libgkm_dep,
+]
+
+libgkm_ssh_store = library('gkm-ssh-store',
+  libgkm_ssh_store_sources,
+  dependencies: libgkm_ssh_store_deps,
+  include_directories: config_h_inc,
+)
+
+libgkm_ssh_store_dep = declare_dependency(
+  link_with: libgkm_ssh_store,
+)
+
+# Tests
+libgkm_ssh_store_tests = [
+  {
+    'name': 'test-ssh-openssh',
+    'needs-mock': false,
+  },
+  {
+    'name': 'test-private-key',
+    'needs-mock': true,
+  },
+]
+
+libgkm_ssh_store_tests_deps = [
+  gck_dep,
+  gcr_base_dep,
+
+  libgkm_ssh_store_deps,
+  libgkm_ssh_store_dep,
+]
+
+libgkm_ssh_store_tests_cflags = [
+  '-DSRCDIR="@0@"'.format(source_root),
+]
+
+foreach _test : libgkm_ssh_store_tests
+  test_name = _test['name']
+
+  test_sources = [ '@0@.c'.format(test_name) ]
+  if _test['needs-mock']
+    test_sources += 'mock-ssh-module.c'
+  endif
+
+  test_bin = executable(test_name,
+    test_sources,
+    dependencies: libgkm_ssh_store_tests_deps,
+    c_args: libgkm_ssh_store_tests_cflags,
+    include_directories: config_h_inc,
+  )
+
+  test(test_name, test_bin,
+    suite: 'gkm::ssh-store',
+  )
+endforeach
diff --git a/pkcs11/wrap-layer/meson.build b/pkcs11/wrap-layer/meson.build
new file mode 100644
index 00000000..cf4043e5
--- /dev/null
+++ b/pkcs11/wrap-layer/meson.build
@@ -0,0 +1,93 @@
+libgkm_wrap_layer_sources = files(
+  'gkm-wrap-layer.c',
+  'gkm-wrap-login.c',
+  'gkm-wrap-prompt.c',
+)
+
+libgkm_wrap_layer_deps = [
+  glib_dep,
+  gobject_dep,
+  gcr_base_dep,
+  libgcrypt_dep,
+
+  libegg_dep,
+  libgkm_dep,
+]
+
+libgkm_wrap_layer = library('gkm-wrap-layer',
+  libgkm_wrap_layer_sources,
+  dependencies: libgkm_wrap_layer_deps,
+  include_directories: config_h_inc,
+)
+
+libgkm_wrap_layer_dep = declare_dependency(
+  link_with: libgkm_wrap_layer,
+)
+
+# Tests
+libgkm_wrap_layer_tests = [
+  {
+    'name': 'test-create-credential',
+    'needs-mock': false,
+  },
+  {
+    'name': 'test-init-pin',
+    'needs-mock': false,
+  },
+  {
+    'name': 'test-login-auto',
+    'needs-mock': true,
+  },
+  {
+    'name': 'test-login-hints',
+    'needs-mock': false,
+  },
+  {
+    'name': 'test-login-keyring',
+    'needs-mock': true,
+  },
+  {
+    'name': 'test-login-specific',
+    'needs-mock': false,
+  },
+  {
+    'name': 'test-login-user',
+    'needs-mock': false,
+  },
+  {
+    'name': 'test-set-pin',
+    'needs-mock': false,
+  },
+]
+
+libgkm_wrap_layer_tests_deps = [
+  gck_dep,
+  gcr_base_dep,
+
+  libgkd_test_dep,
+  libgkm_wrap_layer_deps,
+  libgkm_wrap_layer_dep,
+]
+
+libgkm_wrap_layer_tests_cflags = [
+]
+
+foreach _test : libgkm_wrap_layer_tests
+  test_name = _test['name']
+
+  test_sources = [ '@0@.c'.format(test_name) ]
+  if _test['needs-mock']
+    test_sources += 'mock-secret-store.c'
+  endif
+
+  test_bin = executable(test_name,
+    test_sources,
+    dependencies: libgkm_wrap_layer_tests_deps,
+    c_args: libgkm_wrap_layer_tests_cflags,
+    include_directories: config_h_inc,
+  )
+
+  test(test_name, test_bin,
+    suite: 'gkm::wrap-layer',
+  )
+endforeach
diff --git a/pkcs11/xdg-store/meson.build b/pkcs11/xdg-store/meson.build
new file mode 100644
index 00000000..4f138593
--- /dev/null
+++ b/pkcs11/xdg-store/meson.build
@@ -0,0 +1,82 @@
+libgkm_xdg_store_sources = files(
+  'gkm-xdg-asn1-defs.c',
+  'gkm-xdg-assertion.c',
+  'gkm-xdg-module.c',
+  'gkm-xdg-trust.c',
+)
+
+libgkm_xdg_store_deps = [
+  glib_dep,
+  gobject_dep,
+  libgcrypt_dep,
+
+  libegg_dep,
+  libgkm_dep,
+]
+
+libgkm_xdg_store = library('gkm-xdg-store',
+  libgkm_xdg_store_sources,
+  dependencies: libgkm_xdg_store_deps,
+  include_directories: config_h_inc,
+)
+
+libgkm_xdg_store_dep = declare_dependency(
+  link_with: libgkm_xdg_store,
+  include_directories: include_directories('..'),
+)
+
+# Tests
+libgkm_xdg_store_tests = [
+  {
+    'name': 'test-xdg-module',
+    'needs-mock': true,
+  },
+  {
+    'name': 'test-xdg-trust',
+    'needs-mock': true,
+  },
+]
+
+libgkm_xdg_store_tests_deps = [
+  gck_dep,
+  gcr_base_dep,
+
+  libgkm_xdg_store_deps,
+  libgkm_xdg_store_dep,
+]
+
+libgkm_xdg_store_tests_cflags = [
+  '-DSRCDIR="@0@"'.format(source_root),
+]
+
+foreach _test : libgkm_xdg_store_tests
+  test_name = _test['name']
+
+  test_sources = [ '@0@.c'.format(test_name) ]
+  if _test['needs-mock']
+    test_sources += 'mock-xdg-module.c'
+  endif
+
+  test_bin = executable(test_name,
+    test_sources,
+    dependencies: libgkm_xdg_store_tests_deps,
+    c_args: libgkm_xdg_store_tests_cflags,
+    include_directories: config_h_inc,
+  )
+
+  test(test_name, test_bin,
+    suite: 'gkm::xdg-store',
+  )
+endforeach
+
+# Example programs
+frob_trust_file = executable('frob-trust-file',
+  'frob-trust-file.c',
+  dependencies: [ glib_dep, libegg_dep, libgkm_xdg_store_dep ],
+  include_directories: config_h_inc,
+)
+dump_trust_file = executable('dump-trust-file',
+  'dump-trust-file.c',
+  dependencies: [ glib_dep, libegg_dep, libgkm_xdg_store_dep ],
+  include_directories: config_h_inc,
+)
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 00000000..f904cde4
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,3 @@
+i18n.gettext(meson.project_name(),
+  preset: 'glib'
+)
diff --git a/schema/meson.build b/schema/meson.build
new file mode 100644
index 00000000..6c4fecf7
--- /dev/null
+++ b/schema/meson.build
@@ -0,0 +1,8 @@
+compiled_schemas = gnome.compile_schemas()
+install_data('org.gnome.crypto.cache.gschema.xml',
+  install_dir: get_option('datadir') / 'glib-2.0' / 'schemas',
+)
+
+install_data('org.gnome.crypto.cache.convert',
+  install_dir: get_option('datadir') / 'GConf' / 'gsettings',
+)
diff --git a/tool/meson.build b/tool/meson.build
new file mode 100644
index 00000000..2049ff7c
--- /dev/null
+++ b/tool/meson.build
@@ -0,0 +1,20 @@
+gnome_keyring_tool_sources = files(
+  'gkr-tool.c',
+  'gkr-tool-import.c',
+  'gkr-tool-trust.c',
+  'gkr-tool-version.c',
+)
+
+gnome_keyring_tool_deps = [
+  glib_dep,
+  gck_dep,
+  gcr_base_dep,
+  gcr_ui_dep,
+  libegg_dep,
+]
+
+gnome_keyring_tool = executable('gnome-keyring-@0@'.format(gkr_major_version),
+  gnome_keyring_tool_sources,
+  dependencies: gnome_keyring_tool_deps,
+  include_directories: config_h_inc,
+)


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