1project('geary', [ 'vala', 'c' ], 2 version: '40.0', 3 license: 'LGPL2.1+', 4 meson_version: '>= 0.55', 5) 6 7# Determine the type of build 8profile = get_option('profile') 9appid_suffix = '' 10name_suffix = '' 11if profile == 'auto' 12 if run_command('[', '-d', '.git', ']').returncode() == 0 13 profile = 'development' 14 else 15 error('No build profile specified, see BUILDING.md') 16 endif 17endif 18 19if profile == 'development' 20 appid_suffix = '.Devel' 21 name_suffix = ' (Development)' 22elif profile == 'beta' 23 appid_suffix = '.Beta' 24 name_suffix = ' (Beta)' 25elif profile != 'release' 26 error('Unknown build profile specified, see BUILDING.md') 27endif 28 29# Configurable install dirs 30geary_prefix = get_option('prefix') 31bin_dir = geary_prefix / get_option('bindir') 32data_dir = geary_prefix / get_option('datadir') 33lib_dir = geary_prefix / get_option('libdir') 34locale_dir = geary_prefix / get_option('localedir') 35 36# Source dirs 37metadata_dir = meson.source_root() / 'bindings'/ 'metadata' 38po_dir = meson.source_root() / 'po' 39vapi_dir = meson.source_root() / 'bindings' / 'vapi' 40 41# Compiler configuration 42add_project_arguments([ 43 # Make sure Meson can find custom VAPIs 44 '--vapidir', vapi_dir, 45 '--metadatadir', metadata_dir, 46 ], 47 language: 'vala' 48) 49cc = meson.get_compiler('c') 50valac = meson.get_compiler('vala') 51 52# 53# Required libraries and other dependencies 54# 55 56target_glib = '2.66' 57target_gtk = '3.24.23' 58target_vala = '0.48.11' 59target_webkit = '2.30' 60 61if not valac.version().version_compare('>=' + target_vala) 62 error('Vala does not meet minimum required version: ' + target_vala) 63endif 64 65# Primary deps 66glib = dependency('glib-2.0', version: '>=' + target_glib) 67gmime = dependency('gmime-3.0', version: '>= 3.2.4') 68gtk = dependency('gtk+-3.0', version: '>=' + target_gtk) 69sqlite = dependency('sqlite3', version: '>= 3.24') 70webkit2gtk = dependency('webkit2gtk-4.0', version: '>=' + target_webkit) 71 72# Secondary deps - keep sorted alphabetically 73# We need appdata.its from appstream-glib: 74# https://gitlab.gnome.org/GNOME/geary/issues/439 75appstream_glib = dependency('appstream-glib', version: '>=0.7.10') 76cairo = dependency('cairo') 77enchant = dependency('enchant-2', version: '>=2.1') 78folks = dependency('folks', version: '>=0.11') 79gck = dependency('gck-1') 80gcr = dependency('gcr-3', version: '>= 3.10.1') 81gdk = dependency('gdk-3.0', version: '>=' + target_gtk) 82gee = dependency('gee-0.8', version: '>= 0.8.5') 83gio = dependency('gio-2.0', version: '>=' + target_glib) 84goa = dependency('goa-1.0') 85gsound = dependency('gsound') 86gspell = dependency('gspell-1') 87gthread = dependency('gthread-2.0', version: '>=' + target_glib) 88icu_uc = dependency('icu-uc', version: '>=60') 89iso_codes = dependency('iso-codes') 90javascriptcoregtk = dependency('javascriptcoregtk-4.0', version: '>=' + target_webkit) 91json_glib = dependency('json-glib-1.0', version: '>= 1.0') 92libhandy = dependency('libhandy-1', version: '>= 1.2.1', required: false) 93libmath = cc.find_library('m') 94libpeas = dependency('libpeas-1.0', version: '>= 1.24.0') 95libpeas_gtk = dependency('libpeas-gtk-1.0', version: '>= 1.24.0') 96libsecret = dependency('libsecret-1', version: '>= 0.11') 97libstemmer_dep = cc.find_library('stemmer', dirs: [ '/usr/local/lib/' ]) 98libsoup = dependency('libsoup-2.4', version: '>= 2.48') 99libunwind_dep = dependency( 100 'libunwind', version: '>= 1.1', required: get_option('libunwind') 101) 102libunwind_generic_dep = dependency( 103 'libunwind-generic', version: '>= 1.1', required: get_option('libunwind') 104) 105libxml = dependency('libxml-2.0', version: '>= 2.7.8') 106libytnef = dependency('libytnef', version: '>= 1.9.3', required: get_option('tnef')) 107posix = valac.find_library('posix') 108webkit2gtk_web_extension = dependency('webkit2gtk-web-extension-4.0', version: '>=' + target_webkit) 109 110# System dependencies above ensures appropriate versions for the 111# following libraries, but the declared dependency is what we actually 112# build against so we can include the custom VAPI correctly. 113 114icu_uc = declare_dependency( 115 dependencies: [ 116 valac.find_library('icu-uc', dirs: [vapi_dir]), 117 cc.find_library('icuuc', dirs: [ '/usr/local/lib/' ]), 118 ], 119) 120 121if libunwind_dep.found() 122 # We need to add native lib to the search path for these so Flatpak 123 # builds can find it. 124 unwind_lib = libunwind_dep.get_pkgconfig_variable('libdir') 125 libunwind = declare_dependency( 126 dependencies: [ 127 valac.find_library('libunwind', dirs: [vapi_dir, unwind_lib]), 128 cc.find_library('libunwind', dirs: unwind_lib), 129 cc.find_library('libunwind-generic', dirs: unwind_lib) 130 ], 131 ) 132endif 133 134libstemmer = declare_dependency( 135 dependencies: [ 136 valac.find_library('libstemmer', dirs: [vapi_dir]), 137 libstemmer_dep, 138 ], 139) 140 141# Required until libhandy 1.2.1 is GA 142libhandy_vapi = '' 143if not libhandy.found() 144 libhandy_project = subproject( 145 'libhandy', 146 default_options: [ 147 'examples=false', 148 'package_subdir=geary', 149 'tests=false', 150 ] 151 ) 152 libhandy = declare_dependency( 153 dependencies: [ 154 libhandy_project.get_variable('libhandy_dep'), 155 libhandy_project.get_variable('libhandy_vapi') 156 ] 157 ) 158 libhandy_vapi = meson.build_root() / 'subprojects' / 'libhandy' / 'src' 159endif 160 161# Optional dependencies 162appstream_util = find_program('appstream-util', required: false) 163desktop_file_validate = find_program('desktop-file-validate', required: false) 164libmessagingmenu_dep = dependency('messaging-menu', version: '>= 12.10', required: false) 165 166# 167# Internal build configuration 168# 169 170# Build variables 171geary_id = 'org.gnome.Geary@0@'.format(appid_suffix) 172geary_version = meson.project_version() 173revno = get_option('revno') 174if revno == '' 175 revno = run_command('build-aux/git_version.py').stdout().strip() 176endif 177 178gnome = import('gnome') 179i18n = import('i18n') 180 181# Static install dirs 182dbus_services_dir = data_dir / 'dbus-1' / 'services' 183client_lib_dir = lib_dir / 'geary' 184plugins_dir = client_lib_dir / 'plugins' 185web_extensions_dir = client_lib_dir / 'web-extensions' 186 187# Ensure SQLite was built correctly 188if not cc.has_header_symbol('sqlite3.h', 'SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER', dependencies: sqlite) 189 error('SQLite3 was not built with FTS3 support. See BUILDING.md for details.') 190endif 191if not cc.has_header_symbol('sqlite3.h', 'Fts5ExtensionApi', dependencies: sqlite) 192 error('SQLite3 was not built with FTS5 support. See BUILDING.md for details.') 193endif 194 195# 196# Build glue 197# 198 199valadoc = find_program('valadoc', required: get_option('valadoc')) 200 201vala_unit_proj = subproject( 202 'vala-unit', 203 default_options: [ 204 'install=false', 205 'valadoc=@0@'.format(valadoc.found()) 206 ] 207) 208vala_unit_dep = vala_unit_proj.get_variable('vala_unit_dep') 209 210# Language detection 211 212iso_codes_dir = iso_codes.get_pkgconfig_variable('prefix')/'share'/'xml'/'iso-codes' 213 214iso_639_xml = get_option('iso_639_xml') 215if iso_639_xml == '' 216 iso_639_xml = iso_codes_dir / 'iso_639.xml' 217endif 218 219iso_3166_xml = get_option('iso_3166_xml') 220if iso_3166_xml == '' 221 iso_3166_xml = iso_codes_dir / 'iso_3166.xml' 222endif 223 224files(iso_639_xml, iso_3166_xml) # Check to make sure these exist 225 226# Post-install scripts 227meson.add_install_script('build-aux' / 'post_install.py') 228 229# GNOME Builder doesn't support YAML manifests, so generate a JSON 230# version from the YAML and commit it. :( GNOME/gnome-builder#520 231yaml_to_json = find_program('build-aux' / 'yaml_to_json.py') 232custom_target( 233 'org.gnome.Geary.json', 234 build_by_default: true, 235 command: [yaml_to_json, '@INPUT@', meson.source_root(), '@OUTPUT@'], 236 input: files('org.gnome.Geary.yaml'), 237 output: 'org.gnome.Geary.json' 238) 239 240# Subfolders 241subdir('desktop') 242subdir('help') 243subdir('icons') 244subdir('po') 245subdir('sql') 246subdir('ui') 247subdir('src') 248subdir('test') 249