forked from GNOME/glib-networking
-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.build
145 lines (112 loc) · 4.19 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
project(
'glib-networking', 'c',
version: '2.57.2',
license: 'LGPL2.1+',
meson_version: '>= 0.46.0',
default_options: ['c_std=c11']
)
prefix = get_option('prefix')
datadir = join_paths(prefix, get_option('datadir'))
libdir = join_paths(prefix, get_option('libdir'))
libexecdir = join_paths(prefix, get_option('libexecdir'))
localedir = join_paths(prefix, get_option('localedir'))
installed_tests_metadir = join_paths(datadir, 'installed-tests', meson.project_name())
installed_tests_execdir = join_paths(libexecdir, 'installed-tests', meson.project_name())
cc = meson.get_compiler('c')
host_system = host_machine.system()
config_h = configuration_data()
config_h.set_quoted('GETTEXT_PACKAGE', meson.project_name())
# compiler flags
common_flags = [
'-DHAVE_CONFIG_H',
'-DG_LOG_DOMAIN="GLib-Net"',
'-DLOCALE_DIR="@0@"'.format(localedir),
'-DG_DISABLE_DEPRECATED',
'-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_56'
]
add_project_arguments(common_flags, language: 'c')
symbol_map = join_paths(meson.current_source_dir(), meson.project_name() + '.map')
module_ldflags = []
if host_system.contains('linux')
test_ldflag = '-Wl,--version-script,' + symbol_map
module_ldflags += cc.get_supported_link_arguments(test_ldflag)
endif
# *** Check GLib GIO ***
glib_dep = dependency('glib-2.0', version: '>= 2.55.1',
fallback: ['glib', 'libglib_dep'])
gio_dep = dependency('gio-2.0',
fallback: ['glib', 'libgio_dep'])
gobject_dep = dependency('gio-2.0',
fallback: ['glib', 'libgobject_dep'])
gmodule_dep = dependency('gmodule-2.0',
fallback: ['glib', 'libgmodule_dep'])
if glib_dep.type_name() == 'internal'
glib_proj = subproject('glib')
gio_module_dir = glib_proj.get_variable('glib_giomodulesdir')
else
gio_module_dir = gio_dep.get_pkgconfig_variable('giomoduledir',
define_variable: ['prefix', prefix])
endif
assert(gio_module_dir != '', 'GIO_MODULE_DIR is missing from gio-2.0.pc')
# *** Checks for LibProxy ***
enable_libproxy_support = get_option('libproxy_support')
if enable_libproxy_support
libproxy_dep = dependency('libproxy-1.0', version: '>= 0.3.1', required: true)
endif
# *** Checks for GNOME ***
enable_gnome_proxy_support = get_option('gnome_proxy_support')
if enable_gnome_proxy_support
gsettings_desktop_schemas_dep = dependency('gsettings-desktop-schemas', required: true)
endif
# *** Checks for GnuTLS ***
gnutls_dep = dependency('gnutls', version: '>= 3.4', required: true)
# *** Checks for p11-kit ***
enable_pkcs11_support = get_option('pkcs11_support')
if enable_pkcs11_support
pkcs11_dep = dependency('p11-kit-1', version: '>= 0.20', required: true)
config_h.set('HAVE_PKCS11', enable_pkcs11_support,
description: 'Building with PKCS#11 support')
endif
configure_file(
output: 'config.h',
configuration: config_h
)
gnome = import('gnome')
i18n = import('i18n')
pkg = import('pkgconfig')
po_dir = join_paths(meson.source_root(), 'po')
top_inc = include_directories('.')
tls_inc = include_directories('tls')
subdir('po')
enable_installed_tests = get_option('installed_tests')
test_template = files('template.test.in')
module_suffix = []
# Keep the autotools convention for shared module suffix because GModule
# depends on it: https://gitlab.gnome.org/GNOME/glib/issues/520
if ['darwin', 'ios'].contains(host_system)
module_suffix = 'so'
endif
if enable_libproxy_support or enable_gnome_proxy_support
proxy_test_programs = []
if enable_libproxy_support
subdir('proxy/libproxy')
endif
if enable_gnome_proxy_support
subdir('proxy/gnome')
endif
subdir('proxy/tests')
endif
if enable_pkcs11_support
subdir('tls/pkcs11')
endif
subdir('tls/gnutls')
subdir('tls/tests')
# Will automatically pick it up from the cross file if defined
gio_querymodules = find_program('gio-querymodules', required : false)
if gio_querymodules.found()
meson.add_install_script('meson_post_install.py', gio_querymodules.path(), gio_module_dir)
endif
output = '\n\n libproxy support: ' + enable_libproxy_support.to_string() + '\n'
output += ' GNOME proxy support: ' + enable_gnome_proxy_support.to_string() + '\n'
output += ' PKCS#11 support: ' + enable_pkcs11_support.to_string() + '\n'
message(output)