summaryrefslogtreecommitdiff
path: root/meson.build
blob: 51a59e331f3676b597de7bdc78499d77c35e3637 (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
project('gnome-desktop', 'c',
  meson_version: '>= 0.56.2',
  version: '44.0',
  license: ['GPL-2.0-or-later', 'LGPL-2.1-or-later'],
  default_options: [
    'c_std=gnu99',
  ],
)

# Before making a release, the libversion string should be modified.
#
#  * Bump the first component if binary compatibility has been broken; or
#  * Bump the second component if new APIs are added; or
#  * Bump the third component otherwise.
#
# When bumping the first component version, set the second and third components
# to 0. When bumping the second version, set the third one to zero.
#
# A lot easier than libtool, right?
libversion = '2.1.0'
soversion = libversion.split('.')[0]

# Compatibility versions for libgnome-desktop-3
compat_libversion = '20.0.0'
compat_soversion = compat_libversion.split('.')[0]

gdk_pixbuf_req = '>= 2.36.5'
gtk3_req = '>= 3.3.6'
gtk4_req = '>= 4.4.0'
glib_req = '>= 2.53.0'
xrandr_req = '>= 1.3'
schemas_req = '>= 3.27.0'
xext_req = '>= 1.1'

gnome = import('gnome')
i18n = import('i18n')
pkg = import('pkgconfig')

prefix = get_option('prefix')

datadir = prefix / get_option('datadir')
libexecdir = prefix / get_option('libexecdir')

liblocaledir = get_option('prefix') / 'lib/locale'
localedir = datadir / 'locale'
test_metadir = datadir / 'installed-tests' / meson.project_name()
test_execdir = libexecdir / 'installed-tests' / meson.project_name()
versiondir = datadir / 'gnome'

gdk_pixbuf_dep = dependency('gdk-pixbuf-2.0', version: gdk_pixbuf_req)
gtk3_dep = dependency('gtk+-3.0', version: gtk3_req, required: get_option('legacy_library'))
gtk4_dep = dependency('gtk4', version: gtk4_req, required: get_option('build_gtk4'))
glib_dep = dependency('glib-2.0', version: glib_req)
gio_dep = dependency('gio-2.0', version: glib_req)
gio_unix_dep = dependency('gio-unix-2.0', version: glib_req)
schemas_dep = dependency('gsettings-desktop-schemas', version: schemas_req)
fontconfig_dep = dependency('fontconfig')
xkb_config_dep = dependency('xkeyboard-config')
xkbregistry_dep = dependency('xkbregistry', required: false)
iso_codes_dep = dependency('iso-codes')
libsystemd_dep = dependency('libsystemd', required: get_option('systemd'))
udev_dep = dependency('libudev', required: get_option('udev'))

# Check for bubblewrap compatible platform
host_os = host_machine.system()
host_cpu = host_machine.cpu()
supported_os = ['linux']
unsupported_cpus = ['alpha', 'ia64', 'm68k', 'sh4', 'sparc', 'sparc64']
if supported_os.contains(host_os) and not unsupported_cpus.contains(host_cpu)
  seccomp_dep = dependency('libseccomp')
else
  seccomp_dep = dependency('', required: false)
endif

fontconfig_cache_path = fontconfig_dep.get_variable(pkgconfig: 'cachedir')
xkb_base = xkb_config_dep.get_variable(pkgconfig: 'xkb_base')
iso_codes_prefix = iso_codes_dep.get_variable(pkgconfig: 'prefix')

cc = meson.get_compiler('c')

m_dep = cc.find_library('m', required: false)
rt_dep = cc.find_library('rt', required: false)

if not cc.has_function('clock_gettime', dependencies: rt_dep)
  rt_dep = dependency('', required: false)
endif

subdir('libgnome-desktop')
subdir('po')
subdir('tests')

if get_option('desktop_docs')
  subdir('desktop-docs/fdl')
  subdir('desktop-docs/gpl')
  subdir('desktop-docs/lgpl')
endif

if get_option('gtk_doc')
  subdir('docs/reference/gnome-desktop3')
endif

summary({
    'prefix': get_option('prefix'),
    'datadir': datadir,
    'libexecdir': libexecdir,
    'localedir': localedir,
    'versiondir': versiondir,
  },
  section: 'Directories',
)

summary({
    'Use systemd': get_option('systemd').enabled() or get_option('systemd').auto(),
    'Use udev': get_option('udev').enabled() or get_option('udev').auto(),
    'Build GTK4 libraries': get_option('build_gtk4'),
    'Build legacy libgnome-desktop': get_option('legacy_library'),
    'Desktop documentation': get_option('desktop_docs'),
    'API documentation': get_option('gtk_doc'),
    'Debug tools': get_option('debug_tools'),
    'Installed tests': get_option('installed_tests'),
  },
  section: 'Build options',
  bool_yn: true,
)