-
Notifications
You must be signed in to change notification settings - Fork 10
/
meson.build
197 lines (172 loc) · 5.65 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
# Convention:
# - Local variables in lower_case.
# - Global variables in UPPER_CASE.
# See: https://github.com/mesonbuild/meson/issues/2607
project(
'devhelp', 'c',
meson_version: '>= 0.57',
version: '43.1',
default_options: ['warning_level=2']
)
GNOME = import('gnome')
PKG_CONFIG = import('pkgconfig')
I18N = import('i18n')
# API version, used for parallel installability.
LIBDEVHELP_API_VERSION = '3'
# It would be nice to get rid of this variant, to use only the short version
# everywhere.
LIBDEVHELP_API_VERSION_FULL = '3.0'
# Libtool versioning
#
# A good time to update it is for the GNOME x.y.90 version, at API freeze, so
# that packagers have the time to update the package. For other development
# releases (if the minor package version is odd), keep the same Libtool
# version.
#
# To update the Libtool version, apply the following algorithm step by step:
# 1. If the library source code has changed at all since the last
# update, then increment REVISION.
# 2. If any exported functions or data have been added, removed, or
# changed since the last update, increment CURRENT and set REVISION
# to 0.
# 3. If any exported functions or data have been added since the last
# public release, increment AGE.
# 4. If any exported functions or data have been removed since the last
# public release, set AGE to 0.
#
# When incrementing the API version (usually for a new major package version),
# set CURRENT, REVISION and AGE to 0 since it's like a new library.
lt_current = 6
lt_revision = 3
lt_age = 0
LIBDEVHELP_LT_VERSION = '@0@.@1@.@2@'.format(lt_current, lt_revision, lt_age)
webkit_dep = dependency('webkit2gtk-4.1', required : false)
webkit_abi = '4.1'
if not webkit_dep.found()
webkit_abi = '4.0'
webkit_dep = dependency('webkit2gtk-4.0')
endif
LIBDEVHELP_PUBLIC_DEPS = [
dependency('gio-2.0', version: '>= 2.64'),
dependency('gtk+-3.0', version: '>= 3.22'),
webkit_dep,
]
LIBDEVHELP_PRIVATE_DEPS = [
dependency('gsettings-desktop-schemas'),
]
LIBDEVHELP_DEPS = [
LIBDEVHELP_PUBLIC_DEPS,
LIBDEVHELP_PRIVATE_DEPS,
meson.get_compiler('c').find_library('m'),
]
DEVHELP_APP_DEPS = [
LIBDEVHELP_DEPS,
dependency('gsettings-desktop-schemas'),
]
devhelp_version = meson.project_version().split('.')
devhelp_is_devel = devhelp_version[1] in ['alpha', 'beta', 'rc']
devel_build = get_option('profile') == 'devel' or devhelp_is_devel
if devel_build
APPLICATION_ID = 'org.gnome.Devhelp.Devel'
else
APPLICATION_ID = 'org.gnome.Devhelp'
endif
# config.h
config_data = configuration_data()
GETTEXT_PACKAGE_NAME = meson.project_name()
config_data.set_quoted('GETTEXT_PACKAGE', GETTEXT_PACKAGE_NAME)
config_data.set_quoted('DATADIR', get_option('prefix') / get_option('datadir'))
config_data.set_quoted('LOCALEDIR', get_option('prefix') / get_option('localedir'))
config_data.set_quoted('PACKAGE_VERSION', meson.project_version())
config_data.set_quoted('LIBDEVHELP_API_VERSION', LIBDEVHELP_API_VERSION)
config_data.set_quoted('APPLICATION_ID', APPLICATION_ID)
config_data.set10('DEVEL_BUILD', devel_build)
config_data.set10('FLATPAK_BUILD', get_option('flatpak_build'))
configure_file(
output: 'config.h',
configuration: config_data
)
# Misc
# For #include <devhelp/something.h> or #include "config.h".
ROOT_INCLUDE_DIR = include_directories('.')
add_project_arguments(
'-DG_LOG_DOMAIN="@0@"'.format(meson.project_name()),
language: 'c'
)
#####
# CFLAGS
# Try to mimic the AX_COMPILER_FLAGS Autotools macro.
# Some flags are missing when using only the builtin warning_level meson option,
# even at the maximum level.
# The following warning_cflags suppose that warning_level=2.
warning_cflags = [
'-fno-strict-aliasing',
'-Wundef',
'-Wnested-externs',
'-Wwrite-strings',
'-Wpointer-arith',
'-Wmissing-declarations',
'-Wmissing-prototypes',
'-Wstrict-prototypes',
'-Wredundant-decls',
'-Wno-unused-parameter',
'-Wno-missing-field-initializers',
'-Wdeclaration-after-statement',
'-Wformat=2',
'-Wold-style-definition',
'-Wcast-align',
'-Wformat-nonliteral',
'-Wformat-security',
'-Wsign-compare',
'-Wstrict-aliasing',
'-Wshadow',
'-Winline',
'-Wpacked',
'-Wmissing-format-attribute',
'-Wmissing-noreturn',
'-Winit-self',
'-Wredundant-decls',
'-Wmissing-include-dirs',
'-Wunused-but-set-variable',
'-Warray-bounds',
'-Wimplicit-function-declaration',
'-Wreturn-type',
'-Wswitch-enum',
'-Wswitch-default',
'-Wduplicated-cond',
'-Wduplicated-branches',
'-Wlogical-op',
'-Wrestrict',
'-Wnull-dereference',
'-Wjump-misses-init',
'-Wdouble-promotion'
]
c_compiler = meson.get_compiler('c')
supported_warning_cflags = c_compiler.get_supported_arguments(warning_cflags)
add_project_arguments(supported_warning_cflags, language: 'c')
##### end CFLAGS
subdir('data')
subdir('plugins')
subdir('po')
subdir('help')
subdir('devhelp')
subdir('src')
subdir('unit-tests')
if get_option('gtk_doc')
subdir('docs/reference')
endif
GNOME.post_install(
glib_compile_schemas: true,
gtk_update_icon_cache: true,
)
summary('Prefix', get_option('prefix'))
summary('Libdir', get_option('prefix') / get_option('libdir'))
summary('Datadir', get_option('prefix') / get_option('datadir'))
summary('Debug', get_option('debug'), section: 'Build')
summary('Optimization', get_option('optimization'), section: 'Build')
summary('API documentation', get_option('gtk_doc'), section: 'Build')
summary('Flatpak build mode', get_option('flatpak_build'), section: 'Build')
summary('Development build', devel_build, section: 'Build')
summary('Plugin for Emacs', get_option('plugin_emacs'), section: 'Plugins')
summary('Plugin for gedit', get_option('plugin_gedit'), section: 'Plugins')
summary('Plugin for Vim', get_option('plugin_vim'), section: 'Plugins')