summaryrefslogtreecommitdiff
path: root/meson.build
blob: 6bd3108e6a2da57c8922c5ad03935d28dd96be88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
project(
  'pluma', 'c',
  version: '1.28.1',
  meson_version: '>= 0.61.2',
  license: 'GPL2',
  default_options: ['warning_level=1', 'buildtype=debugoptimized', 'c_std=gnu11'],
)

gnome = import('gnome')
i18n = import('i18n')
cc = meson.get_compiler('c')

version_arr = meson.project_version().split('.')
pluma_major_version = version_arr[0].to_int()
pluma_minor_version = version_arr[1].to_int()
pluma_micro_version = version_arr[2].to_int()

prefix      = get_option('prefix')
bindir      = join_paths(prefix, get_option('bindir'))
libdir      = join_paths(prefix, get_option('libdir'))
datadir     = join_paths(prefix, get_option('datadir'))
includedir  = join_paths(prefix, get_option('includedir'))
libexecdir  = join_paths(prefix, get_option('libexecdir'))
localedir   = join_paths(prefix, get_option('localedir'))
pkgdatadir  = join_paths(datadir, 'pluma')
pkglibdir   = join_paths(libdir, 'pluma')
pluginsdir  = join_paths(pkglibdir, 'plugins')

config_h = configuration_data()
config_h.set_quoted('PACKAGE',      'pluma')
config_h.set_quoted('PACKAGE_URL',  'https://github.com/mate-desktop/pluma')
config_h.set_quoted('VERSION',      meson.project_version())
config_h.set_quoted('GETTEXT_PACKAGE', 'pluma')
config_h.set_quoted('DATADIR',      datadir)
config_h.set_quoted('PLUMA_DATADIR', pkgdatadir)
config_h.set_quoted('LIBDIR',       libdir)
config_h.set_quoted('PLUMA_LIBDIR', pkglibdir)
config_h.set_quoted('PLUMA_LOCALEDIR', localedir)
config_h.set('PLUMA_MAJOR_VERSION', pluma_major_version)
config_h.set('PLUMA_MINOR_VERSION', pluma_minor_version)
config_h.set('PLUMA_MICRO_VERSION', pluma_micro_version)

add_project_arguments('-DHAVE_CONFIG_H', language: 'c')
add_project_arguments('-I' + meson.project_build_root(), language: 'c')

if get_option('gvfs-metadata')
  config_h.set('ENABLE_GVFS_METADATA', 1)
endif

# Required dependencies
libxml_dep        = dependency('libxml-2.0',        version: '>= 2.5.0')
glib_dep          = dependency('glib-2.0',          version: '>= 2.50.0')
gmodule_dep       = dependency('gmodule-2.0',       required: false)
gthread_dep       = dependency('gthread-2.0',       version: '>= 2.13.0')
gio_dep           = dependency('gio-2.0',           version: '>= 2.50.0')
gtk_dep           = dependency('gtk+-3.0',          version: '>= 3.22.0')
gtksourceview_dep = dependency('gtksourceview-4',   version: '>= 4.0.2')
libpeas_dep       = dependency('libpeas-1.0',       version: '>= 1.2.0')
libpeas_gtk_dep   = dependency('libpeas-gtk-1.0',   version: '>= 1.2.0')
mate_desktop_dep  = dependency('mate-desktop-2.0',  version: '>= 1.27.1')
x11_dep           = dependency('x11')
sm_dep            = dependency('sm',                version: '>= 1.0.0')
ice_dep           = dependency('ice',               version: '>= 1.0.0')
m_dep             = cc.find_library('m', required: false)

mate_submodules_dep = dependency('mate-submodules', version: '1.24.0',
  fallback: ['mate-submodules', 'mate_submodules_dep'])

pluma_deps = [
  libxml_dep,
  glib_dep,
  gthread_dep,
  gio_dep,
  gtk_dep,
  gtksourceview_dep,
  libpeas_dep,
  libpeas_gtk_dep,
  mate_desktop_dep,
  x11_dep,
]
if m_dep.found()
  pluma_deps += [m_dep]
endif
if gmodule_dep.found()
  pluma_deps += [gmodule_dep]
endif

# Optional: GObject Introspection
have_introspection = false
gobject_introspection_dep = dependency('gobject-introspection-1.0',
  version: '>= 0.9.3',
  required: get_option('introspection'))
if gobject_introspection_dep.found()
  have_introspection = true
  config_h.set('HAVE_INTROSPECTION', 1)
endif

# Optional: Spell plugin (enchant + iso-codes)
have_enchant = false
if get_option('spell')
  enchant_dep = dependency('enchant-2', version: '>= 1.6.0', required: false)
  if not enchant_dep.found()
    enchant_dep = dependency('enchant', version: '>= 1.6.0', required: false)
  endif
  if enchant_dep.found()
    iso_codes_dep = dependency('iso-codes', version: '>= 0.35', required: false)
    if iso_codes_dep.found()
      have_enchant = true
      config_h.set('HAVE_ISO_CODES', 1)
      config_h.set_quoted('ISO_CODES_PREFIX',
        iso_codes_dep.get_variable(pkgconfig: 'prefix'))
    else
      error('iso-codes is required for spell plugin. Use -Dspell=false to disable.')
    endif
  endif
endif

configure_file(output: 'config.h', configuration: config_h)

root_inc = include_directories('.')

subdir('pluma')
subdir('data')
subdir('po')
subdir('plugins')
subdir('help')
if get_option('tests')
  subdir('tests')
endif

gnome.post_install(
  glib_compile_schemas: true,
  update_desktop_database: find_program('update-desktop-database', required: false).found(),
)

summary({
  'GObject introspection': have_introspection,
  'Spell checking':        have_enchant,
  'GVFS metadata':         get_option('gvfs-metadata'),
  'Tests':                 get_option('tests'),
})