summaryrefslogtreecommitdiffstats
path: root/meson.build
blob: 66a6048f1cd68ba4168afecb512c82991de567ac (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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
project('nautilus', 'c',
  default_options: ['c_std=c11'],

  # Do not forget when releasing:
  #  * Update version in data/org.gnome.Nautilus.appdata.xml.in.in
  version: '43.2',

  meson_version: '>= 0.59.0',
  license: 'GPL-3.0-or-later'
)

nautilus_extension_version = '4'

###############
# Directories #
###############

prefix = get_option('prefix')

bindir = get_option('bindir')
datadir = get_option('datadir')
desktopdir = join_paths(datadir, 'applications')
includedir = get_option('includedir')
libdir = get_option('libdir')
localedir = get_option('localedir')
docdir = datadir / 'doc'
extensiondir = join_paths(libdir, 'nautilus', 'extensions-' + nautilus_extension_version)
servicedir = join_paths(datadir, 'dbus-1', 'services')

###################
# End directories #
###################

#############
# Compilers #
#############

cc = meson.get_compiler('c')

#################
# End compilers #
#################

add_global_arguments(
  cc.get_supported_arguments([
    '-DGLIB_DISABLE_DEPRECATION_WARNINGS',
  ]),
  language: 'c',
)

add_project_arguments(
  cc.get_supported_arguments([
    '-Wall',
    '-Wduplicated-branches',
    '-Wduplicated-cond',
    '-Wlogical-op',
    '-Werror=declaration-after-statement',
    '-Werror=empty-body',
    '-Werror=format=2',
    '-Werror=implicit-function-declaration',
    '-Werror=incompatible-pointer-types',
    '-Werror=init-self',
    '-Werror=missing-include-dirs',
    '-Werror=missing-prototypes',
    '-Werror=pointer-arith',
    '-Werror=sequence-point',
    '-Werror=shadow',
    '-Werror=strict-prototypes',
    '-Werror=undef',
    '-Werror=uninitialized',
    # Context: https://gitlab.com/freedesktop-sdk/freedesktop-sdk/commit/ce54a2527555e51e4ebf4cce9cbb6259cafa89a4
    # -O2 and -fexceptions unmask some cases of -Wmaybe-uninitialized, which
    # become errors for some reason (I’m guessing because of the
    # -Werror=uninitialized above, but no idea why that implies this).
    # This being an error is nice and all, but not when its appearance is
    # dependent on optimization level and other flags.
    '-Wno-error=maybe-uninitialized',
  ]),
  '-D_GNU_SOURCE',
  language: 'c'
)

##################
# Module imports #
##################

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

######################
# End module imports #
######################

################
# Dependencies #
################
glib_ver = '>= 2.72.0'

libm = cc.find_library('m')

if get_option('extensions')
  gexiv = dependency('gexiv2', version: '>= 0.14.0')
  gdkpixbuf = dependency('gdk-pixbuf-2.0', version: '>= 2.30.0')
  gst_tag_dep = dependency('gstreamer-tag-1.0')
  gst_pbutils_dep = dependency('gstreamer-pbutils-1.0')
endif
gio = dependency('gio-2.0', version: glib_ver)
gio_unix = dependency('gio-unix-2.0', version: glib_ver)
glib = dependency('glib-2.0', version: glib_ver)
gmodule = dependency('gmodule-no-export-2.0', version: glib_ver)
gnome_autoar = dependency('gnome-autoar-0', version: '>= 0.4.0')
gnome_desktop = dependency('gnome-desktop-4', version: '>= 43')
gtk = dependency('gtk4', version: '>= 4.7.2')
libadwaita = dependency('libadwaita-1', version: '>= 1.2.beta')
libportal = dependency('libportal', version: '>= 0.5')
libportal_gtk4 = dependency('libportal-gtk4', version: '>= 0.5')
selinux = []
if get_option('selinux')
  selinux = dependency('libselinux', version: '>= 2.0')
endif
tracker_sparql = dependency('tracker-sparql-3.0')
xml = dependency('libxml-2.0', version: '>= 2.7.8')
cloudproviders = dependency('cloudproviders', version: '>= 0.3.1')
gi_docgen = find_program('gi-docgen', required: get_option('docs'))

####################
# End dependencies #
####################

#################
# Configuration #
#################
conf = configuration_data()

profile = get_option('profile')
name_suffix = ''

if get_option('profile') == 'Devel'
  name_suffix = ' (Development Snapshot)'
endif

application_id = 'org.gnome.Nautilus' + profile

if profile == ''
  # Example: 40.0
  version_string = meson.project_version()
else
  # Examples: 40.alpha-787a835f
  version_string = '@0@-@VCS_TAG@'.format(meson.project_version())
endif

conf.set_quoted('APPLICATION_ID', application_id)
conf.set_quoted('GETTEXT_PACKAGE', 'nautilus')
conf.set_quoted('LOCALEDIR', join_paths(prefix, localedir))
conf.set_quoted('NAME_SUFFIX', name_suffix)
conf.set_quoted('NAUTILUS_DATADIR', join_paths(prefix, datadir, 'nautilus'))
conf.set_quoted('NAUTILUS_EXTENSIONDIR', join_paths(prefix, extensiondir))
conf.set_quoted('PACKAGE_VERSION', meson.project_version())
conf.set_quoted('PROFILE', profile)
conf.set_quoted('VERSION', version_string)

conf.set('ENABLE_PACKAGEKIT', get_option('packagekit'))
conf.set('ENABLE_PROFILING', get_option('profiling'))
conf.set('HAVE_SELINUX', get_option('selinux'))

#############################################################
# config.h dependency, add to target dependencies if needed #
#############################################################

config_h = declare_dependency(
  sources: vcs_tag(
    command: ['git', 'rev-parse', '--short', 'HEAD'],
    fallback: profile != '' ? 'devel' : '',
    input: configure_file(
      output: 'config.h.in',
      configuration: conf
    ),
    output: 'config.h'
  )
)

#####################
# End configuration #
#####################

nautilus_include_dirs = include_directories(
  '.',
  'libnautilus-extension'
)

#########
# Build #
#########

subdirs = [
  'data',
  'eel',
  'libnautilus-extension',
  'po',
  'src',
]

########################
# Conditional building #
########################

if gi_docgen.found()
  subdirs += 'docs'
endif
if get_option('tests') != 'none'
  subdirs += 'test'
endif
if get_option('extensions')
  subdirs += 'extensions'
endif

foreach dir : subdirs
  subdir(dir)
endforeach

#############
# End build #
#############

gnome.post_install(
  gtk_update_icon_cache: true,
  glib_compile_schemas: true,
  update_desktop_database: true,
)