[shotwell] build: meson: Add back build options



commit 97194a9c3dab535cd1a79f6a080fe0c7602e16ed
Author: Jens Georg <mail jensge org>
Date:   Thu May 25 10:07:02 2017 +0200

    build: meson: Add back build options

 git-hash            |    4 +
 meson.build         |   33 +++-
 meson_options.txt   |    3 +
 plugins/meson.build |    4 +-
 src/meson.build     |    2 +-
 vapi/unity.deps     |    6 -
 vapi/unity.vapi     |  438 ---------------------------------------------------
 7 files changed, 38 insertions(+), 452 deletions(-)
---
diff --git a/git-hash b/git-hash
new file mode 100755
index 0000000..bcb8f94
--- /dev/null
+++ b/git-hash
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+cd $MESON_SOURCE_ROOT
+exec git rev-parse HEAD 2>/dev/null
diff --git a/meson.build b/meson.build
index e77424f..8d97fd5 100644
--- a/meson.build
+++ b/meson.build
@@ -12,17 +12,28 @@ conf.set('_PREFIX', '"@0@"'.format(get_option('prefix')))
 conf.set('_LANG_SUPPORT_DIR', '"@0@"'.format(join_paths(get_option('prefix'), get_option('localedir'))))
 conf.set('_LIBEXECDIR', '"@0@"'.format(join_paths(get_option('prefix'), get_option('libexecdir'))))
 conf.set('_LIB', '"@0@"'.format(join_paths(get_option('prefix'), get_option('libdir'))))
-
 configure_file(output : 'config.h', configuration: conf)
+
 config_incdir = include_directories('.')
 vapi_incdir = include_directories('vapi')
 shotwell_plugin_dir = join_paths(get_option('libdir'), 'shotwell', 'plugins', 'builtin')
 
-add_global_arguments('-DHAVE_CONFIG_H=1', language : 'c')
-add_global_arguments(['-include'], ['config.h'], language : 'c')
-add_global_arguments('--target-glib=2.40', language : 'vala')
-add_global_arguments('--vapidir=@0@'.format(join_paths(meson.current_source_dir(),
-    'vapi')), language : 'vala')
+add_global_arguments(['-DHAVE_CONFIG_H=1'],
+                     ['-include'], ['config.h'], language : 'c')
+add_global_arguments(['--target-glib=2.40',
+                      '--vapidir=@0@'.format(join_paths(meson.current_source_dir(),
+                        'vapi')),
+                      '--enable-checking',
+                      '--fatal-warnings',
+                      '--enable-experimental',
+                      '--enable-deprecated'], language : 'vala')
+
+gitver = run_command(find_program('git-hash'))
+if gitver.returncode() == 0
+  add_global_arguments(['-D_GIT_VERSION="@0@"'.format(gitver.stdout().strip())],
+    language : 'c')
+  add_global_arguments(['--define=_GITVERSION'], language : 'vala')
+endif
 
 gtk = dependency('gtk+-3.0', version : '>= 3.18')
 gio = dependency('gio-2.0', version: '>= 2.40')
@@ -43,6 +54,16 @@ gudev = dependency('gudev-1.0', version : '>= 145')
 gexiv2 = dependency('gexiv2', version: '>= 0.10.4')
 libraw = dependency('libraw', version : '>= 0.13.2')
 libexif = dependency('libexif', version : '>= 0.6.16')
+unity = dependency('unity', required : false)
+
+if unity.found() and get_option('enable-unity-support')
+  add_global_arguments(['--define=UNITY_SUPPORT'], language : 'vala')
+endif
+
+foreach publisher : get_option('publishers').split(',')
+  add_global_arguments(['--define=HAVE_@0@'.format(publisher.to_upper())],
+                       language : 'vala')
+endforeach
 
 json_glib = dependency('json-glib-1.0')
 gdata = dependency('libgdata')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..649e849
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,3 @@
+option('enable-unity-support', type: 'boolean', value : 'false', description: 'Enable Ubuntu Unity support')
+option('publishers', type: 'string', value : 
'facebook,flickr,picasa,piwigo,youtube,gallery3,rajce,tumblr,yandex', description: 'The list of publishing 
plugins to build')
+option('enable-extra-plugins', type : 'boolean', value : 'true', description: 'Enable building and 
installation of extra publishing plugins')
diff --git a/plugins/meson.build b/plugins/meson.build
index 757b7cd..b7f3365 100644
--- a/plugins/meson.build
+++ b/plugins/meson.build
@@ -16,5 +16,7 @@ sw_plugin_common_dep = declare_dependency(include_directories : include_director
 
 subdir('authenticator')
 subdir('shotwell-publishing')
-subdir('shotwell-publishing-extras')
+if get_option('enable-extra-plugins')
+  subdir('shotwell-publishing-extras')
+endif
 subdir('shotwell-transitions')
diff --git a/src/meson.build b/src/meson.build
index 8020753..a61e9a6 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -204,7 +204,7 @@ executable('shotwell',
            include_directories : vapi_incdir,
            dependencies : [gio, gee, sqlite, gtk, sqlite, posix, gphoto2,
                            gstreamer_pbu, gio_unix, gudev, gexiv2, gmodule,
-                           libraw, libexif, sw_plugin],
+                           libraw, libexif, sw_plugin, unity],
            vala_args : ['--pkg', 'libgphoto2',
                         '--pkg', 'libraw',
                         '--pkg', 'libexif',


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