2 '-DG_LOG_DOMAIN="GLib-GIO"',
4 '-DGIO_MODULE_DIR="@0@"'.format(glib_giomodulesdir),
7 gio_c_args += glib_hidden_visibility_args
9 # FIXME: Install empty glib_giomodulesdir
11 gnetworking_h_conf = configuration_data()
13 gnetworking_h_wspiapi_include = ''
14 gnetworking_h_nameser_compat_include = ''
16 if host_system == 'windows'
17 # <wspiapi.h> in the Windows SDK and in mingw-w64 has wrappers for
18 # inline workarounds for getaddrinfo, getnameinfo and freeaddrinfo if
19 # they aren't present at run-time (on Windows 2000).
20 gnetworking_h_wspiapi_include = '#include <wspiapi.h>'
21 elif not host_system.contains('android')
22 # Don't check for C_IN on Android since it does not define it in public
23 # headers, we define it ourselves wherever necessary
24 if not cc.compiles('''#include <sys/types.h>
25 #include <arpa/nameser.h>
26 int qclass = C_IN;''',
27 name : 'C_IN in public headers (no arpa/nameser_compat.h needed)')
28 if cc.compiles('''#include <sys/types.h>
29 #include <arpa/nameser.h>
30 #include <arpa/nameser_compat.h>
31 int qclass = C_IN;''',
32 name : 'arpa/nameser_compat.h needed for C_IN')
33 gnetworking_h_nameser_compat_include = '#include <arpa/nameser_compat.h>'
35 error('Could not find required includes for ARPA C_IN')
42 if host_system != 'windows'
44 res_query_test = '''#include <resolv.h>
45 int main (int argc, char ** argv) {
46 return res_query("test", 0, 0, (void *)0, 0);
48 res_query_test_full = '''#include <sys/types.h>
49 #include <netinet/in.h>
50 #include <arpa/nameser.h>
52 if not cc.links(res_query_test_full, name : 'res_query()')
53 if cc.links(res_query_test_full, args : '-lresolv', name : 'res_query() in -lresolv')
54 network_libs += [ cc.find_library('resolv') ]
55 network_args += [ '-lresolv' ]
56 elif cc.links(res_query_test, args : '-lbind', name : 'res_query() in -lbind')
57 network_libs += [ cc.find_library('bind') ]
58 network_args += [ '-lbind' ]
60 error('Could not find res_query()')
65 socket_test = '''#include <sys/types.h>
66 #include <sys/socket.h>
67 int main (int argc, char ** argv) {
68 return socket(1, 2, 3);
70 if not cc.links(socket_test, name : 'socket()')
71 if cc.links(socket_test, args : '-lsocket', name : 'socket() in -lsocket')
72 network_libs += [ cc.find_library('socket') ]
73 network_args += [ '-lsocket' ]
75 error('Could not find socket()')
80 if cc.links('''#include <sys/types.h>
81 #include <netinet/in.h>
82 #include <arpa/nameser.h>
84 int main (int argc, char ** argv) {
86 }''', args : network_args, name : 'res_init()')
87 glib_conf.set('HAVE_RES_INIT', 1)
91 if cc.links('''#include <sys/types.h>
92 #include <netinet/in.h>
93 #include <arpa/nameser.h>
95 int main (int argc, char ** argv) {
96 struct __res_state res;
97 return res_nclose(&res);
98 }''', args : network_args, name : 'res_nclose()')
99 glib_conf.set('HAVE_RES_NCLOSE', 1)
103 if cc.links('''#include <sys/types.h>
104 #include <netinet/in.h>
105 #include <arpa/nameser.h>
107 int main (int argc, char ** argv) {
108 struct __res_state res;
109 return res_ndestroy(&res);
110 }''', args : network_args, name : 'res_ndestroy()')
111 glib_conf.set('HAVE_RES_NDESTROY', 1)
115 if cc.links('''#include <sys/types.h>
116 #include <netinet/in.h>
117 #include <arpa/nameser.h>
119 int main (int argc, char ** argv) {
120 struct __res_state res;
121 return res_ninit(&res);
122 }''', args : network_args, name : 'res_ninit()')
123 glib_conf.set('HAVE_RES_NINIT', 1)
127 if cc.links('''#include <sys/types.h>
128 #include <netinet/in.h>
129 #include <arpa/nameser.h>
131 int main (int argc, char ** argv) {
132 struct __res_state res;
133 return res_nquery(&res, "test", 0, 0, (void *)0, 0);
134 }''', args : network_args, name : 'res_nquery()')
135 glib_conf.set('HAVE_RES_NQUERY', 1)
138 if cc.compiles('''#include <netinet/in.h>
139 struct ip_mreqn foo;''',
140 name : 'struct ip_mreqn')
141 glib_conf.set('HAVE_IP_MREQN', '/**/')
144 if cc.compiles('''#include <sys/ioctl.h>
146 int main (int argc, char ** argv) {
148 ioctl(0, SIOCGIFADDR, &ifr);
151 name : 'ioctl with request SIOCGIFADDR')
152 glib_conf.set('HAVE_SIOCGIFADDR', '/**/')
157 network_args_string = ''
158 foreach arg : network_args
159 network_args_string += arg + ' '
161 glib_conf.set('NETWORK_LIBS', network_args_string)
163 gnetworking_h_conf.set('WSPIAPI_INCLUDE', gnetworking_h_wspiapi_include)
164 gnetworking_h_conf.set('NAMESER_COMPAT_INCLUDE', gnetworking_h_nameser_compat_include)
166 gnetworking_h = configure_file(input : 'gnetworking.h.in',
167 output : 'gnetworking.h',
168 install_dir : join_paths(get_option('includedir'), 'glib-2.0/gio'),
169 configuration : gnetworking_h_conf)
171 gdbus_headers = files(
172 'gdbusauthobserver.h',
180 'gdbusnamewatching.h',
182 'gdbusintrospection.h',
183 'gdbusmethodinvocation.h',
186 'gdbusinterfaceskeleton.h',
188 'gdbusobjectskeleton.h',
189 'gdbusobjectproxy.h',
190 'gdbusobjectmanager.h',
191 'gdbusobjectmanagerclient.h',
192 'gdbusobjectmanagerserver.h',
196 gdbus_sources = files(
199 'gdbusauthobserver.c',
201 'gdbusauthmechanism.c',
202 'gdbusauthmechanismanon.c',
203 'gdbusauthmechanismexternal.c',
204 'gdbusauthmechanismsha1.c',
209 'gdbusnamewatching.c',
212 'gdbusintrospection.c',
213 'gdbusmethodinvocation.c',
216 'gdbusinterfaceskeleton.c',
218 'gdbusobjectskeleton.c',
219 'gdbusobjectproxy.c',
220 'gdbusobjectmanager.c',
221 'gdbusobjectmanagerclient.c',
222 'gdbusobjectmanagerserver.c',
226 # Generate gdbus-codegen
227 subdir('gdbus-2.0/codegen')
229 # Generate xdp-dbus.{c,h}
230 xdp_dbus_generated = custom_target('xdp-dbus',
231 input : ['org.freedesktop.portal.Documents.xml',
232 'org.freedesktop.portal.OpenURI.xml',
233 'org.freedesktop.portal.NetworkMonitor.xml',
234 'org.freedesktop.portal.ProxyResolver.xml'],
235 output : ['xdp-dbus.h', 'xdp-dbus.c'],
236 depend_files : gdbus_codegen_built_files,
237 command : [python, gdbus_codegen,
238 '--interface-prefix', 'org.freedesktop.portal.',
239 '--output-directory', '@OUTDIR@',
240 '--generate-c-code', 'xdp-dbus',
241 '--c-namespace', 'GXdp',
242 '--annotate', 'org.freedesktop.portal.Documents.Add()',
243 'org.gtk.GDBus.C.UnixFD', 'true',
244 '--annotate', 'org.freedesktop.portal.Documents.AddNamed()',
245 'org.gtk.GDBus.C.UnixFD', 'true',
246 '--annotate', 'org.freedesktop.portal.Documents.AddFull()',
247 'org.gtk.GDBus.C.UnixFD', 'true',
248 '--annotate', 'org.freedesktop.portal.OpenURI.OpenFile()',
249 'org.gtk.GDBus.C.UnixFD', 'true',
252 # Generate gdbus-generated.{c,h}
253 gdbus_daemon_generated = custom_target('gdbus-daemon-generated',
254 input : ['dbus-daemon.xml'],
255 output : ['gdbus-daemon-generated.h', 'gdbus-daemon-generated.c'],
256 depend_files : gdbus_codegen_built_files,
257 command : [python, gdbus_codegen,
258 '--interface-prefix', 'org.',
259 '--output-directory', '@OUTDIR@',
260 '--generate-c-code', 'gdbus-daemon-generated',
261 '--c-namespace', '_G', '@INPUT@'])
263 settings_headers = files(
264 'gsettingsbackend.h',
269 settings_sources = files(
270 'gvdb/gvdb-reader.c',
271 'gdelayedsettingsbackend.c',
272 'gkeyfilesettingsbackend.c',
273 'gmemorysettingsbackend.c',
274 'gnullsettingsbackend.c',
275 'gsettingsbackend.c',
277 'gsettings-mapping.c',
281 if host_system == 'windows'
282 settings_sources += files('gregistrysettingsbackend.c')
287 #settings_sources += files('gnextstepsettingsbackend.c')
290 application_headers = files(
292 'gapplicationcommandline.h',
296 'gsimpleactiongroup.h',
297 'gremoteactiongroup.h',
298 'gactiongroupexporter.h',
299 'gdbusactiongroup.h',
311 application_sources = files(
313 'gapplicationcommandline.c',
314 'gapplicationimpl-dbus.c',
318 'gsimpleactiongroup.c',
319 'gremoteactiongroup.c',
320 'gactiongroupexporter.c',
321 'gdbusactiongroup.c',
331 'gnotificationbackend.c',
334 local_sources = files(
337 'glocalfileenumerator.c',
339 'glocalfileinputstream.c',
340 'glocalfilemonitor.c',
341 'glocalfileoutputstream.c',
342 'glocalfileiostream.c',
347 'thumbnail-verify.c',
353 contenttype_sources = []
358 # This is also used by tests/gdbus-daemon, so use files() to include the path
359 gdbus_daemon_sources = [
360 files('gdbusdaemon.c'),
361 gdbus_daemon_generated,
364 if host_system != 'windows'
365 unix_sources = files(
366 'gfiledescriptorbased.c',
368 'gunixcredentialsmessage.c',
373 'gunixsocketaddress.c',
375 'gunixvolumemonitor.c',
376 'gunixinputstream.c',
377 'gunixoutputstream.c',
378 'gfdonotificationbackend.c',
379 'ggtknotificationbackend.c',
382 portal_sources = [files(
385 'gnetworkmonitorportal.c',
386 'gproxyresolverportal.c',
388 'gportalnotificationbackend.c'),
392 gio_unix_include_headers = files(
393 'gfiledescriptorbased.h',
395 'gunixcredentialsmessage.h',
399 'gunixinputstream.h',
400 'gunixoutputstream.h',
401 'gunixsocketaddress.h',
405 contenttype_sources += files('gosxcontenttype.c')
406 appinfo_sources += files('gosxappinfo.c')
407 if glib_have_os_x_9_or_later
408 unix_sources += files('gcocoanotificationbackend.c')
411 contenttype_sources += files('gcontenttype.c')
412 appinfo_sources += files('gdesktopappinfo.c')
413 gio_unix_include_headers += files('gdesktopappinfo.h')
415 internal_deps += [xdgmime_lib]
418 install_headers(gio_unix_include_headers, subdir : 'gio-unix-2.0/gio')
420 if glib_conf.has('HAVE_NETLINK')
421 unix_sources += files(
422 'gnetworkmonitornetlink.c',
423 'gnetworkmonitornm.c',
427 appinfo_sources += files('gwin32appinfo.c')
428 contenttype_sources += files('gcontenttype-win32.c')
429 platform_deps += [cc.find_library('shlwapi'),
430 cc.find_library('dnsapi'),
433 win32_sources += files(
434 'gwin32registrykey.c',
436 'gwin32volumemonitor.c',
437 'gwin32inputstream.c',
438 'gwin32outputstream.c',
439 'gwin32networkmonitor.c',
440 'gwin32networkmonitor.h',
443 gio_win_rc = configure_file(
446 configuration: glibconfig_conf,
448 gio_win_res = windows.compile_resources(gio_win_rc)
449 win32_sources += [gio_win_res]
451 gio_win32_include_headers = files(
452 'gwin32inputstream.h',
453 'gwin32outputstream.h',
455 install_headers(gio_win32_include_headers, subdir : 'gio-win32-2.0/gio')
463 'gbufferedinputstream.c',
464 'gbufferedoutputstream.c',
467 'gcharsetconverter.c',
468 'gcontextspecificgroup.c',
470 'gconverterinputstream.c',
471 'gconverteroutputstream.c',
474 'gdatainputstream.c',
475 'gdataoutputstream.c',
478 'gdummyproxyresolver.c',
479 'gdummytlsbackend.c',
487 'gfileinputstream.c',
489 'gfilenamecompleter.c',
490 'gfileoutputstream.c',
492 'gfilterinputstream.c',
493 'gfilteroutputstream.c',
496 'ginetaddressmask.c',
497 'ginetsocketaddress.c',
507 'gmemoryinputstream.c',
508 'gmemoryoutputstream.c',
510 'gnativevolumemonitor.c',
511 'gnativesocketaddress.c',
515 'gnetworkmonitorbase.c',
519 'gpollableinputstream.c',
520 'gpollableoutputstream.c',
522 'gpollfilemonitor.c',
525 'gproxyaddressenumerator.c',
531 'gsimpleasyncresult.c',
533 'gsimplepermission.c',
536 'gsocketaddressenumerator.c',
538 'gsocketconnectable.c',
539 'gsocketconnection.c',
540 'gsocketcontrolmessage.c',
541 'gsocketinputstream.c',
543 'gsocketoutputstream.c',
544 'gsubprocesslauncher.c',
548 'gsimpleproxyresolver.c',
551 'gtcpwrapperconnection.c',
552 'gthreadedsocketservice.c',
554 'gthreadedresolver.c',
555 'gthreadedresolver.h',
558 'gtlsclientconnection.c',
561 'gtlsfiledatabase.c',
564 'gtlsserverconnection.c',
566 'gdtlsclientconnection.c',
567 'gdtlsserverconnection.c',
568 'gunionvolumemonitor.c',
573 'gzlibdecompressor.c',
578 gio_sources += appinfo_sources
579 gio_sources += contenttype_sources
580 gio_sources += gdbus_daemon_sources
581 gio_sources += unix_sources
582 gio_sources += win32_sources
583 gio_sources += application_sources
584 gio_sources += settings_sources
585 gio_sources += gdbus_sources
586 gio_sources += portal_sources
587 gio_sources += local_sources
590 # This is read by gobject-introspection/misc/ and gtk-doc
591 gio-public-headers.txt: Makefile
592 '$(AM_V_GEN) echo $(gioinclude_HEADERS) $(giowin32include_HEADERS) $(giounixinclude_HEADERS) > $@.tmp && mv $@.tmp $@
594 gio.def: libgio-2.0.la
595 '$(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
597 gio-2.0.lib: libgio-2.0.la gio.def
598 '$(AM_V_GEN) lib.exe -machine:@LIB_EXE_MACHINE_FLAG@ -name:libgio-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:$(builddir)/gio.def -out:$@
605 'gbufferedinputstream.h',
606 'gbufferedoutputstream.h',
610 'gcharsetconverter.h',
612 'gconverterinputstream.h',
613 'gconverteroutputstream.h',
615 'gdatainputstream.h',
616 'gdataoutputstream.h',
625 'gfileinputstream.h',
627 'gfilenamecompleter.h',
628 'gfileoutputstream.h',
630 'gfilterinputstream.h',
631 'gfilteroutputstream.h',
634 'ginetaddressmask.h',
635 'ginetsocketaddress.h',
639 'gio-autocleanups.h',
648 'gmemoryinputstream.h',
649 'gmemoryoutputstream.h',
651 'gnativevolumemonitor.h',
657 'gpollableinputstream.h',
658 'gpollableoutputstream.h',
662 'gproxyaddressenumerator.h',
667 'gsimpleasyncresult.h',
669 'gsimplepermission.h',
672 'gsocketaddressenumerator.h',
674 'gsocketconnectable.h',
675 'gsocketconnection.h',
676 'gsocketcontrolmessage.h',
680 'gsimpleproxyresolver.h',
683 'gsubprocesslauncher.h',
685 'gtcpwrapperconnection.h',
686 'gthreadedsocketservice.h',
690 'gtlsclientconnection.h',
693 'gtlsfiledatabase.h',
696 'gtlsserverconnection.h',
698 'gdtlsclientconnection.h',
699 'gdtlsserverconnection.h',
704 'gzlibdecompressor.h',
709 gio_headers += application_headers
710 gio_headers += settings_headers
711 gio_headers += gdbus_headers
712 install_headers(gio_headers, subdir : 'glib-2.0/gio/')
714 # We can't use gnome.mkenums() because the GNOME module looks for glib-mkenums
715 # in PATH, which means you can't bootstrap glib with its own glib-mkenums.
716 gioenumtypes_h = custom_target('gioenumtypes_h',
717 output : 'gioenumtypes.h',
721 install_dir : join_paths(get_option('includedir'), 'glib-2.0/gio'),
722 command : [python, glib_mkenums,
723 '--template', files('gioenumtypes.h.template'),
724 '@INPUT@', gnetworking_h])
726 gioenumtypes_c = custom_target('gioenumtypes_c',
727 output : 'gioenumtypes.c',
730 depends : [gioenumtypes_h],
731 command : [python, glib_mkenums,
732 '--template', files('gioenumtypes.c.template'),
733 '@INPUT@', gnetworking_h])
735 gioenumtypes_dep = declare_dependency(sources : [gioenumtypes_h])
738 if glib_conf.has('HAVE_SYS_INOTIFY_H') and have_func_inotify_init1
740 internal_deps += [ inotify_lib ]
744 if have_func_kqueue and have_func_kevent
746 internal_deps += [ kqueue_lib ]
749 if host_system == 'windows'
751 internal_deps += [ giowin32_lib ]
761 'completion/gapplication',
763 'completion/gsettings',
764 'completion/gresource'
766 install_dir: join_paths(get_option('datadir'), 'bash-completion/completions'))
770 gio_dtrace_obj = dtrace_obj_gen.process('gio_probes.d')
771 gio_dtrace_hdr = dtrace_hdr_gen.process('gio_probes.d')
777 libgio = library('gio-2.0',
778 gioenumtypes_h, gioenumtypes_c, gnetworking_h, gio_sources,
779 gio_dtrace_hdr, gio_dtrace_obj,
780 version : library_version,
781 soversion : soversion,
783 include_directories : [configinc, gioinc],
784 link_with : internal_deps,
785 #libgio_2_0_la_LDFLAGS = $(GLIB_LINK_FLAGS)',
786 # '$(gio_win32_res_ldflag)',
787 dependencies : [libintl, libz_dep, libdl_dep, libmount_dep, libglib_dep,
788 libgobject_dep, libgmodule_dep, selinux_dep, xattr_dep,
789 platform_deps, network_libs],
791 # intl.lib is not compatible with SAFESEH
792 link_args : noseh_link_args,
795 libgio_dep = declare_dependency(link_with : libgio,
796 dependencies : [gioenumtypes_dep],
797 # We sadly need to export configinc here because everyone includes <gio/*.h>
798 include_directories : [configinc, gioinc])
800 if host_system == 'windows'
801 # Hack till https://github.com/mesonbuild/meson/issues/2324 is fixed
802 libgiounix_dep = dependency('', required : false)
803 libgiowin32_dep = libgio_dep
805 libgiowin32_dep = dependency('', required : false)
806 libgiounix_dep = libgio_dep
809 # Dependencies used by executables below
810 libelf = dependency('libelf', version : '>= 0.8.12', required : false)
812 glib_conf.set('HAVE_LIBELF', 1)
815 gconstructor_as_data_h = custom_target('gconstructor_as_data.h',
816 input : ['data-to-c.py', files('../glib/gconstructor.h')],
817 output : ['gconstructor_as_data.h'],
818 command : [python, '@INPUT0@', '@INPUT1@', 'gconstructor_code', '@OUTPUT@'])
820 # Several installed executables
830 'gio-tool-monitor.c',
842 # FIXME: are all these HAVE_CONFIG_H needed/used here?
843 executable('gio', gio_tool_sources,
845 c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
846 # intl.lib is not compatible with SAFESEH
847 link_args : noseh_link_args,
848 dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
850 executable('gresource', 'gresource-tool.c',
852 c_args : ['-DHAVE_CONFIG_H=1'],
853 # intl.lib is not compatible with SAFESEH
854 link_args : noseh_link_args,
855 dependencies : [libelf, libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
857 executable('gio-querymodules', 'gio-querymodules.c', 'giomodule-priv.c',
859 c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
860 # intl.lib is not compatible with SAFESEH
861 link_args : noseh_link_args,
862 dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
864 glib_compile_schemas = executable('glib-compile-schemas',
865 [gconstructor_as_data_h, 'gvdb/gvdb-builder.c', 'glib-compile-schemas.c'],
867 c_args : ['-DHAVE_CONFIG_H=1'],
868 # intl.lib is not compatible with SAFESEH
869 link_args : noseh_link_args,
870 dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
872 glib_compile_resources = executable('glib-compile-resources',
873 [gconstructor_as_data_h, 'gvdb/gvdb-builder.c', 'glib-compile-resources.c'],
875 c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
876 # intl.lib is not compatible with SAFESEH
877 link_args : noseh_link_args,
878 dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
880 executable('gsettings', 'gsettings-tool.c',
882 c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
883 # intl.lib is not compatible with SAFESEH
884 link_args : noseh_link_args,
885 dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
886 install_data('gschema.dtd',
887 install_dir : join_paths(get_option('datadir'), 'glib-2.0/schemas'))
889 install_data(['gschema.loc', 'gschema.its'],
890 install_dir : join_paths(get_option('datadir'), 'gettext/its'))
892 executable('gdbus', 'gdbus-tool.c',
894 c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
895 # intl.lib is not compatible with SAFESEH
896 link_args : noseh_link_args,
897 dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
899 if host_system != 'windows'
900 executable('gapplication', 'gapplication-tool.c',
902 c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
903 # intl.lib is not compatible with SAFESEH
904 link_args : noseh_link_args,
905 dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
909 gio_stp = configure_file(input : 'gio.stp.in',
910 output : '@0@.stp'.format(libgio.full_path().split('/').get(-1)),
911 configuration : stp_cdata,
912 install_dir : tapset_install_dir,
916 if host_system != 'windows'