[eog/wip/inigomartinez/meson] build: Port to meson build system



commit 2c19a1dd3f5ed187dbb46854d7956ca187e93353
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Thu Jun 29 18:05:02 2017 +0200

    build: Port to meson build system

 data/icons/meson.build     |   45 ++++++
 data/meson.build           |   66 +++++++++
 doc/reference/eog-docs.xml |   85 ++++++++++++
 doc/reference/meson.build  |   76 +++++++++++
 help/meson.build           |   92 +++++++++++++
 jpegutils/meson.build      |   18 +++
 meson.build                |  322 ++++++++++++++++++++++++++++++++++++++++++++
 meson_options.txt          |    8 +
 meson_post_install.py      |   15 ++
 plugins/meson.build        |   34 +++++
 po/meson.build             |    1 +
 src/eog.map                |    6 +
 src/meson.build            |  234 ++++++++++++++++++++++++++++++++
 tests/meson.build          |   44 ++++++
 tests/tests.in             |    3 +
 15 files changed, 1049 insertions(+), 0 deletions(-)
---
diff --git a/data/icons/meson.build b/data/icons/meson.build
new file mode 100644
index 0000000..0440dd7
--- /dev/null
+++ b/data/icons/meson.build
@@ -0,0 +1,45 @@
+icon_sizes = [
+  '16x16',
+  '22x22',
+  '24x24',
+  '32x32',
+  '256x256'
+]
+
+foreach icon_size: icon_sizes
+  install_subdir(
+    join_paths(icon_size, 'apps'),
+    install_dir: join_paths(eog_datadir, 'icons', 'hicolor', icon_size)
+  )
+endforeach
+
+install_data(
+  'scalable/apps/eog-symbolic.svg',
+  install_dir: join_paths(eog_datadir, 'icons', 'hicolor', 'scalable', 'apps')
+)
+
+icon_sizes = [
+  '16x16',
+  '22x22',
+  '24x24',
+  '32x32',
+  '48x48'
+]
+
+foreach icon_size: icon_sizes
+  actions_icons = files(icon_size + '/actions/slideshow-play.png')
+
+  if icon_size != '24x24' and icon_size != '48x48'
+    actions_icons += files(icon_size + '/actions/eog-plugin.png')
+  endif
+
+  install_data(
+    actions_icons,
+    install_dir: join_paths(eog_pkgdatadir, 'icons', 'hicolor', icon_size, 'actions')
+  )
+endforeach
+
+install_subdir(
+  'scalable/actions',
+  install_dir: join_paths(eog_pkgdatadir, 'icons', 'hicolor', 'scalable')
+)
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..5ecc05e
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,66 @@
+subdir('icons')
+
+resource_files = files(
+  'pixmaps/thumbnail-frame.png',
+  'eog-app-menu.ui',
+  'eog-gear-menu.ui',
+  'eog-image-properties-dialog.ui',
+  'eog-multiple-save-as-dialog.ui',
+  'eog-preferences-dialog.ui',
+  'eog-zoom-entry.ui',
+  'eog.css',
+  'fullscreen-toolbar.ui',
+  'help-overlay.ui',
+  'metadata-sidebar.ui',
+  'popup-menus.ui'
+)
+
+desktop_conf = configuration_data()
+desktop_conf.set('VERSION', eog_version)
+
+desktop = 'eog.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(eog_datadir, 'applications')
+)
+
+info = 'eog.metainfo.xml'
+
+i18n.merge_file(
+  info,
+  input: 'eog.appdata.xml.in',
+  output: info,
+  po_dir: po_dir,
+  install: true,
+  install_dir: join_paths(eog_datadir, 'metainfo')
+)
+
+schema_conf = configuration_data()
+schema_conf.set('GETTEXT_PACKAGE', meson.project_name())
+
+schema = 'org.gnome.eog.gschema.xml'
+
+configure_file(
+  input: schema + '.in',
+  output: schema,
+  install: true,
+  install_dir: eog_schemadir,
+  configuration: schema_conf
+)
+
+install_data(
+  'eog.convert',
+  install_dir: join_paths(eog_datadir, 'GConf', 'gsettings')
+)
diff --git a/doc/reference/eog-docs.xml b/doc/reference/eog-docs.xml
new file mode 100644
index 0000000..967a5f0
--- /dev/null
+++ b/doc/reference/eog-docs.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+               "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"; [
+<!ENTITY version SYSTEM "version.xml">
+]>
+<book id="index" xmlns:xi="http://www.w3.org/2003/XInclude";>
+  <bookinfo>
+    <title>Eye of GNOME Reference Manual</title>
+    <releaseinfo>
+      for Eye of GNOME &version;
+    </releaseinfo>
+  </bookinfo>
+
+  <reference>
+    <title>API Reference</title>
+    <chapter>
+      <title>User Interface</title>
+      <xi:include href="xml/eog-properties-dialog.xml"/>
+      <xi:include href="xml/eog-list-store.xml"/>
+      <xi:include href="xml/eog-file-chooser.xml"/>
+      <xi:include href="xml/eog-thumb-nav.xml"/>
+      <xi:include href="xml/eog-thumb-view.xml"/>
+      <xi:include href="xml/eog-scroll-view.xml"/>
+      <xi:include href="xml/eog-window.xml"/>
+      <xi:include href="xml/eog-window-activatable.xml"/>
+      <xi:include href="xml/eog-statusbar.xml"/>
+      <xi:include href="xml/eog-sidebar.xml"/>
+      <xi:include href="xml/eog-thumbnail.xml"/>
+      <xi:include href="xml/eog-save-as-dialog-helper.xml"/>
+      <xi:include href="xml/eog-error-message-area.xml"/>
+    </chapter>
+
+    <chapter>
+      <title>Image data and manipulation</title>
+      <xi:include href="xml/eog-image.xml"/>
+      <xi:include href="xml/eog-image-save-info.xml"/>
+      <xi:include href="xml/eog-transform.xml"/>
+      <xi:include href="xml/eog-clipboard-handler.xml"/>
+    </chapter>
+
+    <chapter>
+      <title>Printing</title>
+      <xi:include href="xml/eog-print.xml"/>
+    </chapter>
+
+    <chapter>
+      <title>Application and configuration</title>
+      <xi:include href="xml/eog-application.xml"/>
+      <xi:include href="xml/eog-session.xml"/>
+      <xi:include href="xml/eog-config-keys.xml"/>
+    </chapter>
+
+    <!--<chapter>
+      <title>Plugins</title>
+      <xi:include href="xml/eog-plugin-engine.xml"/>
+    </chapter>-->
+
+    <chapter>
+      <title>Utilities</title>
+      <xi:include href="xml/eog-debug.xml"/>
+      <xi:include href="xml/eog-uri-converter.xml"/>
+      <xi:include href="xml/eog-util.xml"/>
+      <!--
+      <xi:include href="xml/eog-exif-util.xml"/>
+      -->
+      <xi:include href="xml/eog-pixbuf-util.xml"/>
+      <xi:include href="xml/zoom.xml"/>
+    </chapter>
+
+    <chapter>
+      <title>Asynchronous jobs</title>
+      <xi:include href="xml/eog-jobs.xml"/>
+      <xi:include href="xml/eog-job-scheduler.xml"/>
+    </chapter>
+  </reference>
+
+  <part>
+    <title>Appendix</title>
+    <index id="api-index">
+      <title>API Index</title>
+      <xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
+    </index>
+    <xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
+  </part>
+</book>
diff --git a/doc/reference/meson.build b/doc/reference/meson.build
new file mode 100644
index 0000000..3c32bee
--- /dev/null
+++ b/doc/reference/meson.build
@@ -0,0 +1,76 @@
+private_headers = [
+  'eog-application-service.h',
+  'eog-close-confirmation-dialog.h',
+  'eog-enum-types.h',
+  'eog-image-private.h',
+  'eog-image-jpeg.h',
+  'eog-marshal.h',
+  'eog-metadata-details.h',
+  'eog-metadata-reader.h',
+  'eog-metadata-reader-jpg.h',
+  'eog-metadata-reader-png.h',
+  'eog-metadata-sidebar.h',
+  'eog-module.h',
+  'eog-plugin-engine.h',
+  'eog-preferences-dialog.h',
+  'eog-print-image-setup.h',
+  'eog-print-preview.h'
+]
+
+if not have_exif
+  private_headers += 'eog-exif-util.h'
+endif
+
+version_conf = configuration_data()
+version_conf.set('VERSION', eog_version)
+
+version_xml = 'version.xml'
+
+configure_file(
+  input: version_xml + '.in',
+  output: version_xml,
+  configuration: version_conf
+)
+
+# FIXME: gtkdoc is not able to get a configure_object as main_xml file.
+#        https://github.com/mesonbuild/meson/issues/1875
+#        https://github.com/mesonbuild/meson/issues/550
+'''
+# Build EXIF-related documentation if we really have support for it
+doc_conf = configuration_data()
+if have_exif or have_exempi
+  doc_conf.set('EOG_DOC_EXIF_START', '')
+  doc_conf.set('EOG_DOC_EXIF_STOP', '')
+else
+  doc_conf.set('EOG_DOC_EXIF_START', '<!--')
+  doc_conf.set('EOG_DOC_EXIF_STOP', '-->')
+endif
+
+docs_xml = meson.project_name() + '-docs.xml'
+
+main_xml = configure_file(
+  input: docs_xml + '.in',
+  output: docs_xml,
+  configuration: doc_conf
+)
+'''
+
+doc_path = join_paths(eog_datadir, 'gtk-doc', 'html', meson.project_name())
+
+gnome.gtkdoc(
+  meson.project_name(),
+  main_xml: meson.project_name() + '-docs.xml',
+  src_dir: src_inc,
+  dependencies: libeog_dep,
+  scan_args: [
+    '--rebuild-types',
+    '--ignore-headers=' + ' '.join(private_headers),
+  ],
+  mkdb_args: [
+    '--xml-mode',
+    '--output-format=xml'
+  ],
+  gobject_typesfile: meson.project_name() + '.types',
+  install: true,
+  install_dir: doc_path
+)
diff --git a/help/meson.build b/help/meson.build
new file mode 100644
index 0000000..f620815
--- /dev/null
+++ b/help/meson.build
@@ -0,0 +1,92 @@
+sources = [
+  'bug-filing.page',
+  'commandline.page',
+  'copy-paste.page',
+  'default.page',
+  'desktop-background.page',
+  'develop.page',
+  'documentation.page',
+  'edit.page',
+  'flip-rotate.page',
+  'format-change.page',
+  'formats-save.page',
+  'formats-view.page',
+  'index.page',
+  'introduction.page',
+  'legal.xml',
+  'license.page',
+  'open.page',
+  'plugin-exif-digital.page',
+  'plugin-fullscreen-background.page',
+  'plugin-fullscreen-double-click.page',
+  'plugin-picasa.page',
+  'plugin-python-console.page',
+  'plugin-send-by-mail.page',
+  'plugin-slideshow-shuffle.page',
+  'plugins.page',
+  'plugin-zoom-width.page',
+  'preferences.page',
+  'print.page',
+  'rename-multiple.page',
+  'shortcuts.page',
+  'slideshow.page',
+  'toolbar.page',
+  'translate.page',
+  'view.page',
+  'zoom.page'
+]
+
+media = [
+  'figures/eog-logo.png',
+  'figures/eog-toolbar-editor.png',
+  'figures/eog-trail.png',
+  'figures/image-view-prefs.png',
+  'figures/multiple-convert.png',
+  'figures/multiple-rename-count.png',
+  'figures/plugins-all.png',
+  'figures/plugin-send-by-mail.png',
+  'figures/prefs-plugins-date.png',
+  'figures/prefs-plugins-fullscreen.png',
+  'figures/prefs-plugins.png',
+  'figures/slideshow-prefs.png'
+]
+
+linguas = [
+  'ar',
+  'ca',
+  'cs',
+  'da',
+  'de',
+  'el',
+  'en_GB',
+  'es',
+  'eu',
+  'fi',
+  'fr',
+  'gl',
+  'hu',
+  'it',
+  'ja',
+  'ko',
+  'lv',
+  'oc',
+  'pa',
+  'pt_BR',
+  'ro',
+  'ru',
+  'sl',
+  'sv',
+  'te',
+  'th',
+  'uk',
+  'zh_CN',
+  'zh_TW'
+]
+
+gnome.yelp(
+  meson.project_name(),
+  sources: sources,
+  media: media,
+  symlink_media: true,
+  languages: linguas
+)
diff --git a/jpegutils/meson.build b/jpegutils/meson.build
new file mode 100644
index 0000000..a5d1a4e
--- /dev/null
+++ b/jpegutils/meson.build
@@ -0,0 +1,18 @@
+if have_jpeg_80
+  sources = files('transupp-8a.c')
+else
+  sources = files('transupp-6b.c')
+endif
+
+libjpegutils = static_library(
+  'libeog-jpegutils',
+  sources: sources,
+  include_directories: top_inc,
+  dependencies: eog_deps
+)
+
+jpeg_deps += declare_dependency(
+  link_with: libjpegutils,
+  include_directories: include_directories('.'),
+  dependencies: eog_deps
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..9f9ccfc
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,322 @@
+project(
+  'eog', 'c',
+  version: '3.25.2',
+  license: 'GPL2',
+  default_options: [
+    'buildtype=debugoptimized',
+    'c_std=gnu99',
+    'warning_level=1'
+  ],
+  meson_version: '>= 0.41.0'
+)
+
+eog_version = meson.project_version()
+version_array = eog_version.split('.')
+eog_major_version = version_array[0].to_int()
+eog_minor_version = version_array[1].to_int()
+eog_micro_version = version_array[2].to_int()
+
+eog_api_version = '@0@.0'.format(eog_major_version)
+eog_api_name = '@0@-@1@'.format(meson.project_name(), eog_api_version)
+
+eog_gir_ns = 'Eog'
+eog_gir_version = '1.0'
+
+eog_prefix = get_option('prefix')
+eog_bindir = join_paths(eog_prefix, get_option('bindir'))
+eog_datadir = join_paths(eog_prefix, get_option('datadir'))
+eog_includedir = join_paths(eog_prefix, get_option('includedir'))
+eog_libdir = join_paths(eog_prefix, get_option('libdir'))
+eog_libexecdir = join_paths(eog_prefix, get_option('libexecdir'))
+eog_localedir = join_paths(eog_prefix, get_option('localedir'))
+
+eog_pkgdatadir = join_paths(eog_datadir, meson.project_name())
+eog_pkglibdir = join_paths(eog_libdir, meson.project_name())
+eog_pkglibexecdir = join_paths(eog_libexecdir, meson.project_name())
+eog_pluginsdir = join_paths(eog_pkglibdir, 'plugins')
+
+eog_schemadir = join_paths(eog_datadir, 'glib-2.0', 'schemas')
+
+eog_buildtype = get_option('buildtype')
+
+cc = meson.get_compiler('c')
+
+config_h = configuration_data()
+
+# package
+config_h.set_quoted('PACKAGE', meson.project_name())
+config_h.set_quoted('PACKAGE_BUGREPORT', 'http://bugzilla.gnome.org/enter_bug.cgi?product=eog')
+config_h.set_quoted('PACKAGE_NAME', meson.project_name())
+config_h.set_quoted('PACKAGE_STRING', '@0@ @1@'.format(meson.project_name(), eog_version))
+config_h.set_quoted('PACKAGE_TARNAME', meson.project_name())
+config_h.set_quoted('PACKAGE_URL', 'https://wiki.gnome.org/Apps/EyeOfGnome')
+config_h.set_quoted('PACKAGE_VERSION', eog_version)
+config_h.set_quoted('VERSION', eog_version)
+
+config_h.set('EOG_MAJOR_VERSION', eog_major_version)
+config_h.set('EOG_MINOR_VERSION', eog_minor_version)
+config_h.set('EOG_MICRO_VERSION', eog_micro_version)
+
+# debug options
+config_h.set('GNOME_ENABLE_DEBUG', eog_buildtype != 'release',
+             description: 'Define if debugging is enabled')
+config_h.set('NDEBUG', get_option('buildtype') == 'release')
+
+# translation options
+config_h.set_quoted('GETTEXT_PACKAGE', meson.project_name())
+
+config_h.set('HAVE_DCGETTEXT', cc.has_function('dcgettext'))
+config_h.set('HAVE_GETTEXT', cc.has_function('gettext'))
+config_h.set('HAVE_ICONV', cc.has_function('iconv'))
+
+# 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
+config_h.set('HAVE_DLFCN_H', cc.has_header('dlfcn.h'))
+config_h.set('HAVE_INTTYPES_H', cc.has_header('inttypes.h'))
+config_h.set('HAVE_MEMORY_H', cc.has_header('memory.h'))
+config_h.set('HAVE_STDINT_H', cc.has_header('stdint.h'))
+config_h.set('HAVE_STDLIB_H', cc.has_header('stdlib.h'))
+config_h.set('HAVE_STRINGS_H', cc.has_header('strings.h'))
+config_h.set('HAVE_STRING_H', cc.has_header('string.h'))
+config_h.set('HAVE_SYS_STAT_H', cc.has_header('sys/stat.h'))
+config_h.set('HAVE_SYS_TYPES_H', cc.has_header('sys/types.h'))
+config_h.set('HAVE_UNISTD_H', cc.has_header('unistd.h'))
+
+# functions
+if host_machine.system().contains('darwin')
+  config_h.set('HAVE_CFLOCALECOPYCURRENT', cc.has_function('CFLocaleCopyCurrent'))
+  config_h.set('HAVE_CFPREFERENCESCOPYAPPVALUE', cc.has_function('CFPreferencesCopyAppValue'))
+endif
+
+config_h.set('HAVE_STRPTIME', cc.has_function('strptime'))
+
+# compiler flags
+common_flags = ['-DHAVE_CONFIG_H']
+
+test_cflags = []
+if eog_buildtype == 'debug' or eog_buildtype == 'debugoptimized'
+  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'
+  ]
+
+  foreach cflag: test_cflags
+    if cc.has_argument(cflag)
+      common_flags += [cflag]
+    endif
+  endforeach
+endif
+
+add_project_arguments(common_flags, language: 'c')
+
+glib_req_version = '>= 2.42.0'
+peas_req_version = '>= 0.7.4'
+
+eog_deps = [
+  dependency('gtk+-3.0', version: '>= 3.22.0'),
+  dependency('glib-2.0', version: glib_req_version),
+  dependency('gio-2.0', version: glib_req_version),
+  dependency('gio-unix-2.0', version: glib_req_version),
+  dependency('gnome-desktop-3.0', version: '>= 2.91.2'),
+  dependency('gdk-pixbuf-2.0', version: '>= 2.30.0'),
+  dependency('gtk+-unix-print-3.0', version: '>= 3.5.4'),
+  dependency('shared-mime-info', version: '>= 0.20'),
+  dependency('gsettings-desktop-schemas', version: '>= 2.91.92'),
+  dependency('libpeas-1.0', version: peas_req_version),
+  dependency('libpeas-gtk-1.0', version: peas_req_version)
+]
+
+# ZLIB support (required)
+have_zlib = false
+if cc.has_header('zlib.h')
+  config_h.set('HAVE_ZLIB_H', true)
+  zlib_dep = cc.find_library('z', required: false)
+  if zlib_dep.found() and (cc.has_function('inflate', dependencies: zlib_dep) or cc.has_function('crc32', 
dependencies: zlib_dep))
+    have_zlib = true
+    config_h.set('HAVE_LIBZ', true)
+    eog_deps += zlib_dep
+  endif
+endif
+
+assert(have_zlib, 'No sufficient zlib library found on your system')
+
+# EXIF (optional)
+have_exif = false
+if get_option('enable-libexif')
+  libexif_dep = dependency('libexif', version: '>= 0.6.14', required: false)
+  if libexif_dep.found() and cc.has_header('libexif/exif-data.h', dependencies: libexif_dep)
+    have_exif = true
+    config_h.set('HAVE_EXIF', 1,
+                 description: 'EXIF Support.')
+    eog_deps += libexif_dep
+  endif
+endif
+
+# Little CMS (optional)
+have_lcms = false
+if get_option('enable-cms')
+  libcms_dep = dependency('lcms2', required: false)
+  if libcms_dep.found()
+    have_lcms = true
+    config_h.set('HAVE_LCMS', 1,
+                 description: 'Little CMS Support.')
+    eog_deps += libcms_dep
+  endif
+endif
+
+# Exempi (optional)
+have_exempi = false
+if get_option('enable-xmp')
+  libexempi_dep = dependency('exempi-2.0', version: '>= 1.99.5', required: false)
+  if libexempi_dep.found()
+    have_exempi = true
+    config_h.set('HAVE_EXEMPI', 1,
+                 description: 'XMP Support.')
+    eog_deps += libexempi_dep
+  endif
+endif
+
+jpeg_deps = []
+
+# Jpeg (semi-optional)
+have_jpeg = false
+have_jpeg_80 = false
+
+libjpeg_option = get_option('enable-libjpeg')
+if libjpeg_option
+  libjpeg_dep = dependency('libjpeg', required: false)
+  if libjpeg_dep.found()
+    if cc.has_function('jpeg_destroy_decompress', dependencies: libjpeg_dep) and cc.has_header('jpeglib.h', 
dependencies: libjpeg_dep)
+      have_jpeg = true
+      config_h.set('HAVE_JPEG', 1,
+                   description: 'Jpeg Support.')
+      config_h.set('HAVE_LIBJPEG', true,
+                   description: 'libjpeg is Present.')
+      jpeg_deps += libjpeg_dep
+
+      if cc.has_function('jpeg_simple_progression', dependencies: libjpeg_dep)
+        config_h.set('HAVE_PROGRESSIVE_JPEG', true,
+                     description: 'Jpeg Progressive Saving Support.')
+      else
+        message('JPEG library does not support progressive saving.')
+      endif
+
+      message('Checking libjpeg version is 8 or greater')
+      jpeg_80_check_src = '''
+        #include <stdio.h>
+        #include <jpeglib.h>
+        #if JPEG_LIB_VERSION < 80
+        #error "wrong version"
+        #endif
+      '''
+      have_jpeg_80 = cc.compiles(jpeg_80_check_src, dependencies: libjpeg_dep)
+    else
+      error_msg = '*** JPEG loader will not be built (JPEG header file not found) ***\n'
+    endif
+  else
+    error_msg = '*** JPEG loader will not be built (JPEG library not found) ***\n'
+  endif
+
+  if not have_jpeg
+    error_msg += '*** You can build without it by passing --without-libjpeg to\n'
+    error_msg += '*** configure but some programs using GTK+ may not work properly\n'
+    error(error_msg)
+  endif
+endif
+
+# introspection support
+have_gir = false
+if get_option('enable-introspection')
+  gir_dep = dependency('gobject-introspection-1.0', version: '>= 0.6.7', required: false)
+  if gir_dep.found()
+    have_gir = true
+    config_h.set('HAVE_INTROSPECTION', true)
+    eog_deps += gir_dep
+  endif
+endif
+
+# RSVG (optional for scaling svg image)
+have_rsvg = false
+if get_option('enable-librsvg')
+  librsvg_dep = dependency('librsvg-2.0', version: '>= 2.36.2', required: false)
+  if librsvg_dep.found()
+    have_rsvg = true
+    config_h.set('HAVE_RSVG', true,
+                 description: 'RSVG Support.')
+    eog_deps += librsvg_dep
+  endif
+endif
+
+# libX11 (required for TotemScrSaver and Color Profiling)
+have_x11 = false
+
+gdk_dep = dependency('gdk-3.0', required: false)
+if have_lcms or (gdk_dep.found() and gdk_dep.get_pkgconfig_variable('targets').contains('x11'))
+  libx11_dep = dependency('x11', required: false)
+  assert(libx11_dep.found(), 'X development libraries (libX11) not found')
+  have_x11 = true
+  eog_deps += libx11_dep
+endif
+
+configure_file(
+  output: 'config.h',
+  configuration: config_h
+)
+
+gnome = import('gnome')
+i18n = import('i18n')
+pkg = import('pkgconfig')
+
+po_dir = join_paths(meson.source_root(), 'po')
+
+top_inc = include_directories('.')
+
+subdir('data')
+
+if have_jpeg
+  subdir('jpegutils')
+endif
+
+subdir('src')
+subdir('plugins')
+subdir('help')
+
+if get_option('enable-gtk-doc')
+  subdir('doc/reference')
+endif
+
+subdir('po')
+
+if get_option('enable-installed-tests')
+  subdir('tests')
+endif
+
+meson.add_install_script('meson_post_install.py')
+
+output = 'Configure summary:\n\n'
+output += '  Source code location .......:  ' + meson.source_root() + '\n'
+output += '  Compiler ...................:  ' + cc.get_id() + '\n'
+output += '  Extra Compiler Warnings ....:  ' + ' '.join(test_cflags) + '\n'
+output += '  EXIF support ...............:  ' + have_exif.to_string() + '\n'
+output += '  XMP support ................:  ' + have_exempi.to_string() + '\n'
+output += '  JPEG support ...............:  ' + have_jpeg.to_string() + '\n'
+output += '  Colour management support ..:  ' + have_lcms.to_string() + '\n'
+output += '  GObject Introspection.......:  ' + have_gir.to_string() + '\n'
+message(output)
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..8ffd0b9
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,8 @@
+option('enable-libexif', type: 'boolean', value: true, description: 'enable EXIF support')
+option('enable-cms', type: 'boolean', value: true, description: 'enable colour management support')
+option('enable-xmp', type: 'boolean', value: true, description: 'enable special XMP support')
+option('enable-libjpeg', type: 'boolean', value: true, description: 'enable special JPEG support')
+option('enable-librsvg', type: 'boolean', value: true, description: 'enable RSVG support')
+option('enable-gtk-doc', type: 'boolean', value: false, description: 'use gtk-doc to build documentation')
+option('enable-introspection', type: 'boolean', value: true, description: 'Enable GObject Introspection 
(depends on GObject)')
+option('enable-installed-tests', type: 'boolean', value: false, description: 'enable installed unit tests')
diff --git a/meson_post_install.py b/meson_post_install.py
new file mode 100644
index 0000000..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/plugins/meson.build b/plugins/meson.build
new file mode 100644
index 0000000..c54ca8a
--- /dev/null
+++ b/plugins/meson.build
@@ -0,0 +1,34 @@
+msgfmt = find_program('msgfmt')
+
+plugins = [
+  'fullscreen',
+  'reload'
+]
+
+if have_exif
+  plugins += 'statusbar-date'
+endif
+
+foreach plugin: plugins
+  shared_module(
+    plugin,
+    sources: '@0@/eog-@0@-plugin.c'.format(plugin),
+    include_directories: top_inc,
+    dependencies: libeog_dep,
+    install: true,
+    install_dir: eog_pluginsdir
+  )
+
+  plugin_data = plugin + '.plugin'
+
+  # FIXME: Move custom_target to i18n.merge_file when gettext acquires plugin support.
+  #        http://lists.gnu.org/archive/html/bug-gettext/2017-06/msg00001.html
+  custom_target(
+    plugin_data,
+    input: '@0@/@1  desktop in'.format(plugin, plugin_data),
+    output: plugin_data,
+    command: [msgfmt, '--desktop', '--keyword=Name', '--keyword=Description', '--template', '@INPUT@', '-d', 
po_dir, '-o', '@OUTPUT@'],
+    install: true,
+    install_dir: eog_pluginsdir
+  )
+endforeach
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..e9b77d7
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext(meson.project_name(), preset: 'glib')
diff --git a/src/eog.map b/src/eog.map
new file mode 100644
index 0000000..903bf1f
--- /dev/null
+++ b/src/eog.map
@@ -0,0 +1,6 @@
+LIBEOG_3 {
+global:
+  eog_*;
+local:
+       *;
+};
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..56cacb1
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,234 @@
+src_inc = include_directories('.')
+
+enum_headers = files(
+  'eog-scroll-view.h',
+  'eog-window.h'
+)
+
+gnome.mkenums(
+  'org.gnome.eog.enums.xml',
+  sources: enum_headers,
+  comments: '<!-- @comment@ -->',
+  fhead: '<schemalist>',
+  vhead: '  <@type@ id="org.gnome.eog.@EnumName@">',
+  vprod: '    <value nick="@valuenick@" value="@valuenum@"/>',
+  vtail: '  </@type@>',
+  ftail: '</schemalist>',
+  install_header: true,
+  install_dir: eog_schemadir
+)
+
+headers = enum_headers + files(
+  'eog-application.h',
+  'eog-application-activatable.h',
+  'eog-clipboard-handler.h',
+  'eog-debug.h',
+  'eog-enums.h',
+  'eog-file-chooser.h',
+  'eog-image.h',
+  'eog-image-save-info.h',
+  'eog-job-scheduler.h',
+  'eog-jobs.h',
+  'eog-list-store.h',
+  'eog-properties-dialog.h',
+  'eog-sidebar.h',
+  'eog-statusbar.h',
+  'eog-thumbnail.h',
+  'eog-thumb-nav.h',
+  'eog-thumb-view.h',
+  'eog-transform.h',
+  'eog-uri-converter.h',
+  'eog-window-activatable.h'
+)
+
+sources = files(
+  'eog-application.c',
+  'eog-application-activatable.c',
+  'eog-clipboard-handler.c',
+  'eog-close-confirmation-dialog.c',
+  'eog-debug.c',
+  'eog-error-message-area.c',
+  'eog-file-chooser.c',
+  'eog-image.c',
+  'eog-image-jpeg.c',
+  'eog-image-save-info.c',
+  'eog-job-scheduler.c',
+  'eog-jobs.c',
+  'eog-list-store.c',
+  'eog-metadata-sidebar.c',
+  'eog-metadata-reader.c',
+  'eog-metadata-reader-jpg.c',
+  'eog-metadata-reader-png.c',
+  'eog-pixbuf-util.c',
+  'eog-plugin-engine.c',
+  'eog-preferences-dialog.c',
+  'eog-print.c',
+  'eog-print-image-setup.c',
+  'eog-print-preview.c',
+  'eog-properties-dialog.c',
+  'eog-save-as-dialog-helper.c',
+  'eog-scroll-view.c',
+  'eog-session.c',
+  'eog-sidebar.c',
+  'eog-statusbar.c',
+  'eog-thumbnail.c',
+  'eog-thumb-nav.c',
+  'eog-thumb-view.c',
+  'eog-transform.c',
+  'eog-uri-converter.c',
+  'eog-util.c',
+  'eog-window-activatable.c',
+  'eog-window.c',
+  'eog-zoom-entry.c',
+  'zoom.c'
+)
+
+if have_exif
+  headers += files(
+    'eog-exif-util.h'
+  )
+
+  sources += files(
+    'eog-exif-util.c'
+  )
+endif
+
+if have_exif or have_exempi
+  sources += files(
+    'eog-metadata-details.c'
+  )
+endif
+
+install_headers(
+  headers,
+  subdir: join_paths(eog_api_name, meson.project_name())
+)
+
+sources += gnome.compile_resources(
+  'eog-resources',
+  'eog.gresource.xml',
+  source_dir: join_paths(meson.source_root(), 'data'),
+  c_name: '_eog',
+  dependencies: resource_files,
+  export: true
+)
+
+enum = 'eog-enum-types'
+
+sources += gnome.mkenums(
+  enum,
+  sources: headers,
+  c_template: enum + '.c.template',
+  h_template: enum + '.h.template'
+)
+
+sources += gnome.genmarshal(
+  'eog-marshal',
+  sources: 'eog-marshal.list',
+  prefix: 'eog_marshal'
+)
+
+libeog_deps = eog_deps + jpeg_deps + [
+  cc.find_library('m')
+]
+
+libeog_cflags = [
+  '-DG_LOG_DOMAIN="@0@"'.format(meson.project_name().to_upper()),
+  '-DEOG_PREFIX="@0@"'.format(eog_prefix),
+  '-DEOG_DATA_DIR="@0@"'.format(eog_datadir),
+  '-DEOG_LOCALE_DIR="@0@"'.format(eog_localedir),
+  '-DEOG_PLUGIN_DIR="@0@"'.format(eog_pluginsdir),
+  '-DLIBDIR="@0@"'.format(eog_libdir)
+]
+
+symbol_map = 'eog.map'
+
+ldflags = [
+  '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), symbol_map)
+]
+
+libeog_ldflags = []
+
+if host_machine.system().contains('linux')
+  foreach ldflag: ldflags
+    if cc.has_argument(ldflag)
+      libeog_ldflags += ldflag
+    endif
+  endforeach
+endif
+
+libeog = shared_library(
+  meson.project_name(),
+  sources: sources,
+  include_directories: top_inc,
+  dependencies: libeog_deps,
+  c_args: libeog_cflags,
+  link_args: libeog_ldflags,
+  link_depends: symbol_map,
+  install: true,
+  install_dir: eog_pkglibdir
+)
+
+libeog_dep = declare_dependency(
+  link_with: libeog,
+  include_directories: src_inc,
+  dependencies: eog_deps
+)
+
+pkg.generate(
+  libraries: libeog,
+  version: eog_version,
+  name: 'Eye of GNOME',
+  description: 'The GNOME Image Viewer',
+  filebase: meson.project_name(),
+  subdirs: eog_api_name,
+  requires: 'gtk+-3.0',
+  variables: [
+    'exec_prefix=${prefix}',
+    'pluginsdir=' + eog_pluginsdir
+  ],
+  install_dir: join_paths(eog_libdir, 'pkgconfig')
+)
+
+eog_cflags = [
+  '-DEOG_DATA_DIR="@0@"'.format(eog_datadir),
+  '-DEOG_LOCALE_DIR="@0@"'.format(eog_localedir)
+]
+
+eog = executable(
+  meson.project_name(),
+  'main.c',
+  include_directories: top_inc,
+  dependencies: libeog_dep,
+  c_args: eog_cflags,
+  install: true,
+  install_dir: eog_bindir
+)
+
+if have_gir
+  gir_sources = sources + headers
+
+  gir_incs = [
+    'Gtk-3.0'
+  ]
+
+  gir_extra_args = [
+    '--warn-all'
+  ]
+
+  gir_dir = join_paths(eog_pkgdatadir, 'gir-' + eog_gir_version)
+  typelib_dir = join_paths(eog_pkglibdir, 'girepository-' + eog_gir_version)
+
+  gnome.generate_gir(
+    eog,
+    sources: gir_sources,
+    nsversion: eog_api_version,
+    namespace: eog_gir_ns,
+    includes: gir_incs,
+    dependencies: libeog_dep,
+    install: true,
+    install_dir_gir: gir_dir,
+    install_dir_typelib: typelib_dir,
+    extra_args: gir_extra_args
+  )
+endif
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..ba4f51e
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,44 @@
+tests_exec_dir = join_paths(eog_pkglibexecdir, 'installed-tests')
+
+tests_files = files(
+  'actions.feature',
+  'common_steps.py',
+  'environment.py',
+  'gnome-logo.png',
+  'screenshot_tour.feature'
+)
+
+install_data(
+  tests_files,
+  install_dir: tests_exec_dir
+)
+
+install_subdir(
+  'steps',
+  install_dir: tests_exec_dir
+)
+
+tests = [
+  'about',
+  'undo',
+  'sidepane',
+  'fullscreen',
+  'wallpaper',
+  'screenshot_tour1',
+  'screenshot_tour2'
+]
+
+foreach test: tests
+  tests_conf = configuration_data()
+  tests_conf.set('TESTS_PATH', tests_exec_dir)
+  tests_conf.set('TEST_NAME', test)
+  tests_conf.set('TEST_TYPE', 'session-exclusive')
+
+  configure_file(
+    input: 'tests.in',
+    output: test + '.test',
+    install: true,
+    install_dir: join_paths(eog_datadir, 'installed-tests', meson.project_name()),
+    configuration: tests_conf
+  )
+endforeach
diff --git a/tests/tests.in b/tests/tests.in
new file mode 100644
index 0000000..4481757
--- /dev/null
+++ b/tests/tests.in
@@ -0,0 +1,3 @@
+[Test]
+Exec=behave @TESTS_PATH@ -t @TEST_NAME@ -k -f html -o @TEST_NAME@.html -f plain
+Type=@TEST_TYPE@


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