[gnome-calendar/wip/meson] project: Port to meson build system
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/wip/meson] project: Port to meson build system
- Date: Thu, 1 Jun 2017 19:22:11 +0000 (UTC)
commit bd885bf93e4fd00a22fb17444e321f29a972108f
Author: Iñigo Martínez <inigomartinez gmail com>
Date: Fri May 19 23:13:23 2017 +0200
project: Port to meson build system
https://bugzilla.gnome.org/show_bug.cgi?id=782843
configure_meson | 188 ++++++++++++++++++++++++++++++++
data/appdata/meson.build | 10 ++
data/icons/meson.build | 23 ++++
data/icons/meson_post_install.py | 17 +++
data/meson.build | 63 +++++++++++
data/meson_post_install.py | 10 ++
data/org.gnome.Calendar.service.in | 3 +
doc/meson.build | 1 +
doc/reference/meson.build | 54 +++++++++
meson.build | 208 ++++++++++++++++++++++++++++++++++++
meson_options.txt | 3 +
po/meson.build | 1 +
src/meson.build | 143 +++++++++++++++++++++++++
13 files changed, 724 insertions(+), 0 deletions(-)
---
diff --git a/configure_meson b/configure_meson
new file mode 100755
index 0000000..147e28b
--- /dev/null
+++ b/configure_meson
@@ -0,0 +1,188 @@
+#!/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']=false
+ ['gtk-doc']=false
+ ['tracing']=false
+)
+
+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
+
+if [[ "x$USE_NLS" != "xno" ]]; then
+ meson_options['nls']=true
+fi
+
+# 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 Calendar
+ ==============
+
+ Source ........................... ${srcdir}
+ Prefix ........................... ${prefix}
+ Compiler ......................... ${CC}
+
+ Development options
+ Enable NLS ....................... $(echooption nls)
+ Enable Tracing ................... $(echooption tracing)
+ Enable Documentation ............. $(echooption gtk-doc)
+
+ 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..db4ed2f
--- /dev/null
+++ b/data/appdata/meson.build
@@ -0,0 +1,10 @@
+appdata = 'org.gnome.Calendar.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_calendar_datadir, 'appdata')
+)
diff --git a/data/icons/meson.build b/data/icons/meson.build
new file mode 100644
index 0000000..5e2f083
--- /dev/null
+++ b/data/icons/meson.build
@@ -0,0 +1,23 @@
+icon_sizes = [
+ '16x16',
+ '22x22',
+ '24x24',
+ '32x32',
+ '48x48',
+ '256x256',
+ '512x512'
+]
+
+foreach icon_size: icon_sizes
+ install_data(
+ '_'.join(['hicolor', 'apps', icon_size, 'org.gnome.Calendar.png']),
+ install_dir: join_paths(gnome_calendar_datadir, 'icons', 'hicolor', icon_size, 'apps')
+ )
+endforeach
+
+install_data(
+ '_'.join(['hicolor', 'apps', 'symbolic', 'org.gnome.Calendar-symbolic.svg']),
+ install_dir: join_paths(gnome_calendar_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..a432222
--- /dev/null
+++ b/data/icons/meson_post_install.py
@@ -0,0 +1,17 @@
+#!/usr/bin/env python3
+
+import glob
+import os
+import re
+import subprocess
+
+name_pattern = re.compile('hicolor_apps_(?:\d+x\d+|symbolic)_(.*)')
+search_pattern = '/**/hicolor_*'
+
+icon_dir = os.path.join(os.environ['MESON_INSTALL_PREFIX'], 'share', 'icons', 'hicolor')
+[os.rename(file, os.path.join(os.path.dirname(file), name_pattern.search(file).group(1)))
+ for file in glob.glob(icon_dir + search_pattern, recursive=True)]
+
+if not os.environ.get('DESTDIR'):
+ print('Update icon cache...')
+ subprocess.call(['gtk-update-icon-cache', '-f', '-t', icon_dir])
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..ed96bbb
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,63 @@
+msgfmt = find_program('msgfmt')
+
+po_dir = join_paths(meson.source_root(), 'po')
+
+desktop = 'org.gnome.Calendar.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_calendar_datadir, 'applications')
+)
+
+install_data(
+ 'org.gnome.Calendar.search-provider.ini',
+ install_dir: join_paths(gnome_calendar_datadir, 'gnome-shell', 'search-providers')
+)
+
+service_conf = configuration_data()
+service_conf.set('bindir', gnome_calendar_bindir)
+
+service = 'org.gnome.Calendar.service'
+
+configure_file(
+ input: '@0@.in'.format(service),
+ output: service,
+ install: true,
+ install_dir: join_paths(gnome_calendar_datadir, 'dbus-1', 'services'),
+ configuration: service_conf
+)
+
+schemas_dir = join_paths(gnome_calendar_datadir, 'glib-2.0', 'schemas')
+
+enums = 'org.gnome.calendar.enums.xml'
+
+custom_target(
+ enums,
+ input: join_paths(meson.source_root(), 'src', 'gcal-utils.h'),
+ output: enums,
+ command: [find_program('glib-mkenums'),
+ '--comments', '<!-- @comment@ -->',
+ '--fhead', '<schemalist>',
+ '--vhead', ' <@type@ id="org.gnome.calendar.@EnumName@">',
+ '--vprod', ' <value nick="@valuenick@" value="@valuenum@"/>',
+ '--vtail', ' </@type@>',
+ '--ftail', '</schemalist>',
+ '--output', '@OUTPUT@',
+ '@INPUT@'],
+ install: true,
+ install_dir: schemas_dir
+)
+
+install_data(
+ 'org.gnome.calendar.gschema.xml',
+ install_dir: schemas_dir
+)
+
+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..dd22e64
--- /dev/null
+++ b/data/meson_post_install.py
@@ -0,0 +1,10 @@
+#!/usr/bin/env python3
+
+import os
+import subprocess
+
+schema_dir = 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', schema_dir])
diff --git a/data/org.gnome.Calendar.service.in b/data/org.gnome.Calendar.service.in
new file mode 100644
index 0000000..f313461
--- /dev/null
+++ b/data/org.gnome.Calendar.service.in
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=org.gnome.Calendar
+Exec=@bindir@/gnome-calendar --gapplication-service
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..9a74eea
--- /dev/null
+++ b/doc/reference/meson.build
@@ -0,0 +1,54 @@
+html_images = [
+ join_paths('images', 'gcal-edit-dialog.png'),
+ join_paths('images', 'gcal-event-widget.png'),
+ join_paths('images', 'gcal-source-dialog.png'),
+ join_paths('images', 'gcal-window.png'),
+ join_paths('images', 'gcal-window_agendas.png')
+]
+
+version_conf = configuration_data()
+version_conf.set('VERSION', gnome_calendar_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_calendar_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: libgcal_dep,
+ scan_args: [
+ '--rebuild-types'
+ ],
+ mkdb_args: [
+ '--sgml-mode',
+ '--output-format=xml'
+ ],
+ gobject_typesfile: '@0@.types'.format(meson.project_name()),
+ fixxref_args: [
+ '--extra-dir=@0@'.format(join_paths(gtk_doc_path, 'evolution-data-server')),
+ '--extra-dir=@0@'.format(join_paths(glib_doc_path, 'glib')),
+ '--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')),
+ ],
+ html_assets: html_images,
+ install: true,
+ install_dir: doc_path
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..6b2a7e6
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,208 @@
+project(
+ 'gnome-calendar', 'c',
+ version: '3.25.1',
+ license: 'GPL3+',
+ default_options: [
+ 'buildtype=debugoptimized',
+ 'c_std=gnu99',
+ 'warning_level=1'
+ ],
+ meson_version: '>= 0.38.1'
+)
+
+gnome_calendar_version = meson.project_version()
+version_array = gnome_calendar_version.split('.')
+gnome_calendar_major_version = version_array[0].to_int()
+gnome_calendar_minor_version = version_array[1].to_int()
+gnome_calendar_micro_version = version_array[2].to_int()
+
+gnome_calendar_prefix = get_option('prefix')
+gnome_calendar_bindir = join_paths(gnome_calendar_prefix, get_option('bindir'))
+gnome_calendar_localedir = join_paths(gnome_calendar_prefix, get_option('localedir'))
+gnome_calendar_datadir = join_paths(gnome_calendar_prefix, get_option('datadir'))
+
+gnome_calendar_pkgdatadir = join_paths(gnome_calendar_datadir, meson.project_name())
+
+cc = meson.get_compiler('c')
+
+nl_time_first_weekday_src = '''
+ #include <langinfo.h>
+ int main() {
+ nl_langinfo(_NL_TIME_FIRST_WEEKDAY);
+ };
+'''
+
+conf = configuration_data()
+
+conf.set('ENABLE_TRACING', get_option('enable-tracing'))
+
+conf.set('ENABLE_NLS', get_option('enable-nls'))
+conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
+
+# package
+conf.set_quoted('PACKAGE', meson.project_name())
+conf.set_quoted('PACKAGE_BUGREPORT', 'https://bugzilla.gnome.org/enter_bug.cgi?product=gnome-calendar')
+conf.set_quoted('PACKAGE_NAME', meson.project_name())
+conf.set_quoted('PACKAGE_STRING', '@0@ @1@'.format(meson.project_name(), gnome_calendar_version))
+conf.set_quoted('PACKAGE_TARNAME', meson.project_name())
+conf.set_quoted('PACKAGE_URL', 'https://wiki.gnome.org/Apps/Calendar')
+conf.set_quoted('PACKAGE_VERSION', gnome_calendar_version)
+conf.set_quoted('VERSION', gnome_calendar_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_LANGINFO_H', cc.has_header('langinfo.h'))
+conf.set('HAVE__NL_TIME_FIRST_WEEKDAY', cc.compiles(nl_time_first_weekday_src))
+conf.set('HAVE_LOCALE_H', cc.has_header('locale.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_STRING_H', cc.has_header('string.h'))
+conf.set('HAVE_STRINGS_H', cc.has_header('strings.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
+assert(cc.has_function('strerror'),
+ '"strerror" not found')
+
+if host_machine.system().contains('darwin')
+ conf.set('HAVE_CFLOCALECOPYCURRENT', cc.has_function('CFLocaleCopyCurrent'))
+ conf.set('HAVE_CFPREFERENCESCOPYAPPVALUE', cc.has_function('CFPreferencesCopyAppValue'))
+endif
+
+conf.set('HAVE_DCGETTEXT', cc.has_function('dcgettext'))
+conf.set('HAVE_FLOOR', cc.has_function('floor'))
+conf.set('HAVE_GETTEXT', cc.has_function('gettext'))
+conf.set('HAVE_ICONV', cc.has_function('iconv'))
+conf.set('HAVE_MEMSET', cc.has_function('memset'))
+conf.set('HAVE_NL_LANGINFO', cc.has_function('nl_langinfo'))
+conf.set('HAVE_POW', cc.has_function('pow'))
+conf.set('HAVE_SETLOCALE', cc.has_function('setlocale'))
+conf.set('HAVE_STRSTR', cc.has_function('strstr'))
+
+# Compiler flags
+test_cflags = [
+ '-Wno-sign-compare'
+]
+'''
+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',
+ '-DPACKAGE_LOCALE_DIR="@0@"'.format(gnome_calendar_localedir),
+ '-DPACKAGE_DATA_DIR="@0@"'.format(gnome_calendar_pkgdatadir),
+ '-DUI_DATA_DIR="@0@"'.format(join_paths(gnome_calendar_datadir), 'style'),
+ '-DEDS_DISABLE_DEPRECATED',
+ '-DGOA_API_IS_SUBJECT_TO_CHANGE'
+]
+
+debug_flags = []
+buildtype = get_option('buildtype')
+if buildtype == 'release'
+ debug_flags += [
+ '-DG_DISABLE_ASSERT',
+ '-DG_DISABLE_CHECKS',
+ '-DG_DISABLE_CAST_CHECKS'
+ ]
+elif buildtype == 'debug' or buildtype == 'debugoptimized'
+ debug_flags += [
+ '-DG_DISABLE_CAST_CHECKS'
+ ]
+endif
+
+foreach cflag: test_cflags
+ if cc.has_argument(cflag)
+ common_flags += [cflag]
+ endif
+endforeach
+
+add_global_arguments(common_flags, language: 'c')
+
+libical_dep = dependency('libical', version: '>= 1.0')
+conf.set('HAVE_LIBICAL', libical_dep.found())
+
+assert(cc.has_function('icaltime_days_in_year', dependencies: libical_dep),
+ 'Error: icaltime_days_in_year() not found in libical!. Upgrade your libical library.')
+
+glib_dep = dependency('glib-2.0', version: '>= 2.43.4')
+gtk_dep = dependency('gtk+-3.0', version: '>= 3.21.6')
+
+gnome_calendar_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'),
+ libical_dep,
+ dependency('libsoup-2.4'),
+ dependency('gsettings-desktop-schemas', version: '>= 3.21.2'),
+ dependency('threads'),
+ cc.find_library('m', required: true)
+]
+
+configure_file(
+ output : 'config.h',
+ configuration : conf
+)
+
+gnome = import('gnome')
+pkg = import('pkgconfig')
+
+top_inc = include_directories('.')
+
+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..9b4c436
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,3 @@
+option('enable-nls', type: 'boolean', value: false, description: 'use Native Language Support')
+option('enable-tracing', type: 'boolean', value: false, description: 'add extra debugging information')
+option('enable-gtk-doc', type: 'boolean', value: false, description: 'use gtk-doc to build documentation')
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..e6d4779
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,143 @@
+sources = [
+ 'e-cal-data-model-subscriber.h',
+ 'e-cal-data-model-subscriber.c',
+ 'e-cal-data-model.h',
+ 'e-cal-data-model.c',
+ 'main.c',
+ 'css-code.h',
+ join_paths('views', 'gcal-month-view.c'),
+ join_paths('views', 'gcal-month-view.h'),
+ join_paths('views', 'gcal-range-tree.c'),
+ join_paths('views', 'gcal-range-tree.h'),
+ join_paths('views', 'gcal-week-grid.c'),
+ join_paths('views', 'gcal-week-grid.h'),
+ join_paths('views', 'gcal-week-header.c'),
+ join_paths('views', 'gcal-week-header.h'),
+ join_paths('views', 'gcal-week-view.c'),
+ join_paths('views', 'gcal-week-view.h'),
+ join_paths('views', 'gcal-year-view.c'),
+ join_paths('views', 'gcal-year-view.h'),
+ 'gcal-application.c',
+ 'gcal-application.h',
+ 'gcal-clock.c',
+ 'gcal-clock.h',
+ 'gcal-date-chooser-day.c',
+ 'gcal-date-chooser-day.h',
+ 'gcal-date-chooser.c',
+ 'gcal-date-chooser.h',
+ 'gcal-date-selector.c',
+ 'gcal-date-selector.h',
+ 'gcal-edit-dialog.c',
+ 'gcal-edit-dialog.h',
+ 'gcal-event.c',
+ 'gcal-event.h',
+ 'gcal-event-widget.c',
+ 'gcal-event-widget.h',
+ 'gcal-log.c',
+ 'gcal-log.h',
+ 'gcal-manager.c',
+ 'gcal-manager.h',
+ 'gcal-multi-choice.c',
+ 'gcal-multi-choice.h',
+ 'gcal-quick-add-popover.c',
+ 'gcal-quick-add-popover.h',
+ 'gcal-search-view.h',
+ 'gcal-search-view.c',
+ 'gcal-shell-search-provider.h',
+ 'gcal-shell-search-provider.c',
+ 'gcal-source-dialog.c',
+ 'gcal-source-dialog.h',
+ 'gcal-subscriber-view.c',
+ 'gcal-subscriber-view.h',
+ 'gcal-subscriber-view-private.h',
+ 'gcal-time-selector.c',
+ 'gcal-time-selector.h',
+ 'gcal-utils.c',
+ 'gcal-utils.h',
+ 'gcal-view.c',
+ 'gcal-view.h',
+ 'gcal-window.h',
+ 'gcal-window.c'
+]
+
+data_dir = join_paths(meson.source_root(), 'data')
+
+sources += gnome.compile_resources(
+ 'gcal-resources',
+ join_paths(data_dir, 'calendar.gresource.xml'),
+ export: true,
+ source_dir: data_dir,
+ c_name: 'calendar'
+)
+
+enum_types = 'gcal-enum-types'
+
+sources += gnome.mkenums(
+ enum_types,
+ sources: 'gcal-utils.h',
+ c_template: '@0@.c.template'.format(enum_types),
+ h_template: '@0@.h.template'.format(enum_types)
+)
+
+sources += gnome.gdbus_codegen(
+ 'gcal-shell-search-provider-generated',
+ join_paths(data_dir, 'shell-search-provider-dbus-interfaces.xml'),
+ interface_prefix: 'org.gnome.',
+ namespace: 'Gcal'
+)
+
+debug = 'gcal-debug.h'
+
+sources += configure_file(
+ input: '@0@.in'.format(debug),
+ output: debug,
+ configuration: conf
+)
+
+ldflags = [
+ '-Wl,--export-dynamic'
+]
+
+gnome_calendar_ldflags = []
+
+if host_machine.system().contains('linux')
+ foreach ldflag: ldflags
+ if cc.has_argument(ldflag)
+ gnome_calendar_ldflags += ldflag
+ endif
+ endforeach
+endif
+
+gnome_calendar_inc = [
+ top_inc,
+ include_directories(
+ 'views'
+ )
+]
+
+executable(
+ meson.project_name(),
+ sources,
+ include_directories: gnome_calendar_inc,
+ dependencies: gnome_calendar_dep,
+ c_args: common_flags + debug_flags,
+ link_args: gnome_calendar_ldflags,
+ install: true,
+ install_dir: gnome_calendar_bindir
+)
+
+libgcal_lib = shared_library(
+ 'gcal',
+ sources: sources,
+ include_directories: gnome_calendar_inc,
+ dependencies: gnome_calendar_dep,
+ c_args: common_flags + debug_flags,
+ link_args: gnome_calendar_ldflags
+)
+
+libgcal_inc = include_directories('.')
+libgcal_dep = declare_dependency(
+ link_with: libgcal_lib,
+ include_directories: gnome_calendar_inc,
+ dependencies: gnome_calendar_dep
+)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]