2 'glib-networking', 'c',
5 meson_version: '>= 0.47.0',
6 default_options: ['c_std=c11']
9 prefix = get_option('prefix')
10 datadir = join_paths(prefix, get_option('datadir'))
11 libdir = join_paths(prefix, get_option('libdir'))
12 libexecdir = join_paths(prefix, get_option('libexecdir'))
13 localedir = join_paths(prefix, get_option('localedir'))
15 installed_tests_metadir = join_paths(datadir, 'installed-tests', meson.project_name())
16 installed_tests_execdir = join_paths(libexecdir, 'installed-tests', meson.project_name())
18 cc = meson.get_compiler('c')
19 host_system = host_machine.system()
21 config_h = configuration_data()
23 config_h.set_quoted('GETTEXT_PACKAGE', meson.project_name())
25 # Update default CA file
26 if get_option('default_ca_file') != ''
27 config_h.set_quoted('TIZEN_DEFAULT_CA_FILE', get_option('default_ca_file'))
33 '-DG_LOG_DOMAIN="GLib-Net"',
34 '-DLOCALE_DIR="@0@"'.format(localedir),
35 '-DG_DISABLE_DEPRECATED',
36 '-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_46'
39 add_project_arguments(common_flags, language: 'c')
41 symbol_map = join_paths(meson.current_source_dir(), meson.project_name() + '.map')
45 if host_system.contains('linux')
46 test_ldflag = '-Wl,--version-script,' + symbol_map
47 module_ldflags += cc.get_supported_link_arguments(test_ldflag)
50 # *** Check GLib GIO ***
51 glib_dep = dependency('glib-2.0', version: '>= 2.46.0',
52 fallback: ['glib', 'libglib_dep'])
53 gio_dep = dependency('gio-2.0',
54 fallback: ['glib', 'libgio_dep'])
55 gobject_dep = dependency('gio-2.0',
56 fallback: ['glib', 'libgobject_dep'])
57 gmodule_dep = dependency('gmodule-2.0',
58 fallback: ['glib', 'libgmodule_dep'])
60 if glib_dep.type_name() == 'internal'
61 glib_proj = subproject('glib')
62 gio_module_dir = glib_proj.get_variable('glib_giomodulesdir')
64 gio_module_dir = gio_dep.get_pkgconfig_variable('giomoduledir',
65 define_variable: ['libdir', join_paths(prefix, libdir)])
68 assert(gio_module_dir.startswith(prefix), 'GIO_MODULE_DIR is missing from gio-2.0.pc')
70 # *** Checks for LibProxy ***
71 libproxy_dep = dependency('libproxy-1.0', version: '>= 0.3.1', required: get_option('libproxy'))
73 # *** Checks for GNOME ***
74 gsettings_desktop_schemas_dep = dependency('gsettings-desktop-schemas', required: get_option('gnome_proxy'))
78 # *** Checks for GnuTLS ***
79 gnutls_dep = dependency('gnutls', version: '>= 3.4.6', required: get_option('gnutls'))
82 backends += ['gnutls']
85 # *** Checks for OpenSSL ***
86 openssl_option = get_option('openssl')
87 if openssl_option.disabled()
90 # XXX: https://github.com/mesonbuild/meson/issues/2945
91 openssl_dep = dependency('openssl1.1', required: openssl_option.enabled() and cc.get_id() != 'msvc')
92 if openssl_dep.found()
93 backends += ['openssl']
94 elif cc.get_id() == 'msvc' and not openssl_option.disabled()
95 # MSVC builds of OpenSSL does not generate pkg-config files,
96 # so we check for it manually here in this case, if we can't find those files
97 # Based on the CMake check for OpenSSL in CURL's CMakeLists.txt,
98 # on which headers we should check for
100 foreach h : ['crypto.h', 'engine.h', 'err.h', 'pem.h',
101 'rsa.h', 'ssl.h', 'x509.h', 'rand.h', 'tls1.h']
102 header = 'openssl/' + h
103 if not cc.has_header(header)
105 if openssl_option.enabled()
106 error('openssl module is enabled and @0@ not found'.format(header))
111 # OpenSSL 1.1.x and 1.0.x (or earlier) have different .lib names,
112 # so we need to look for the correct pair
114 # Find either libcrypto.lib (1.1.x) or libeay32.lib (1.0.x or earlier) first
115 libcrypto_dep = cc.find_library('libcrypto', required: false)
116 if libcrypto_dep.found()
119 libcrypto_dep = cc.find_library('libeay32', required: openssl_option)
123 if libcrypto_dep.found()
124 # Find the corresponding SSL library depending on which crypto .lib we found
125 libssl_dep = cc.find_library(libssl, required: openssl_option)
128 if libcrypto_dep.found() and have_openssl
129 openssl_dep = [libcrypto_dep, libssl_dep]
130 backends += ['openssl']
135 if backends.length() == 0
136 error('No TLS backends enabled. Please enable at least one TLS backend')
141 configuration: config_h
144 gnome = import('gnome')
145 i18n = import('i18n')
146 pkg = import('pkgconfig')
148 po_dir = join_paths(meson.source_root(), 'po')
150 top_inc = include_directories('.')
151 tls_inc = include_directories('tls')
155 enable_installed_tests = get_option('installed_tests')
156 test_template = files('template.test.in')
159 # Keep the autotools convention for shared module suffix because GModule
160 # depends on it: https://gitlab.gnome.org/GNOME/glib/issues/520
161 if ['darwin', 'ios'].contains(host_system)
165 if libproxy_dep.found() or gsettings_desktop_schemas_dep.found()
166 proxy_test_programs = []
168 if libproxy_dep.found()
169 subdir('proxy/libproxy')
172 if gsettings_desktop_schemas_dep.found()
173 subdir('proxy/gnome')
176 subdir('proxy/tests')
181 if gnutls_dep.found()
185 if backends.contains('openssl')
186 subdir('tls/openssl')
191 # Will automatically pick it up from the cross file if defined
192 gio_querymodules = find_program('gio-querymodules', required : false)
193 if gio_querymodules.found()
194 meson.add_install_script('meson_post_install.py', gio_querymodules.path(), gio_module_dir)
198 output += ' gnutls support: ' + backends.contains('gnutls').to_string() + '\n'
199 output += ' openssl support: ' + backends.contains('openssl').to_string() + '\n'
200 output += ' libproxy support: ' + libproxy_dep.found().to_string() + '\n'
201 output += ' GNOME proxy support: ' + gsettings_desktop_schemas_dep.found().to_string() + '\n'
202 output += ' TIZEN default CA file: ' + get_option('default_ca_file') + '\n'