forked from mate-desktop/marco
-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.build
336 lines (288 loc) · 9.07 KB
/
meson.build
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
project(
'marco', 'c',
version: '1.25.0',
meson_version: '>=0.47.0',
license: 'GPL2',
default_options : [ 'warning_level=1', 'buildtype=debugoptimized', 'c_std=gnu11'],
)
package_name = meson.project_name()
package_version = meson.project_version()
# Versionning
version_arr = package_version.split('.')
version_major = version_arr[0].to_int()
version_minor = version_arr[1].to_int()
version_micro = version_arr[2].to_int()
soversion = 2
if version_minor.is_odd()
interface_age = 0
else
interface_age = version_micro
endif
current = version_minor * 100 + version_micro - interface_age
revision = interface_age
libversion = '@0@.@1@.@2@'.format(soversion, current, revision)
package_string = '@0@-@[email protected]'.format(package_name, soversion)
config_h = configuration_data()
config_h.set_quoted('PACKAGE', package_name)
config_h.set_quoted('PACKAGE_NAME', package_name)
config_h.set_quoted('PACKAGE_STRING', package_string)
config_h.set_quoted('PACKAGE_VERSION', package_version)
config_h.set_quoted('GETTEXT_PACKAGE', package_name)
config_h.set_quoted('VERSION', package_version)
# Compiler & Project arguments
add_project_arguments([
'-DHAVE_CONFIG_H',
'-I' + meson.build_root(),
], language: 'c')
# get suported warning flags
test_args = [
#'-fstack-protector-strong',
#'-Waggregate-return',
#'-Warray-bounds',
'-Wcast-align',
'-Wchar-subscripts',
#'-Wclobbered',
#'-Wdeclaration-after-statement',
#'-Wempty-body',
#'-Wextra',
#'-Wformat=2',
#'-Wformat-nonliteral',
#'-Wformat-security',
['-Werror=format-security', '-Werror=format=2'],
#'-Wformat-signedness',
#'-Wignored-qualifiers',
#'-Wimplicit-function-declaration',
#'-Winit-self',
#'-Winline',
'-Wmissing-declarations',
#'-Wmissing-format-attribute',
#'-Wmissing-include-dirs',
#'-Wmissing-noreturn',
#'-Wmissing-parameter-type',
'-Wmissing-prototypes',
'-Wnested-externs',
#'-Wno-discarded-qualifiers',
#'-Wno-missing-field-initializers',
#'-Wno-strict-aliasing',
#'-Wno-suggest-attribute=format',
#'-Wno-unused-parameter',
#'-Wold-style-definition',
#'-Woverride-init',
#'-Wpacked',
'-Wpointer-arith',
#'-Wredundant-decls',
#'-Wreturn-type',
'-Wshadow',
'-Wsign-compare',
#'-Wstrict-aliasing',
#'-Wstrict-prototypes',
#'-Wswitch-default',
#'-Wtype-limits',
#'-Wundef',
#'-Wuninitialized',
#'-Wunused-but-set-variable',
#'-Wwrite-strings'
'-Wall',
#'-ansi',
]
cc = meson.get_compiler('c')
foreach arg: test_args
if cc.has_multi_arguments(arg)
add_project_arguments(arg, language : 'c')
endif
endforeach
# Integer sizes
config_h.set('SIZEOF_CHAR', cc.sizeof('char'))
config_h.set('SIZEOF_SHORT', cc.sizeof('short'))
config_h.set('SIZEOF_LONG', cc.sizeof('long'))
config_h.set('SIZEOF_INT', cc.sizeof('int'))
config_h.set('SIZEOF_VOID_P', cc.sizeof('void *'))
config_h.set('SIZEOF_LONG_LONG', cc.sizeof('long long'))
config_h.set('SIZEOF___INT64', cc.sizeof('__int64'))
# byte order
if build_machine.endian() == 'big'
config_h.set('WORDS_BIGENDIAN', 1)
endif
gnome = import('gnome')
i18n = import('i18n')
pkg = import('pkgconfig')
# Paths
rootdir = include_directories('.')
srcdir = meson.current_source_dir()
builddir = meson.current_build_dir()
prefix = get_option('prefix')
buildtype = get_option('buildtype')
bindir = join_paths(prefix, get_option('bindir'))
includedir = join_paths(prefix, get_option('includedir'))
libdir = join_paths(prefix, get_option('libdir'))
libexecdir = join_paths(prefix, get_option('libexecdir'))
datadir = join_paths(prefix, get_option('datadir'))
pkgincludedir = join_paths(includedir, package_string)
pkgconfigdir = join_paths(libdir, 'pkgconfig')
pkglibdir = join_paths(libdir, package_name)
pkgdatadir = join_paths(datadir, package_name)
dbusdir = join_paths(datadir, 'dbus-1')
glibdir = join_paths(datadir, 'glib-2.0')
gtkdocdir = join_paths(datadir, 'gtk-doc')
localdir = join_paths(datadir, 'local')
vapidir = join_paths(datadir, 'vala', 'vapi')
# Dependencies
glib_req = '>= 2.58.0'
gio_req = '>= 2.25.10'
gtk_req = '>= 3.22.0'
pango_req = '>= 1.2.0'
libcanberra_gtk_req = '>= 3.22.0'
startup_notification_req = '>= 0.7'
glib_dep = dependency('glib-2.0', version: glib_req)
gtk_dep = dependency('gtk+-3.0', version: gtk_req)
gio_dep = dependency('gio-2.0', version: gio_req)
pango_dep = dependency('pango', version: pango_req)
libcanberra_gtk_dep = dependency('libcanberra-gtk3')
x11_dep = dependency('x11')
marco_deps = [
glib_dep,
gtk_dep,
gio_dep,
pango_dep,
libcanberra_gtk_dep,
]
marco_message_deps = [
gtk_dep,
x11_dep,
]
marco_window_demo_deps = [
gtk_dep,
x11_dep,
]
xcomposite_req ='>= 0.3'
xrender_req ='>= 0.0'
startup_notification_dep = dependency('libstartup-notification-1.0', version:startup_notification_req, required: false)
xcomposite_dep = dependency('xcomposite', version:xcomposite_req, required: false)
xrender_dep = dependency('xrender', version:xrender_req, required: false)
xcursor_dep = dependency('xcursor', required: false)
libgtop_dep = dependency('libgtop-2.0', required: false)
xrandr_dep = dependency('xrandr', required: false)
xpresent_dep = dependency('xpresent', required: false)
xinerama_dep = dependency('xinerama', required: false)
sm_dep = dependency('sm', required: false)
if get_option('verbose-mode')
config_h.set('WITH_VERBOSE_MODE', 1, description: 'Build with verbose mode support')
endif
if cc.has_function('backtrace', prefix : '#include <execinfo.h>')
config_h.set('HAVE_BACKTRACE', 1)
endif
build_startup_notification = false
if get_option('startup-notification') and startup_notification_dep.found()
build_startup_notification = true
config_h.set('HAVE_STARTUP_NOTIFICATION', 1, description: 'Building with startup notification support')
config_h.set('SN_API_NOT_YET_FROZEN', 1)
marco_deps += [ startup_notification_dep ]
endif
build_xcomposite = false
if get_option('compositor') and xcomposite_dep.found()
build_xcomposite = true
marco_deps += [ xcomposite_dep, dependency('xfixes'), xrender_dep, dependency('xdamage')]
config_h.set('HAVE_COMPOSITE_EXTENSIONS', 1)
endif
build_render = false
if get_option('render') and xrender_dep.found()
build_render = true
marco_deps += [xrender_dep]
config_h.set('HAVE_RENDER', 1, description: 'Building with Render extension support')
endif
build_xcursor = false
if xcursor_dep.found()
build_xcursor = true
marco_deps += [xcursor_dep]
config_h.set('HAVE_XCURSOR', 1, description: 'Building with Render extension support')
endif
if libgtop_dep.found()
marco_deps += [libgtop_dep]
config_h.set('HAVE_GTOP', 1, description: 'Building with libgtop')
endif
build_xinerama = false
if get_option('xinerama') and xinerama_dep.found()
build_xinerama = true
config_h.set('HAVE_XFREE_XINERAMA', 1)
config_h.set('HAVE_XINERAMA', 1)
marco_deps += [xinerama_dep]
endif
#xext
build_shape = false
if cc.has_header('X11/extensions/shape.h')
build_shape = true
config_h.set('HAVE_SHAPE', 1)
endif
if cc.has_header('X11/XKBlib.h')
config_h.set('HAVE_XKB', 1)
endif
build_randr = false
if xrandr_dep.found()
build_randr = true
config_h.set('HAVE_RANDR', 1, description: 'Have the Xrandr extension library')
marco_deps += [ xrandr_dep ]
endif
#xext
build_xsync = false
if get_option('xsync') and cc.has_header('X11/extensions/sync.h')
build_xsync = true
config_h.set('HAVE_XSYNC', 1)
endif
build_xpresent = xpresent_dep.found()
if build_xpresent
config_h.set('HAVE_PRESENT', 1, description: 'Have the Xpresent extension library')
marco_deps += [ xpresent_dep ]
endif
libm = cc.find_library('m', required: false)
if libm.found()
marco_deps += [libm]
endif
build_sm = false
ice_dep = dependency('ice', required: false)
if get_option('sm') and sm_dep.found() and ice_dep.found()
build_sm = true
config_h.set('HAVE_SM', 1)
marco_deps += [ sm_dep, ice_dep ]
marco_message_deps += [ sm_dep, ice_dep ]
endif
gdk_pixbuf_csource = find_program('gdk-pixbuf-csource')
zenity = find_program('zenity')
libxext = cc.find_library('Xext', required: false)
if build_xsync
marco_deps += [libxext]
endif
config_h.set_quoted('MARCO_LOCALEDIR', localdir)
config_h.set_quoted('LIBDIR', libdir)
config_h.set_quoted('MARCO_DATADIR', datadir)
configure_file(
output: 'config.h',
configuration: config_h
)
subdir('doc')
subdir('src')
subdir('po')
summary = [
'',
'marco-@0@:'.format(meson.project_version()),
'',
' prefix: @0@'.format(prefix),
' source code location: @0@'.format(srcdir),
' compiler: @0@'.format(cc.get_id()),
'',
' Xinerama: @0@'.format(build_xinerama),
' Startup notification: @0@'.format(build_startup_notification),
' Compositing manager: @0@'.format(build_xcomposite),
' Session management: @0@'.format(build_sm),
' Shape extension: @0@'.format(build_shape),
' Resize-and-rotate: @0@'.format(build_randr),
' Xsync: @0@'.format(build_xsync),
' Xpresent: @0@'.format(build_xpresent),
' Render: @0@'.format(build_render),
' Xcursor: @0@'.format(build_xcursor),
'',
]
meson.add_install_script(
'meson_post_install.py',
libdir, datadir,
)
message('\n'.join(summary))