1# Meson build file
2
3# https://github.com/linuxmint/nemo
4project('nemo', 'c', version: '4.8.3',
5  meson_version: '>=0.41.0'
6)
7
8# 1. If the library code has changed at all since last release, then increment revision.
9# 2. If any interfaces have been added, then increment current and set revision to 0.
10# Interface break is not allowed.
11nemo_extension_current  = 5
12nemo_extension_revision = 0
13
14# We need to decrement current by one in the calculation of the age because
15# the library was started with version "1:0:0" instead of "0:0:0"
16NEMO_EXTENSION_VERSION_INFO = '@0@:@1@:@2@'.format(
17  nemo_extension_current, nemo_extension_revision, nemo_extension_current - 1
18)
19
20################################################################################
21conf = configuration_data()
22
23gnome = import('gnome')
24pkgconfig = import('pkgconfig')
25
26cc = meson.get_compiler('c')
27prefix = get_option('prefix')
28buildtype = get_option('buildtype')
29
30# Surround the version in quotes to make it a C string
31conf.set_quoted('VERSION', meson.project_version())
32conf.set('ENABLE_DEBUG', buildtype == 'debug')
33
34check_headers = [
35  'sys/mount.h',
36  'sys/param.h',
37  'sys/vfs.h',
38  'X11/XF86keysym.h',
39]
40
41foreach h : check_headers
42  conf.set10('HAVE_' + h.underscorify().to_upper(), cc.has_header(h))
43endforeach
44
45
46
47if not get_option('deprecated_warnings')
48  add_global_arguments([
49      '-Wno-deprecated-declarations',
50      '-Wno-deprecated',
51      '-Wno-declaration-after-statement',
52      '-DGLIB_DISABLE_DEPRECATION_WARNINGS',
53    ],
54    language: 'c',
55  )
56endif
57
58if get_option('profiling')
59    add_global_arguments('-fno-omit-frame-pointer',
60        language: 'c')
61endif
62
63################################################################################
64# Find dependencies
65
66glib_version = '>=2.45.7'
67
68math    = cc.find_library('m', required: true)
69
70gtk     = dependency('gtk+-3.0',                    version: '>=3.10.0')
71gio     = dependency('gio-2.0',                     version: glib_version)
72gio_unix= dependency('gio-unix-2.0',                version: glib_version)
73glib    = dependency('glib-2.0',                    version: glib_version)
74gmodule = dependency('gmodule-no-export-2.0',       version: glib_version)
75gobject = dependency('gobject-2.0',                 version: '>=2.0')
76go_intr = dependency('gobject-introspection-1.0',   version: '>=1.0')
77libnotif= dependency('libnotify',                   version: '>=0.7.0')
78
79cinnamon= dependency('cinnamon-desktop',            version: '>=4.8.0')
80gail    = dependency('gail-3.0')
81libxml  = dependency('libxml-2.0',                  version: '>=2.7.8')
82x11     = dependency('x11')
83xapp    = dependency('xapp',                        version: '>=2.0.0')
84
85# Facultative dependencies
86
87trackerChoice = get_option('tracker')
88tracker_enabled = false
89if trackerChoice != 'false'
90  trackerRequired = (trackerChoice == 'true')
91  # Check all the possible versions
92    tracker_sparql = dependency('tracker-sparql-2.0',  required: false)
93  if not tracker_sparql.found()
94    tracker_sparql = dependency('tracker-sparql-1.0',  required: false)
95  endif
96  if not tracker_sparql.found()
97    tracker_sparql = dependency('tracker-sparql-0.18', required: false)
98  endif
99  if not tracker_sparql.found()
100    tracker_sparql = dependency('tracker-sparql-0.16', required: trackerRequired)
101  endif
102
103  tracker_enabled = trackerRequired or tracker_sparql.found()
104endif
105conf.set('ENABLE_TRACKER', tracker_enabled)
106
107
108gtkdoc_enabled = get_option('gtk_doc')
109if gtkdoc_enabled
110  find_program('gtkdoc-scan', required: true)
111endif
112
113
114libexif_enabled = get_option('exif')
115if libexif_enabled
116  libexif = dependency('libexif',                   version: '>=0.6.20')
117endif
118conf.set('HAVE_EXIF', libexif_enabled)
119
120exempi_enabled = get_option('xmp')
121if exempi_enabled
122  exempi = dependency('exempi-2.0',                 version: '>=2.2.0')
123endif
124conf.set('HAVE_EXEMPI', exempi_enabled)
125
126libselinux_enabled = get_option('selinux')
127if libselinux_enabled
128  libselinux = dependency('libselinux',             version: '>=2.0')
129endif
130conf.set('HAVE_SELINUX', libselinux_enabled)
131
132# make sure pango development files are installed
133pango = dependency('pango', version: '>=1.40.0')
134# check for newer pango for necessary workarounds
135new_pango = dependency('pango', version: '>=1.44.0', required: false)
136if new_pango.found()
137  conf.set('HAVE_PANGO_144', true)
138else
139  message('................using pango @0@ instead'.format(new_pango.version()))
140endif
141
142enableEmptyView = get_option('empty_view')
143conf.set10('ENABLE_EMPTY_VIEW', enableEmptyView)
144
145conf.set_quoted('GETTEXT_PACKAGE', 'nemo')
146conf.set_quoted('LOCALE_DIR',  join_paths(get_option('prefix'), get_option('localedir')))
147conf.set_quoted('LOCALEDIR',   join_paths(get_option('prefix'), get_option('localedir')))
148conf.set('ENABLE_NLS', cc.has_header('libintl.h'))
149conf.set('HAVE_GETTEXT', true)
150conf.set('HAVE_LOCALE_H', cc.has_header('locale.h'))
151
152# STATX Support check
153statx_supported = cc.compiles(
154'''
155#define _GNU_SOURCE
156#include <linux/stat.h>
157
158struct statx stxbuf;
159'''
160)
161
162if not statx_supported
163    message('WARNING: No native statx support (Kernel < 4.11) - using compatibility wrappers.')
164else
165    message('Native statx support used.')
166endif
167
168conf.set10('NATIVE_STATX', statx_supported)
169# End STATX
170
171configure_file(
172  input : 'config.h.meson.in',
173  output: 'config.h',
174  configuration: conf
175)
176
177################################################################################
178
179rootInclude = include_directories('.')
180nemoDataPath      = join_paths(get_option('prefix'), get_option('datadir'), 'nemo')
181libExecPath       = join_paths(get_option('prefix'), get_option('libexecdir'))
182# Keep this constant, in case some extensions are behind in being updated...
183nemoExtensionPath = join_paths(get_option('prefix'), get_option('libdir'), 'nemo', 'extensions-3.0')
184
185nemo_definitions =  [
186  '-DNEMO_DATADIR="@0@"'.format(nemoDataPath),
187  '-DNEMO_EXTENSIONDIR="@0@"'.format(nemoExtensionPath),
188  '-DLIBEXECDIR="@0@"'.format(libExecPath),
189]
190
191po_subdir = join_paths(meson.source_root(), 'po')
192
193subdir('install-scripts')
194subdir('cut-n-paste-code/libegg')
195subdir('data')
196subdir('eel')
197subdir('files')
198subdir('gresources')
199subdir('libnemo-extension')
200subdir('libnemo-private')
201# subdir('po')
202subdir('src')
203subdir('test')
204subdir('docs')
205
206message('\n'.join(['',
207'        @0@-@1@'.format(meson.project_name(), meson.project_version()),
208'',
209'    prefix:                 @0@'.format(prefix),
210'    source code location:   @0@'.format(meson.source_root()),
211'    compiler:               @0@'.format(cc.get_id()),
212'    debugging support:      @0@'.format(buildtype),
213'    libexif support:        @0@'.format(libexif_enabled),
214'    exempi  support:        @0@'.format(exempi_enabled),
215'    Tracker support:        @0@'.format(tracker_enabled),
216'',
217'    nemo-extension documentation: @0@'.format(gtkdoc_enabled),
218'    nemo-extension introspection: @0@'.format(true),
219'',
220'    perf profiling support: @0@'.format(get_option('profiling')),
221'',
222]))
223