]> jfr.im git - irc/hexchat/hexchat.git/blame - meson.build
Update win8_provider.cpp
[irc/hexchat/hexchat.git] / meson.build
CommitLineData
628100c1 1project('hexchat', 'c',
bfd6eea9 2 version: '2.14.3',
cbb0927a 3 meson_version: '>= 0.47.0',
628100c1
PG
4 default_options: [
5 'c_std=gnu89',
6 'buildtype=debugoptimized',
7 'warning_level=1',
8 ]
9)
10
11i18n = import('i18n')
12gnome = import('gnome')
13cc = meson.get_compiler('c')
14
15
16libgio_dep = dependency('gio-2.0', version: '>= 2.34.0')
17libgmodule_dep = dependency('gmodule-2.0')
cbb0927a
PG
18
19libcanberra_dep = dependency('libcanberra', version: '>= 0.22',
20 required: get_option('libcanberra'))
21dbus_glib_dep = dependency('dbus-glib-1', required: get_option('dbus'))
cbb0927a 22
e9b9ff9f 23global_deps = []
628100c1
PG
24if cc.get_id() == 'msvc'
25 libssl_dep = cc.find_library('libeay32')
26else
27 libssl_dep = dependency('openssl', version: '>= 0.9.8',
cbb0927a 28 required: get_option('tls'))
628100c1
PG
29endif
30
31config_h = configuration_data()
32config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
33config_h.set_quoted('PACKAGE_NAME', meson.project_name())
34config_h.set_quoted('GETTEXT_PACKAGE', 'hexchat')
35config_h.set_quoted('LOCALEDIR', join_paths(get_option('prefix'),
36 get_option('datadir'), 'locale'))
37config_h.set10('ENABLE_NLS', true)
38
39# Optional features
cbb0927a
PG
40config_h.set('USE_OPENSSL', libssl_dep.found())
41config_h.set('USE_LIBCANBERRA', libcanberra_dep.found())
42config_h.set('USE_DBUS', dbus_glib_dep.found())
43config_h.set('USE_PLUGIN', get_option('plugin'))
628100c1
PG
44
45config_h.set('G_DISABLE_SINGLE_INCLUDES', true)
46config_h.set('GTK_DISABLE_DEPRECATED', true)
47config_h.set('GTK_DISABLE_SINGLE_INCLUDES', true)
48config_h.set('GDK_PIXBUF_DISABLE_SINGLE_INCLUDES', true)
49config_h.set('GLIB_VERSION_MAX_ALLOWED', 'GLIB_VERSION_2_34')
50config_h.set('GLIB_VERSION_MIN_REQUIRED', 'GLIB_VERSION_2_34')
51
52# Detected features
53config_h.set('HAVE_MEMRCHR', cc.has_function('memrchr'))
54config_h.set('HAVE_STRINGS_H', cc.has_header('strings.h'))
55
706f9bca
PG
56config_h.set_quoted('HEXCHATLIBDIR',
57 join_paths(get_option('prefix'), get_option('libdir'), 'hexchat/plugins')
58)
59
628100c1
PG
60if libssl_dep.found()
61 config_h.set('HAVE_X509_GET_SIGNATURE_NID',
62 cc.has_function('X509_get_signature_nid', dependencies: libssl_dep)
63 )
64 config_h.set('HAVE_SSL_CTX_GET_SSL_METHOD',
65 cc.has_function('SSL_CTX_get_ssl_method', dependencies: libssl_dep)
66 )
67 config_h.set('HAVE_DH_SET0_PQG',
68 cc.has_function('DH_set0_pqg', dependencies: libssl_dep)
69 )
70 config_h.set('HAVE_DH_GET0_KEY',
71 cc.has_function('DH_get0_key', dependencies: libssl_dep)
72 )
73 config_h.set('HAVE_DH_SET0_KEY',
74 cc.has_function('DH_set0_key', dependencies: libssl_dep)
75 )
ce91bebc
PG
76 config_h.set('HAVE_ERR_REMOVE_THREAD_STATE',
77 cc.has_function('ERR_remove_thread_state', dependencies: libssl_dep)
78 )
79 config_h.set('HAVE_ASN1_STRING_GET0_DATA',
80 cc.has_function('ASN1_STRING_get0_data', dependencies: libssl_dep)
81 )
628100c1
PG
82endif
83
84configure_file(output: 'config.h', configuration: config_h)
85config_h_include = include_directories('.')
86
87if host_machine.system() == 'windows'
d13d2b0e
P
88 add_languages('cpp')
89
e9b9ff9f
PG
90 add_project_arguments(
91 '-DWIN32',
d13d2b0e
P
92 '-DNTDDI_VERSION=NTDDI_WIN8',
93 '-D_WIN32_WINNT=_WIN32_WINNT_WIN8',
e9b9ff9f 94 language: 'c')
d13d2b0e
P
95 add_project_arguments(
96 '-DWIN32',
97 '-DNTDDI_VERSION=NTDDI_WIN8',
98 '-D_WIN32_WINNT=_WIN32_WINNT_WIN8',
99 language: 'cpp')
628100c1
PG
100endif
101
102
103global_cflags = []
104test_cflags = [
628100c1
PG
105 '-funsigned-char',
106 '-Wno-conversion',
107 '-Wno-pointer-sign',
108 '-Wno-padded',
109 '-Wno-unused-parameter',
110 '-Wno-missing-prototypes',
111 '-Winline',
112 '-Wstrict-prototypes',
113 '-Werror=implicit-function-declaration',
114 '-Werror=pointer-arith',
115 '-Werror=init-self',
116 ['-Werror=format-security', '-Werror=format=1'],
117 '-Werror=missing-include-dirs',
118 '-Werror=date-time',
119]
628100c1
PG
120foreach cflag : test_cflags
121 if cc.has_multi_arguments(cflag)
122 global_cflags += cflag
123 endif
124endforeach
e68976ab
PG
125if get_option('buildtype') != 'plain'
126 if cc.has_argument('-fstack-protector-strong') and cc.links('''
127 int main (void) {
128 char buffer[16];
129 strcpy(buffer, "foo");
130 return 0;
131 }
132 ''', args: '-fstack-protector-all')
133 global_cflags += '-fstack-protector-strong'
e9b9ff9f
PG
134
135 if host_machine.system() == 'windows'
136 global_deps += cc.find_library('ssp')
137 endif
e68976ab
PG
138 endif
139endif
628100c1
PG
140add_project_arguments(global_cflags, language: 'c')
141
e68976ab
PG
142
143global_ldflags = []
144test_ldflags = [
145 '-Wl,-z,relro',
146 '-Wl,-z,now',
e9b9ff9f 147 # mingw
e9b9ff9f 148 '-Wl,--nxcompat',
e68976ab 149]
c2cdf0d2 150if not (host_machine.system() == 'windows' and get_option('debug'))
151 test_ldflags += '-Wl,--dynamicbase'
152endif
e68976ab 153foreach ldflag : test_ldflags
c7322f40
PG
154 if meson.version().version_compare('>= 0.46.0')
155 has_arg = cc.has_link_argument(ldflag)
156 else
157 has_arg = cc.has_argument(ldflag)
158 endif
159
160 if has_arg and cc.links('int main (void) { return 0; }', args: ldflag)
e68976ab
PG
161 global_ldflags += ldflag
162 endif
163endforeach
164add_project_link_arguments(global_ldflags, language: 'c')
628100c1
PG
165
166subdir('src')
cbb0927a 167if get_option('plugin')
628100c1
PG
168 subdir('plugins')
169endif
170if cc.get_id() != 'msvc'
171 subdir('data')
172 subdir('po') # FIXME: build xgettext
173
174 meson.add_install_script('meson_post_install.py',
cbb0927a 175 '@0@'.format(get_option('theme-manager'))
628100c1
PG
176 )
177endif
cbb0927a
PG
178
179if meson.version().version_compare('>= 0.53.0')
180 summary({
181 'prefix': get_option('prefix'),
182 'bindir': get_option('bindir'),
183 'libdir': get_option('libdir'),
184 'datadir': get_option('datadir'),
185 }, section: 'Directories')
186
187 summary({
188 'TLS (openssl)': libssl_dep.found(),
189 'Plugin Support': get_option('plugin'),
190 'DBus Support': dbus_glib_dep.found(),
cbb0927a
PG
191 'libcanberra': libcanberra_dep.found(),
192 }, section: 'Features')
193
194 summary({
195 'Lua': get_option('with-lua'),
196 'Python': get_option('with-python'),
197 'Perl': get_option('with-perl'),
198 'Perl Legacy API': get_option('with-perl-legacy-api'),
199 'FiSH': get_option('with-fishlim'),
200 'Sysinfo': get_option('with-sysinfo'),
201 'DCC Checksum': get_option('with-checksum'),
202 }, section: 'Plugins')
203endif