[gnome-photos/wip/inigomartinez/meson: 3/5] build: Port to meson build system



commit 57cee0419069b7b0f7b2e0341ab219d2c797cc4a
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Thu Aug 31 18:50:13 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=787094

 Makefile.am            |    5 +
 data/Makefile.am       |    1 +
 data/icons/Makefile.am |    1 +
 data/icons/meson.build |   20 +++
 data/meson.build       |   56 ++++++++
 generate-authors.sh    |    9 ++
 help/Makefile.am       |    2 +
 help/meson.build       |   37 +++++
 meson.build            |  264 ++++++++++++++++++++++++++++++++++++
 meson_options.txt      |    3 +
 meson_post_install.py  |   29 ++++
 po/meson.build         |    1 +
 src/Makefile.am        |    1 +
 src/meson.build        |  347 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/Makefile.am      |    5 +
 tests/meson.build      |   47 +++++++
 tests/template.test.in |    3 +
 17 files changed, 831 insertions(+), 0 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index d1ba550..cbd7bb1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -16,6 +16,11 @@ photosdoc_DATA = \
 EXTRA_DIST = \
        $(photosdoc_DATA) \
        AUTHORS \
+       meson.build \
+       meson_options.txt \
+       meson_post_install.py \
+       generate-authors.sh \
+       po\meson.build \
        $(NULL)
 
 # We don't want to clean the AUTHORS in tarball builds
diff --git a/data/Makefile.am b/data/Makefile.am
index 0919c5f..ee94b09 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -29,6 +29,7 @@ EXTRA_DIST = \
        Adwaita.css \
        dnd-counter.svg \
        vignette.png \
+       meson.build \
        $(NULL)
 
 CLEANFILES = \
diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am
index fc54673..6150580 100644
--- a/data/icons/Makefile.am
+++ b/data/icons/Makefile.am
@@ -26,6 +26,7 @@ noinst_DATA = \
 EXTRA_DIST = \
        $(public_icons) \
        $(noinst_DATA) \
+       meson.build \
        $(NULL)
 
 gtk_update_icon_cache = gtk-update-icon-cache -f -t
diff --git a/data/icons/meson.build b/data/icons/meson.build
new file mode 100644
index 0000000..7de612e
--- /dev/null
+++ b/data/icons/meson.build
@@ -0,0 +1,20 @@
+icon_sizes = [
+  '16x16',
+  '22x22',
+  '24x24',
+  '32x32',
+  '48x48',
+  '256x256'
+]
+
+foreach icon_size: icon_sizes
+  install_data(
+    '_'.join(['hicolor', 'apps', icon_size, 'org.gnome.Photos.png']),
+    install_dir: join_paths(photos_datadir, 'icons', 'hicolor', icon_size, 'apps')
+  )
+endforeach
+
+install_data(
+  '_'.join(['hicolor', 'apps', 'scalable', 'org.gnome.Photos-symbolic.svg']),
+  install_dir: join_paths(photos_datadir, 'icons', 'hicolor', 'scalable', 'apps')
+)
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..b64323d
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,56 @@
+subdir('icons')
+
+info = 'org.gnome.Photos.metainfo.xml'
+
+i18n.merge_file(
+  info,
+  input: 'org.gnome.Photos.appdata.xml.in',
+  output: info,
+  po_dir: po_dir,
+  install: true,
+  install_dir: join_paths(photos_datadir, 'metainfo')
+)
+
+desktop_conf = configuration_data()
+desktop_conf.set('PACKAGE_TARNAME', photos_name)
+
+desktop = 'org.gnome.Photos.desktop'
+
+desktop_in = configure_file(
+  input: desktop + '.in.in',
+  output: desktop + '.in',
+  configuration: desktop_conf
+)
+
+i18n.merge_file(
+  desktop,
+  type: 'desktop',
+  input: desktop_in,
+  output: desktop,
+  po_dir: po_dir,
+  install: true,
+  install_dir: join_paths(photos_datadir, 'applications')
+)
+
+service_conf = configuration_data()
+service_conf.set('bindir', photos_bindir)
+
+service = 'org.gnome.Photos.service'
+
+configure_file(
+  input: service + '.in',
+  output: service,
+  install: true,
+  install_dir: join_paths(photos_datadir, 'dbus-1', 'services'),
+  configuration: service_conf
+)
+
+install_data(
+  'org.gnome.Photos.search-provider.ini',
+  install_dir: join_paths(photos_datadir, 'gnome-shell', 'search-providers')
+)
+
+install_data(
+  'org.gnome.photos.gschema.xml',
+  install_dir: join_paths(photos_datadir, 'glib-2.0', 'schemas')
+)
diff --git a/generate-authors.sh b/generate-authors.sh
new file mode 100755
index 0000000..87f3988
--- /dev/null
+++ b/generate-authors.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+if [ "$#" -ge 2 ] && [ -d "$1/.git" ]; then
+       {
+               echo '# Generated by Makefile. Do not edit.';
+               echo;
+               git -C $1 log --no-merges --pretty=format:"%an" src | sort | uniq
+       } > $2
+fi
diff --git a/help/Makefile.am b/help/Makefile.am
index 6a14644..89bc4fc 100644
--- a/help/Makefile.am
+++ b/help/Makefile.am
@@ -17,4 +17,6 @@ HELP_MEDIA = \
 
 HELP_LINGUAS = ca cs da de el es fr gl hu ko pl pt_BR ro sv
 
+EXTRA_DIST = meson.build
+
 -include $(top_srcdir)/git.mk
diff --git a/help/meson.build b/help/meson.build
new file mode 100644
index 0000000..8e5ce10
--- /dev/null
+++ b/help/meson.build
@@ -0,0 +1,37 @@
+sources = [
+  'favorites.page',
+  'favorites-set.page',
+  'index.page',
+  'legal.xml',
+  'view-album.page',
+  'view-favorites.page',
+  'view-photos.page',
+  'view.page'
+]
+
+media = 'media/logo1.png'
+
+linguas = [
+  'ca',
+  'cs',
+  'da',
+  'de',
+  'el',
+  'es',
+  'fr',
+  'gl',
+  'hu',
+  'ko',
+  'pl',
+  'pt_BR',
+  'ro',
+  'sv'
+]
+
+gnome.yelp(
+  photos_name,
+  sources: sources,
+  media: media,
+  symlink_media: true,
+  languages: linguas
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..00e2cff
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,264 @@
+project(
+  'Photos', 'c',
+  version: '3.27.1',
+  license: 'GPL2+',
+  default_options: [
+    'buildtype=debugoptimized',
+    'warning_level=1'
+  ],
+  meson_version: '>= 0.43.0'
+)
+
+photos_name = 'gnome-photos'
+photos_version = meson.project_version()
+
+photos_prefix = get_option('prefix')
+photos_bindir = join_paths(photos_prefix, get_option('bindir'))
+photos_datadir = join_paths(photos_prefix, get_option('datadir'))
+photos_libexecdir = join_paths(photos_prefix, get_option('libexecdir'))
+photos_localedir = join_paths(photos_prefix, get_option('localedir'))
+
+photos_docdir = join_paths(photos_datadir, 'doc', photos_name)
+
+photos_installed_test_metadir = join_paths(photos_datadir, 'installed-tests', meson.project_name())
+photos_installed_test_execdir = join_paths(photos_libexecdir, 'installed-tests', meson.project_name())
+
+photos_debug = get_option('buildtype').contains('debug')
+
+cc = meson.get_compiler('c')
+
+config_h = configuration_data()
+
+# defines
+set_defines = [
+  # package
+  ['PACKAGE', photos_name],
+  ['PACKAGE_BUGREPORT', 'http://bugzilla.gnome.org/enter_bug.cgi?product=' + photos_name],
+  ['PACKAGE_NAME', meson.project_name()],
+  ['PACKAGE_STRING', '@0@ @1@'.format(meson.project_name(), photos_version)],
+  ['PACKAGE_TARNAME', photos_name],
+  ['PACKAGE_URL', 'https://wiki.gnome.org/Apps/Photos'],
+  ['PACKAGE_VERSION', photos_version],
+  ['VERSION', photos_version],
+  # i18n
+  ['GETTEXT_PACKAGE', photos_name],
+  # source
+  ['G_LOG_DOMAIN', photos_name]
+]
+
+foreach define: set_defines
+  config_h.set_quoted(define[0], define[1])
+endforeach
+
+# debug options
+config_h.set('NDEBUG', not photos_debug)
+
+if not photos_debug
+  res = run_command(find_command('git'), 'describe')
+  if res.returncode() == 0
+    config_h.set('PACKAGE_COMMIT_ID', res.stdout().strip(),
+                 description: 'Define to the description of this package\'s latest commit')
+  endif
+endif
+
+# Support for nl_langinfo (_NL_MEASUREMENT_MEASUREMENT) (optional)
+langinfo_measurement_src = '''
+  #include <langinfo.h>
+  int main() {
+    char c;
+    c = *((unsigned char *)  nl_langinfo(_NL_MEASUREMENT_MEASUREMENT));
+  };
+'''
+config_h.set('HAVE__NL_MEASUREMENT_MEASUREMENT', cc.compiles(langinfo_measurement_src),
+             description: 'Define if _NL_MEASUREMENT_MEASUREMENT is available')
+
+# headers
+check_headers = [
+  ['HAVE_DLFCN_H', 'dlfcn.h'],
+  ['HAVE_INTTYPES_H', 'inttypes.h'],
+  ['HAVE_LOCALE_H', 'locale.h'],
+  ['HAVE_MEMORY_H', 'memory.h'],
+  ['HAVE_STDINT_H', 'stdint.h'],
+  ['HAVE_STDLIB_H', 'stdlib.h'],
+  ['HAVE_STRINGS_H', 'strings.h'],
+  ['HAVE_STRING_H', 'string.h'],
+  ['HAVE_SYS_STAT_H', 'sys/stat.h'],
+  ['HAVE_SYS_TYPES_H', 'sys/types.h'],
+  ['HAVE_UNISTD_H', 'unistd.h']
+]
+
+foreach header: check_headers
+  config_h.set(header[0], cc.has_header(header[1]))
+endforeach
+
+# functions
+check_functions = [
+  # i18n
+  ['HAVE_DCGETTEXT', 'dcgettext'],
+  ['HAVE_GETTEXT', 'gettext'],
+  ['HAVE_ICONV', 'iconv']
+]
+
+if host_machine.system().contains('darwin')
+  check_functions += [
+    ['HAVE_CFLOCALECOPYCURRENT', 'CFLocaleCopyCurrent'],
+    ['HAVE_CFPREFERENCESCOPYAPPVALUE', 'CFPreferencesCopyAppValue']
+  ]
+endif
+
+foreach func: check_functions
+  config_h.set(func[0], cc.has_function(func[1]))
+endforeach
+
+# symbols
+check_symbols = [
+  # i18n
+  ['HAVE_LC_MESSAGES', 'locale.h', 'LC_MESSAGES'],
+  ['HAVE_BIND_TEXTDOMAIN_CODESET', 'libintl.h', 'bind_textdomain_codeset']
+]
+
+foreach symbol: check_symbols
+  config_h.set(symbol[0], cc.has_header_symbol(symbol[1], symbol[2]))
+endforeach
+
+# compiler flags
+common_flags = ['-DHAVE_CONFIG_H']
+
+if get_option('enable-rdtscp')
+  common_flags += '-DEGG_HAVE_RDTSCP'
+  config_h.set('HAVE_SCHED_GETCPU', cc.has_function('sched_getcpu'))
+endif
+
+if photos_debug
+  test_cflags = [
+    '-fno-strict-aliasing',
+    '-Wcast-align',
+    '-Wdeclaration-after-statement',
+    '-Wformat=2',
+    '-Winit-self',
+    '-Winline',
+    '-Wmissing-declarations',
+    '-Wmissing-format-attribute',
+    '-Wmissing-include-dirs',
+    '-Wmissing-noreturn',
+    '-Wmissing-prototypes',
+    '-Wnested-externs',
+    '-Wno-error=missing-field-initializers',
+    '-Wno-error=unused-parameter',
+    '-Wno-missing-field-initializers',
+    '-Wno-unused-parameter',
+    '-Wold-style-definition',
+    '-Wpacked',
+    '-Wredundant-decls',
+    '-Wshadow',
+    '-Wstrict-prototypes',
+    '-Wswitch-default',
+    '-Wswitch-enum',
+    '-Wundef',
+    '-Wunused-but-set-variable',
+    '-Wwrite-strings'
+  ]
+
+  foreach cflag: test_cflags
+    if cc.has_argument(cflag)
+      common_flags += [cflag]
+    endif
+  endforeach
+endif
+
+add_project_arguments(common_flags, language: 'c')
+
+libgd = subproject(
+  'libgd',
+  default_options: [
+    'static=true',
+    'with-gtk-hacks=true',
+    'with-main-box=true',
+    'with-main-icon-box=true',
+    'with-main-icon-view=true',
+    'with-tagged-entry=true'
+  ]
+)
+libgd_dep = libgd.get_variable('libgd_dep')
+
+libjpeg_dep = dependency('libjpeg', required: false)
+assert(libjpeg_dep.found(), 'JPEG library not found')
+assert(cc.has_function('jpeg_destroy_decompress', dependencies: libjpeg_dep), 'jpeg_destroy_decompress not 
found')
+assert(cc.has_header('jpeglib.h', dependencies: libjpeg_dep), 'JPEG headers not found')
+assert(cc.has_function('jpeg_save_markers', dependencies: libjpeg_dep), 'JPEG library is too old')
+config_h.set('HAVE_LIBJPEG', true)
+
+goa_dep = dependency('goa-1.0', version: '>= 3.8.0')
+config_h.set('GOA_API_IS_SUBJECT_TO_CHANGE', true,
+             description: 'We are aware that GOA\'s API can change')
+
+common_deps = [
+  libjpeg_dep,
+  dependency('babl'),
+  dependency('gegl-0.3', version: '>= 0.3.15'),
+  dependency('gdk-pixbuf-2.0'),
+  dependency('gio-2.0'),
+  dependency('gio-unix-2.0'),
+  dependency('glib-2.0', version: '>= 2.44.0'),
+  dependency('gtk+-3.0', version: '>= 3.22.16'),
+  dependency('libpng16'),
+  dependency('tracker-sparql-2.0'),
+  cc.find_library('m')
+]
+
+# FIXME: shm_open seems a hard dependency
+if not cc.has_function('shm_open')
+  rt_dep = cc.find_library('rt')
+  assert(cc.has_function('shm_open', dependencies: rt_dep), 'shm_open support is missing')
+  common_deps += rt_dep
+endif
+# FIXME: it might be unnecessary because egg-counter.c is expecting:
+#        if (getenv ("EGG_COUNTER_DISABLE_SHM"))
+config_h.set('HAVE_SHM_OPEN', true)
+
+configure_file(
+  output: 'config.h',
+  configuration: config_h
+)
+
+doc_data = files(
+  'ARTISTS',
+  'ChangeLog',
+  'COPYING',
+  'NEWS',
+  'README'
+)
+
+install_data(
+  doc_data,
+  install_dir: photos_docdir
+)
+
+authors = 'AUTHORS'
+
+author = custom_target(
+  authors,
+  output: authors,
+  command: [find_program('generate-authors.sh'), meson.source_root(), '@OUTPUT@'],
+  install: true,
+  install_dir: photos_docdir
+)
+
+gnome = import('gnome')
+i18n = import('i18n')
+pkg = import('pkgconfig')
+
+po_dir = join_paths(meson.source_root(), 'po')
+
+top_inc = include_directories('.')
+
+subdir('data')
+subdir('src')
+subdir('po')
+subdir('tests')
+subdir('help')
+
+meson.add_install_script(
+  'meson_post_install.py',
+  photos_datadir
+)
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..2e4bb5d
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,3 @@
+option('enable-rdtscp', type: 'boolean', value: false, description: 'turn on rdtscp optimizations')
+option('enable-dogtail', type: 'boolean', value: true, description: 'test using dogtail')
+option('enable-installed-tests', type: 'boolean', value: false, description: 'Enable installation of some 
test cases')
diff --git a/meson_post_install.py b/meson_post_install.py
new file mode 100644
index 0000000..3841ac2
--- /dev/null
+++ b/meson_post_install.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python3
+
+import glob
+import os
+import re
+import subprocess
+import sys
+
+if not os.environ.get('DESTDIR'):
+  icondir = os.path.join(sys.argv[1], 'icons', 'hicolor')
+
+  name_pattern = re.compile('hicolor_(?:apps)_(?:\d+x\d+|scalable)_(.*)')
+  search_pattern = '/**/hicolor_*'
+
+  [os.rename(file, os.path.join(os.path.dirname(file), name_pattern.search(file).group(1)))
+   for file in glob.glob(icondir + search_pattern, recursive=True)]
+
+  print('Update icon cache...')
+  subprocess.call(['gtk-update-icon-cache', '-f', '-t', icondir])
+
+  schemadir = os.path.join(sys.argv[1], 'glib-2.0', 'schemas')
+  print('Compiling gsettings schemas...')
+  subprocess.call(['glib-compile-schemas', schemadir])
+
+  desktopdir = os.path.join(sys.argv[1], 'applications')
+  search_pattern = '/*.desktop'
+  print('Validate desktop files...')
+  [subprocess.call(['desktop-file-validate', file])
+   for file in glob.glob(desktopdir + search_pattern, recursive=False)]
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..a166773
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext(photos_name, preset: 'glib')
diff --git a/src/Makefile.am b/src/Makefile.am
index 340e6b4..d389188 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -387,6 +387,7 @@ EXTRA_DIST = \
        photos-dleyna-renderer-manager.xml \
        photos-dleyna-renderer-push-host.xml \
        photos-mpris-player.xml \
+       meson.build \
        $(NULL)
 
 AM_CPPFLAGS = \
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..de5493f
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,347 @@
+common_sources = files(
+  'egg-counter.c',
+  'photos-debug.c',
+  'photos-error.c',
+  'photos-gegl.c',
+  'photos-glib.c',
+  'photos-jpeg-count.c',
+  'photos-operation-insta-curve.c',
+  'photos-operation-insta-filter.c',
+  'photos-operation-insta-hefe.c',
+  'photos-operation-insta-hefe-curve.c',
+  'photos-operation-insta-hefe-vignette.c',
+  'photos-operation-jpg-guess-sizes.c',
+  'photos-operation-png-guess-sizes.c',
+  'photos-operation-saturation.c',
+  'photos-operation-svg-multiply.c',
+  'photos-pipeline.c',
+  'photos-png-count.c',
+  'photos-quarks.c'
+)
+
+enum_headers = files(
+  'photos-item-manager.h',
+  'photos-operation-insta-common.h'
+)
+
+enum = 'photos-enums'
+
+common_sources += gnome.mkenums(
+  enum,
+  sources: enum_headers,
+  c_template: enum + '.c.template',
+  h_template: enum + '.h.template'
+)
+
+resource_data = files('../data/vignette.png')
+
+common_sources += gnome.compile_resources(
+  'photos-resources-gegl',
+  'photos-gegl.gresource.xml',
+  source_dir: '.',
+  c_name: 'photos_gegl',
+  dependencies: resource_data,
+  export: true
+)
+
+thumbnailer_dbus = 'photos-thumbnailer-dbus'
+
+common_sources += gnome.gdbus_codegen(
+  thumbnailer_dbus,
+  thumbnailer_dbus + '.xml',
+  interface_prefix: 'org.gnome.Photos.',
+  namespace: 'Photos',
+  annotations: ['org.gnome.Photos.Thumbnailer', 'org.gtk.GDBus.C.Name', 'ThumbnailerDBus']
+)
+
+sources = common_sources + files(
+  'egg-animation.c',
+  'egg-frame-source.c',
+  'egg-heap.c',
+  'egg-task-cache.c',
+  'photos-application.c',
+  'photos-base-manager.c',
+  'photos-base-model.c',
+  'photos-base-item.c',
+  'photos-camera-cache.c',
+  'photos-collection-icon-watcher.c',
+  'photos-create-collection-icon-job.c',
+  'photos-create-collection-job.c',
+  'photos-delete-item-job.c',
+  'photos-delete-notification.c',
+  'photos-dlna-renderer.c',
+  'photos-dlna-renderers-dialog.c',
+  'photos-dlna-renderers-manager.c',
+  'photos-done-notification.c',
+  'photos-dropdown.c',
+  'photos-export-dialog.c',
+  'photos-export-notification.c',
+  'photos-edit-palette.c',
+  'photos-edit-palette-row.c',
+  'photos-embed.c',
+  'photos-empty-results-box.c',
+  'photos-error-box.c',
+  'photos-facebook-item.c',
+  'photos-fetch-collection-state-job.c',
+  'photos-fetch-collections-job.c',
+  'photos-fetch-ids-job.c',
+  'photos-fetch-metas-job.c',
+  'photos-filterable.c',
+  'photos-flickr-item.c',
+  'photos-google-item.c',
+  'photos-header-bar.c',
+  'photos-image-view.c',
+  'photos-image-view-helper.c',
+  'photos-indexing-notification.c',
+  'photos-item-manager.c',
+  'photos-local-item.c',
+  'photos-main-toolbar.c',
+  'photos-main-window.c',
+  'photos-media-server-item.c',
+  'photos-notification-manager.c',
+  'photos-offset-collections-controller.c',
+  'photos-offset-collection-view-controller.c',
+  'photos-offset-controller.c',
+  'photos-offset-favorites-controller.c',
+  'photos-offset-overview-controller.c',
+  'photos-offset-search-controller.c',
+  'photos-organize-collection-dialog.c',
+  'photos-organize-collection-model.c',
+  'photos-organize-collection-view.c',
+  'photos-overview-searchbar.c',
+  'photos-preview-nav-buttons.c',
+  'photos-preview-view.c',
+  'photos-print-notification.c',
+  'photos-print-operation.c',
+  'photos-print-preview.c',
+  'photos-print-setup.c',
+  'photos-properties-dialog.c',
+  'photos-query.c',
+  'photos-query-builder.c',
+  'photos-remote-display-manager.c',
+  'photos-search-context.c',
+  'photos-search-controller.c',
+  'photos-search-match.c',
+  'photos-search-match-manager.c',
+  'photos-search-provider.c',
+  'photos-search-type.c',
+  'photos-search-type-manager.c',
+  'photos-searchbar.c',
+  'photos-selection-controller.c',
+  'photos-selection-toolbar.c',
+  'photos-set-collection-job.c',
+  'photos-share-dialog.c',
+  'photos-share-notification.c',
+  'photos-share-point.c',
+  'photos-share-point-email.c',
+  'photos-share-point-google.c',
+  'photos-share-point-manager.c',
+  'photos-share-point-online.c',
+  'photos-single-item-job.c',
+  'photos-source.c',
+  'photos-source-manager.c',
+  'photos-source-notification.c',
+  'photos-spinner-box.c',
+  'photos-thumbnail-factory.c',
+  'photos-tool.c',
+  'photos-tool-colors.c',
+  'photos-tool-crop.c',
+  'photos-tool-enhance.c',
+  'photos-tool-filter-button.c',
+  'photos-tool-filters.c',
+  'photos-tracker-change-event.c',
+  'photos-tracker-change-monitor.c',
+  'photos-tracker-collections-controller.c',
+  'photos-tracker-collection-view-controller.c',
+  'photos-tracker-controller.c',
+  'photos-tracker-favorites-controller.c',
+  'photos-tracker-overview-controller.c',
+  'photos-tracker-search-controller.c',
+  'photos-tracker-queue.c',
+  'photos-update-mtime-job.c',
+  'photos-utils.c',
+  'photos-view-container.c',
+  'photos-widget-shader.c',
+  'photos-zoom-controls.c',
+  'photos-main.c'
+)
+
+about_header = 'photos-about-data.h'
+
+sources += custom_target(
+  about_header,
+  output: about_header,
+  capture: true,
+  depends: author,
+  command: [find_program('photos-generate-about'), '--header', meson.build_root(), meson.source_root()]
+)
+
+about_source = 'photos-about-data.c'
+
+sources += custom_target(
+  about_source,
+  output: about_source,
+  capture: true,
+  command: [find_program('photos-generate-about'), '--body', meson.build_root(), meson.source_root()]
+)
+
+marshal = 'photos-marshalers'
+
+sources += gnome.genmarshal(
+  marshal,
+  sources: marshal + '.list',
+  prefix: '_photos_marshal'
+)
+
+resource_data = files(
+  '../data/Adwaita.css',
+  '../data/dnd-counter.svg',
+  '../data/icons/image-adjust-color-symbolic.svg',
+  '../data/icons/image-auto-adjust-symbolic.svg',
+  '../data/icons/image-crop-symbolic.svg',
+  '../data/icons/image-denoise-symbolic.svg',
+  '../data/icons/image-edit-symbolic.svg',
+  '../data/icons/image-filter-symbolic.svg',
+  '../data/icons/image-sharpen-symbolic.svg',
+  'photos-dlna-renderers-dialog.ui',
+  'photos-dropdown.ui',
+  'photos-embed.ui',
+  'photos-export-dialog.ui',
+  'photos-help-overlay.ui',
+  'photos-main-toolbar.ui',
+  'photos-main-window.ui',
+  'photos-menus.ui',
+  'photos-preview-menu.ui',
+  'photos-selection-menu.ui',
+  'photos-selection-toolbar.ui',
+  'photos-share-dialog.ui',
+  'photos-zoom-controls.ui'
+)
+
+sources += gnome.compile_resources(
+  'photos-resources',
+  'photos.gresource.xml',
+  source_dir: '.',
+  c_name: 'photos',
+  dependencies: resource_data,
+  export: true
+)
+
+dleyna_device = 'photos-dleyna-renderer-device'
+
+sources += gnome.gdbus_codegen(
+  dleyna_device,
+  dleyna_device + '.xml',
+  interface_prefix: 'com.intel.dLeynaRenderer.',
+  namespace: 'Dleyna',
+  annotations: ['com.intel.dLeynaRenderer.RendererDevice.GetIcon()[Bytes]', 'org.gtk.GDBus.C.ForceGVariant', 
'true']
+)
+
+dleyna_manager = 'photos-dleyna-renderer-manager'
+
+sources += gnome.gdbus_codegen(
+  dleyna_manager,
+  dleyna_manager + '.xml',
+  interface_prefix: 'com.intel.dLeynaRenderer.',
+  namespace: 'DleynaRenderer'
+)
+
+dleyna_push_host = 'photos-dleyna-renderer-push-host'
+
+sources += gnome.gdbus_codegen(
+  dleyna_push_host,
+  dleyna_push_host + '.xml',
+  interface_prefix: 'com.intel.dLeynaRenderer.',
+  namespace: 'DleynaRenderer'
+)
+
+gom_miner = 'photos-gom-miner'
+
+sources += gnome.gdbus_codegen(
+  gom_miner,
+  gom_miner + '.xml',
+  interface_prefix: 'org.gnome.OnlineMiners.',
+  namespace: 'Gom'
+)
+
+mpris_player = 'photos-mpris-player'
+
+sources += gnome.gdbus_codegen(
+  mpris_player,
+  mpris_player + '.xml',
+  interface_prefix: 'org.mpris.MediaPlayer2.',
+  namespace: 'Mpris'
+)
+
+shell_search_provider = 'photos-'
+
+sources += gnome.gdbus_codegen(
+  'photos-shell-search-provider2',
+  'org.gnome.ShellSearchProvider2.xml',
+  interface_prefix: 'org.gnome.Shell.',
+  namespace: 'Shell'
+)
+
+tracker_extract_priority = 'photos-tracker-extract-priority'
+
+sources += gnome.gdbus_codegen(
+  tracker_extract_priority,
+  tracker_extract_priority + '.xml',
+  interface_prefix: 'org.freedesktop.Tracker1.',
+  namespace: 'Tracker'
+)
+
+tracker_resources = 'photos-tracker-resources'
+
+sources += gnome.gdbus_codegen(
+  tracker_resources,
+  tracker_resources + '.xml',
+  interface_prefix: 'org.freedesktop.Tracker1.',
+  namespace: 'Tracker'
+)
+
+deps = common_deps + [
+  goa_dep,
+  libgd_dep,
+  dependency('cairo', version: '>= 1.14.0'),
+  dependency('cairo-gobject'),
+  dependency('libgfbgraph-0.2', version: '>= 0.2.1'),
+  dependency('libgdata', version: '>= 0.15.2'),
+  dependency('geocode-glib-1.0'),
+  dependency('gexiv2'),
+  dependency('grilo-0.3', version: '>= 0.3.0'),
+  dependency('gsettings-desktop-schemas'),
+  dependency('gtk+-unix-print-3.0'),
+  dependency('tracker-control-2.0')
+]
+
+cflags = [
+  '-DPACKAGE_LIBEXEC_DIR="@0@"'.format(photos_libexecdir),
+  '-DPACKAGE_LOCALE_DIR="@0@"'.format(photos_localedir)
+]
+
+executable(
+  photos_name,
+  sources,
+  include_directories: top_inc,
+  dependencies: deps,
+  c_args: cflags,
+  install: true,
+  install_dir: photos_bindir
+)
+
+sources = common_sources + files(
+  'photos-pixbuf.c',
+  'photos-thumbnailer.c',
+  'photos-thumbnailer-main.c'
+)
+
+executable(
+  photos_name + '-thumbnailer',
+  sources,
+  include_directories: top_inc,
+  dependencies: common_deps,
+  c_args: cflags,
+  install: true,
+  install_dir: photos_libexecdir
+)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f3f3b20..3be5dcd 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -26,4 +26,9 @@ EXTRA_DIST += \
        $(NULL)
 endif
 
+EXTRA_DIST += \
+       meson.build \
+       template.test.in \
+       $(NULL)
+
 -include $(top_srcdir)/git.mk
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..f93d3a1
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,47 @@
+enable_installed_tests = get_option('enable-installed-tests')
+
+test_names = ['basic.py']
+
+test_template = files('template.test.in')
+
+foreach name: test_names
+  test_conf = configuration_data()
+  test_conf.set('installed_testdir', photos_installed_test_execdir)
+  test_conf.set('program', name)
+
+  configure_file(
+    input: test_template,
+    output: name + '.test',
+    install: enable_installed_tests,
+    install_dir: photos_installed_test_metadir,
+    configuration: test_conf
+  )
+endforeach
+
+if get_option('enable-dogtail')
+  test_names += ['testutil.py']
+endif
+
+if enable_installed_tests
+  install_data(
+    test_names,
+    install_dir: join_paths(photos_libexecdir, 'installed-tests', meson.project_name())
+  )
+endif
+
+test_env = [
+  'LC_ALL=C',
+  'GSETTINGS_BACKEND=memory'
+]
+
+python = find_program('python2')
+
+foreach name: test_names
+  test_script = files(name)
+  test(
+    name,
+    python,
+    args: test_script,
+    env: test_env
+  )
+endforeach
diff --git a/tests/template.test.in b/tests/template.test.in
new file mode 100644
index 0000000..5346a7b
--- /dev/null
+++ b/tests/template.test.in
@@ -0,0 +1,3 @@
+[Test]
+Type=session-exclusive
+Exec=@installed_testdir@/@program@


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