2 '-DG_LOG_DOMAIN="GLib-GIO"',
4 '-DGIO_MODULE_DIR="@0@"'.format(glib_giomodulesdir),
7 # FIXME: Install empty glib_giomodulesdir
9 gnetworking_h_conf = configuration_data()
11 gnetworking_h_wspiapi_include = ''
12 gnetworking_h_nameser_compat_include = ''
14 if host_system == 'windows'
15 # <wspiapi.h> in the Windows SDK and in mingw-w64 has wrappers for
16 # inline workarounds for getaddrinfo, getnameinfo and freeaddrinfo if
17 # they aren't present at run-time (on Windows 2000).
18 gnetworking_h_wspiapi_include = '#include <wspiapi.h>'
21 if host_system.contains('android')
22 # Android does not have C_IN in public headers, we define it wherever necessary
23 if not cc.compiles('''#include <sys/types.h>
24 #include <arpa/nameser.h>
25 int qclass = C_IN;''',
26 name : 'C_IN in public headers (no arpa/nameser_compat.h needed)')
27 if cc.compiles('''#include <sys/types.h>
28 #include <arpa/nameser.h>
29 #include <arpa/nameser_compat.h>
30 int qclass = C_IN;''',
31 name : 'arpa/nameser_compat.h needed for C_IN')
32 gnetworking_h_nameser_compat_include = '#include <arpa/nameser_compat.h>'
34 error('Could not find required includes for ARPA C_IN')
41 if host_system != 'windows'
43 res_query_test = '''#include <resolv.h>
44 int main (int argc, char ** argv) {
45 return res_query("test", 0, 0, (void *)0, 0);
47 res_query_test_full = '''#include <sys/types.h>
48 #include <netinet/in.h>
49 #include <arpa/nameser.h>
51 if not cc.links(res_query_test_full, name : 'res_query()')
52 if cc.links(res_query_test_full, args : '-lresolv', name : 'res_query() in -lresolv')
53 network_libs += [ cc.find_library('resolv') ]
54 network_args += [ '-lresolv' ]
55 elif cc.links(res_query_test, args : '-lbind', name : 'res_query() in -lbind')
56 network_libs += [ cc.find_library('bind') ]
57 network_args += [ '-lbind' ]
59 error('Could not find res_query()')
64 socket_test = '''#include <sys/types.h>
65 #include <sys/socket.h>
66 int main (int argc, char ** argv) {
67 return socket(1, 2, 3);
69 if not cc.links(socket_test, name : 'socket()')
70 if cc.links(socket_test, args : '-lsocket', name : 'socket() in -lsocket')
71 network_libs += [ cc.find_library('socket') ]
72 network_args += [ '-lsocket' ]
74 error('Could not find socket()')
79 if cc.links('''#include <sys/types.h>
80 #include <netinet/in.h>
81 #include <arpa/nameser.h>
83 int main (int argc, char ** argv) {
85 }''', args : network_args, name : 'res_init()')
86 glib_conf.set('HAVE_RES_INIT', 1)
89 if cc.compiles('''#include <netinet/in.h>
90 struct ip_mreqn foo;''',
91 name : 'struct ip_mreqn')
92 glib_conf.set('HAVE_IP_MREQN', '/**/')
96 network_args_string = ''
97 foreach arg : network_args
98 network_args_string += arg + ' '
100 glib_conf.set('NETWORK_LIBS', network_args_string)
102 gnetworking_h_conf.set('WSPIAPI_INCLUDE', gnetworking_h_wspiapi_include)
103 gnetworking_h_conf.set('NAMESER_COMPAT_INCLUDE', gnetworking_h_nameser_compat_include)
105 gnetworking_h = configure_file(input : 'gnetworking.h.in',
106 output : 'gnetworking.h',
107 install_dir : join_paths(get_option('includedir'), 'glib-2.0/gio'),
108 configuration : gnetworking_h_conf)
111 'gdbusauthobserver.h',
119 'gdbusnamewatching.h',
121 'gdbusintrospection.h',
122 'gdbusmethodinvocation.h',
125 'gdbusinterfaceskeleton.h',
127 'gdbusobjectskeleton.h',
128 'gdbusobjectproxy.h',
129 'gdbusobjectmanager.h',
130 'gdbusobjectmanagerclient.h',
131 'gdbusobjectmanagerserver.h',
138 'gdbusauthobserver.c',
140 'gdbusauthmechanism.c',
141 'gdbusauthmechanismanon.c',
142 'gdbusauthmechanismexternal.c',
143 'gdbusauthmechanismsha1.c',
148 'gdbusnamewatching.c',
151 'gdbusintrospection.c',
152 'gdbusmethodinvocation.c',
155 'gdbusinterfaceskeleton.c',
157 'gdbusobjectskeleton.c',
158 'gdbusobjectproxy.c',
159 'gdbusobjectmanager.c',
160 'gdbusobjectmanagerclient.c',
161 'gdbusobjectmanagerserver.c',
165 # Generate gdbus-codegen
166 subdir('gdbus-2.0/codegen')
168 # Generate xdp-dbus.{c,h}
169 xdp_dbus_generated = custom_target('xdp-dbus',
170 input : ['org.freedesktop.portal.Documents.xml',
171 'org.freedesktop.portal.NetworkMonitor.xml',
172 'org.freedesktop.portal.ProxyResolver.xml'],
173 output : ['xdp-dbus.h', 'xdp-dbus.c'],
174 command : [python, gdbus_codegen,
175 '--interface-prefix', 'org.freedesktop.portal.',
176 '--generate-c-code', '@OUTDIR@/xdp-dbus',
177 '--c-namespace', 'GXdp',
178 '--annotate', 'org.freedesktop.portal.Documents.Add()',
179 'org.gtk.GDBus.C.UnixFD', 'true',
180 '--annotate', 'org.freedesktop.portal.Documents.AddNamed()',
181 'org.gtk.GDBus.C.UnixFD', 'true',
184 # Generate gdbus-generated.{c,h}
185 gdbus_daemon_generated = custom_target('gdbus-daemon-generated',
186 input : ['dbus-daemon.xml'],
187 output : ['gdbus-daemon-generated.h', 'gdbus-daemon-generated.c'],
188 command : [python, gdbus_codegen,
189 '--interface-prefix', 'org.',
190 '--generate-c-code', '@OUTDIR@/gdbus-daemon-generated',
191 '--c-namespace', '_G', '@INPUT@'])
194 'gsettingsbackend.h',
200 'gvdb/gvdb-reader.c',
201 'gdelayedsettingsbackend.c',
202 'gkeyfilesettingsbackend.c',
203 'gmemorysettingsbackend.c',
204 'gnullsettingsbackend.c',
205 'gsettingsbackend.c',
207 'gsettings-mapping.c',
211 if host_system == 'windows'
212 settings_sources += [ 'gregistrysettingsbackend.c' ]
217 #settings_sources += [ 'gnextstepsettingsbackend.c' ]
220 application_headers = [
222 'gapplicationcommandline.h',
226 'gsimpleactiongroup.h',
227 'gremoteactiongroup.h',
228 'gactiongroupexporter.h',
229 'gdbusactiongroup.h',
241 application_sources = [
243 'gapplicationcommandline.c',
244 'gapplicationimpl-dbus.c',
248 'gsimpleactiongroup.c',
249 'gremoteactiongroup.c',
250 'gactiongroupexporter.c',
251 'gdbusactiongroup.c',
261 'gnotificationbackend.c',
267 'glocalfileenumerator.c',
269 'glocalfileinputstream.c',
270 'glocalfilemonitor.c',
271 'glocalfileoutputstream.c',
272 'glocalfileiostream.c',
277 'thumbnail-verify.c',
286 if host_system != 'windows'
287 appinfo_sources += ['gdesktopappinfo.c']
289 internal_deps += [xdgmime_lib]
291 'gfiledescriptorbased.c',
293 'gunixcredentialsmessage.c',
298 'gunixsocketaddress.c',
300 'gunixvolumemonitor.c',
301 'gunixinputstream.c',
302 'gunixoutputstream.c',
304 'gfdonotificationbackend.c',
305 'ggtknotificationbackend.c',
310 'gnetworkmonitorportal.c',
311 'gproxyresolverportal.c',
313 'gportalnotificationbackend.c',
319 #unix_sources += gcocoanotificationbackend.c
322 gio_unix_include_headers = [
324 'gfiledescriptorbased.h',
326 'gunixcredentialsmessage.h',
330 'gunixinputstream.h',
331 'gunixoutputstream.h',
332 'gunixsocketaddress.h',
334 install_headers(gio_unix_include_headers, subdir : 'gio-unix-2.0/gio')
336 if glib_conf.has('HAVE_NETLINK')
338 'gnetworkmonitornetlink.c',
339 'gnetworkmonitornm.c',
344 gdbus_daemon_sources = [
346 gdbus_daemon_generated,
349 win32_sources = gdbus_daemon_sources
350 if host_system == 'windows'
351 appinfo_sources += ['gwin32appinfo.c']
352 platform_deps += [cc.find_library('shlwapi'),
353 cc.find_library('dnsapi'),
354 cc.find_library('iphlpapi'),
357 'gwin32registrykey.c',
358 'gcontenttype-win32.c',
360 'gwin32volumemonitor.c',
361 'gwin32inputstream.c',
362 'gwin32outputstream.c',
365 gio_win32_include_headers = [
366 'gwin32inputstream.h',
367 'gwin32outputstream.h',
369 install_headers(gio_win32_include_headers, subdir : 'gio-win32-2.0/gio')
377 'gbufferedinputstream.c',
378 'gbufferedoutputstream.c',
381 'gcharsetconverter.c',
382 'gcontextspecificgroup.c',
384 'gconverterinputstream.c',
385 'gconverteroutputstream.c',
388 'gdatainputstream.c',
389 'gdataoutputstream.c',
392 'gdummyproxyresolver.c',
393 'gdummytlsbackend.c',
401 'gfileinputstream.c',
403 'gfilenamecompleter.c',
404 'gfileoutputstream.c',
406 'gfilterinputstream.c',
407 'gfilteroutputstream.c',
410 'ginetaddressmask.c',
411 'ginetsocketaddress.c',
420 'gmemoryinputstream.c',
421 'gmemoryoutputstream.c',
423 'gnativevolumemonitor.c',
424 'gnativesocketaddress.c',
428 'gnetworkmonitorbase.c',
432 'gpollableinputstream.c',
433 'gpollableoutputstream.c',
435 'gpollfilemonitor.c',
438 'gproxyaddressenumerator.c',
444 'gsimpleasyncresult.c',
446 'gsimplepermission.c',
449 'gsocketaddressenumerator.c',
451 'gsocketconnectable.c',
452 'gsocketconnection.c',
453 'gsocketcontrolmessage.c',
454 'gsocketinputstream.c',
456 'gsocketoutputstream.c',
457 'gsubprocesslauncher.c',
461 'gsimpleproxyresolver.c',
464 'gtcpwrapperconnection.c',
465 'gthreadedsocketservice.c',
467 'gthreadedresolver.c',
468 'gthreadedresolver.h',
471 'gtlsclientconnection.c',
474 'gtlsfiledatabase.c',
477 'gtlsserverconnection.c',
479 'gdtlsclientconnection.c',
480 'gdtlsserverconnection.c',
481 'gunionvolumemonitor.c',
486 'gzlibdecompressor.c',
491 gio_sources += appinfo_sources
492 gio_sources += unix_sources
493 gio_sources += win32_sources
494 gio_sources += application_sources
495 gio_sources += settings_sources
496 gio_sources += gdbus_sources
497 gio_sources += portal_sources
498 gio_sources += local_sources
501 if OS_WIN32_AND_DLL_COMPILATION
502 gio_win32_res = gio-win32-res.o
503 gio_win32_res_ldflag = -Wl,$(gio_win32_res)
506 gio-win32-res.o: gio.rc
507 '$(WINDRES) gio.rc $@
509 # This is read by gobject-introspection/misc/ and gtk-doc
510 gio-public-headers.txt: Makefile
511 '$(AM_V_GEN) echo $(gioinclude_HEADERS) $(giowin32include_HEADERS) $(giounixinclude_HEADERS) > $@.tmp && mv $@.tmp $@
513 gio.def: libgio-2.0.la
514 '$(AM_V_GEN) dumpbin.exe -exports .libs/libgio-2.0-0.dll | awk 'BEGIN { print "EXPORTS" } / +[[:digit:]]+ +[[:xdigit:]]+ +[[:xdigit:]]+/{ print $$4 }' > gio.def.tmp && mv gio.def.tmp gio.def
516 gio-2.0.lib: libgio-2.0.la gio.def
517 '$(AM_V_GEN) lib.exe -machine:@LIB_EXE_MACHINE_FLAG@ -name:libgio-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:$(builddir)/gio.def -out:$@
524 'gbufferedinputstream.h',
525 'gbufferedoutputstream.h',
529 'gcharsetconverter.h',
531 'gconverterinputstream.h',
532 'gconverteroutputstream.h',
534 'gdatainputstream.h',
535 'gdataoutputstream.h',
544 'gfileinputstream.h',
546 'gfilenamecompleter.h',
547 'gfileoutputstream.h',
549 'gfilterinputstream.h',
550 'gfilteroutputstream.h',
553 'ginetaddressmask.h',
554 'ginetsocketaddress.h',
558 'gio-autocleanups.h',
567 'gmemoryinputstream.h',
568 'gmemoryoutputstream.h',
570 'gnativevolumemonitor.h',
576 'gpollableinputstream.h',
577 'gpollableoutputstream.h',
581 'gproxyaddressenumerator.h',
586 'gsimpleasyncresult.h',
588 'gsimplepermission.h',
591 'gsocketaddressenumerator.h',
593 'gsocketconnectable.h',
594 'gsocketconnection.h',
595 'gsocketcontrolmessage.h',
599 'gsimpleproxyresolver.h',
602 'gsubprocesslauncher.h',
604 'gtcpwrapperconnection.h',
605 'gthreadedsocketservice.h',
609 'gtlsclientconnection.h',
612 'gtlsfiledatabase.h',
615 'gtlsserverconnection.h',
617 'gdtlsclientconnection.h',
618 'gdtlsserverconnection.h',
623 'gzlibdecompressor.h',
628 gio_headers += application_headers
629 gio_headers += settings_headers
630 gio_headers += gdbus_headers
631 install_headers(gio_headers, subdir : 'glib-2.0/gio/')
633 gio_build_mkenum = find_program('build_mkenum.py')
635 gioenumtypes_h = custom_target('gioenumtypes_h',
636 output : 'gioenumtypes.h',
639 install_dir : join_paths(get_option('includedir'), 'glib-2.0/gio'),
640 command : [gio_build_mkenum, perl, glib_mkenums,
641 '@OUTPUT@', meson.current_source_dir(),
642 '@INPUT@', gnetworking_h])
644 gioenumtypes_c = custom_target('gioenumtypes_c',
645 output : 'gioenumtypes.c',
647 depends : [gioenumtypes_h],
648 command : [gio_build_mkenum, perl, glib_mkenums,
649 '@OUTPUT@', meson.current_source_dir(),
650 '@INPUT@', gnetworking_h])
652 gioenumtypes_dep = declare_dependency(sources : [gioenumtypes_h])
655 if glib_conf.has('HAVE_SYS_INOTIFY_H') and have_func_inotify_init1
657 internal_deps += [ inotify_lib ]
661 if have_func_kqueue and have_func_kevent
663 internal_deps += [ kqueue_lib ]
666 if host_system == 'windows'
668 internal_deps += [ giowin32_lib ]
677 'completion/gapplication',
679 'completion/gsettings',
680 'completion/gresource'
682 install_dir: join_paths(get_option('datadir'), 'bash-completion/completions'))
684 libgio = shared_library('gio-2.0',
685 gioenumtypes_h, gioenumtypes_c, gnetworking_h, gio_sources,
686 version : library_version,
687 soversion : soversion,
689 include_directories : [configinc, gioinc],
690 link_with : internal_deps,
691 #libgio_2_0_la_LDFLAGS = $(GLIB_LINK_FLAGS)',
692 # '$(gio_win32_res_ldflag)',
695 dependencies : [libintl, libz_dep, libdl_dep, libmount_dep, libglib_dep,
696 libgobject_dep, libgmodule_dep] + platform_deps + network_libs,
698 # intl.lib is not compatible with SAFESEH
699 link_args : noseh_link_args,
702 libgio_dep = declare_dependency(link_with : libgio,
703 dependencies : [gioenumtypes_dep],
704 # We sadly need to export configinc here because everyone includes <gio/*.h>
705 include_directories : [configinc, gioinc])
707 # Dependencies used by executables below
708 libelf = dependency('libelf', version : '>= 0.8.12', required : false)
710 glib_conf.set('HAVE_LIBELF', 1)
713 gconstructor_as_data_h = custom_target('gconstructor_as_data.h',
714 input : ['data-to-c.py', meson.source_root() + '/glib/gconstructor.h'],
715 output : ['gconstructor_as_data.h'],
716 command : [python, '@INPUT0@', '@INPUT1@', 'gconstructor_code', '@OUTPUT@'])
718 # Several installed executables
728 'gio-tool-monitor.c',
740 executable('gio', gio_tool_sources,
742 c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
743 # intl.lib is not compatible with SAFESEH
744 link_args : noseh_link_args,
745 dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
747 executable('gresource', 'gresource-tool.c',
749 c_args : ['-DHAVE_CONFIG_H=1'],
750 # intl.lib is not compatible with SAFESEH
751 link_args : noseh_link_args,
752 dependencies : [libelf, libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
754 executable('gio-querymodules', 'gio-querymodules.c',
756 c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
757 # intl.lib is not compatible with SAFESEH
758 link_args : noseh_link_args,
759 dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
761 executable('glib-compile-schemas',
762 [gconstructor_as_data_h, 'gvdb/gvdb-builder.c', 'glib-compile-schemas.c'],
764 c_args : ['-DHAVE_CONFIG_H=1'],
765 # intl.lib is not compatible with SAFESEH
766 link_args : noseh_link_args,
767 dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
769 executable('glib-compile-resources',
770 [gconstructor_as_data_h, 'gvdb/gvdb-builder.c', 'glib-compile-resources.c'],
772 c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
773 # intl.lib is not compatible with SAFESEH
774 link_args : noseh_link_args,
775 dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
777 executable('gsettings', 'gsettings-tool.c',
779 c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
780 # intl.lib is not compatible with SAFESEH
781 link_args : noseh_link_args,
782 dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
783 install_data('gschema.dtd',
784 install_dir : join_paths(get_option('datadir'), 'glib-2.0/schemas'))
786 install_data(['gschema.loc', 'gschema.its'],
787 install_dir : join_paths(get_option('datadir'), 'gettext/its'))
789 executable('gdbus', 'gdbus-tool.c',
791 c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
792 # intl.lib is not compatible with SAFESEH
793 link_args : noseh_link_args,
794 dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
796 if host_system != 'windows'
797 executable('gapplication', 'gapplication-tool.c',
799 c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
800 # intl.lib is not compatible with SAFESEH
801 link_args : noseh_link_args,
802 dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
805 if host_system != 'windows'