-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmeson.build
More file actions
228 lines (202 loc) · 6.92 KB
/
Copy pathmeson.build
File metadata and controls
228 lines (202 loc) · 6.92 KB
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
project(
'orage',
'c',
version : '4.21.1-dev',
license : 'GPL-2.0-or-later',
meson_version : '>= 0.54.0',
default_options : ['c_std=gnu11', 'buildtype=debugoptimized', 'warning_level=2']
)
project_namespace = 'apps'
pkgdatadir = get_option('prefix') / get_option('datadir') / meson.project_name()
copyright_year = '2025'
cc = meson.get_compiler('c')
pkgconfig = import('pkgconfig')
gnome = import('gnome')
i18n = import('i18n')
dependency_versions = {
'glib': '>= 2.74.0',
'gtk': '>= 3.24.0',
'xfce4': '>= 4.20.0',
'libical': '>= 3.0',
'libnotify': '>= 0.7.0',
}
glib = dependency('glib-2.0', version: dependency_versions['glib'])
gio = dependency('gio-2.0', version: dependency_versions['glib'])
gtk = dependency('gtk+-3.0', version: dependency_versions['gtk'])
libxfce4ui = dependency('libxfce4ui-2', version: dependency_versions['xfce4'])
libxfce4util = dependency('libxfce4util-1.0', version: dependency_versions['xfce4'])
libical = dependency('libical-glib', version: dependency_versions['libical'])
libnotify = dependency('libnotify', version: dependency_versions['libnotify'], required: get_option('libnotify'))
libm = cc.find_library('m')
if libical.version().version_compare('= 3.0.15')
error('Unsupported libical version 3.0.15, see https://gitlab.xfce.org/apps/orage/-/issues/20')
endif
if libical.version().version_compare('>= 4.0')
libical = [libical, dependency('libicalss')]
endif
feature_cflags = []
if libnotify.found()
feature_cflags += '-DHAVE_NOTIFY=1'
endif
if cc.has_header_symbol('langinfo.h', '_NL_TIME_FIRST_WEEKDAY')
feature_cflags += '-DHAVE__NL_TIME_FIRST_WEEKDAY=1'
endif
if cc.has_function('setsid')
feature_cflags += '-DHAVE_SETSID=1'
endif
headers = [
'sys/stat.h',
'sys/types.h',
'sys/wait.h',
'errno.h',
'stdlib.h',
'string.h',
]
foreach header : headers
if cc.check_header(header)
feature_cflags += '-DHAVE_@0@=1'.format(header.underscorify().to_upper())
endif
endforeach
if get_option('archive')
feature_cflags += '-DHAVE_ARCHIVE=1'
endif
if get_option('x11-tray-icon')
feature_cflags += '-DHAVE_X11_TRAY_ICON=1'
endif
default_logger = get_option('default-logger')
if default_logger == 'orage'
feature_cflags += '-DORAGE_DEFAULT_LOGGER_ORAGE=1'
else
feature_cflags += '-DORAGE_DEFAULT_LOGGER_GLIB=1'
endif
# TODO: Add switch or condition to enable sync code
feature_cflags += '-DENABLE_SYNC=1'
extra_cflags = []
extra_cflags_check = [
'-Wmissing-declarations',
'-Wmissing-noreturn',
'-Wold-style-definition',
'-Wredundant-decls',
'-Wpointer-arith',
'-Wcast-align',
'-Winit-self',
'-Wshadow',
'-Wmissing-include-dirs',
'-Wundef',
'-Wformat',
'-Wformat-security',
'-Wformat-y2k',
'-Wnested-externs',
'-Wno-unused-parameter',
'-Wno-declaration-after-statement',
'-Wno-missing-field-initializers',
'-Werror=implicit-function-declaration',
'-Wno-error=deprecated-declarations',
]
optimization = get_option('optimization')
if get_option('debug') and optimization in ['0', 'g']
extra_cflags_check += '-fstack-protector-strong'
extra_cflags += [
'-DDEBUG=1',
'-DDEBUG_TRACE=1',
'-DG_ENABLE_DEBUG',
]
elif optimization in ['3', 's']
extra_cflags += [
'-DNDEBUG',
'-DG_DISABLE_CAST_CHECKS',
'-DG_DISABLE_ASSERT',
]
endif
if dependency_versions.has_key('glib')
glib_version_parts = dependency_versions['glib'].split(' ')
glib_min_version_parts = glib_version_parts[1].split('.')
glib_min_version_define = 'GLIB_VERSION_@0@_@1@'.format(glib_min_version_parts[0], glib_min_version_parts[1])
extra_cflags += [
'-DGLIB_VERSION_MIN_REQUIRED=@0@'.format(glib_min_version_define),
'-DGLIB_VERSION_MAX_ALLOWED=@0@'.format(glib_min_version_define),
'-DG_LOG_DOMAIN="@0@"'.format(meson.project_name()),
'-DG_LOG_USE_STRUCTURED=1',
]
endif
version_parts = meson.project_version().split('-dev')[0].split('.')
version_short = '@0@.@1@'.format(version_parts[0], version_parts[1])
extra_cflags += [
'-DPACKAGE="@0@"'.format(meson.project_name()),
'-DPACKAGE_NAME="@0@"'.format(meson.project_name()),
'-DPACKAGE_VERSION="@0@"'.format(meson.project_version()),
'-DVERSION="@0@"'.format(meson.project_version()),
'-DVERSION_SHORT="@0@"'.format(version_short),
'-DPACKAGE_STRING="@0@ @1@"'.format(meson.project_name(), meson.project_version()),
'-DPACKAGE_DATADIR="@0@"'.format(pkgdatadir),
'-DCOPYRIGHT_YEAR="@0@"'.format(copyright_year),
'-DPACKAGE_LOCALE_DIR="@0@"'.format(get_option('prefix') / get_option('localedir')),
'-DPACKAGE_URL="https://docs.xfce.org/@0@/@1@/start"'.format(project_namespace, meson.project_name()),
'-DPACKAGE_BUGREPORT="https://gitlab.xfce.org/@0@/@1@/-/issues"'.format(project_namespace, meson.project_name()),
'-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()),
'-DPREFIX="@0@"'.format(get_option('prefix')),
'-DBINDIR="@0@"'.format(get_option('prefix') / get_option('bindir')),
'-DDATADIR="@0@"'.format(get_option('prefix') / get_option('datadir')),
'-DDOCDIR="@0@"'.format(get_option('prefix') / 'doc' / meson.project_name()),
'-DINCLUDEDIR="@0@"'.format(get_option('prefix') / get_option('includedir')),
'-DLIBDIR="@0@"'.format(get_option('prefix') / get_option('libdir')),
'-DLIBEXECDIR="@0@"'.format(get_option('prefix') / get_option('libexecdir')),
'-DLOCALEDIR="@0@"'.format(get_option('prefix') / get_option('localedir')),
'-DLOCALSTATEDIR="@0@"'.format(get_option('prefix') / get_option('localstatedir')),
'-DSBINDIR="@0@"'.format(get_option('prefix') / get_option('sbindir')),
'-DSYSCONFDIR="@0@"'.format(get_option('prefix') / get_option('sysconfdir')),
'-DHAVE_XFCE_REVISION_H=1',
]
add_project_arguments(cc.get_supported_arguments(extra_cflags_check), language: 'c')
add_project_arguments(feature_cflags, language: 'c')
add_project_arguments(extra_cflags, language: 'c')
xfce_revision_h = vcs_tag(
command: ['git', 'rev-parse', '--short', 'HEAD'],
fallback: 'UNKNOWN',
input: 'xfce-revision.h.in',
output: 'xfce-revision.h',
replace_string: '@REVISION@',
)
i18n.merge_file(
input: 'org.xfce.orage.appdata.xml.in',
output: 'org.xfce.orage.appdata.xml',
po_dir: 'po',
type: 'xml',
install: true,
install_dir: get_option('prefix') / get_option('datadir') / 'metainfo',
)
i18n.merge_file(
input: 'org.xfce.orage.desktop.in',
output: 'org.xfce.orage.desktop',
po_dir: 'po',
type: 'desktop',
install: true,
install_dir: get_option('prefix') / get_option('datadir') / 'applications',
)
configure_file(
configuration: configuration_data({
'bindir': get_option('prefix') / get_option('bindir'),
}),
input: 'org.xfce.orage.service.in',
output: 'org.xfce.orage.service',
install: true,
install_dir: get_option('prefix') / get_option('datadir') / 'dbus-1' / 'services'
)
subdir('src')
subdir('icons')
subdir('plugin')
subdir('sounds')
subdir('themes')
subdir('po')
if get_option('debug') and get_option('tests')
subdir('tests')
build_tests=true
else
build_tests=false
endif
summary(
{
'build tests': build_tests,
},
section: 'Optional features',
)