1project('nautilus', 'c',
2  default_options: ['c_std=c11'],
3
4  # Do not forget when releasing:
5  #  * Update version in data/org.gnome.Nautilus.appdata.xml.in.in
6  #  * Update GTK-based codes over src/gtk/gtk-code-generator.sh
7  version: '41.1',
8
9  meson_version: '>= 0.49.0',
10  license: 'GPL3+'
11)
12
13###############
14# Directories #
15###############
16
17prefix = get_option('prefix')
18
19bindir = get_option('bindir')
20datadir = get_option('datadir')
21desktopdir = join_paths(datadir, 'applications')
22includedir = get_option('includedir')
23libdir = get_option('libdir')
24localedir = get_option('localedir')
25extensiondir = join_paths(libdir, 'nautilus', 'extensions-3.0')
26servicedir = join_paths(datadir, 'dbus-1', 'services')
27
28###################
29# End directories #
30###################
31
32#############
33# Compilers #
34#############
35
36cc = meson.get_compiler('c')
37
38#################
39# End compilers #
40#################
41
42add_global_arguments(
43  cc.get_supported_arguments([
44    '-DGLIB_DISABLE_DEPRECATION_WARNINGS',
45  ]),
46  language: 'c',
47)
48
49add_project_arguments(
50  cc.get_supported_arguments([
51    '-Wall',
52    '-Wduplicated-branches',
53    '-Wduplicated-cond',
54    '-Wlogical-op',
55    '-Werror=declaration-after-statement',
56    '-Werror=empty-body',
57    '-Werror=format=2',
58    '-Werror=implicit-function-declaration',
59    '-Werror=incompatible-pointer-types',
60    '-Werror=init-self',
61    '-Werror=missing-include-dirs',
62    '-Werror=missing-prototypes',
63    '-Werror=pointer-arith',
64    '-Werror=sequence-point',
65    '-Werror=shadow',
66    '-Werror=strict-prototypes',
67    '-Werror=undef',
68    '-Werror=uninitialized',
69    # Context: https://gitlab.com/freedesktop-sdk/freedesktop-sdk/commit/ce54a2527555e51e4ebf4cce9cbb6259cafa89a4
70    # -O2 and -fexceptions unmask some cases of -Wmaybe-uninitialized, which
71    # become errors for some reason (I’m guessing because of the
72    # -Werror=uninitialized above, but no idea why that implies this).
73    # This being an error is nice and all, but not when its appearance is
74    # dependent on optimization level and other flags.
75    '-Wno-error=maybe-uninitialized',
76  ]),
77  '-D_GNU_SOURCE',
78  language: 'c'
79)
80
81##################
82# Module imports #
83##################
84
85gnome = import('gnome')
86i18n = import('i18n')
87pkgconfig = import('pkgconfig')
88
89######################
90# End module imports #
91######################
92
93################
94# Dependencies #
95################
96glib_ver = '>= 2.67.1'
97
98libgd = subproject(
99  'libgd',
100  default_options: [
101    'static=true',
102    'with-gtk-hacks=true',
103    'with-main-view=true',
104    'with-tagged-entry=true'
105  ]
106)
107libgd_dep = libgd.get_variable('libgd_dep')
108
109libm = cc.find_library('m')
110
111if get_option('extensions')
112  gexiv = dependency('gexiv2', version: '>= 0.12.2')
113  gst_tag_dep = dependency('gstreamer-tag-1.0')
114  gst_pbutils_dep = dependency('gstreamer-pbutils-1.0')
115endif
116gio = dependency('gio-2.0', version: glib_ver)
117gio_unix = dependency('gio-unix-2.0', version: glib_ver)
118glib = dependency('glib-2.0', version: glib_ver)
119gmodule = dependency('gmodule-no-export-2.0', version: glib_ver)
120gnome_autoar = dependency('gnome-autoar-0', version: '>= 0.4.0')
121gnome_desktop = dependency('gnome-desktop-3.0', version: '>= 3.0.0')
122gtk = dependency('gtk+-3.0', version: '>= 3.22.27')
123libhandy = dependency('libhandy-1', version: '>= 1.1.90')
124libportal = []
125libportal_gtk3 = []
126if get_option('libportal')
127  libportal = dependency('libportal', version: '>= 0.5')
128  libportal_gtk3 = dependency('libportal-gtk3', version: '>= 0.5')
129endif
130selinux = []
131if get_option('selinux')
132  selinux = dependency('libselinux', version: '>= 2.0')
133endif
134tracker_sparql = dependency('tracker-sparql-3.0')
135xml = dependency('libxml-2.0', version: '>= 2.7.8')
136
137####################
138# End dependencies #
139####################
140
141#################
142# Configuration #
143#################
144conf = configuration_data()
145
146profile = get_option('profile')
147name_suffix = ''
148
149if get_option('profile') == 'Devel'
150  name_suffix = ' (Development Snapshot)'
151endif
152
153application_id = 'org.gnome.Nautilus' + profile
154
155if profile == ''
156  # Example: 40.0
157  version_string = meson.project_version()
158else
159  # Examples: 40.alpha-787a835f
160  version_string = '@0@-@VCS_TAG@'.format(meson.project_version())
161endif
162
163conf.set_quoted('APPLICATION_ID', application_id)
164conf.set_quoted('GETTEXT_PACKAGE', 'nautilus')
165conf.set_quoted('LOCALEDIR', join_paths(prefix, localedir))
166conf.set_quoted('NAME_SUFFIX', name_suffix)
167conf.set_quoted('NAUTILUS_DATADIR', join_paths(prefix, datadir, 'nautilus'))
168conf.set_quoted('NAUTILUS_EXTENSIONDIR', join_paths(prefix, extensiondir))
169conf.set_quoted('PACKAGE_VERSION', meson.project_version())
170conf.set_quoted('PROFILE', profile)
171conf.set_quoted('VERSION', version_string)
172
173conf.set('ENABLE_PACKAGEKIT', get_option('packagekit'))
174conf.set('ENABLE_PROFILING', get_option('profiling'))
175conf.set('HAVE_LIBPORTAL', get_option('libportal'))
176conf.set('HAVE_SELINUX', get_option('selinux'))
177
178#############################################################
179# config.h dependency, add to target dependencies if needed #
180#############################################################
181
182config_h = declare_dependency(
183  sources: vcs_tag(
184    command: ['git', 'rev-parse', '--short', 'HEAD'],
185    fallback: profile != '' ? 'devel' : '',
186    input: configure_file(
187      output: 'config.h.in',
188      configuration: conf
189    ),
190    output: 'config.h'
191  )
192)
193
194#####################
195# End configuration #
196#####################
197
198nautilus_include_dirs = include_directories(
199  '.',
200  'libnautilus-extension'
201)
202
203#########
204# Build #
205#########
206
207subdirs = [
208  'data',
209  'eel',
210  'libnautilus-extension',
211  'po',
212  'src',
213]
214
215########################
216# Conditional building #
217########################
218
219if get_option('docs')
220  subdirs += 'docs'
221endif
222if get_option('tests') != 'none'
223  subdirs += 'test'
224endif
225if get_option('extensions')
226  subdirs += 'extensions'
227endif
228
229foreach dir : subdirs
230  subdir(dir)
231endforeach
232
233#############
234# End build #
235#############
236
237#########################################################
238# Compile GSettings schemas when installing from source #
239#########################################################
240meson.add_install_script('build-aux/meson/postinstall.py')
241