[gnome-todo] project: Port to meson build system



commit 8d71b495daa8b851be54fc300b1ab94114443275
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Fri Apr 28 18:19:56 2017 +0200

    project: Port to meson build system
    
    https://bugzilla.gnome.org/show_bug.cgi?id=781908

 configure_meson                         |  199 ++++++++++++++++++++++
 data/appdata/meson.build                |   10 +
 data/icons/meson.build                  |   22 +++
 data/icons/meson_post_install.py        |   10 +
 data/meson.build                        |   82 +++++++++
 data/meson_post_install.py              |   10 +
 doc/meson.build                         |    1 +
 doc/reference/meson.build               |   84 +++++++++
 doc/reference/xml/gtkdocentities.ent.in |    8 +
 doc/reference/xml/meson.build           |    7 +
 meson.build                             |  167 ++++++++++++++++++
 meson_options.txt                       |   11 ++
 plugins/background/meson.build          |   27 +++
 plugins/dark-theme/meson.build          |   19 ++
 plugins/eds/meson.build                 |   27 +++
 plugins/meson.build                     |   36 ++++
 plugins/scheduled-panel/meson.build     |   21 +++
 plugins/score/meson.build               |   16 ++
 plugins/today-panel/meson.build         |   21 +++
 plugins/todo-txt/meson.build            |   31 ++++
 plugins/unscheduled-panel/meson.build   |   16 ++
 po/meson.build                          |    1 +
 src/meson.build                         |  283 +++++++++++++++++++++++++++++++
 23 files changed, 1109 insertions(+), 0 deletions(-)
---
diff --git a/configure_meson b/configure_meson
new file mode 100755
index 0000000..dc0b488
--- /dev/null
+++ b/configure_meson
@@ -0,0 +1,199 @@
+#!/bin/bash
+# configure script adapter for Meson
+# Based on build-api: https://github.com/cgwalters/build-api
+# Copyright 2010, 2011, 2013 Colin Walters <walters verbum org>
+# Copyright 2016, 2017 Emmanuele Bassi
+# Copyright 2017 Iñigo Martínez <inigomartinez gmail com>
+# Licensed under the new-BSD license (http://www.opensource.org/licenses/bsd-license.php)
+
+# Build API variables:
+
+# Little helper function for reading args from the commandline.
+# it automatically handles -a b and -a=b variants, and returns 1 if
+# we need to shift $3.
+read_arg() {
+    # $1 = arg name
+    # $2 = arg value
+    # $3 = arg parameter
+    local rematch='^[^=]*=(.*)$'
+    if [[ $2 =~ $rematch ]]; then
+        read "$1" <<< "${BASH_REMATCH[1]}"
+    else
+        read "$1" <<< "$3"
+        # There is no way to shift our callers args, so
+        # return 1 to indicate they should do it instead.
+        return 1
+    fi
+}
+
+sanitycheck() {
+    # $1 = arg name
+    # $1 = arg command
+    # $2 = arg alternates
+    local cmd=$( which $2 2>/dev/null )
+
+    if [ -x "$cmd" ]; then
+        read "$1" <<< "$cmd"
+        return 0
+    fi
+
+    test -z $3 || {
+        for alt in $3; do
+            cmd=$( which $alt 2>/dev/null )
+
+            if [ -x "$cmd" ]; then
+                read "$1" <<< "$cmd"
+                return 0
+            fi
+        done
+    }
+
+    echo -e "\e[1;31mERROR\e[0m: Command '$2' not found"
+    exit 1
+}
+
+checkoption() {
+    # $1 = arg
+    option="${1#*--}"
+    action="${option%%-*}"
+    name="${option#*-}"
+    if [ ${default_options[$name]+_} ]; then
+        case "$action" in
+            enable) meson_options[$name]=true;;
+            disable) meson_options[$name]=false;;
+            *) echo -e "\e[1;33mINFO\e[0m: Ignoring unknown action '$action'";;
+        esac
+    else
+        echo -e "\e[1;33mINFO\e[0m: Ignoring unknown option '$option'"
+    fi
+}
+
+echooption() {
+    # $1 = option
+    if [ ${meson_options[$1]+_} ]; then
+        echo ${meson_options[$1]}
+    elif [ ${default_options[$1]+_} ]; then
+        echo ${default_options[$1]}
+    fi
+}
+
+sanitycheck MESON 'meson'
+sanitycheck MESONTEST 'mesontest'
+sanitycheck NINJA 'ninja' 'ninja-build'
+
+declare -A default_options=(
+    ['nls']=true
+    ['gtk-doc']=false
+    ['dark-theme-plugin']=true
+    ['background-plugin']=true
+    ['scheduled-panel-plugin']=true
+    ['score-plugin']=true
+    ['today-panel-plugin']=true
+    ['unscheduled-panel-plugin']=true
+    ['todo-txt-plugin']=true
+    ['introspection']=true
+)
+
+declare -A meson_options
+
+while (($# > 0)); do
+    case "${1%%=*}" in
+        --prefix) read_arg prefix "$@" || shift;;
+        --bindir) read_arg bindir "$@" || shift;;
+        --sbindir) read_arg sbindir "$@" || shift;;
+        --libexecdir) read_arg libexecdir "$@" || shift;;
+        --datarootdir) read_arg datarootdir "$@" || shift;;
+        --datadir) read_arg datadir "$@" || shift;;
+        --sysconfdir) read_arg sysconfdir "$@" || shift;;
+        --libdir) read_arg libdir "$@" || shift;;
+        --mandir) read_arg mandir "$@" || shift;;
+        --includedir) read_arg includedir "$@" || shift;;
+        *) checkoption $1;;
+    esac
+    shift
+done
+
+# Defaults
+test -z ${prefix} && prefix="/usr/local"
+test -z ${bindir} && bindir=${prefix}/bin
+test -z ${sbindir} && sbindir=${prefix}/sbin
+test -z ${libexecdir} && libexecdir=${prefix}/bin
+test -z ${datarootdir} && datarootdir=${prefix}/share
+test -z ${datadir} && datadir=${datarootdir}
+test -z ${sysconfdir} && sysconfdir=${prefix}/etc
+test -z ${libdir} && libdir=${prefix}/lib
+test -z ${mandir} && mandir=${prefix}/share/man
+test -z ${includedir} && includedir=${prefix}/include
+
+# The source directory is the location of this file
+srcdir=$(dirname $0)
+
+# The build directory is the current location
+builddir=`pwd`
+
+# If we're calling this file from the source directory then
+# we automatically create a build directory and ensure that
+# both Meson and Ninja invocations are relative to that
+# location
+if [[ -f "${builddir}/meson.build" ]]; then
+    mkdir -p _build
+    builddir="${builddir}/_build"
+    NINJA_OPT="-C ${builddir}"
+fi
+
+# Wrapper Makefile for Ninja
+cat > Makefile <<END
+# Generated by configure; do not edit
+
+all:
+       CC="\$(CC)" CXX="\$(CXX)" ${NINJA} ${NINJA_OPT}
+
+install:
+       DESTDIR="\$(DESTDIR)" ${NINJA} ${NINJA_OPT} install
+
+check:
+       ${MESONTEST} ${NINJA_OPT}
+END
+
+echo "
+
+        gnome-todo
+        ==========
+
+        meson:         ${MESON}
+        ninja:         ${NINJA}
+        prefix:        ${prefix}
+        compiler:      ${CC}
+        global flags:  ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
+        nls:           $(echooption nls)
+        documentation: $(echooption gtk-doc)
+
+    Plugins:
+        Dark theme .............. $(echooption dark-theme-plugin)
+        Run in Background ....... $(echooption background-plugin)
+        Scheduled panel ......... $(echooption scheduled-panel-plugin)
+        Score ................... $(echooption score-plugin)
+        Today panel ............. $(echooption today-panel-plugin)
+        Unscheduled panel ....... $(echooption unscheduled-panel-plugin)
+        Todo.txt ................ $(echooption todo-txt-plugin)
+
+        Now type '${NINJA} -C ${builddir}' to build
+"
+
+cmd_options=""
+for key in "${!meson_options[@]}"; do
+    cmd_options="$cmd_options -Denable-$key=${meson_options[$key]}"
+done
+
+exec ${MESON} \
+    --prefix=${prefix} \
+    --libdir=${libdir} \
+    --libexecdir=${libexecdir} \
+    --datadir=${datadir} \
+    --sysconfdir=${sysconfdir} \
+    --bindir=${bindir} \
+    --includedir=${includedir} \
+    --mandir=${mandir} \
+    ${cmd_options} \
+    ${builddir} \
+    ${srcdir}
diff --git a/data/appdata/meson.build b/data/appdata/meson.build
new file mode 100644
index 0000000..1cebb8b
--- /dev/null
+++ b/data/appdata/meson.build
@@ -0,0 +1,10 @@
+appdata = 'org.gnome.Todo.appdata.xml'
+
+custom_target(
+  appdata,
+  input: '@0@.in'.format(appdata),
+  output: appdata,
+  command: [msgfmt, '--xml', '--template', '@INPUT@', '-d', po_dir, '-o', '@OUTPUT@'],
+  install: true,
+  install_dir: join_paths(gnome_todo_datadir, 'appdata')
+)
diff --git a/data/icons/meson.build b/data/icons/meson.build
new file mode 100644
index 0000000..0175733
--- /dev/null
+++ b/data/icons/meson.build
@@ -0,0 +1,22 @@
+icon_sizes = [
+  '16x16',
+  '22x22',
+  '32x32',
+  '48x48',
+  '256x256',
+  '512x512'
+]
+
+foreach icon_size: icon_sizes
+  install_data(
+    join_paths('hicolor', icon_size, 'apps', 'org.gnome.Todo.png'),
+    install_dir: join_paths(gnome_todo_datadir, 'icons', 'hicolor', icon_size, 'apps')
+  )
+endforeach
+
+install_data(
+  join_paths('hicolor', 'symbolic', 'apps', 'org.gnome.Todo-symbolic.svg'),
+  install_dir: join_paths(gnome_todo_datadir, 'icons', 'hicolor', 'symbolic', 'apps')
+)
+
+meson.add_install_script('meson_post_install.py')
diff --git a/data/icons/meson_post_install.py b/data/icons/meson_post_install.py
new file mode 100644
index 0000000..b363ab5
--- /dev/null
+++ b/data/icons/meson_post_install.py
@@ -0,0 +1,10 @@
+#!/usr/bin/env python3
+
+import os
+import subprocess
+
+icondir = os.path.join(os.environ['MESON_INSTALL_PREFIX'], 'share', 'icons', 'hicolor')
+
+if not os.environ.get('DESTDIR'):
+  print('Update icon cache...')
+  subprocess.call(['gtk-update-icon-cache', '-f', '-t', icondir])
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..3b85504
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,82 @@
+# gnome.pc.in options
+pc_conf = configuration_data()
+pc_conf.set('prefix', gnome_todo_prefix)
+pc_conf.set('includedir', gnome_todo_includedir)
+pc_conf.set('VERSION', gnome_todo_version)
+
+pc = 'gnome-todo.pc'
+
+configure_file(
+  input: '@0@.in'.format(pc),
+  output: pc,
+  install: true,
+  install_dir: join_paths(gnome_todo_libdir, 'pkgconfig'),
+  configuration: pc_conf
+)
+
+msgfmt = find_program('msgfmt')
+
+po_dir = join_paths(meson.source_root(), 'po')
+
+desktop = 'org.gnome.Todo.desktop'
+
+custom_target(
+  desktop,
+  input: '@0@.in'.format(desktop),
+  output: desktop,
+  command: [msgfmt, '--desktop', '--template', '@INPUT@', '-d', po_dir, '-o', '@OUTPUT@'],
+  install: true,
+  install_dir: join_paths(gnome_todo_datadir, 'applications')
+)
+
+autostart = 'org.gnome.Todo.Autostart.desktop'
+
+custom_target(
+  autostart,
+  input: '@0@.in'.format(autostart),
+  output: autostart,
+  command: [msgfmt, '--desktop', '--template', '@INPUT@', '-d', po_dir, '-o', '@OUTPUT@'],
+  install: true,
+  install_dir: gnome_todo_pkgdatadir
+)
+
+service_conf = configuration_data()
+service_conf.set('bindir', gnome_todo_bindir)
+
+service = 'org.gnome.Todo.service'
+
+configure_file(
+  input: '@0@.in'.format(service),
+  output: service,
+  install: true,
+  install_dir: join_paths(gnome_todo_datadir, 'dbus-1', 'services'),
+  configuration: service_conf
+)
+
+enums = 'org.gnome.todo.enums.xml'
+
+custom_target(
+  enums,
+  input: join_paths(meson.source_root(), 'src', 'gtd-enums.h'),
+  output: enums,
+  command: [find_program('glib-mkenums'),
+            '--comments', '<!-- @comment@ -->',
+            '--fhead', '<schemalist>',
+            '--vhead', '  <@type@ id="org.gnome.todo.@EnumName@">',
+            '--vprod', '    <value nick="@valuenick@" value="@valuenum@"/>',
+            '--vtail', '  </@type@>',
+            '--ftail', '</schemalist>',
+            '--output', '@OUTPUT@',
+            '@INPUT@'],
+  install: true,
+  install_dir: gnome_todo_schemadir
+)
+
+install_data(
+  'org.gnome.todo.gschema.xml',
+  install_dir: gnome_todo_schemadir
+)
+meson.add_install_script('meson_post_install.py')
+
+subdir('appdata')
+subdir('icons')
diff --git a/data/meson_post_install.py b/data/meson_post_install.py
new file mode 100644
index 0000000..ee5bd7b
--- /dev/null
+++ b/data/meson_post_install.py
@@ -0,0 +1,10 @@
+#!/usr/bin/env python3
+
+import os
+import subprocess
+
+schemadir = os.path.join(os.environ['MESON_INSTALL_PREFIX'], 'share', 'glib-2.0', 'schemas')
+
+if not os.environ.get('DESTDIR'):
+  print('Compiling gsettings schemas...')
+  subprocess.call(['glib-compile-schemas', schemadir])
diff --git a/doc/meson.build b/doc/meson.build
new file mode 100644
index 0000000..ead14c4
--- /dev/null
+++ b/doc/meson.build
@@ -0,0 +1 @@
+subdir('reference')
diff --git a/doc/reference/meson.build b/doc/reference/meson.build
new file mode 100644
index 0000000..2293ccd
--- /dev/null
+++ b/doc/reference/meson.build
@@ -0,0 +1,84 @@
+subdir('xml')
+
+private_headers = [
+  'gtd-application.h',
+  'gtd-arrow-frame.h',
+  'gtd-dnd-row.h',
+  'gtd-edit-pane.h',
+  'gtd-empty-list-widget.h',
+  'gtd-enum-types.h',
+  'gtd-initial-setup-window.h',
+  'gtd-list-selector.h',
+  'gtd-list-selector-grid.h',
+  'gtd-list-selector-grid-item.h',
+  'gtd-list-selector-item.h',
+  'gtd-list-selector-list.h',
+  'gtd-list-selector-list-item.h',
+  'gtd-list-selector-panel.h',
+  'gtd-manager-protected.h',
+  'gtd-notification-widget.h',
+  'gtd-plugin-dialog.h',
+  'gtd-plugin-dialog-row.h',
+  'gtd-plugin-manager.h',
+  'gtd-provider-dialog.h',
+  'gtd-provider-popover.h',
+  'gtd-provider-row.h',
+  'gtd-provider-selector.h',
+  'gtd-resources.h',
+  'gtd-task-row.h',
+  'gtd-types.h'
+]
+
+html_images = [
+  join_paths('images', 'notification.png')
+]
+
+version_conf = configuration_data()
+version_conf.set('VERSION', gnome_todo_version)
+
+version = 'version.xml'
+
+version_xml = configure_file(
+  input: '@0@.in'.format(version),
+  output: version,
+  configuration: version_conf
+)
+
+gtk_prefix = gtk_dep.get_pkgconfig_variable('prefix')
+gtk_doc_path = join_paths(gtk_prefix, 'share', 'gtk-doc', 'html')
+
+glib_prefix = glib_dep.get_pkgconfig_variable('prefix')
+glib_doc_path = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
+
+doc_path = join_paths(gnome_todo_datadir, 'gtk-doc', 'html', meson.project_name())
+
+gnome.gtkdoc(
+  meson.project_name(),
+  main_sgml: '@0 -docs sgml'.format(meson.project_name()),
+  src_dir: [
+    join_paths(meson.source_root(), 'src'),
+    join_paths(meson.build_root(), 'src')
+  ],
+  dependencies: libgtd_dep,
+  scan_args: [
+    '--rebuild-types',
+    '--ignore-headers=' + ' '.join(private_headers),
+  ],
+  mkdb_args: [
+    '--sgml-mode',
+    '--output-format=xml'
+  ],
+  gobject_typesfile: '@0@.types'.format(meson.project_name()),
+  fixxref_args: [
+    '--extra-dir=@0@'.format(join_paths(glib_doc_path, 'glib')),
+    '--extra-dir=@0@'.format(join_paths(glib_doc_path, 'gmodule')),
+    '--extra-dir=@0@'.format(join_paths(glib_doc_path, 'gobject')),
+    '--extra-dir=@0@'.format(join_paths(glib_doc_path, 'gio')),
+    '--extra-dir=@0@'.format(join_paths(gtk_doc_path, 'gdk')),
+    '--extra-dir=@0@'.format(join_paths(gtk_doc_path, 'gtk')),
+    '--extra-dir=@0@'.format(join_paths(gtk_doc_path, 'gtksourceview-3.0')),
+  ],
+  html_assets: html_images,
+  install: true,
+  install_dir: doc_path
+)
diff --git a/doc/reference/xml/gtkdocentities.ent.in b/doc/reference/xml/gtkdocentities.ent.in
new file mode 100644
index 0000000..abc7730
--- /dev/null
+++ b/doc/reference/xml/gtkdocentities.ent.in
@@ -0,0 +1,8 @@
+<!ENTITY package @PACKAGE@>
+<!ENTITY package_bugreport @PACKAGE_BUGREPORT@>
+<!ENTITY package_name @PACKAGE_NAME@>
+<!ENTITY package_string @PACKAGE_STRING@>
+<!ENTITY package_tarname @PACKAGE_TARNAME@>
+<!ENTITY package_url @PACKAGE_URL@>
+<!ENTITY package_version @PACKAGE_VERSION@>
+<!ENTITY package_api_version @PACKAGE_API_VERSION@>
diff --git a/doc/reference/xml/meson.build b/doc/reference/xml/meson.build
new file mode 100644
index 0000000..a7ed06b
--- /dev/null
+++ b/doc/reference/xml/meson.build
@@ -0,0 +1,7 @@
+entities = 'gtkdocentities.ent'
+
+configure_file(
+  input: '@0@.in'.format(entities),
+  output: entities,
+  configuration: conf
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..90b47db
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,167 @@
+project(
+  'gnome-todo', 'c',
+  version: '3.25.1',
+  license: 'GPL3+',
+  default_options: [
+    'buildtype=debugoptimized',
+    'c_std=gnu99',
+    'warning_level=1'
+  ],
+  meson_version: '>= 0.38.1'
+)
+
+gnome_todo_version = meson.project_version()
+version_array = gnome_todo_version.split('.')
+gnome_todo_major_version = version_array[0].to_int()
+gnome_todo_minor_version = version_array[1].to_int()
+gnome_todo_micro_version = version_array[2].to_int()
+
+gnome_todo_gir_ns = 'Gtd'
+gnome_todo_gir_version = '1.0'
+
+gnome_todo_prefix = get_option('prefix')
+gnome_todo_bindir = join_paths(gnome_todo_prefix, get_option('bindir'))
+gnome_todo_libdir = join_paths(gnome_todo_prefix, get_option('libdir'))
+gnome_todo_localedir = join_paths(gnome_todo_prefix, get_option('localedir'))
+gnome_todo_datadir = join_paths(gnome_todo_prefix, get_option('datadir'))
+gnome_todo_includedir = join_paths(gnome_todo_prefix, get_option('includedir'))
+
+gnome_todo_pkglibdir = join_paths(gnome_todo_libdir, meson.project_name())
+gnome_todo_pkgdatadir = join_paths(gnome_todo_datadir, meson.project_name())
+gnome_todo_pkgincludedir = join_paths(gnome_todo_includedir, meson.project_name())
+
+gnome_todo_schemadir = join_paths(gnome_todo_datadir, 'glib-2.0', 'schemas')
+
+cc = meson.get_compiler('c')
+
+conf = configuration_data()
+
+conf.set('ENABLE_NLS', get_option('enable-nls'))
+conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
+
+# debug options
+conf.set('GNOME_TODO_ENABLE_DEBUG', get_option('buildtype') != 'release')
+conf.set('NDEBUG', get_option('buildtype') == 'release')
+
+# package
+conf.set_quoted('PACKAGE', meson.project_name())
+conf.set_quoted('PACKAGE_BUGREPORT', 'https://bugzilla.gnome.org/enter_bug.cgi?product=gnome-todo')
+conf.set_quoted('PACKAGE_NAME', meson.project_name())
+conf.set_quoted('PACKAGE_STRING', '@0@-@1@'.format(meson.project_name(), gnome_todo_version))
+conf.set_quoted('PACKAGE_TARNAME', gnome_todo_version)
+conf.set_quoted('PACKAGE_URL', '')
+conf.set_quoted('PACKAGE_VERSION', gnome_todo_version)
+conf.set_quoted('PACKAGE_API_VERSION', gnome_todo_version)
+conf.set_quoted('VERSION', gnome_todo_version)
+
+# headers
+conf.set('HAVE_DLFCN_H', cc.has_header('dlfcn.h'))
+conf.set('HAVE_INTTYPES_H', cc.has_header('inttypes.h'))
+conf.set('HAVE_MATH_H', cc.has_header('math.h'))
+conf.set('HAVE_MEMORY_H', cc.has_header('memory.h'))
+conf.set('HAVE_STDINT_H', cc.has_header('stdint.h'))
+conf.set('HAVE_STDLIB_H', cc.has_header('stdlib.h'))
+conf.set('HAVE_STRINGS_H', cc.has_header('strings.h'))
+conf.set('HAVE_STRING_H', cc.has_header('string.h'))
+conf.set('HAVE_SYS_STAT_H', cc.has_header('sys/stat.h'))
+conf.set('HAVE_SYS_TYPES_H', cc.has_header('sys/types.h'))
+conf.set('HAVE_UNISTD_H', cc.has_header('unistd.h'))
+
+# functions
+conf.set('HAVE_DCGETTEXT', cc.has_function('dcgettext'))
+conf.set('HAVE_GETTEXT', cc.has_function('gettext'))
+conf.set('HAVE_ICONV', cc.has_function('iconv'))
+
+# Compiler flags
+test_cflags = [
+  '-fno-strict-aliasing',
+  '-Wall',
+  '-Warray-bounds',
+  '-Wcast-align',
+  '-Wdeclaration-after-statement',
+  '-Wextra',
+  '-Wformat-nonliteral',
+  '-Wformat-security',
+  '-Wformat=2',
+  '-Wimplicit-function-declaration',
+  '-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',
+  '-Wpointer-arith',
+  '-Wredundant-decls',
+  '-Wreturn-type',
+  '-Wshadow',
+  '-Wsign-compare',
+  '-Wstrict-aliasing',
+  '-Wstrict-prototypes',
+  '-Wswitch-default',
+  '-Wswitch-enum',
+  '-Wundef',
+  '-Wunused-but-set-variable',
+  '-Wwrite-strings'
+]
+
+common_flags = [
+  '-DHAVE_CONFIG_H'
+]
+
+foreach cflag: test_cflags
+  if cc.has_argument(cflag)
+    common_flags += [cflag]
+  endif
+endforeach
+
+add_global_arguments(common_flags, language: 'c')
+
+glib_dep =  dependency('glib-2.0', version: '>= 2.43.4')
+gtk_dep = dependency('gtk+-3.0', version: '>= 3.22.0')
+
+gnome_todo_dep = [
+  dependency('gmodule-export-2.0'),
+  dependency('gio-2.0', version: '>= 2.43.4'),
+  glib_dep,
+  dependency('goa-1.0', version: '>= 3.2.0'),
+  gtk_dep,
+  dependency('libecal-1.2', version: '>= 3.13.90'),
+  dependency('libedataserver-1.2', version: '>= 3.17.1'),
+  dependency('libedataserverui-1.2', version: '>= 3.17.1'),
+  dependency('libical', version: '>= 0.43'),
+  dependency('libpeas-1.0', version: '>= 1.17'),
+  cc.find_library('m', required: true)
+]
+
+configure_file(
+  output : 'config.h',
+  configuration : conf
+)
+
+gnome = import('gnome')
+pkg = import('pkgconfig')
+
+top_inc = include_directories('.')
+src_inc = include_directories('src')
+
+subdir('plugins')
+subdir('src')
+subdir('data')
+
+if get_option('enable-gtk-doc')
+  subdir('doc')
+endif
+
+if get_option('enable-nls')
+  i18n = import('i18n')
+
+  subdir('po')
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..38cc32d
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,11 @@
+option('enable-nls', type: 'boolean', value: false, description: 'use Native Language Support')
+option('enable-eds-plugin', type: 'boolean', value: true, description: 'enable Evolution-Data-Server plugin')
+option('enable-background-plugin', type: 'boolean', value: true, description: 'enable Run In Background 
plugin')
+option('enable-dark-theme-plugin', type: 'boolean', value: true, description: 'enable Dark theme plugin')
+option('enable-scheduled-panel-plugin', type: 'boolean', value: true, description: 'enable Scheduled Panel 
plugin')
+option('enable-score-plugin', type: 'boolean', value: true, description: 'enable Score plugin')
+option('enable-today-panel-plugin', type: 'boolean', value: true, description: 'enable Today Panel plugin')
+option('enable-unscheduled-panel-plugin', type: 'boolean', value: true, description: 'enable Unscheduled 
Tasks Panel plugin')
+option('enable-todo-txt-plugin', type: 'boolean', value: true, description: 'enable Todo.Txt plugin')
+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)')
diff --git a/plugins/background/meson.build b/plugins/background/meson.build
new file mode 100644
index 0000000..27d754a
--- /dev/null
+++ b/plugins/background/meson.build
@@ -0,0 +1,27 @@
+plugin_name = 'background'
+
+sources = [
+  'gtd-plugin-background.c',
+  'gtd-plugin-background.h'
+]
+
+libbackground_lib = static_library(
+  plugin_name,
+  sources: sources,
+  include_directories: plugins_inc,
+  dependencies: gnome_todo_dep,
+  c_args: common_flags + [
+    '-DPACKAGE_DATA_DIR="@0@"'.format(gnome_todo_pkgdatadir)
+  ]
+)
+
+install_data(
+  'org.gnome.todo.background.gschema.xml',
+  install_dir: gnome_todo_schemadir
+)
+
+plugins_files += configure_file(
+  input: '@0  plugin in'.format(plugin_name),
+  output: '@0@.plugin'.format(plugin_name),
+  configuration: plugins_conf
+)
diff --git a/plugins/dark-theme/meson.build b/plugins/dark-theme/meson.build
new file mode 100644
index 0000000..9fbbc08
--- /dev/null
+++ b/plugins/dark-theme/meson.build
@@ -0,0 +1,19 @@
+plugin_name = 'dark-theme'
+
+sources = [
+  'gtd-plugin-dark-theme.c',
+  'gtd-plugin-dark-theme.h'
+]
+
+libdarktheme_lib = static_library(
+  'darktheme',
+  sources: sources,
+  include_directories: plugins_inc,
+  dependencies: gnome_todo_dep,
+)
+
+plugins_files += configure_file(
+  input: '@0  plugin in'.format(plugin_name),
+  output: '@0@.plugin'.format(plugin_name),
+  configuration: plugins_conf
+)
diff --git a/plugins/eds/meson.build b/plugins/eds/meson.build
new file mode 100644
index 0000000..0428f3a
--- /dev/null
+++ b/plugins/eds/meson.build
@@ -0,0 +1,27 @@
+plugin_name = 'eds'
+
+sources = [
+  'gtd-plugin-eds.c',
+  'gtd-plugin-eds.h',
+  'gtd-provider-eds.c',
+  'gtd-provider-eds.h',
+  'gtd-provider-goa.c',
+  'gtd-provider-goa.h',
+  'gtd-provider-local.c',
+  'gtd-provider-local.h',
+  'gtd-task-list-eds.c',
+  'gtd-task-list-eds.h'
+]
+
+libeds_lib = static_library(
+  plugin_name,
+  sources: sources,
+  include_directories: plugins_inc,
+  dependencies: gnome_todo_dep,
+)
+
+plugins_files += configure_file(
+  input: '@0  plugin in'.format(plugin_name),
+  output: '@0@.plugin'.format(plugin_name),
+  configuration: plugins_conf
+)
diff --git a/plugins/meson.build b/plugins/meson.build
new file mode 100644
index 0000000..09a75b9
--- /dev/null
+++ b/plugins/meson.build
@@ -0,0 +1,36 @@
+plugins_install_dir = join_paths(gnome_todo_pkglibdir, 'plugins')
+plugins_inc = [top_inc, src_inc]
+plugins_files = []
+
+plugins_conf = configuration_data()
+plugins_conf.set('VERSION', gnome_todo_version)
+
+subdir('eds')
+
+if get_option('enable-background-plugin')
+  subdir('background')
+endif
+
+if get_option('enable-dark-theme-plugin')
+  subdir('dark-theme')
+endif
+
+if get_option('enable-scheduled-panel-plugin')
+  subdir('scheduled-panel')
+endif
+
+if get_option('enable-score-plugin')
+  subdir('score')
+endif
+
+if get_option('enable-today-panel-plugin')
+  subdir('today-panel')
+endif
+
+if get_option('enable-unscheduled-panel-plugin')
+  subdir('unscheduled-panel')
+endif
+
+if get_option('enable-todo-txt-plugin')
+  subdir('todo-txt')
+endif
diff --git a/plugins/scheduled-panel/meson.build b/plugins/scheduled-panel/meson.build
new file mode 100644
index 0000000..7fb8463
--- /dev/null
+++ b/plugins/scheduled-panel/meson.build
@@ -0,0 +1,21 @@
+plugin_name = 'scheduled-panel'
+
+sources = [
+  'gtd-panel-scheduled.c',
+  'gtd-panel-scheduled.h',
+  'gtd-plugin-scheduled-panel.c',
+  'gtd-plugin-scheduled-panel.h'
+]
+
+libscheduledpanel_lib = static_library(
+  'scheduledpanel',
+  sources: sources,
+  include_directories: plugins_inc,
+  dependencies: gnome_todo_dep,
+)
+
+plugins_files += configure_file(
+  input: '@0  plugin in'.format(plugin_name),
+  output: '@0@.plugin'.format(plugin_name),
+  configuration: plugins_conf
+)
diff --git a/plugins/score/meson.build b/plugins/score/meson.build
new file mode 100644
index 0000000..d1f4420
--- /dev/null
+++ b/plugins/score/meson.build
@@ -0,0 +1,16 @@
+plugin_name = 'score'
+
+install_dir = join_paths(plugins_install_dir, plugin_name)
+
+install_data(
+  join_paths(plugin_name, '__init__.py'),
+  install_dir: join_paths(install_dir, plugin_name)
+)
+
+configure_file(
+  input: '@0  plugin in'.format(plugin_name),
+  output: '@0@.plugin'.format(plugin_name),
+  install: true,
+  install_dir: install_dir,
+  configuration: plugins_conf
+)
diff --git a/plugins/today-panel/meson.build b/plugins/today-panel/meson.build
new file mode 100644
index 0000000..eac8de9
--- /dev/null
+++ b/plugins/today-panel/meson.build
@@ -0,0 +1,21 @@
+plugin_name = 'today-panel'
+
+sources = [
+  'gtd-panel-today.c',
+  'gtd-panel-today.h',
+  'gtd-plugin-today-panel.c',
+  'gtd-plugin-today-panel.h'
+]
+
+libtodaypanel_lib = static_library(
+  'todaypanel',
+  sources: sources,
+  include_directories: plugins_inc,
+  dependencies: gnome_todo_dep,
+)
+
+plugins_files += configure_file(
+  input: '@0  plugin in'.format(plugin_name),
+  output: '@0@.plugin'.format(plugin_name),
+  configuration: plugins_conf
+)
diff --git a/plugins/todo-txt/meson.build b/plugins/todo-txt/meson.build
new file mode 100644
index 0000000..407ea26
--- /dev/null
+++ b/plugins/todo-txt/meson.build
@@ -0,0 +1,31 @@
+plugin_name = 'todo-txt'
+
+sources = [
+  'gtd-plugin-todo-txt.c',
+  'gtd-plugin-todo-txt.h',
+  'gtd-provider-todo-txt.c',
+  'gtd-provider-todo-txt.h',
+  'gtd-todo-txt-parser.c',
+  'gtd-todo-txt-parser.h'
+]
+
+libtodotxt_lib = static_library(
+  'todotxt',
+  sources: sources,
+  include_directories: plugins_inc,
+  dependencies: gnome_todo_dep,
+  c_args: common_flags + [
+    '-DPACKAGE_DATA_DIR="@0@"'.format(gnome_todo_pkgdatadir)
+  ]
+)
+
+install_data(
+  'org.gnome.todo.txt.gschema.xml',
+  install_dir: gnome_todo_schemadir
+)
+
+plugins_files += configure_file(
+  input: '@0  plugin in'.format(plugin_name),
+  output: '@0@.plugin'.format(plugin_name),
+  configuration: plugins_conf
+)
diff --git a/plugins/unscheduled-panel/meson.build b/plugins/unscheduled-panel/meson.build
new file mode 100644
index 0000000..9cc500e
--- /dev/null
+++ b/plugins/unscheduled-panel/meson.build
@@ -0,0 +1,16 @@
+plugin_name = 'unscheduled-panel'
+
+install_dir = join_paths(plugins_install_dir, plugin_name)
+
+install_data(
+  join_paths(plugin_name, '__init__.py'),
+  install_dir: join_paths(install_dir, plugin_name)
+)
+
+configure_file(
+  input: '@0  plugin in'.format(plugin_name),
+  output: '@0@.plugin'.format(plugin_name),
+  install: true,
+  install_dir: install_dir,
+  configuration: plugins_conf
+)
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/meson.build b/src/meson.build
new file mode 100644
index 0000000..b0dc444
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,283 @@
+engine_headers = [
+  join_paths('engine', 'gtd-manager.h')
+]
+
+install_headers(
+  engine_headers,
+  subdir: join_paths(gnome_todo_pkgincludedir, 'engine')
+)
+
+interfaces_headers = [
+  join_paths('interfaces', 'gtd-activatable.h'),
+  join_paths('interfaces', 'gtd-panel.h'),
+  join_paths('interfaces', 'gtd-provider.h')
+]
+
+install_headers(
+  interfaces_headers,
+  subdir: join_paths(gnome_todo_pkgincludedir, 'interfaces')
+)
+
+notification_headers = [
+  join_paths('notification', 'gtd-notification.h')
+]
+
+install_headers(
+  notification_headers,
+  subdir: join_paths(gnome_todo_pkgincludedir, 'notification')
+)
+
+headers = [
+  'gtd-enums.h',
+  'gtd-object.h',
+  'gtd-task.h',
+  'gtd-task-list.h',
+  'gtd-task-list-view.h',
+  'gtd-timer.h',
+  'gtd-types.h',
+  'gtd-window.h',
+  'gnome-todo.h'
+]
+
+install_headers(
+  headers,
+  subdir: gnome_todo_pkgincludedir
+)
+
+private_headers = [
+  join_paths('engine', 'gtd-manager-protected.h'),
+  join_paths('engine', 'gtd-plugin-manager.h'),
+  join_paths('notification', 'gtd-notification-widget.h'),
+  join_paths('provider', 'gtd-provider-popover.h'),
+  join_paths('provider', 'gtd-provider-row.h'),
+  join_paths('provider', 'gtd-provider-selector.h'),
+  join_paths('views', 'gtd-list-selector.h'),
+  join_paths('views', 'gtd-list-selector-grid.h'),
+  join_paths('views', 'gtd-list-selector-grid-item.h'),
+  join_paths('views', 'gtd-list-selector-item.h'),
+  join_paths('views', 'gtd-list-selector-list.h'),
+  join_paths('views', 'gtd-list-selector-list-item.h'),
+  join_paths('views', 'gtd-list-selector-panel.h'),
+  'gtd-application.h',
+  'gtd-arrow-frame.h',
+  'gtd-dnd-row.h',
+  'gtd-edit-pane.h',
+  'gtd-empty-list-widget.h',
+  'gtd-initial-setup-window.h',
+  'gtd-new-task-row.h',
+  'gtd-plugin-dialog.h',
+  'gtd-plugin-dialog-row.h',
+  'gtd-task-row.h',
+  'main.c'
+]
+
+sources = [
+  join_paths('engine', 'gtd-manager.c'),
+  join_paths('engine', 'gtd-plugin-manager.c'),
+  join_paths('interfaces', 'gtd-activatable.c'),
+  join_paths('interfaces', 'gtd-panel.c'),
+  join_paths('interfaces', 'gtd-provider.c'),
+  join_paths('notification', 'gtd-notification.c'),
+  join_paths('notification', 'gtd-notification-widget.c'),
+  join_paths('provider', 'gtd-provider-popover.c'),
+  join_paths('provider', 'gtd-provider-row.c'),
+  join_paths('provider', 'gtd-provider-selector.c'),
+  join_paths('views', 'gtd-list-selector.c'),
+  join_paths('views', 'gtd-list-selector-grid.c'),
+  join_paths('views', 'gtd-list-selector-grid-item.c'),
+  join_paths('views', 'gtd-list-selector-item.c'),
+  join_paths('views', 'gtd-list-selector-list.c'),
+  join_paths('views', 'gtd-list-selector-list-item.c'),
+  join_paths('views', 'gtd-list-selector-panel.c'),
+  'gtd-application.c',
+  'gtd-arrow-frame.c',
+  'gtd-dnd-row.c',
+  'gtd-edit-pane.c',
+  'gtd-empty-list-widget.c',
+  'gtd-initial-setup-window.c',
+  'gtd-new-task-row.c',
+  'gtd-object.c',
+  'gtd-plugin-dialog.c',
+  'gtd-plugin-dialog-row.c',
+  'gtd-task.c',
+  'gtd-task-list.c',
+  'gtd-task-list-view.c',
+  'gtd-task-row.c',
+  'gtd-timer.c',
+  'gtd-window.c',
+  'main.c'
+]
+
+data_dir = join_paths(meson.source_root(), 'data')
+
+sources += gnome.compile_resources(
+  'gtd-resources',
+  join_paths(data_dir, 'todo.gresource.xml'),
+  dependencies: plugins_files,
+  export: true,
+  source_dir: [
+    data_dir,
+    join_paths(meson.build_root(), 'plugins')
+  ],
+  c_name: 'todo',
+)
+
+enum = 'gtd-enum-types'
+
+sources += gnome.mkenums(
+  enum,
+  sources: 'gtd-enums.h',
+  c_template: '@0@.c.template'.format(enum),
+  h_template: '@0@.h.template'.format(enum),
+)
+
+ldflags = [
+  '-Wl,--export-dynamic',
+  '-Wl,--undefined=gtd_plugin_eds_register_types'
+]
+
+gnome_todo_libs = [
+  libeds_lib
+]
+
+if get_option('enable-background-plugin')
+  ldflags += ['-Wl,--undefined=gtd_plugin_background_register_types']
+  gnome_todo_libs += [libbackground_lib]
+endif
+
+if get_option('enable-dark-theme-plugin')
+  ldflags += ['-Wl,--undefined=gtd_plugin_dark_theme_register_types']
+  gnome_todo_libs += [libdarktheme_lib]
+endif
+
+if get_option('enable-scheduled-panel-plugin')
+  ldflags += ['-Wl,--undefined=gtd_plugin_scheduled_panel_register_types']
+  gnome_todo_libs += [libscheduledpanel_lib]
+endif
+
+if get_option('enable-today-panel-plugin')
+  ldflags += ['-Wl,--undefined=gtd_plugin_today_panel_register_types']
+  gnome_todo_libs += [libtodaypanel_lib]
+endif
+
+if get_option('enable-todo-txt-plugin')
+  ldflags += ['-Wl,--undefined=gtd_plugin_todo_txt_register_types']
+  gnome_todo_libs += [libtodotxt_lib]
+endif
+
+gnome_todo_ldflags = []
+
+if host_machine.system().contains('linux')
+  foreach ldflag: ldflags
+    if cc.has_argument(ldflag)
+      gnome_todo_ldflags += ldflag
+    endif
+  endforeach
+endif
+
+gnome_todo_cflags = common_flags + [
+  '-DPACKAGE_LOCALE_DIR="@0@"'.format(gnome_todo_localedir),
+  '-DPACKAGE_DATA_DIR="@0@"'.format(gnome_todo_pkgdatadir),
+  '-DPACKAGE_LIB_DIR="@0@"'.format(gnome_todo_pkglibdir),
+  '-DUI_DATA_DIR="@0@"'.format(join_paths(gnome_todo_pkgdatadir, 'style'))
+]
+
+gnome_todo_inc = [
+  top_inc,
+  include_directories(
+    'engine',
+    'provider',
+    'notification',
+    'interfaces',
+    'views'
+  )
+]
+
+gnome_todo = executable(
+  'gnome-todo',
+  sources + headers + private_headers,
+  include_directories: gnome_todo_inc,
+  dependencies: gnome_todo_dep,
+  c_args: gnome_todo_cflags,
+  link_with: gnome_todo_libs,
+  link_args: gnome_todo_ldflags,
+  install: true,
+  install_dir: gnome_todo_bindir
+)
+
+gtd_ldflags = [
+  '-Wl,--export-dynamic'
+]
+
+libgtd_lib = shared_library(
+  'gtd',
+  sources: sources + headers + private_headers,
+  include_directories: gnome_todo_inc,
+  dependencies: gnome_todo_dep,
+  c_args: gnome_todo_cflags,
+  link_args: gtd_ldflags
+)
+
+libgtd_inc = include_directories('.')
+libgtd_dep = declare_dependency(
+  link_with: libgtd_lib,
+  include_directories: libgtd_inc,
+  dependencies: gnome_todo_dep
+)
+
+if get_option('enable-introspection')
+  gir_sources = [
+    join_paths('engine', 'gtd-manager.c'),
+    join_paths('engine', 'gtd-manager.h'),
+    join_paths('interfaces', 'gtd-activatable.c'),
+    join_paths('interfaces', 'gtd-activatable.h'),
+    join_paths('interfaces', 'gtd-panel.c'),
+    join_paths('interfaces', 'gtd-panel.h'),
+    join_paths('interfaces', 'gtd-provider.c'),
+    join_paths('interfaces', 'gtd-provider.h'),
+    join_paths('notification', 'gtd-notification.c'),
+    join_paths('notification', 'gtd-notification.h'),
+    'gtd-enums.h',
+    'gtd-object.c',
+    'gtd-object.h',
+    'gtd-task.c',
+    'gtd-task.h',
+    'gtd-task-list.c',
+    'gtd-task-list.h',
+    'gtd-task-list-view.c',
+    'gtd-task-list-view.h',
+    'gtd-timer.c',
+    'gtd-timer.h',
+    'gtd-window.c',
+    'gtd-window.h',
+    'gtd-types.h'
+  ]
+
+  gir_inc = [
+    'Gio-2.0',
+    'GObject-2.0',
+    'Gtk-3.0'
+  ]
+
+  gir_extra_args = [
+    '--warn-all'
+  ]
+
+  gir_dir = join_paths(gnome_todo_datadir, '@0@-@1@'.format('gir', gnome_todo_gir_version))
+  typelib_dir = join_paths(gnome_todo_libdir, '@0@-@1@'.format('girepository', gnome_todo_gir_version))
+
+  gnome.generate_gir(
+    gnome_todo,
+    sources: gir_sources,
+    namespace: gnome_todo_gir_ns,
+    nsversion: gnome_todo_gir_version,
+    identifier_prefix: gnome_todo_gir_ns,
+    symbol_prefix: gnome_todo_gir_ns.to_lower(),
+    includes: gir_inc,
+    include_directories: gnome_todo_inc,
+    install: true,
+    install_dir_gir: gir_dir,
+    install_dir_typelib: typelib_dir,
+    extra_args: gir_extra_args
+  )
+endif


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