Merge branch 'mjog/meson-cleanup' into 'mainline'

Meson build config cleanup

See merge request GNOME/geary!316
This commit is contained in:
Michael Gratton 2019-09-27 15:02:18 +00:00
commit afa83c552b
16 changed files with 184 additions and 122 deletions

View file

@ -16,7 +16,7 @@ desktop_file = i18n.merge_file(
type: 'desktop',
po_dir: po_dir,
install: true,
install_dir: join_paths(datadir, 'applications')
install_dir: join_paths(data_dir, 'applications')
)
desktop_output += desktop_file
@ -30,7 +30,7 @@ autostart_file = i18n.merge_file(
type: 'desktop',
po_dir: po_dir,
install: true,
install_dir: join_paths(datadir, 'applications')
install_dir: join_paths(data_dir, 'applications')
)
desktop_output += autostart_file
@ -60,7 +60,7 @@ appdata_merged = i18n.merge_file(
type: 'xml',
po_dir: po_dir,
install: true,
install_dir: join_paths(datadir, 'metainfo')
install_dir: join_paths(data_dir, 'metainfo')
)
if appstream_util.found()
@ -87,11 +87,11 @@ if install_contractor_file
output: 'geary-attach.contract',
command: [msgfmt, '--desktop', '--keyword=Description', '--template', '@INPUT@', '-d', po_dir, '-o', '@OUTPUT@'],
install: true,
install_dir: join_paths(datadir, 'contractor')
install_dir: join_paths(data_dir, 'contractor')
)
install_data('geary-attach',
install_dir: bindir,
install_dir: bin_dir,
)
endif
@ -108,7 +108,7 @@ geary_compiled_schema = gnome.compile_schemas(
depend_files: files('org.gnome.Geary.gschema.xml'),
)
install_data('org.gnome.Geary.gschema.xml',
install_dir: join_paths(datadir, 'glib-2.0', 'schemas'),
install_dir: join_paths(data_dir, 'glib-2.0', 'schemas'),
)
#
@ -116,7 +116,7 @@ install_data('org.gnome.Geary.gschema.xml',
#
service_conf = configuration_data()
service_conf.set('bindir', bindir)
service_conf.set('bindir', bin_dir)
service_conf.set('appid', geary_id)
configure_file(

View file

@ -1,4 +1,4 @@
system_icons_dir = join_paths(datadir, 'icons', 'hicolor')
system_icons_dir = join_paths(data_dir, 'icons', 'hicolor')
icon_files = files(
'mail-archive-symbolic.svg',
@ -45,7 +45,7 @@ scalable_dir = join_paths('hicolor', 'scalable', 'apps')
install_data(
join_paths(scalable_dir, 'org.gnome.Geary.svg'),
install_dir: join_paths(datadir, 'icons', scalable_dir),
install_dir: join_paths(data_dir, 'icons', scalable_dir),
rename: '@0@.svg'.format(geary_id)
)
@ -53,7 +53,6 @@ symbolic_dir = join_paths('hicolor', 'symbolic', 'apps')
install_data(
join_paths(symbolic_dir, 'org.gnome.Geary-symbolic.svg'),
install_dir: join_paths(datadir, 'icons', symbolic_dir),
install_dir: join_paths(data_dir, 'icons', symbolic_dir),
rename: '@0@-symbolic.svg'.format(geary_id)
)

View file

@ -4,18 +4,13 @@ project('geary', [ 'vala', 'c' ],
meson_version: '>= 0.50',
)
gnome = import('gnome')
i18n = import('i18n')
# Option
install_contractor_file = get_option('contractor')
iso_639_xml = get_option('iso_639_xml')
iso_3166_xml = get_option('iso_3166_xml')
reference_tracking = get_option('ref_tracking')
poodle = get_option('poodle')
# Build-time configuration options
enable_valadoc = get_option('valadoc')
revno = run_command('build-aux/git_version.py').stdout().strip()
install_contractor_file = get_option('contractor')
iso_3166_xml = get_option('iso_3166_xml')
iso_639_xml = get_option('iso_639_xml')
poodle = get_option('poodle')
reference_tracking = get_option('ref_tracking')
# Build type
if get_option('profile') == 'development'
@ -29,38 +24,34 @@ else
name_suffix = ''
endif
geary_id = 'org.gnome.Geary@0@'.format(profile)
geary_version = meson.project_version()
# Some variables
cc = meson.get_compiler('c')
valac = meson.get_compiler('vala')
config_h_dir = include_directories('.')
# Configurable install dirs
geary_prefix = get_option('prefix')
bindir = join_paths(geary_prefix, get_option('bindir'))
datadir = join_paths(geary_prefix, get_option('datadir'))
libdir = join_paths(geary_prefix, get_option('libdir'))
bin_dir = join_paths(geary_prefix, get_option('bindir'))
data_dir = join_paths(geary_prefix, get_option('datadir'))
lib_dir = join_paths(geary_prefix, get_option('libdir'))
locale_dir = join_paths(geary_prefix, get_option('localedir'))
# Source dirs
metadata_dir = join_paths(meson.source_root(), 'bindings', 'metadata')
po_dir = join_paths(meson.source_root(), 'po')
vapi_dir = join_paths(meson.source_root(), 'bindings', 'vapi')
metadata_dir = join_paths(meson.source_root(), 'bindings', 'metadata')
dbus_services_dir = join_paths(datadir, 'dbus-1', 'services')
web_extensions_dir = join_paths(libdir, 'geary', 'web-extensions')
plugins_dir = join_paths(libdir, 'geary', 'plugins')
# Make sure Meson can find our custom VAPI's
# Compiler configuration
add_project_arguments([
# Make sure Meson can find custom VAPIs
'--vapidir', vapi_dir,
'--metadatadir', metadata_dir,
],
language: 'vala'
)
cc = meson.get_compiler('c')
valac = meson.get_compiler('vala')
#
# Required libraries and other dependencies
#
target_glib = '2.54' # Also passed to valac, so don't include a point rev
target_glib = '2.60.4'
target_gtk = '3.24.7'
target_webkit = '2.24'
@ -150,6 +141,23 @@ desktop_file_validate = find_program('desktop-file-validate', required: false)
libmessagingmenu_dep = dependency('messaging-menu', version: '>= 12.10', required: false)
libunity = dependency('unity', version: '>= 5.12.0', required: false)
#
# Internal build configuration
#
# Build variables
geary_id = 'org.gnome.Geary@0@'.format(profile)
geary_version = meson.project_version()
revno = run_command('build-aux/git_version.py').stdout().strip()
gnome = import('gnome')
i18n = import('i18n')
# Static install dirs
dbus_services_dir = join_paths(data_dir, 'dbus-1', 'services')
plugins_dir = join_paths(lib_dir, 'geary', 'plugins')
web_extensions_dir = join_paths(lib_dir, 'geary', 'web-extensions')
# Ensure SQLite was built correctly
if not cc.has_header_symbol('sqlite3.h', 'SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER', dependencies: sqlite)
error('SQLite3 is missing FTS3 tokenizer support. Please compile it with -DSQLITE_ENABLE_FTS3.\n'
@ -174,30 +182,6 @@ if iso_3166_xml == ''
endif
files(iso_639_xml, iso_3166_xml) # Check to make sure these exist
# Configuration
conf = configuration_data()
conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
conf.set_quoted('G_LOG_DOMAIN', meson.project_name())
conf.set_quoted('PACKAGE_NAME', meson.project_name())
conf.set_quoted('PACKAGE_STRING', '@0@-@1@'.format(meson.project_name(), meson.project_version()))
conf.set_quoted('PACKAGE_VERSION', meson.project_version())
conf.set_quoted('_BUILD_ROOT_DIR', meson.build_root())
conf.set_quoted('_SOURCE_ROOT_DIR', meson.source_root())
conf.set_quoted('_GSETTINGS_DIR', join_paths(meson.build_root(), 'desktop'))
conf.set_quoted('_INSTALL_PREFIX', geary_prefix)
conf.set_quoted('_WEB_EXTENSIONS_DIR', web_extensions_dir)
conf.set_quoted('_PLUGINS_DIR', plugins_dir)
conf.set_quoted('LANGUAGE_SUPPORT_DIRECTORY', locale_dir)
conf.set_quoted('ISO_CODE_639_XML', iso_639_xml)
conf.set_quoted('ISO_CODE_3166_XML', iso_3166_xml)
conf.set('GCR_API_SUBJECT_TO_CHANGE', true)
conf.set_quoted('_VERSION', geary_version)
conf.set_quoted('_APP_ID', geary_id)
conf.set_quoted('_PROFILE', profile)
conf.set_quoted('_NAME_SUFFIX', name_suffix)
conf.set_quoted('_REVNO', revno)
configure_file(output: 'config.h', configuration: conf)
# Post-install scripts
meson.add_install_script(join_paths('build-aux', 'post_install.py'))

View file

@ -1,11 +1,50 @@
option('valadoc', type: 'boolean', value: false, description: 'Whether to build the documentaton (requires valadoc).')
option('contractor', type: 'boolean', value: false, description: 'Whether to install the contractor file (Elementary OS-specific).')
option('poodle', type: 'boolean', value: true, description: 'Whether to apply the POODLE SSLv3 fix.')
option('ref_tracking', type: 'boolean', value: false, description: 'Whether to use explicit reference tracking.')
option('iso_639_xml', type: 'string', value: '', description: 'Full path to the ISO 639 XML file.')
option('iso_3166_xml', type: 'string', value: '', description: 'Full path to the ISO 3166 XML file.')
option('libunwind_optional', type: 'boolean', value: false, description: 'Determines if libunwind is required.')
option('tnef-support', type: 'boolean', value: true, description: 'Whether to support TNEF attachments (requires libytnef).')
#
# General build options
#
option(
'contractor',
type: 'boolean',
value: false,
description: 'Whether to install the contractor file (Elementary OS-specific).'
)
option(
'iso_639_xml',
type: 'string',
value: '',
description: 'Full path to the ISO 639 XML file.'
)
option(
'iso_3166_xml',
type: 'string',
value: '',
description: 'Full path to the ISO 3166 XML file.'
)
option(
'libunwind_optional',
type: 'boolean',
value: false,
description: 'Determines if libunwind is required.'
)
option(
'poodle',
type: 'boolean',
value: true,
description: 'Whether to apply the POODLE SSLv3 fix.'
)
option(
'tnef-support',
type: 'boolean',
value: true,
description: 'Whether to support TNEF attachments (requires libytnef).'
)
option(
'valadoc',
type: 'boolean',
value: false,
description: 'Whether to build the documentaton (requires valadoc).'
)
# Development options
option(
'profile',
type: 'combo',
@ -13,3 +52,9 @@ option(
choices: ['default','development','beta'],
description: 'Specifies the application type to be built'
)
option(
'ref_tracking',
type: 'boolean',
value: false,
description: 'Whether to use explicit reference tracking.'
)

View file

@ -27,5 +27,5 @@ sql_files = [
]
install_data(sql_files,
install_dir: join_paths(datadir, meson.project_name(), 'sql')
install_dir: join_paths(data_dir, meson.project_name(), 'sql')
)

View file

@ -134,14 +134,14 @@ geary_client_dependencies = [
webkit2gtk,
]
geary_client_vala_options = geary_vala_options
geary_client_vala_args = geary_vala_args
# Enable shared shecondary process if available.
# See issues #558 and #559
webkit_version = webkit2gtk.version().split('.')
if webkit_version[0].to_int() <= 2 and webkit_version[1].to_int() <= 24
message('Enabling WebKitGTK shared process model')
geary_client_vala_options += [
geary_client_vala_args += [
'-D', 'HAS_WEBKIT_SHARED_PROC'
]
endif
@ -151,8 +151,8 @@ geary_client_lib = static_library('geary-client',
geary_client_sources,
dependencies: geary_client_dependencies,
include_directories: config_h_dir,
vala_args: geary_client_vala_options,
c_args: geary_c_options,
vala_args: geary_client_vala_args,
c_args: geary_c_args,
)
geary_client_dep = declare_dependency(

View file

@ -9,8 +9,9 @@ shared_module(
plugin_name,
sources: plugin_src,
dependencies: plugin_dependencies,
vala_args: geary_vala_options,
c_args: plugin_cflags,
include_directories: config_h_dir,
vala_args: geary_vala_args,
c_args: plugin_c_args,
install: true,
install_dir: plugin_dest
)

View file

@ -20,7 +20,7 @@ plugin_dependencies = [
webkit2gtk,
]
plugin_cflags = geary_c_options
plugin_c_args = geary_c_args
subdir('desktop-notifications')
subdir('messaging-menu')

View file

@ -28,8 +28,9 @@ if libmessagingmenu_dep.found()
plugin_name + '-geary',
sources: plugin_src,
dependencies: messaging_menu_dependencies,
vala_args: geary_vala_options,
c_args: plugin_cflags,
include_directories: config_h_dir,
vala_args: geary_vala_args,
c_args: plugin_c_args,
install: true,
install_dir: plugin_dest
)

View file

@ -13,8 +13,9 @@ if libunity.found()
plugin_name,
sources: plugin_src,
dependencies: badge_dependencies,
vala_args: geary_vala_options,
c_args: plugin_cflags,
include_directories: config_h_dir,
vala_args: geary_vala_args,
c_args: plugin_c_args,
install: true,
install_dir: plugin_dest
)

View file

@ -4,10 +4,9 @@
* (version 2.1 or later). See the COPYING file in this distribution.
*/
extern const string LANGUAGE_SUPPORT_DIRECTORY;
extern const string ISO_CODE_639_XML;
extern const string ISO_CODE_3166_XML;
public const string TRANSLATABLE = "translatable";
extern const string _LANGUAGE_SUPPORT_DIRECTORY;
extern const string _ISO_CODE_639_XML;
extern const string _ISO_CODE_3166_XML;
namespace Util.International {
@ -25,7 +24,7 @@ namespace Util.International {
// TODO: Geary should be able to use langpacks from the build directory
private string get_langpack_dir_path(string program_path) {
return LANGUAGE_SUPPORT_DIRECTORY;
return _LANGUAGE_SUPPORT_DIRECTORY;
}
/**
@ -147,7 +146,7 @@ namespace Util.International {
if (language_names == null) {
language_names = new HashTable<string, string>(GLib.str_hash, GLib.str_equal);
unowned Xml.Doc doc = Xml.Parser.parse_file(ISO_CODE_639_XML);
unowned Xml.Doc doc = Xml.Parser.parse_file(_ISO_CODE_639_XML);
if (doc == null) {
return null;
}
@ -197,7 +196,7 @@ namespace Util.International {
if (country_names == null) {
country_names = new HashTable<string, string>(GLib.str_hash, GLib.str_equal);
unowned Xml.Doc doc = Xml.Parser.parse_file(ISO_CODE_3166_XML);
unowned Xml.Doc doc = Xml.Parser.parse_file(_ISO_CODE_3166_XML);
if (doc == null) {
return null;

View file

@ -14,6 +14,6 @@ geary_console = executable('geary-console',
geary_console_sources,
dependencies: geary_console_dependencies,
include_directories: config_h_dir,
vala_args: geary_vala_options,
c_args: geary_c_options,
vala_args: geary_vala_args,
c_args: geary_c_args,
)

View file

@ -343,21 +343,21 @@ build_dir = meson.current_build_dir()
# Generate internal VAPI for unit testing. See Meson issue
# https://github.com/mesonbuild/meson/issues/1781 for official
# internal VAPI support.
geary_engine_vala_options = geary_vala_options
geary_engine_vala_options += [
geary_engine_vala_args = geary_vala_args
geary_engine_vala_args += [
'--internal-header=@0@/geary-engine-internal.h'.format(build_dir),
'--internal-vapi=@0@/geary-engine-internal.vapi'.format(build_dir)
]
if libunwind_dep.found()
geary_engine_vala_options += [
geary_engine_vala_args += [
'-D', 'HAVE_LIBUNWIND',
]
endif
if get_option('tnef-support')
geary_engine_dependencies += libytnef
geary_engine_vala_options += [
geary_engine_vala_args += [
'-D', 'WITH_TNEF_SUPPORT'
]
endif
@ -366,8 +366,8 @@ geary_engine_lib = static_library('geary-engine',
geary_engine_sources,
dependencies: geary_engine_dependencies,
include_directories: config_h_dir,
vala_args: geary_engine_vala_options,
c_args: geary_c_options,
vala_args: geary_engine_vala_args,
c_args: geary_c_args,
)
# Dummy target to tell Meson about the internal VAPI given the

View file

@ -13,6 +13,6 @@ geary_mailer = executable('geary-mailer',
geary_mailer_sources,
dependencies: geary_mailer_dependencies,
include_directories: config_h_dir,
vala_args: geary_vala_options,
c_args: geary_c_options,
vala_args: geary_vala_args,
c_args: geary_c_args,
)

View file

@ -1,19 +1,41 @@
# Common vala options
geary_vala_options = [
'--target-glib=@0@'.format(target_glib),
# Build source configuration
config_h_dir = include_directories('.')
conf = configuration_data()
conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
conf.set_quoted('G_LOG_DOMAIN', meson.project_name())
conf.set_quoted('_APP_ID', geary_id)
conf.set_quoted('_BUILD_ROOT_DIR', meson.build_root())
conf.set_quoted('_GSETTINGS_DIR', join_paths(meson.build_root(), 'desktop'))
conf.set_quoted('_INSTALL_PREFIX', geary_prefix)
conf.set_quoted('_ISO_CODE_3166_XML', iso_3166_xml)
conf.set_quoted('_ISO_CODE_639_XML', iso_639_xml)
conf.set_quoted('_LANGUAGE_SUPPORT_DIRECTORY', locale_dir)
conf.set_quoted('_NAME_SUFFIX', name_suffix)
conf.set_quoted('_PLUGINS_DIR', plugins_dir)
conf.set_quoted('_PROFILE', profile)
conf.set_quoted('_REVNO', revno)
conf.set_quoted('_SOURCE_ROOT_DIR', meson.source_root())
conf.set_quoted('_VERSION', geary_version)
conf.set_quoted('_WEB_EXTENSIONS_DIR', web_extensions_dir)
configure_file(output: 'config.h', configuration: conf)
# Common valac options
geary_vala_args = [
'--enable-checking',
]
# Symbols for valac's preprocessor must be defined as compiler args,
# not in the code or in config.h
if reference_tracking
geary_vala_options += [ '--define=REF_TRACKING' ]
geary_vala_args += [ '--define=REF_TRACKING' ]
endif
if not poodle
geary_vala_options += [ '--define=DISABLE_POODLE' ]
geary_vala_args += [ '--define=DISABLE_POODLE' ]
endif
geary_c_options = [
# Common cc options
geary_c_args = [
'-include', 'config.h',
# Enable GLib structured logging
'-DG_LOG_USE_STRUCTURED',
@ -22,6 +44,7 @@ geary_c_options = [
'-DUNW_LOCAL_ONLY',
# None of these kids want to hang out unless you are cool enough
'-DGCK_API_SUBJECT_TO_CHANGE',
'-DGCR_API_SUBJECT_TO_CHANGE',
'-DGOA_API_IS_SUBJECT_TO_CHANGE',
'-DHANDY_USE_UNSTABLE_API',
]
@ -40,13 +63,15 @@ geary_web_process_sources = files(
# Web process extension library
geary_web_process = library('geary-web-process',
geary_web_process_sources,
c_args: geary_c_options,
dependencies: [
geary_engine_dep,
gee,
gmime,
webkit2gtk_web_extension,
],
include_directories: config_h_dir,
vala_args: geary_client_vala_args,
c_args: geary_c_args,
install: true,
install_dir: web_extensions_dir
)
@ -80,8 +105,8 @@ geary_bin_dependencies = [
geary_bin = executable('geary',
geary_bin_sources,
dependencies: geary_bin_dependencies,
vala_args: geary_vala_options,
c_args: geary_c_options,
vala_args: geary_vala_args,
c_args: geary_c_args,
install: true,
)
@ -95,15 +120,22 @@ if enable_valadoc
'--verbose',
'--force',
'--internal',
'--package-name=@0@-@1@'.format(meson.project_name(), meson.project_version()),
'--package-name=@0@'.format(meson.project_name()),
'--package-version=@0@'.format(meson.project_version()),
'--target-glib=@0@'.format(target_glib),
'-b', meson.current_source_dir(),
'-o', '@OUTPUT@',
'--vapidir=@0@'.format(vapi_dir),
'--vapidir=@0@'.format(meson.current_build_dir()),
# Hopefully, Meson gets baked-in valadoc support, so we don't have to do this (see also https://github.com/mesonbuild/meson/issues/894)
'--pkg', 'glib-2.0', '--pkg', 'gio-2.0', '--pkg', 'gee-0.8', '--pkg', 'sqlite3', '--pkg', 'gmime-2.6', '--pkg', 'javascriptcoregtk-4.0', '--pkg', 'libxml-2.0', '--pkg', 'libunwind',
# Hopefully, Meson gets baked-in valadoc support, so we don't
# have to do this (see https://github.com/mesonbuild/meson/issues/894)
'--pkg', 'glib-2.0',
'--pkg', 'gio-2.0',
'--pkg', 'gee-0.8',
'--pkg', 'sqlite3',
'--pkg', 'gmime-2.6',
'--pkg', 'javascriptcoregtk-4.0',
'--pkg', 'libxml-2.0',
'--pkg', 'libunwind',
'@INPUT@',
]
)

View file

@ -114,8 +114,8 @@ geary_test_lib = static_library('test-lib',
geary_test_lib_sources,
dependencies: geary_test_lib_dependencies,
include_directories: config_h_dir,
vala_args: geary_vala_options,
c_args: geary_c_options,
vala_args: geary_vala_args,
c_args: geary_c_args,
)
# Engine tests
@ -125,11 +125,11 @@ geary_test_engine_dependencies = [
]
geary_test_engine_dependencies += geary_engine_dependencies
geary_test_engine_vala_options = geary_vala_options
geary_test_engine_vala_args = geary_vala_args
if get_option('tnef-support')
geary_test_engine_dependencies += libytnef
geary_test_engine_vala_options += [
geary_test_engine_vala_args += [
'-D', 'WITH_TNEF_SUPPORT'
]
endif
@ -139,8 +139,8 @@ geary_test_engine_bin = executable('test-engine',
link_with: geary_test_lib,
dependencies: geary_test_engine_dependencies,
include_directories: config_h_dir,
vala_args: geary_test_engine_vala_options,
c_args: geary_c_options,
vala_args: geary_test_engine_vala_args,
c_args: geary_c_args,
)
# Client tests
@ -155,8 +155,8 @@ geary_test_client_bin = executable('test-client',
dependencies: geary_test_client_dependencies,
link_with: geary_test_lib,
include_directories: config_h_dir,
vala_args: geary_vala_options,
c_args: geary_c_options,
vala_args: geary_vala_args,
c_args: geary_c_args,
)
# Integration tests
@ -172,8 +172,8 @@ geary_test_integration_bin = executable('test-integration',
],
link_with: geary_test_lib,
include_directories: config_h_dir,
vala_args: geary_vala_options,
c_args: geary_c_options,
vala_args: geary_vala_args,
c_args: geary_c_args,
)
test('engine-tests', geary_test_engine_bin)