meson.build 7.44 KB
Newer Older
1
project('geary', [ 'vala', 'c' ],
2
  version: '40.0',
3
  license: 'LGPL2.1+',
4
  meson_version: '>= 0.55',
5 6
)

7 8 9 10 11 12 13 14
# Determine the type of build
profile = get_option('profile')
appid_suffix = ''
name_suffix = ''
if profile == 'auto'
  if run_command('[', '-d', '.git', ']').returncode() == 0
    profile = 'development'
  else
15
    error('No build profile specified, see BUILDING.md')
16 17 18 19 20
  endif
endif

if profile == 'development'
  appid_suffix = '.Devel'
21
  name_suffix = ' (Development)'
22 23
elif profile == 'beta'
  appid_suffix = '.Beta'
Michael Gratton's avatar
Michael Gratton committed
24
  name_suffix = ' (Beta)'
25
elif profile != 'release'
26
  error('Unknown build profile specified, see BUILDING.md')
27 28
endif

29
# Configurable install dirs
30
geary_prefix = get_option('prefix')
31 32 33 34
bin_dir = geary_prefix / get_option('bindir')
data_dir = geary_prefix / get_option('datadir')
lib_dir = geary_prefix / get_option('libdir')
locale_dir = geary_prefix / get_option('localedir')
35

36
# Source dirs
37 38 39
metadata_dir = meson.source_root() / 'bindings'/ 'metadata'
po_dir = meson.source_root() / 'po'
vapi_dir = meson.source_root() / 'bindings' / 'vapi'
40

41
# Compiler configuration
42
add_project_arguments([
43
    # Make sure Meson can find custom VAPIs
44 45 46 47 48
    '--vapidir', vapi_dir,
    '--metadatadir', metadata_dir,
  ],
  language: 'vala'
)
49 50
cc = meson.get_compiler('c')
valac = meson.get_compiler('vala')
51

52
#
53
# Required libraries and other dependencies
54 55
#

56 57 58 59
target_glib = '2.66'
target_gtk = '3.24.23'
target_vala = '0.48.11'
target_webkit = '2.30'
60

61 62 63 64
if not valac.version().version_compare('>=' + target_vala)
  error('Vala does not meet minimum required version: ' + target_vala)
endif

65
# Primary deps
66
glib = dependency('glib-2.0', version: '>=' + target_glib)
67
gmime = dependency('gmime-3.0', version: '>= 3.2.4')
68
gtk = dependency('gtk+-3.0', version: '>=' + target_gtk)
69
sqlite = dependency('sqlite3', version: '>= 3.24')
70 71 72
webkit2gtk = dependency('webkit2gtk-4.0', version: '>=' + target_webkit)

# Secondary deps - keep sorted alphabetically
Federico Bruni's avatar
Federico Bruni committed
73 74 75
# We need appdata.its from appstream-glib:
# https://gitlab.gnome.org/GNOME/geary/issues/439
appstream_glib = dependency('appstream-glib', version: '>=0.7.10')
76
cairo = dependency('cairo')
77
enchant = dependency('enchant-2', version: '>=2.1')
78
folks = dependency('folks', version: '>=0.11')
79
gck = dependency('gck-1')
80
gcr = dependency('gcr-3', version: '>= 3.10.1')
81 82 83
gdk = dependency('gdk-3.0', version: '>=' + target_gtk)
gee = dependency('gee-0.8', version: '>= 0.8.5')
gio = dependency('gio-2.0', version: '>=' + target_glib)
84
goa = dependency('goa-1.0')
85
gsound = dependency('gsound')
86
gspell = dependency('gspell-1')
87
gthread = dependency('gthread-2.0', version: '>=' + target_glib)
88
icu_uc = dependency('icu-uc', version: '>=60')
89
iso_codes = dependency('iso-codes')
90
javascriptcoregtk = dependency('javascriptcoregtk-4.0', version: '>=' + target_webkit)
91
json_glib = dependency('json-glib-1.0', version: '>= 1.0')
92
libhandy = dependency('libhandy-1', version: '>= 1.2.1', required: false)
93
libmath = cc.find_library('m')
Michael Gratton's avatar
Michael Gratton committed
94
libpeas = dependency('libpeas-1.0', version: '>= 1.24.0')
95
libpeas_gtk = dependency('libpeas-gtk-1.0', version: '>= 1.24.0')
96
libsecret = dependency('libsecret-1', version: '>= 0.11')
97
libstemmer_dep = cc.find_library('stemmer')
98
libsoup = dependency('libsoup-2.4', version: '>= 2.48')
99
libunwind_dep = dependency(
100
  'libunwind', version: '>= 1.1', required: get_option('libunwind')
101 102
)
libunwind_generic_dep = dependency(
103
  'libunwind-generic', version: '>= 1.1', required: get_option('libunwind')
104
)
105
libxml = dependency('libxml-2.0', version: '>= 2.7.8')
106
libytnef = dependency('libytnef', version: '>= 1.9.3', required: get_option('tnef'))
107
posix = valac.find_library('posix')
108
webkit2gtk_web_extension = dependency('webkit2gtk-web-extension-4.0', version: '>=' + target_webkit)
109

110 111 112 113
# System dependencies above ensures appropriate versions for the
# following libraries, but the declared dependency is what we actually
# build against so we can include the custom VAPI correctly.

114 115 116 117 118 119 120
icu_uc = declare_dependency(
  dependencies: [
    valac.find_library('icu-uc', dirs: [vapi_dir]),
    cc.find_library('icuuc'),
  ],
)

121
if libunwind_dep.found()
122 123
  # We need to add native lib to the search path for these so Flatpak
  # builds can find it.
124 125 126 127 128 129 130 131 132
  unwind_lib = libunwind_dep.get_pkgconfig_variable('libdir')
  libunwind = declare_dependency(
     dependencies: [
       valac.find_library('libunwind', dirs: [vapi_dir, unwind_lib]),
       cc.find_library('libunwind', dirs: unwind_lib),
       cc.find_library('libunwind-generic', dirs: unwind_lib)
     ],
   )
endif
133

134 135 136 137 138 139 140
libstemmer = declare_dependency(
  dependencies: [
    valac.find_library('libstemmer', dirs: [vapi_dir]),
    libstemmer_dep,
  ],
)

141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
# Required until libhandy 1.2.1 is GA
libhandy_vapi = ''
if not libhandy.found()
  libhandy_project = subproject(
    'libhandy',
    default_options: [
      'examples=false',
      'package_subdir=geary',
      'tests=false',
    ]
  )
  libhandy = declare_dependency(
    dependencies: [
      libhandy_project.get_variable('libhandy_dep'),
      libhandy_project.get_variable('libhandy_vapi')
    ]
  )
  libhandy_vapi = meson.build_root() / 'subprojects' / 'libhandy' / 'src'
endif

161 162 163
# Optional dependencies
appstream_util = find_program('appstream-util', required: false)
desktop_file_validate = find_program('desktop-file-validate', required: false)
164
libmessagingmenu_dep = dependency('messaging-menu', version: '>= 12.10', required: false)
165

166 167 168 169 170
#
# Internal build configuration
#

# Build variables
171
geary_id = 'org.gnome.Geary@0@'.format(appid_suffix)
172
geary_version = meson.project_version()
173 174 175 176
revno = get_option('revno')
if revno == ''
  revno = run_command('build-aux/git_version.py').stdout().strip()
endif
177 178 179 180 181

gnome = import('gnome')
i18n = import('i18n')

# Static install dirs
182 183 184 185
dbus_services_dir = data_dir / 'dbus-1' / 'services'
client_lib_dir = lib_dir / 'geary'
plugins_dir = client_lib_dir / 'plugins'
web_extensions_dir = client_lib_dir / 'web-extensions'
186

187
# Ensure SQLite was built correctly
188
if not cc.has_header_symbol('sqlite3.h', 'SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER', dependencies: sqlite)
189 190 191 192
  error('SQLite3 was not built with FTS3 support. See BUILDING.md for details.')
endif
if not cc.has_header_symbol('sqlite3.h', 'Fts5ExtensionApi', dependencies: sqlite)
  error('SQLite3 was not built with FTS5 support. See BUILDING.md for details.')
193 194
endif

195 196 197 198
#
# Build glue
#

199 200
valadoc = find_program('valadoc', required: get_option('valadoc'))

201 202 203 204
vala_unit_proj = subproject(
  'vala-unit',
  default_options: [
    'install=false',
205
    'valadoc=@0@'.format(valadoc.found())
206 207 208 209
  ]
)
vala_unit_dep = vala_unit_proj.get_variable('vala_unit_dep')

210
# Language detection
211

212
iso_codes_dir = iso_codes.get_pkgconfig_variable('prefix')/'share'/'xml'/'iso-codes'
213 214

iso_639_xml = get_option('iso_639_xml')
215
if iso_639_xml == ''
216
  iso_639_xml = iso_codes_dir / 'iso_639.xml'
217
endif
218 219

iso_3166_xml = get_option('iso_3166_xml')
220
if iso_3166_xml == ''
221
  iso_3166_xml = iso_codes_dir / 'iso_3166.xml'
222
endif
223

224 225 226
files(iso_639_xml, iso_3166_xml) # Check to make sure these exist

# Post-install scripts
227
meson.add_install_script('build-aux' / 'post_install.py')
228

229 230 231 232 233 234 235
# GNOME Builder doesn't support YAML manifests, so generate a JSON
# version from the YAML and commit it. :( GNOME/gnome-builder#520
yaml_to_json = find_program('build-aux' / 'yaml_to_json.py')
custom_target(
  'org.gnome.Geary.json',
  build_by_default: true,
  command: [yaml_to_json, '@INPUT@', meson.source_root(), '@OUTPUT@'],
236
  input: files('org.gnome.Geary.yaml'),
237 238 239
  output: 'org.gnome.Geary.json'
)

240 241 242 243 244 245 246 247 248
# Subfolders
subdir('desktop')
subdir('help')
subdir('icons')
subdir('po')
subdir('sql')
subdir('ui')
subdir('src')
subdir('test')