[seahorse] Port build system to Meson. Bug 789994.



commit d73a61be2ac359646a58199aa7c447806a523783
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Mon Sep 18 11:47:04 2017 +0200

    Port build system to Meson. Bug 789994.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=789994
    
    See also https://mesonbuild.com.

 README.md                   |    7 ++
 common/meson.build          |   35 ++++++++
 data/icons/meson.build      |   58 +++++++++++++
 data/meson.build            |   65 +++++++++++++++
 data/seahorse.gresource.xml |   46 +++++++++++
 gkr/meson.build             |   26 ++++++
 help/meson.build            |   53 ++++++++++++
 libegg/meson.build          |   41 +++++++++
 libseahorse/meson.build     |   56 +++++++++++++
 meson.build                 |  188 +++++++++++++++++++++++++++++++++++++++++++
 meson/gpg_check_version.py  |   42 ++++++++++
 meson/post_install.py       |   15 ++++
 meson_options.txt           |    7 ++
 pgp/meson.build             |   92 +++++++++++++++++++++
 pkcs11/meson.build          |   27 ++++++
 po/meson.build              |    3 +
 src/meson.build             |   42 ++++++++++
 ssh/meson.build             |   49 +++++++++++
 18 files changed, 852 insertions(+), 0 deletions(-)
---
diff --git a/README.md b/README.md
index 8b07d10..3e04dad 100644
--- a/README.md
+++ b/README.md
@@ -16,6 +16,13 @@ make
 make install
 ```
 
+or using [Meson](http://mesonbuild.com/):
+```sh
+meson _build
+ninja -C _build
+ninja -C _build install
+```
+
 ## Issue tracker
 Seahorse uses the GNOME Bugzilla, where you can check the
 [list of open bugs](https://bugzilla.gnome.org/browse.cgi?product=seahorse).
diff --git a/common/meson.build b/common/meson.build
new file mode 100644
index 0000000..1cc41cc
--- /dev/null
+++ b/common/meson.build
@@ -0,0 +1,35 @@
+common_sources = [
+  'actions.vala',
+  'backend.vala',
+  'catalog.vala',
+  'deletable.vala',
+  'delete-dialog.vala',
+  'deleter.vala',
+  'exportable.vala',
+  'exporter.vala',
+  'icons.vala',
+  'lockable.vala',
+  'place.vala',
+  'registry.vala',
+  'types.vala',
+  'util.vala',
+  'viewable.vala',
+]
+
+common_deps = [
+  glib_deps,
+  gtk,
+  gcr,
+  config,
+]
+
+common_lib = static_library('common',
+  common_sources,
+  dependencies: common_deps,
+  vala_header: 'seahorse-common.h',
+)
+
+common_dep = declare_dependency(
+  link_with: common_lib,
+  include_directories: include_directories('.'),
+)
diff --git a/data/icons/meson.build b/data/icons/meson.build
new file mode 100644
index 0000000..4db6588
--- /dev/null
+++ b/data/icons/meson.build
@@ -0,0 +1,58 @@
+icons_install_dir = join_paths(datadir, 'icons')
+
+foreach size: [ 16, 22, 24, 32, 48 ]
+  icon_size_str = '@0@x@0@'.format(size)
+  icon_subfolder = join_paths('hicolor', icon_size_str, 'apps')
+
+  foreach app: [ 'seahorse', 'seahorse-preferences' ]
+    install_data(
+      join_paths(icon_subfolder, app + '.png'),
+      install_dir: join_paths(icons_install_dir, icon_subfolder),
+    )
+  endforeach
+endforeach
+
+# special case for symbolic and 256
+icon_subfolder = join_paths('hicolor', '256x256', 'apps')
+install_data(
+  join_paths(icon_subfolder, 'seahorse.png'),
+  install_dir: join_paths(icons_install_dir, icon_subfolder),
+)
+icon_subfolder = join_paths('hicolor', 'symbolic', 'apps')
+install_data(
+  join_paths(icon_subfolder, 'seahorse-symbolic.svg'),
+  install_dir: join_paths(icons_install_dir, icon_subfolder),
+)
+
+# private icons
+private_icons_install_dir = join_paths(pkgdatadir, 'icons')
+
+foreach size: [ 22, 48 ]
+  icon_size_str = '@0@x@0@'.format(size)
+
+  # ..../apps
+  icon_subfolder = join_paths('hicolor', icon_size_str, 'apps')
+  foreach private_icon: [ 'key', 'key-personal', 'key-ssh', 'person' ]
+    install_data(
+      join_paths(icon_subfolder, 'seahorse-@0@.png'.format(private_icon)),
+      install_dir: join_paths(private_icons_install_dir, icon_subfolder),
+    )
+  endforeach
+
+  # ..../status
+  icon_subfolder = join_paths('hicolor', icon_size_str, 'status')
+
+  foreach private_icon: [ 'sign', 'sign-bad', 'sign-ok' ]
+    install_data(
+      join_paths(icon_subfolder, 'seahorse-@0@.png'.format(private_icon)),
+      install_dir: join_paths(private_icons_install_dir, icon_subfolder),
+    )
+  endforeach
+endforeach
+
+# Only has a 48x48 version somehow
+icon_subfolder = join_paths('hicolor', '48x48', 'status')
+install_data(
+  join_paths(icon_subfolder, 'seahorse-sign-unknown.png'),
+  install_dir: join_paths(private_icons_install_dir, icon_subfolder),
+)
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..ea50166
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,65 @@
+subdir('icons')
+
+# GSettings
+gsettings_files = [
+  'org.gnome.seahorse.gschema.xml',
+  'org.gnome.seahorse.manager.gschema.xml',
+  'org.gnome.seahorse.window.gschema.xml',
+]
+install_data(gsettings_files,
+  install_dir: join_paths(datadir, 'glib-2.0', 'schemas'),
+)
+
+# Resources
+resources_src = gnome.compile_resources('seahorse-resources',
+  'seahorse.gresource.xml',
+  c_name: 'seahorse',
+  extra_args: [
+    '--manual-register',
+  ]
+)
+
+# The appdata file
+i18n.merge_file(
+  input: 'seahorse.appdata.xml.in',
+  output: 'seahorse.appdata.xml',
+  type: 'xml',
+  po_dir: po_dir,
+  install: true,
+  install_dir: join_paths(datadir, 'metainfo')
+)
+
+# The configuration for the desktop and service files
+desktop_conf = configuration_data()
+desktop_conf.set('bindir', bindir)
+desktop_conf.set('VERSION', meson.project_version())
+
+# The desktop file
+configured_desktop_file = configure_file(
+  input: 'seahorse.desktop.in.in',
+  output: 'seahorse.desktop.in',
+  configuration: desktop_conf,
+)
+i18n.merge_file(
+  input: configured_desktop_file,
+  output: 'seahorse.desktop',
+  type: 'desktop',
+  po_dir: po_dir,
+  install: true,
+  install_dir: join_paths(datadir, 'applications')
+)
+
+# The service file
+configure_file(
+  input: 'org.gnome.seahorse.Application.service.in',
+  output: 'org.gnome.seahorse.Application.service',
+  configuration: desktop_conf,
+  install: true,
+  install_dir: join_paths(datadir, 'dbus-1', 'services'),
+)
+
+# The search provider
+install_data(
+  'seahorse-search-provider.ini',
+  install_dir: join_paths(datadir, 'gnome-shell', 'search-providers')
+)
diff --git a/data/seahorse.gresource.xml b/data/seahorse.gresource.xml
new file mode 100644
index 0000000..3db0ee5
--- /dev/null
+++ b/data/seahorse.gresource.xml
@@ -0,0 +1,46 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<gresources>
+  <gresource prefix="/org/gnome/Seahorse">
+    <file alias="seahorse.css">../libseahorse/seahorse.css</file>
+
+    <file alias="seahorse-add-keyserver.ui" 
preprocess="xml-stripblanks">../libseahorse/seahorse-add-keyserver.ui</file>
+    <file alias="seahorse-prefs.ui" preprocess="xml-stripblanks">../libseahorse/seahorse-prefs.ui</file>
+    <file alias="seahorse-progress.ui" 
preprocess="xml-stripblanks">../libseahorse/seahorse-progress.ui</file>
+
+    <!-- Seahorse -->
+    <file alias="seahorse-change-passphrase.ui" 
preprocess="xml-stripblanks">../src/seahorse-change-passphrase.ui</file>
+    <file alias="seahorse-generate-select.ui" 
preprocess="xml-stripblanks">../src/seahorse-generate-select.ui</file>
+    <file alias="seahorse-key-manager-widgets.ui" 
preprocess="xml-stripblanks">../src/seahorse-key-manager-widgets.ui</file>
+    <file alias="seahorse-key-manager.ui" preprocess="xml-stripblanks">../src/seahorse-key-manager.ui</file>
+
+    <!-- GKR -->
+    <file alias="seahorse-gkr-add-item.ui" 
preprocess="xml-stripblanks">../gkr/seahorse-gkr-add-item.ui</file>
+    <file alias="seahorse-add-keyring.ui" preprocess="xml-stripblanks">../gkr/seahorse-add-keyring.ui</file>
+    <file alias="seahorse-gkr-item-properties.ui" 
preprocess="xml-stripblanks">../gkr/seahorse-gkr-item-properties.ui</file>
+    <file alias="seahorse-gkr-keyring.ui" preprocess="xml-stripblanks">../gkr/seahorse-gkr-keyring.ui</file>
+
+    <!-- SSH -->
+    <file alias="seahorse-ssh-generate.ui" 
preprocess="xml-stripblanks">../ssh/seahorse-ssh-generate.ui</file>
+    <file alias="seahorse-ssh-key-properties.ui" 
preprocess="xml-stripblanks">../ssh/seahorse-ssh-key-properties.ui</file>
+    <file alias="seahorse-ssh-upload.ui" preprocess="xml-stripblanks">../ssh/seahorse-ssh-upload.ui</file>
+
+    <!-- PGP -->
+    <file alias="seahorse-add-subkey.ui" preprocess="xml-stripblanks">../pgp/seahorse-add-subkey.ui</file>
+    <file alias="seahorse-add-uid.ui" preprocess="xml-stripblanks">../pgp/seahorse-add-uid.ui</file>
+    <file alias="seahorse-expires.ui" preprocess="xml-stripblanks">../pgp/seahorse-expires.ui</file>
+    <file alias="seahorse-keyserver-results-widgets.ui" 
preprocess="xml-stripblanks">../pgp/seahorse-keyserver-results-widgets.ui</file>
+    <file alias="seahorse-keyserver-results.ui" 
preprocess="xml-stripblanks">../pgp/seahorse-keyserver-results.ui</file>
+    <file alias="seahorse-keyserver-search.ui" 
preprocess="xml-stripblanks">../pgp/seahorse-keyserver-search.ui</file>
+    <file alias="seahorse-keyserver-sync.ui" 
preprocess="xml-stripblanks">../pgp/seahorse-keyserver-sync.ui</file>
+    <file alias="seahorse-pgp-generate.ui" 
preprocess="xml-stripblanks">../pgp/seahorse-pgp-generate.ui</file>
+    <file alias="seahorse-pgp-private-key-properties.ui" 
preprocess="xml-stripblanks">../pgp/seahorse-pgp-private-key-properties.ui</file>
+    <file alias="seahorse-pgp-public-key-properties.ui" 
preprocess="xml-stripblanks">../pgp/seahorse-pgp-public-key-properties.ui</file>
+    <file alias="seahorse-revoke.ui" preprocess="xml-stripblanks">../pgp/seahorse-revoke.ui</file>
+    <file alias="seahorse-sign.ui" preprocess="xml-stripblanks">../pgp/seahorse-sign.ui</file>
+    <file alias="seahorse-signer.ui" preprocess="xml-stripblanks">../pgp/seahorse-signer.ui</file>
+
+    <!-- PKCS#11 -->
+    <file alias="seahorse-pkcs11-generate.ui" 
preprocess="xml-stripblanks">../pkcs11/seahorse-pkcs11-generate.ui</file>
+    <file alias="seahorse-pkcs11-request.ui" 
preprocess="xml-stripblanks">../pkcs11/seahorse-pkcs11-request.ui</file>
+  </gresource>
+</gresources>
diff --git a/gkr/meson.build b/gkr/meson.build
new file mode 100644
index 0000000..9898004
--- /dev/null
+++ b/gkr/meson.build
@@ -0,0 +1,26 @@
+gkr_sources = [
+  'gkr-backend.vala',
+  'gkr-dialogs.vala',
+  'gkr-module.vala',
+  'gkr-item.vala',
+  'gkr-item-add.vala',
+  'gkr-item-properties.vala',
+  'gkr-keyring.vala',
+  'gkr-keyring-add.vala',
+  'gkr-keyring-properties.vala',
+]
+
+gkr_dependencies = [
+  glib_deps,
+  gtk,
+  gcr,
+  gcr_ui,
+  libsecret,
+  config,
+  common_dep,
+]
+
+gkr_lib = static_library('seahorse-gkr',
+  gkr_sources,
+  dependencies: gkr_dependencies,
+)
diff --git a/help/meson.build b/help/meson.build
new file mode 100644
index 0000000..899ef10
--- /dev/null
+++ b/help/meson.build
@@ -0,0 +1,53 @@
+help_pages = [
+  'about-diff-private-public.page',
+  'about-pgp.page',
+  'about-ssh.page',
+  'concepts.page',
+  'glossary.page',
+  'index.page',
+  'introduction.page',
+  'key-servers-add.page',
+  'keyring-change-default.page',
+  'keyring-create.page',
+  'keyring-lock.page',
+  'keyring-unlock.page',
+  'keyring-update-password.page',
+  'keyring.page',
+  'legal.xml',
+  'misc-key-backup.page',
+  'misc-key-fingerprint.page',
+  'passwords-stored-create.page',
+  'passwords-view.page',
+  'pgp-create.page',
+  'pgp-delete.page',
+  'pgp-expiration-change.page',
+  'pgp-expired.page',
+  'pgp-export.page',
+  'pgp-import.page',
+  'pgp-photoid.page',
+  'pgp-publish.page',
+  'pgp-retrieve-remote.page',
+  'pgp-sign.page',
+  'pgp-subkeys.page',
+  'pgp-sync.page',
+  'pgp-userid-add.page',
+  'pgp-userid-primary.page',
+  'pgp-userid-remove.page',
+  'pgp-userid.page',
+  'ssh-connect-remote.page',
+  'ssh-create.page',
+  'ssh-export.page',
+  'ssh-import.page',
+  'subkeys-add.page',
+  'subkeys-examine.page',
+  'subkeys-revoke.page',
+]
+
+help_media = [
+  'media/seahorse.png',
+]
+
+gnome.yelp(meson.project_name(),
+  sources: help_pages,
+  media: help_media,
+)
diff --git a/libegg/meson.build b/libegg/meson.build
new file mode 100644
index 0000000..b9f3d2d
--- /dev/null
+++ b/libegg/meson.build
@@ -0,0 +1,41 @@
+# Libeggdatetime
+libeggdatetime_dependencies = [
+  gtk,
+  config,
+]
+
+libeggdatetime_cflags = [
+  '-DGTK_DISABLE_DEPRECATED',
+  '-DGDK_DISABLE_DEPRECATED',
+  '-DG_DISABLE_DEPRECATED',
+]
+
+libeggdatetime_lib = static_library('libeggdatetime',
+  'egg-datetime.c',
+  c_args: libeggdatetime_cflags,
+  dependencies: libeggdatetime_dependencies,
+)
+
+
+# Libtreemultidnd
+libtreemultidnd_dependencies = [
+  gtk,
+  config,
+]
+
+libtreemultidnd_cflags = [
+  '-DGTK_DISABLE_DEPRECATED',
+  '-DGDK_DISABLE_DEPRECATED',
+  '-DG_DISABLE_DEPRECATED',
+]
+
+libtreemultidnd_lib = static_library('libtreemultidnd',
+  'eggtreemultidnd.c',
+  c_args: libtreemultidnd_cflags,
+  dependencies: libtreemultidnd_dependencies,
+)
+
+libtreemultidnd_dep = declare_dependency(
+  link_with: libtreemultidnd_lib,
+  include_directories: include_directories('..'),
+)
diff --git a/libseahorse/meson.build b/libseahorse/meson.build
new file mode 100644
index 0000000..61f016f
--- /dev/null
+++ b/libseahorse/meson.build
@@ -0,0 +1,56 @@
+marshaller = gnome.genmarshal('seahorse-marshal',
+  sources: 'seahorse-marshal.list',
+  prefix: 'seahorse_marshal',
+)
+
+search_provider_src = gnome.gdbus_codegen('seahorse-shell-search-provider-generated',
+  'org.gnome.ShellSearchProvider2.xml',
+  interface_prefix : 'org.gnome.',
+  namespace : 'Seahorse',
+)
+
+
+libseahorse_sources = [
+  'seahorse-application.c',
+  'seahorse-bind.c',
+  'seahorse-collection.c',
+  'seahorse-interaction.c',
+  'seahorse-key-manager-store.c',
+  'seahorse-object.c',
+  'seahorse-object-list.c',
+  'seahorse-object-model.c',
+  'seahorse-object-widget.c',
+  'seahorse-passphrase.c',
+  'seahorse-predicate.c',
+  'seahorse-prefs.c',
+  'seahorse-progress.c',
+  'seahorse-search-provider.c',
+  'seahorse-servers.c',
+  'seahorse-util.c',
+  'seahorse-validity.c',
+  'seahorse-widget.c',
+  marshaller,
+  resources_src,
+  search_provider_src,
+]
+
+if with_keyservers
+  libseahorse_sources += 'seahorse-keyserver-control.c'
+endif
+
+libseahorse_deps = [
+  glib_deps,
+  gcr,
+  libsecret,
+  libtreemultidnd_dep,
+  common_dep,
+]
+
+libseahorse_lib = static_library('libseahorse',
+  libseahorse_sources,
+  dependencies: libseahorse_deps,
+)
+
+libseahorse_dep = declare_dependency(
+  link_with: libseahorse_lib,
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..e6237db
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,188 @@
+project('seahorse', ['vala', 'c'],
+  version: '3.20.0',
+  meson_version: '>= 0.42',
+  license: 'GPL2+',
+)
+
+gnome = import('gnome')
+i18n = import('i18n')
+
+# Options
+with_pgp = get_option('pgp-support')
+check_compatible_gpg = get_option('check-compatible-gpg')
+with_pkcs11 = get_option('pkcs11-support')
+with_hkp = get_option('hkp-support')
+with_ldap = get_option('ldap-support')
+with_keyservers = get_option('keyservers-support')
+with_key_sharing = get_option('key-sharing')
+
+# Some variables
+cc = meson.get_compiler('c')
+valac = meson.get_compiler('vala')
+buildtype = get_option('buildtype')
+
+seahorse_prefix = get_option('prefix')
+po_dir = join_paths(meson.source_root(), 'po')
+datadir = join_paths(seahorse_prefix, get_option('datadir'))
+bindir = join_paths(seahorse_prefix, get_option('bindir'))
+pkgdatadir = join_paths(datadir, meson.project_name())
+libexecbindir = join_paths(seahorse_prefix, get_option('libexecdir'), meson.project_name())
+localedir = join_paths(seahorse_prefix, get_option('localedir'))
+
+# Project-wide flags
+add_project_arguments([
+    '-DGCR_API_SUBJECT_TO_CHANGE',
+    '-DGCK_API_SUBJECT_TO_CHANGE',
+    '-include', 'config.h',
+  ],
+  language: 'c',
+)
+
+# Use more warnings
+warning_flags = [
+  '-Wchar-subscripts',
+  '-Wmissing-declarations',
+  '-Wmissing-prototypes',
+  '-Wnested-externs',
+  '-Wpointer-arith',
+  '-Wcast-align',
+  '-Wsign-compare',
+  '-Wno-deprecated-declarations',
+  '-Wno-strict-aliasing',
+  '-Wno-sign-compare',
+]
+supported_warning_flags = []
+foreach flag : warning_flags
+  if cc.has_argument(flag)
+    supported_warning_flags += flag
+  endif
+endforeach
+add_project_arguments(supported_warning_flags,
+  language: 'c',
+)
+
+# Dependencies
+min_glib_version = '2.44'
+min_gcr_version = '3.11.91'
+min_gpgme_version = '1.7.0'
+accepted_gpg_versions = [ '2.0.12', '2.1.4', '2.2.0' ]
+gpg_check_version = find_program(join_paths('meson', 'gpg_check_version.py'))
+
+glib_deps = [
+  dependency('glib-2.0',    version: '>=' + min_glib_version),
+  dependency('gobject-2.0', version: '>=' + min_glib_version),
+  dependency('gio-2.0',     version: '>=' + min_glib_version),
+  dependency('gmodule-2.0', version: '>=' + min_glib_version),
+]
+gtk = dependency('gtk+-3.0', version: '>= 3.4.0')
+gcr = dependency('gcr-3',       version: '>=' + min_gcr_version)
+gcr_ui = dependency('gcr-ui-3', version: '>=' + min_gcr_version)
+libsecret = dependency('libsecret-1', version: '>= 0.16')
+posix = valac.find_library('posix')
+ssh_bin = find_program('ssh')
+ssh_keygen = find_program('ssh-keygen')
+gpg_bin = find_program('gpg2', 'gpg', required: with_pgp)
+gpgme = cc.find_library('gpgme', required: with_pgp)
+gpgme_config = find_program('gpgme-config', required: with_pgp)
+
+if check_compatible_gpg
+  gpg_version_check = run_command([gpg_check_version, gpg_bin.path(), 'false', accepted_gpg_versions ])
+  gpg_version = gpg_version_check.stdout()
+  message('GnuPG Version: @0@'.format(gpg_version))
+  if gpg_version_check.returncode() != 0
+    error('Incompatible version of GnuPG. Accepted versions are: @0@'.format(accepted_gpg_versions))
+  endif
+
+  gpgme_version_check = run_command([gpg_check_version, gpgme_config.path(), 'true', min_gpgme_version ])
+  gpgme_version = gpgme_version_check.stdout()
+  message('GPGME version: @0@'.format(gpgme_version))
+  if gpgme_version_check.returncode() != 0
+    error('Incompatible version of GPGME. Minimal version required is @0@'.format(min_gpgme_version))
+  endif
+endif
+
+pkcs11_dep = valac.find_library('pkcs11')
+if with_pkcs11 and not pkcs11_dep.found()
+  error('Required library "pkcs11" not found (needed for PKCS#11 support)')
+endif
+
+libldap = cc.find_library('ldap')
+liblber = cc.find_library('lber')
+if with_ldap
+  if not libldap.found()
+    error('Required library "ldap" not found (needed for LDAP support)')
+  elif not liblber.found()
+    error('Required library "lber" not found (needed for LDAP support)')
+  endif
+endif
+
+libsoup = dependency('libsoup-2.4', version: '>= 2.33.92', required: with_hkp)
+avahi_client = dependency('avahi-client', required: with_key_sharing)
+avahi_glib = dependency('avahi-glib', version: '>= 0.6', required: with_key_sharing)
+
+
+# configuration
+conf = configuration_data()
+
+conf.set_quoted('VERSION', meson.project_version())
+conf.set_quoted('PACKAGE', meson.project_name())
+conf.set_quoted('PACKAGE_NAME', meson.project_name())
+conf.set_quoted('PACKAGE_VERSION', meson.project_version())
+conf.set_quoted('PACKAGE_STRING', '@0@ @1@'.format(meson.project_name(), meson.project_version()))
+conf.set_quoted('PKGDATADIR', pkgdatadir)
+conf.set_quoted('EXECDIR', libexecbindir)
+conf.set_quoted('LOCALEDIR', localedir)
+conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
+conf.set_quoted('G_LOG_DOMAIN', meson.project_name())
+conf.set10('WITH_DEBUG', buildtype.contains('debug'))
+conf.set10('_DEBUG', buildtype.contains('debug'))
+conf.set('HAVE_STRSEP', cc.has_function('strsep'))
+conf.set('WITH_PGP', with_pgp)
+conf.set('WITH_PKCS11', with_pkcs11)
+conf.set('WITH_LDAP', with_ldap)
+conf.set('WITH_HKP', with_hkp)
+conf.set('WITH_SOUP', with_hkp)
+conf.set('WITH_KEYSERVER', with_keyservers)
+conf.set('WITH_SHARING', with_key_sharing)
+conf.set_quoted('SSH_KEYGEN_PATH', ssh_keygen.path())
+conf.set_quoted('SSH_PATH', ssh_bin.path())
+if with_pgp
+  conf.set_quoted('GNUPG', gpg_bin.path())
+  gpg_version_split = gpg_version.split('.')
+  conf.set('GPG_MAJOR', gpg_version_split[0])
+  conf.set('GPG_MINOR', gpg_version_split[1])
+  conf.set('GPG_MICRO', gpg_version_split[2])
+endif
+
+config_file = configure_file(
+  output: 'config.h',
+  configuration: conf,
+)
+
+config = declare_dependency(
+  sources: config_file,
+  dependencies: [
+    valac.find_library('config', dirs: join_paths(meson.source_root(), 'common')),
+  ],
+  include_directories: include_directories('.'),
+)
+
+# Post-install scripts
+meson.add_install_script(join_paths('meson', 'post_install.py'))
+
+# subdirs
+subdir('po')
+subdir('data')
+subdir('help')
+subdir('common')
+subdir('libegg')
+subdir('gkr')
+subdir('ssh')
+if with_pgp
+  subdir('pgp')
+endif
+if with_pkcs11
+  subdir('pkcs11')
+endif
+subdir('libseahorse')
+subdir('src')
diff --git a/meson/gpg_check_version.py b/meson/gpg_check_version.py
new file mode 100755
index 0000000..b3481b3
--- /dev/null
+++ b/meson/gpg_check_version.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python3
+
+import sys
+import subprocess
+
+# Parses the GPG version from the output of the --version flag.
+# Should work on the output for `gpg`, `gpg2` and `gpgme-config`.
+def parse_version(gpg_output):
+    version_line = gpg_output.splitlines()[0]
+    return version_line.strip().split(' ')[-1]
+
+# Checks whether the GPG version is compatible with the given version.
+# For GPG, this means that the major and minor version should be equal;
+# for GPGME, this means only the major version should be equal.
+def check_version(gpg_version, accepted_version, is_gpgme = False):
+    gpg_major, gpg_minor, gpg_micro = gpg_version.split('.', 2)
+    acc_major, acc_minor, acc_micro = accepted_version.split('.', 2)
+    if is_gpgme:
+        return gpg_major == acc_major and gpg_minor >= acc_minor and gpg_micro >= acc_micro
+    else:
+        return gpg_major == acc_major and gpg_minor == acc_minor and gpg_micro >= acc_micro
+
+if len(sys.argv) <= 3:
+    sys.exit(1)
+
+gpg_path = sys.argv[1]
+is_gpgme =  True if sys.argv[2].lower() == 'true' else False
+accepted_versions = sys.argv[3:]
+
+# Parse and print the version
+proc = subprocess.Popen([gpg_path, '--version'],
+                        stdout=subprocess.PIPE,
+                        universal_newlines=True)
+gpg_version = parse_version(proc.stdout.read())
+print(gpg_version, end='')
+
+# Then return whether we're compatible with that version
+for accepted_version in accepted_versions:
+    if check_version(gpg_version, accepted_version, is_gpgme):
+        sys.exit(0)
+
+sys.exit(1)
diff --git a/meson/post_install.py b/meson/post_install.py
new file mode 100644
index 0000000..bf320a9
--- /dev/null
+++ b/meson/post_install.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python3
+
+import os
+import subprocess
+
+install_prefix = os.environ['MESON_INSTALL_PREFIX']
+icondir = os.path.join(install_prefix, 'share', 'icons', 'hicolor')
+schemadir = os.path.join(install_prefix, 'share', 'glib-2.0', 'schemas')
+
+if not os.environ.get('DESTDIR'):
+  print('Update icon cache...')
+  subprocess.call(['gtk-update-icon-cache', '-f', '-t', icondir])
+
+  print('Compiling gsettings schemas...')
+  subprocess.call(['glib-compile-schemas', schemadir])
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..6b44fb7
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,7 @@
+option('pgp-support', type: 'boolean', value: true, description: 'Add support PGP keys')
+option('check-compatible-gpg', type: 'boolean', value: true, description: 'Perform a rudimentary check if 
the GPG and GPG versions are compatible')
+option('pkcs11-support', type: 'boolean', value: true, description: 'Add support for PKCS#11 objects')
+option('keyservers-support', type: 'boolean', value: true, description: 'Add support for keyservers')
+option('hkp-support', type: 'boolean', value: true, description: 'Add support for keyservers using LDAP')
+option('ldap-support', type: 'boolean', value: true, description: 'Add support for keyservers using HKP')
+option('key-sharing', type: 'boolean', value: true, description: 'Add support for DNS-SD key sharing')
diff --git a/pgp/meson.build b/pgp/meson.build
new file mode 100644
index 0000000..c05d085
--- /dev/null
+++ b/pgp/meson.build
@@ -0,0 +1,92 @@
+pgp_sources = [
+  'seahorse-combo-keys.c',
+  'seahorse-discovery.c',
+  'seahorse-gpgme.c',
+  'seahorse-gpgme-add-subkey.c',
+  'seahorse-gpgme-add-uid.c',
+  'seahorse-gpgme-data.c',
+  'seahorse-gpgme-expires.c',
+  'seahorse-gpgme-exporter.c',
+  'seahorse-gpgme-generate.c',
+  'seahorse-gpgme-key.c',
+  'seahorse-gpgme-key-deleter.c',
+  'seahorse-gpgme-key-op.c',
+  'seahorse-gpgme-keyring.c',
+  'seahorse-gpgme-photo.c',
+  'seahorse-gpgme-photos.c',
+  'seahorse-gpgme-revoke.c',
+  'seahorse-gpgme-secret-deleter.c',
+  'seahorse-gpgme-sign.c',
+  'seahorse-gpgme-subkey.c',
+  'seahorse-gpgme-uid.c',
+  'seahorse-gpg-op.c',
+  'seahorse-gpg-options.c',
+  'seahorse-pgp.c',
+  'seahorse-pgp-actions.c',
+  'seahorse-pgp-backend.c',
+  'seahorse-pgp-key.c',
+  'seahorse-pgp-key-properties.c',
+  'seahorse-pgp-keysets.c',
+  'seahorse-pgp-photo.c',
+  'seahorse-pgp-signature.c',
+  'seahorse-pgp-subkey.c',
+  'seahorse-pgp-uid.c',
+  'seahorse-signer.c',
+  'seahorse-transfer.c',
+  'seahorse-unknown.c',
+  'seahorse-unknown-source.c',
+]
+
+pgp_dependencies = [
+  glib_deps,
+  gcr,
+  gpgme,
+  config,
+  common_dep,
+]
+
+pgp_c_flags = [
+]
+
+if with_ldap
+  pgp_sources += 'seahorse-ldap-source.c'
+  pgp_dependencies += [
+    libldap,
+    liblber,
+  ]
+  pgp_c_flags += '-DLDAP_DEPRECATED'
+endif
+
+if with_hkp
+  pgp_sources += 'seahorse-hkp-source.c'
+  pgp_dependencies += libsoup
+endif
+
+if with_keyservers
+  pgp_sources += [
+    'seahorse-server-source.c',
+    'seahorse-keyserver-search.c',
+    'seahorse-keyserver-sync.c',
+    'seahorse-keyserver-results.c',
+  ]
+endif
+
+if with_key_sharing
+  pgp_dependencies += [
+    avahi_client,
+    avahi_glib,
+  ]
+endif
+
+pgp_lib = static_library('seahorse-pgp',
+  pgp_sources,
+  dependencies: pgp_dependencies,
+  c_args: pgp_c_flags,
+)
+
+# xloadimage helper binary
+xloadimage = executable('xloadimage',
+  'seahorse-xloadimage.c',
+  install: true,
+  install_dir: libexecbindir,
+)
diff --git a/pkcs11/meson.build b/pkcs11/meson.build
new file mode 100644
index 0000000..977f964
--- /dev/null
+++ b/pkcs11/meson.build
@@ -0,0 +1,27 @@
+pkcs11_sources = [
+  'certificate-der-exporter.vala',
+  'pkcs11-certificate.vala',
+  'pkcs11-deleter.vala',
+  'pkcs11-key-deleter.vala',
+  'pkcs11-module.vala',
+  'pkcs11-private-key.vala',
+  'pkcs11-properties.vala',
+  'pkcs11-request.vala',
+  'pkcs11-token.vala',
+
+  'seahorse-pkcs11-backend.c',
+  'seahorse-pkcs11-generate.c',
+]
+
+pkcs11_deps = [
+  glib_deps,
+  gcr_ui,
+  pkcs11_dep,
+  config,
+  common_dep,
+]
+
+pkcs11_lib = static_library('seahorse-pkcs11',
+  pkcs11_sources,
+  dependencies: pkcs11_deps,
+)
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..f904cde
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,3 @@
+i18n.gettext(meson.project_name(),
+  preset: 'glib'
+)
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..a4c73a6
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,42 @@
+seahorse_sources = [
+  'seahorse-generate-select.c',
+  'seahorse-import-dialog.c',
+  'seahorse-key-manager.c',
+  'seahorse-main.c',
+  'seahorse-sidebar.c',
+  resources_src,
+]
+
+seahorse_dependencies = [
+  glib_deps,
+  gtk,
+  gcr,
+  config,
+  common_dep,
+  libseahorse_dep,
+]
+
+seahorse_linkedlibs = [
+  libeggdatetime_lib,
+  libtreemultidnd_lib,
+  gkr_lib,
+  ssh_lib,
+]
+
+if with_pgp
+  seahorse_linkedlibs += pgp_lib
+endif
+if with_pkcs11
+  seahorse_linkedlibs += pkcs11_lib
+endif
+
+
+seahorse_exe = executable('seahorse',
+  seahorse_sources,
+  dependencies: seahorse_dependencies,
+  link_with: seahorse_linkedlibs,
+  install: true,
+)
+
+# Manpage
+install_man('seahorse.1')
diff --git a/ssh/meson.build b/ssh/meson.build
new file mode 100644
index 0000000..005f0e2
--- /dev/null
+++ b/ssh/meson.build
@@ -0,0 +1,49 @@
+ssh_sources = [
+  'actions.vala',
+  'algorithm.vala',
+  'backend.vala',
+  'deleter.vala',
+  'errors.vala',
+  'exporter.vala',
+  'generate.vala',
+  'key-data.vala',
+  'key-properties.vala',
+  'key.vala',
+  'operation.vala',
+  'source.vala',
+  'ssh.vala',
+  'upload.vala',
+]
+
+ssh_dependencies = [
+  glib_deps,
+  gcr,
+  posix,
+  gtk,
+  config,
+  common_dep,
+]
+
+ssh_lib = static_library('seahorse-ssh',
+  ssh_sources,
+  dependencies: ssh_dependencies,
+)
+
+# ssh-askpass helper binary
+ssh_askpass_sources = [
+  'seahorse-ssh-askpass.c',
+  join_paths(meson.source_root(), 'libseahorse', 'seahorse-passphrase.c'),
+]
+
+ssh_askpass_dependencies = [
+  gcr,
+  gtk,
+  config,
+]
+
+ssh_askpass = executable('ssh-askpass',
+  ssh_askpass_sources,
+  dependencies: ssh_askpass_dependencies,
+  install: true,
+  install_dir: libexecbindir,
+)


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