[bijiben/wip/inigomartinez/meson: 1/7] build: Port to meson build system



commit 3c60e86ca1d217d9440a9627f2d1830fe74321ee
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Tue May 16 22:00:45 2017 +0200

    build: Port to meson build system

 .gitmodules                      |    3 +
 configure_meson                  |  183 ++++++++++++++++++++++++++++++++++++++
 data/icons/meson.build           |   43 +++++++++
 data/icons/meson_post_install.py |   21 +++++
 data/meson.build                 |   88 ++++++++++++++++++
 data/meson_compile_schemas.py    |   10 ++
 data/meson_desktop_validate.py   |   10 ++
 data/meson_update_mime.py        |   10 ++
 help/meson.build                 |   44 +++++++++
 meson.build                      |  171 +++++++++++++++++++++++++++++++++++
 meson_options.txt                |    2 +
 po/meson.build                   |    1 +
 src/libbiji/meson.build          |   99 ++++++++++++++++++++
 src/meson.build                  |   88 ++++++++++++++++++
 subprojects/libgd                |    1 +
 subprojects/libgd.wrap           |    4 +
 16 files changed, 778 insertions(+), 0 deletions(-)
---
diff --git a/.gitmodules b/.gitmodules
index bfd964e..e4d4b5b 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,6 @@
 [submodule "libgd"]
        path = libgd
        url = git://git.gnome.org/libgd
+[submodule "subprojects/libgd"]
+       path = subprojects/libgd
+       url = https://git.gnome.org/browse/libgd
diff --git a/configure_meson b/configure_meson
new file mode 100755
index 0000000..600a3f0
--- /dev/null
+++ b/configure_meson
@@ -0,0 +1,183 @@
+#!/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=(
+    ['zeitgeist']=false
+    ['update-mimedb']=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
+
+# 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 "
+
+        bijiben
+        =======
+
+        meson:         ${MESON}
+        ninja:         ${NINJA}
+        prefix:        ${prefix}
+        compiler:      ${CC}
+        global flags:  ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
+        nls:           $(echooption nls)
+        zeitgeist:     $(echooption zeitgeist)
+        update-mimedb: $(echooption update-mimedb)
+
+        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/icons/meson.build b/data/icons/meson.build
new file mode 100644
index 0000000..ab0832f
--- /dev/null
+++ b/data/icons/meson.build
@@ -0,0 +1,43 @@
+apps_icon_sizes = [
+  '16x16',
+  '22x22',
+  '32x32',
+  '48x48',
+  '256x256',
+]
+
+# must be renamed to org.gnome.bijiben.png
+foreach icon_size: apps_icon_sizes
+  install_data(
+    '_'.join(['hicolor', 'apps', icon_size, 'org.gnome.bijiben.png']),
+    install_dir: join_paths(bijiben_datadir, 'icons', 'hicolor', icon_size, 'apps')
+  )
+endforeach
+
+# must be renamed to org.gnome.bijiben-symbolic.svg
+install_data(
+  '_'.join(['hicolor', 'apps', 'scalable', 'org.gnome.bijiben-symbolic.svg']),
+  install_dir: join_paths(bijiben_datadir, 'icons', 'hicolor', 'scalable', 'apps')
+)
+
+actions_icon_sizes = [
+  '16x16',
+  '24x24',
+  '48x48',
+]
+
+# must be renamed to note.png
+foreach icon_size: actions_icon_sizes
+  install_data(
+    '_'.join(['hicolor', 'actions', icon_size, 'note.png']),
+    install_dir: join_paths(bijiben_pkgdatadir, 'icons', 'hicolor', icon_size, 'actions')
+  )
+endforeach
+
+# must be renamed to link.svg
+install_data(
+  '_'.join(['hicolor', 'actions', 'scalable', 'link.svg']),
+  install_dir: join_paths(bijiben_pkgdatadir, 'icons', 'hicolor', 'scalable', 'actions')
+)
+
+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..1c519f4
--- /dev/null
+++ b/data/icons/meson_post_install.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python3
+
+import glob
+import os
+import re
+import subprocess
+
+name_pattern = re.compile('hicolor_(?:apps|actions)_(?:\d+x\d+|scalable)_(.*)')
+search_pattern = '/**/hicolor_*'
+
+actions_icon_dir = os.path.join(os.environ['MESON_INSTALL_PREFIX'], 'share', 'bijiben', 'icons', 'hicolor')
+[os.rename(file, os.path.join(os.path.dirname(file), name_pattern.search(file).group(1)))
+ for file in glob.glob(actions_icon_dir + search_pattern, recursive=True)]
+
+apps_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(apps_icon_dir + search_pattern, recursive=True)]
+
+if not os.environ.get('DESTDIR'):
+  print('Update icon cache...')
+  subprocess.call(['gtk-update-icon-cache', '-f', '-t', apps_icon_dir])
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..7ef8ed8
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,88 @@
+po_dir = join_paths(meson.source_root(), 'po')
+
+intltool_merge = find_program('intltool-merge')
+intltool_cache = join_paths(po_dir, '.intltool-merge-cache')
+
+appdata = 'org.gnome.bijiben.appdata.xml'
+
+custom_target(
+  appdata,
+  input: '@0@.in'.format(appdata),
+  output: appdata,
+  command : [intltool_merge, '-x', '-u', '-c', intltool_cache, po_dir, '@INPUT@', '@OUTPUT@'],
+  install: true,
+  install_dir: join_paths(bijiben_datadir, 'appdata')
+)
+
+desktop = 'org.gnome.bijiben.desktop'
+
+desktop_conf = configuration_data()
+desktop_conf.set('VERSION', bijiben_version)
+
+desktop_in = configure_file(
+  input: '@0  in in'.format(desktop),
+  output: '@0@.in'.format(desktop),
+  configuration: desktop_conf
+)
+
+custom_target(
+  desktop,
+  input: desktop_in,
+  output: desktop,
+  command : [intltool_merge, '-d', '-u', '-c', intltool_cache, po_dir, '@INPUT@', '@OUTPUT@'],
+  install: true,
+  install_dir: join_paths(bijiben_datadir, 'applications')
+)
+meson.add_install_script('meson_desktop_validate.py')
+
+service_conf = configuration_data()
+service_conf.set('libexecdir', bijiben_libexecdir)
+
+service = 'org.gnome.bijiben.SearchProvider.service'
+
+configure_file(
+  input: '@0@.in'.format(service),
+  output: service,
+  install: true,
+  install_dir: join_paths(bijiben_datadir, 'dbus-1', 'services'),
+  configuration: service_conf
+)
+
+install_data(
+  'org.gnome.bijiben-search-provider.ini',
+  install_dir: join_paths(bijiben_datadir, 'gnome-shell', 'search-providers')
+)
+
+web_files = [
+  'Default.css',
+  'bijiben.js'
+]
+
+install_data(
+  web_files,
+  install_dir: bijiben_pkgdatadir
+)
+
+install_data(
+  'org.gnome.bijiben.gschema.xml',
+  install_dir: join_paths(bijiben_datadir, 'glib-2.0', 'schemas'),
+  install_mode: 'rw-r--r--'
+)
+meson.add_install_script('meson_compile_schemas.py')
+
+mime = 'org.gnome.bijiben.xml'
+
+custom_target(
+  mime,
+  input: '@0@.in'.format(mime),
+  output: mime,
+  command : [intltool_merge, '-x', '-u', '-c', intltool_cache, po_dir, '@INPUT@', '@OUTPUT@'],
+  install: true,
+  install_dir: join_paths(bijiben_datadir, 'mime', 'packages')
+)
+
+if get_option('enable-update-mimedb')
+  meson.add_install_script('meson_update_mime.py')
+endif
+
+subdir('icons')
diff --git a/data/meson_compile_schemas.py b/data/meson_compile_schemas.py
new file mode 100644
index 0000000..b738d52
--- /dev/null
+++ b/data/meson_compile_schemas.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('Compile gsettings schemas...')
+  subprocess.call(['glib-compile-schemas', schema_dir])
diff --git a/data/meson_desktop_validate.py b/data/meson_desktop_validate.py
new file mode 100644
index 0000000..3891eeb
--- /dev/null
+++ b/data/meson_desktop_validate.py
@@ -0,0 +1,10 @@
+#!/usr/bin/env python3
+
+import os
+import subprocess
+
+desktop_file = os.path.join(os.environ['MESON_INSTALL_PREFIX'], 'share', 'applications', 
'org.gnome.bijiben.desktop')
+
+if not os.environ.get('DESTDIR'):
+  print('Validate desktop file...')
+  subprocess.call(['desktop-file-validate', desktop_file])
diff --git a/data/meson_update_mime.py b/data/meson_update_mime.py
new file mode 100644
index 0000000..3264681
--- /dev/null
+++ b/data/meson_update_mime.py
@@ -0,0 +1,10 @@
+#!/usr/bin/env python3
+
+import os
+import subprocess
+
+mimedir = os.path.join(os.environ['MESON_INSTALL_PREFIX'], 'share', 'mime')
+
+if not os.environ.get('DESTDIR'):
+  print('Update mime database...')
+  subprocess.call(['update-mime-database', mimedir])
diff --git a/help/meson.build b/help/meson.build
new file mode 100644
index 0000000..9b150c4
--- /dev/null
+++ b/help/meson.build
@@ -0,0 +1,44 @@
+sources = [
+  'colors.page',
+  'create.page',
+  'cut-copy-paste.page',
+  'delete.page',
+  'delete-permanent.page',
+  'delete-restore.page',
+  'format-list.page',
+  'format-text.page',
+  'index.page',
+  'introduction.page',
+  'new-window.page',
+  'notebooks.page',
+  'rename.page',
+  'search.page',
+  'share.page',
+  'legal.xml'
+]
+
+media = [
+  join_paths('figures', 'hicolor_apps_48x48_bijiben.png'),
+  join_paths('figures', 'hicolor_apps_16x16_bijiben.png'),
+  join_paths('figures', 'notes-3-12.png')
+]
+
+linguas = [
+  'cs',
+  'de',
+  'el',
+  'es',
+  'fr',
+  'hu',
+  'ko',
+  'pt_BR',
+  'sv'
+]
+
+gnome.yelp(
+  meson.project_name(),
+  sources: sources,
+  media: media,
+  symlink_media: false,
+  languages: linguas
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..cff0268
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,171 @@
+project(
+  'bijiben', 'c',
+  version: '3.21.2',
+  license: 'GPL3',
+  default_options: [
+    'buildtype=debugoptimized',
+    'c_std=gnu99',
+    'warning_level=1'
+  ],
+  meson_version: '>= 0.38.1'
+)
+
+bijiben_version = meson.project_version()
+version_array = bijiben_version.split('.')
+bijiben_major_version = version_array[0].to_int()
+bijiben_minor_version = version_array[1].to_int()
+bijiben_micro_version = version_array[2].to_int()
+
+bijiben_prefix = get_option('prefix')
+bijiben_bindir = join_paths(bijiben_prefix, get_option('bindir'))
+bijiben_libexecdir = join_paths(bijiben_prefix, get_option('libexecdir'))
+bijiben_localedir = join_paths(bijiben_prefix, get_option('localedir'))
+bijiben_datadir = join_paths(bijiben_prefix, get_option('datadir'))
+bijiben_pkgdatadir = join_paths(bijiben_prefix, get_option('datadir'), meson.project_name())
+
+cc = meson.get_compiler('c')
+
+conf = configuration_data()
+
+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=bijiben')
+conf.set_quoted('PACKAGE_NAME', meson.project_name())
+conf.set_quoted('PACKAGE_STRING', '@0@ @1@'.format(meson.project_name(), bijiben_version))
+conf.set_quoted('PACKAGE_TARNAME', meson.project_name())
+conf.set_quoted('PACKAGE_URL', 'https://wiki.gnome.org/Apps/Bijiben')
+conf.set_quoted('PACKAGE_VERSION', bijiben_version)
+conf.set_quoted('VERSION', bijiben_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_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_GETTEXT', cc.has_function('gettext'))
+
+# Compiler flags
+test_cflags = [
+  '-fno-strict-aliasing',
+  '-Wall',
+  '-Warray-bounds',
+  '-Wcast-align',
+  '-Wdeclaration-after-statement',
+  #'-Werror',
+  '-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-suggest-attribute=format',
+  '-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 = [
+  '-DDATADIR="@0@"'.format(bijiben_datadir),
+  '-DPACKAGE_LOCALE_DIR="@0@"'.format(bijiben_localedir)
+]
+
+foreach cflag: test_cflags
+  if cc.has_argument(cflag)
+    common_flags += [cflag]
+  endif
+endforeach
+
+add_global_arguments(common_flags, language: 'c')
+
+tracker_sparql_dep = dependency(
+  'tracker-sparql-1.0',
+  required: false
+)
+
+if not tracker_sparql_dep.found()
+  tracker_sparql_dep = dependency(
+    'tracker-sparql-0.18',
+    required: true
+  )
+endif
+
+libgd_options = [
+  'static=true',
+  'with-view-common=true',
+  'with-gtk-hacks=true',
+  'with-main-view=true',
+  'with-tagged-entry=true'
+]
+
+libgd = subproject(
+  'libgd',
+  default_options: libgd_options
+)
+
+libgd_dep = libgd.get_variable('libgd_dep')
+
+bijiben_dep = [
+  dependency('libecal-1.2', version: '>= 3.13.90'),
+  dependency('libedataserver-1.2', version: '>= 3.13.90'),
+  dependency('gio-unix-2.0'),
+  dependency('goa-1.0'),
+  dependency('glib-2.0', version: '>= 2.28'),
+  dependency('gtk+-3.0', version: '>= 3.11.4'),
+  dependency('libxml-2.0'),
+  dependency('uuid'),
+  dependency('webkit2gtk-4.0', version: '>= 2.10'),
+  cc.find_library('m', required: true),
+  tracker_sparql_dep,
+  libgd_dep
+]
+
+if get_option('enable-zeitgeist')
+  bijiben_dep += [dependency('zeitgeist-2.0')]
+endif
+
+configure_file(
+  output: 'config.h',
+  configuration: conf
+)
+
+gnome = import('gnome')
+i18n = import('i18n')
+
+top_inc = include_directories('.')
+
+subdir('src')
+subdir('data')
+subdir('po')
+subdir('help')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..96ecfa4
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,2 @@
+option('enable-zeitgeist', type: 'boolean', value: false, description: 'Enable Zeitgeist')
+option('enable-update-mimedb', type: 'boolean', value: false, description: 'update-mime-database after 
install')
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/libbiji/meson.build b/src/libbiji/meson.build
new file mode 100644
index 0000000..c6808f3
--- /dev/null
+++ b/src/libbiji/meson.build
@@ -0,0 +1,99 @@
+marshallers = gnome.genmarshal(
+  'biji-marshalers',
+  sources: 'biji-marshalers.list',
+  prefix: '_biji_marshal'
+)
+
+headers = [
+  'libbiji.h',
+  'biji-date-time.h',
+  'biji-error.h',
+  'biji-info-set.h',
+  'biji-item.h',
+  'biji-manager.h',
+  'biji-notebook.h',
+  'biji-note-id.h',
+  'biji-note-obj.h',
+  'biji-string.h',
+  'biji-timeout.h',
+  'biji-tracker.h',
+  'biji-zeitgeist.h',
+  join_paths('deserializer', 'biji-lazy-deserializer.h'),
+  join_paths('deserializer', 'biji-tomboy-reader.h'),
+  join_paths('editor', 'biji-editor-selection.h'),
+  join_paths('editor', 'biji-webkit-editor.h'),
+  join_paths('provider', 'biji-import-provider.h'),
+  join_paths('provider', 'biji-local-note.h'),
+  join_paths('provider', 'biji-local-provider.h'),
+  join_paths('provider', 'biji-memo-note.h'),
+  join_paths('provider', 'biji-memo-provider.h'),
+  join_paths('provider', 'biji-own-cloud-note.h'),
+  join_paths('provider', 'biji-own-cloud-provider.h'),
+  join_paths('provider', 'biji-provider.h'),
+  join_paths('serializer', 'biji-lazy-serializer.h'),
+]
+
+sources = [
+  'biji-date-time.c',
+  'biji-error.c',
+  'biji-info-set.c',
+  'biji-item.c',
+  'biji-manager.c',
+  'biji-notebook.c',
+  'biji-note-id.c',
+  'biji-note-obj.c',
+  'biji-string.c',
+  'biji-timeout.c',
+  'biji-tracker.c',
+  'biji-zeitgeist.c',
+  join_paths('deserializer', 'biji-lazy-deserializer.c'),
+  join_paths('deserializer', 'biji-tomboy-reader.c'),
+  join_paths('editor', 'biji-editor-selection.c'),
+  join_paths('editor', 'biji-webkit-editor.c'),
+  join_paths('provider', 'biji-import-provider.c'),
+  join_paths('provider', 'biji-local-note.c'),
+  join_paths('provider', 'biji-local-provider.c'),
+  join_paths('provider', 'biji-memo-note.c'),
+  join_paths('provider', 'biji-memo-provider.c'),
+  join_paths('provider', 'biji-own-cloud-note.c'),
+  join_paths('provider', 'biji-own-cloud-provider.c'),
+  join_paths('provider', 'biji-provider.c'),
+  join_paths('serializer', 'biji-lazy-serializer.c'),
+]
+
+ldflags = [
+  '-Wl,-Bsymbolic-functions',
+  '-Wl,-z,relro',
+  '-Wl,-z,now',
+]
+
+libbiji_ldflags = []
+
+if host_machine.system().contains('linux')
+  foreach ldflag: ldflags
+    if cc.has_argument(ldflag)
+      libbiji_ldflags += ldflag
+    endif
+  endforeach
+endif
+
+libbiji_cflags = common_flags
+if get_option('enable-zeitgeist')
+  libbiji_cflags += '-DBUILD_ZEITGEIST'
+endif
+
+libbiji_lib = static_library(
+  'libbiji',
+  sources: sources + headers + marshallers,
+  include_directories: top_inc,
+  dependencies: bijiben_dep,
+  c_args: libbiji_cflags,
+  link_args: libbiji_ldflags
+)
+
+libbiji_inc = include_directories('.')
+libbiji_dep = declare_dependency(
+  link_with: libbiji_lib,
+  include_directories: libbiji_inc,
+  dependencies: bijiben_dep
+)
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..80fe483
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,88 @@
+subdir('libbiji')
+
+resources = gnome.compile_resources(
+  'bjb-resources',
+  'bjb.gresource.xml',
+  export: true,
+  source_dir: '.',
+  c_name: 'bjb'
+)
+
+bijiben_sources = [
+  'bjb-app-menu.c',
+  'bjb-app-menu.h',
+  'bjb-bijiben.c',
+  'bjb-bijiben.h',
+  'bjb-color-button.c',
+  'bjb-color-button.h',
+  'bjb-controller.c',
+  'bjb-controller.h',
+  'bjb-debug.c',
+  'bjb-debug.h',
+  'bjb-editor-toolbar.c',
+  'bjb-editor-toolbar.h',
+  'bjb-empty-results-box.c',
+  'bjb-empty-results-box.h',
+  'bjb-import-dialog.h',
+  'bjb-import-dialog.c',
+  'bjb-load-more-button.c',
+  'bjb-load-more-button.h',
+  'bjb-main.c',
+  'bjb-main-toolbar.c',
+  'bjb-main-toolbar.h',
+  'bjb-main-view.c',
+  'bjb-main-view.h',
+  'bjb-note-view.c',
+  'bjb-note-view.h',
+  'bjb-organize-dialog.c',
+  'bjb-organize-dialog.h',
+  'bjb-rename-note.c',
+  'bjb-rename-note.h',
+  'bjb-search-toolbar.c',
+  'bjb-search-toolbar.h',
+  'bjb-selection-toolbar.c',
+  'bjb-selection-toolbar.h',
+  'bjb-settings.c',
+  'bjb-settings.h',
+  'bjb-settings-dialog.c',
+  'bjb-settings-dialog.h',
+  'bjb-share.c',
+  'bjb-share.h',
+  'bjb-window-base.c',
+  'bjb-window-base.h'
+]
+
+bijiben_cflags = common_flags + [
+  '-DHAVE_CONFIG_H'
+]
+
+executable(
+  'bijiben',
+  bijiben_sources + resources,
+  include_directories: top_inc,
+  dependencies: [bijiben_dep, libbiji_dep],
+  c_args: bijiben_cflags,
+  install: true,
+  install_dir: bijiben_bindir
+)
+
+gdbus_src = gnome.gdbus_codegen(
+  'bijiben-shell-search-provider-generated',
+  join_paths(meson.source_root(), 'data', 'shell-search-provider-dbus-interfaces.xml'),
+  interface_prefix: 'org.gnome.',
+  namespace: 'Bijiben'
+)
+
+search_provider_sources = [
+  gdbus_src,
+  'bijiben-shell-search-provider.c'
+]
+
+executable(
+  'bijiben-shell-search-provider',
+  search_provider_sources,
+  include_directories: top_inc,
+  dependencies: [bijiben_dep, libbiji_dep],
+  install: true,
+  install_dir: bijiben_libexecdir
+)
diff --git a/subprojects/libgd b/subprojects/libgd
new file mode 160000
index 0000000..cc90107
--- /dev/null
+++ b/subprojects/libgd
@@ -0,0 +1 @@
+Subproject commit cc90107531640bcba6c3c58e5cf6aec94d498763
diff --git a/subprojects/libgd.wrap b/subprojects/libgd.wrap
new file mode 100644
index 0000000..fd83a39
--- /dev/null
+++ b/subprojects/libgd.wrap
@@ -0,0 +1,4 @@
+[wrap-git]
+directory=libgd
+url=https://git.gnome.org/browse/libgd
+revision=master


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