1# Meson build file
2
3# https://github.com/linuxmint/cinnamon-desktop
4project('cinnamon-desktop', 'c', version: '4.8.1',
5  meson_version: '>=0.41.0'
6)
7
8# Before making a release, the LT_VERSION string should be modified.
9# The string is of the form C.R.A.
10# - If interfaces have been changed or added, but binary compatibility has
11#   been preserved, change to C+1.0.A+1
12# - If binary compatibility has been broken (eg removed or changed interfaces)
13#   change to C+1.0.0
14# - If the interface is the same as the previous version, change to C.R+1.A
15LT_VERSION='4.0.0'
16
17################################################################################
18conf = configuration_data()
19
20pkgconfig = import('pkgconfig')
21i18n      = import('i18n')
22gnome     = import('gnome')
23
24cc                = meson.get_compiler('c')
25
26if not get_option('deprecation_warnings')
27  add_global_arguments('-Wno-deprecated-declarations', language: 'c')
28endif
29
30################################################################################
31
32math    = cc.find_library('m')
33
34gdk_pixb= dependency('gdk-pixbuf-2.0',  version: '>=2.22.0')
35gio     = dependency('gio-2.0',         version: '>=2.37.3')
36glib    = dependency('glib-2.0',        version: '>=2.37.3')
37gtk     = dependency('gtk+-3.0',        version: '>=3.3.16')
38
39x11     = dependency('x11')
40xext    = dependency('xext',            version: '>=1.1')
41xkbconf = dependency('xkeyboard-config')
42xkbfile = dependency('xkbfile')
43xrandr  = dependency('xrandr',          version: '>=1.3')
44
45cinnamon_deps = [
46  gdk_pixb,
47  gio,
48  glib,
49  gtk,
50  math,
51  x11,
52  xext,
53  xkbconf,
54  xkbfile,
55  xrandr,
56]
57
58# CVC dependencies
59gobject = dependency('gobject-2.0')
60
61cvc_deps = cinnamon_deps + [
62  gobject
63]
64
65use_alsa = get_option('alsa')
66
67if use_alsa
68  cvc_deps += dependency('alsa')
69endif
70
71xkb_base = xkbconf.get_pkgconfig_variable('xkb_base')
72
73# Path to the pnp.ids file -- to know if we use one shipped with another
74# package, or an internal file
75
76pnp_ids_path = get_option('pnp_ids')
77pnp_ids_install_internal = (pnp_ids_path == '')
78
79if pnp_ids_install_internal
80  # Default value
81  pnp_ids_path = join_paths(get_option('datadir'), 'libcinnamon-desktop')
82  pnp_ids_abspath = join_paths(get_option('prefix'), pnp_ids_path)
83else
84  pnp_ids_abspath = pnp_ids_path
85endif
86
87################################################################################
88# Config
89
90timerfd_check = cc.compiles('''
91#include <sys/timerfd.h>
92#include <unistd.h>
93int main () {
94  timerfd_create (CLOCK_MONOTONIC, TFD_CLOEXEC);
95  return 0;
96}
97''')
98
99gettext_package = meson.project_name()
100conf.set_quoted('GETTEXT_PACKAGE', gettext_package)
101conf.set_quoted('GNOMELOCALEDIR', join_paths(get_option('prefix'), get_option('localedir')))
102conf.set_quoted('PACKAGE_VERSION', meson.project_version())
103
104conf.set('HAVE_BIND_TEXTDOMAIN_CODESET', cc.has_function('bind_textdomain_codeset'))
105conf.set('datadir',             get_option('datadir'))
106conf.set('ENABLE_NLS',          cc.has_header('libintl.h'))
107conf.set('HAVE_ALSA',           use_alsa)
108conf.set('HAVE_GETTEXT',        true)
109conf.set('HAVE_INTROSPECTION',  true)
110conf.set('HAVE_TIMERFD',        timerfd_check)
111
112################################################################################
113
114rootInclude = include_directories('.')
115
116configure_file(
117  output: 'config.h',
118  configuration: conf
119)
120
121subdir('install-scripts')
122subdir('po')
123subdir('libcinnamon-desktop')
124subdir('schemas')
125
126
127pnp_message = '@0@: @1@'.format(
128  ''+(pnp_ids_install_internal ? 'internal' : 'system'),
129  pnp_ids_abspath
130)
131
132message('\n'.join([
133  '',
134  '        prefix:                       ' + get_option('prefix'),
135  '        exec_prefix:                  ' + get_option('prefix'),
136  '        libdir:                       ' + get_option('libdir'),
137  '        bindir:                       ' + get_option('bindir'),
138  '        sbindir:                      ' + get_option('sbindir'),
139  '        sysconfdir:                   ' + get_option('sysconfdir'),
140  '        localstatedir:                ' + get_option('localstatedir'),
141  '        datadir:                      ' + get_option('datadir'),
142  '        source code location:         ' + meson.source_root(),
143  '        compiler:                     ' + cc.get_id(),
144  '        debugging support:            ' + get_option('buildtype'),
145  '        Use *_DISABLE_DEPRECATED:     @0@'.format(get_option('deprecation_warnings')),
146  '        Use PNP files:                ' + pnp_message,
147  '        Use ALSA:                     ' + '@0@'.format(use_alsa),
148  '',
149]))
150