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>'
23 if host_system.contains('android')
24 # Android does not have C_IN in public headers, we define it wherever necessary
25 if not cc.compiles('''#include <sys/types.h>
26 #include <arpa/nameser.h>
27 int qclass = C_IN;''',
28 name : 'C_IN in public headers (no arpa/nameser_compat.h needed)')
29 if cc.compiles('''#include <sys/types.h>
30 #include <arpa/nameser.h>
31 #include <arpa/nameser_compat.h>
32 int qclass = C_IN;''',
33 name : 'arpa/nameser_compat.h needed for C_IN')
34 gnetworking_h_nameser_compat_include = '#include <arpa/nameser_compat.h>'
36 error('Could not find required includes for ARPA C_IN')
43 if host_system != 'windows'
45 res_query_test = '''#include <resolv.h>
46 int main (int argc, char ** argv) {
47 return res_query("test", 0, 0, (void *)0, 0);
49 res_query_test_full = '''#include <sys/types.h>
50 #include <netinet/in.h>
51 #include <arpa/nameser.h>
53 if not cc.links(res_query_test_full, name : 'res_query()')
54 if cc.links(res_query_test_full, args : '-lresolv', name : 'res_query() in -lresolv')
55 network_libs += [ cc.find_library('resolv') ]
56 network_args += [ '-lresolv' ]
57 elif cc.links(res_query_test, args : '-lbind', name : 'res_query() in -lbind')
58 network_libs += [ cc.find_library('bind') ]
59 network_args += [ '-lbind' ]
61 error('Could not find res_query()')
66 socket_test = '''#include <sys/types.h>
67 #include <sys/socket.h>
68 int main (int argc, char ** argv) {
69 return socket(1, 2, 3);
71 if not cc.links(socket_test, name : 'socket()')
72 if cc.links(socket_test, args : '-lsocket', name : 'socket() in -lsocket')
73 network_libs += [ cc.find_library('socket') ]
74 network_args += [ '-lsocket' ]
76 error('Could not find socket()')
81 if cc.links('''#include <sys/types.h>
82 #include <netinet/in.h>
83 #include <arpa/nameser.h>
85 int main (int argc, char ** argv) {
87 }''', args : network_args, name : 'res_init()')
88 glib_conf.set('HAVE_RES_INIT', 1)
91 if cc.compiles('''#include <netinet/in.h>
92 struct ip_mreqn foo;''',
93 name : 'struct ip_mreqn')
94 glib_conf.set('HAVE_IP_MREQN', '/**/')
98 network_args_string = ''
99 foreach arg : network_args
100 network_args_string += arg + ' '
102 glib_conf.set('NETWORK_LIBS', network_args_string)
104 gnetworking_h_conf.set('WSPIAPI_INCLUDE', gnetworking_h_wspiapi_include)
105 gnetworking_h_conf.set('NAMESER_COMPAT_INCLUDE', gnetworking_h_nameser_compat_include)
107 gnetworking_h = configure_file(input : 'gnetworking.h.in',
108 output : 'gnetworking.h',
109 install_dir : join_paths(get_option('includedir'), 'glib-2.0/gio'),
110 configuration : gnetworking_h_conf)
112 gdbus_headers = files([
113 'gdbusauthobserver.h',
121 'gdbusnamewatching.h',
123 'gdbusintrospection.h',
124 'gdbusmethodinvocation.h',
127 'gdbusinterfaceskeleton.h',
129 'gdbusobjectskeleton.h',
130 'gdbusobjectproxy.h',
131 'gdbusobjectmanager.h',
132 'gdbusobjectmanagerclient.h',
133 'gdbusobjectmanagerserver.h',
140 'gdbusauthobserver.c',
142 'gdbusauthmechanism.c',
143 'gdbusauthmechanismanon.c',
144 'gdbusauthmechanismexternal.c',
145 'gdbusauthmechanismsha1.c',
150 'gdbusnamewatching.c',
153 'gdbusintrospection.c',
154 'gdbusmethodinvocation.c',
157 'gdbusinterfaceskeleton.c',
159 'gdbusobjectskeleton.c',
160 'gdbusobjectproxy.c',
161 'gdbusobjectmanager.c',
162 'gdbusobjectmanagerclient.c',
163 'gdbusobjectmanagerserver.c',
167 # Generate gdbus-codegen
168 subdir('gdbus-2.0/codegen')
170 # Generate xdp-dbus.{c,h}
171 xdp_dbus_generated = custom_target('xdp-dbus',
172 input : ['org.freedesktop.portal.Documents.xml',
173 'org.freedesktop.portal.OpenURI.xml',
174 'org.freedesktop.portal.NetworkMonitor.xml',
175 'org.freedesktop.portal.ProxyResolver.xml'],
176 output : ['xdp-dbus.h', 'xdp-dbus.c'],
177 command : [python, gdbus_codegen,
178 '--interface-prefix', 'org.freedesktop.portal.',
179 '--output-directory', '@OUTDIR@',
180 '--generate-c-code', 'xdp-dbus',
181 '--c-namespace', 'GXdp',
182 '--annotate', 'org.freedesktop.portal.Documents.Add()',
183 'org.gtk.GDBus.C.UnixFD', 'true',
184 '--annotate', 'org.freedesktop.portal.Documents.AddNamed()',
185 'org.gtk.GDBus.C.UnixFD', 'true',
186 '--annotate', 'org.freedesktop.portal.Documents.AddFull()',
187 'org.gtk.GDBus.C.UnixFD', 'true',
188 '--annotate', 'org.freedesktop.portal.OpenURI.OpenFile()',
189 'org.gtk.GDBus.C.UnixFD', 'true',
192 # Generate gdbus-generated.{c,h}
193 gdbus_daemon_generated = custom_target('gdbus-daemon-generated',
194 input : ['dbus-daemon.xml'],
195 output : ['gdbus-daemon-generated.h', 'gdbus-daemon-generated.c'],
196 command : [python, gdbus_codegen,
197 '--interface-prefix', 'org.',
198 '--output-directory', '@OUTDIR@',
199 '--generate-c-code', 'gdbus-daemon-generated',
200 '--c-namespace', '_G', '@INPUT@'])
202 settings_headers = files([
203 'gsettingsbackend.h',
209 'gvdb/gvdb-reader.c',
210 'gdelayedsettingsbackend.c',
211 'gkeyfilesettingsbackend.c',
212 'gmemorysettingsbackend.c',
213 'gnullsettingsbackend.c',
214 'gsettingsbackend.c',
216 'gsettings-mapping.c',
220 if host_system == 'windows'
221 settings_sources += [ 'gregistrysettingsbackend.c' ]
226 #settings_sources += [ 'gnextstepsettingsbackend.c' ]
229 application_headers = files([
231 'gapplicationcommandline.h',
235 'gsimpleactiongroup.h',
236 'gremoteactiongroup.h',
237 'gactiongroupexporter.h',
238 'gdbusactiongroup.h',
250 application_sources = [
252 'gapplicationcommandline.c',
253 'gapplicationimpl-dbus.c',
257 'gsimpleactiongroup.c',
258 'gremoteactiongroup.c',
259 'gactiongroupexporter.c',
260 'gdbusactiongroup.c',
270 'gnotificationbackend.c',
276 'glocalfileenumerator.c',
278 'glocalfileinputstream.c',
279 'glocalfilemonitor.c',
280 'glocalfileoutputstream.c',
281 'glocalfileiostream.c',
286 'thumbnail-verify.c',
292 contenttype_sources = []
296 if host_system != 'windows'
298 'gfiledescriptorbased.c',
300 'gunixcredentialsmessage.c',
305 'gunixsocketaddress.c',
307 'gunixvolumemonitor.c',
308 'gunixinputstream.c',
309 'gunixoutputstream.c',
310 'gfdonotificationbackend.c',
311 'ggtknotificationbackend.c',
317 'gnetworkmonitorportal.c',
318 'gproxyresolverportal.c',
320 'gportalnotificationbackend.c',
324 gio_unix_include_headers = [
325 'gfiledescriptorbased.h',
327 'gunixcredentialsmessage.h',
331 'gunixinputstream.h',
332 'gunixoutputstream.h',
333 'gunixsocketaddress.h',
337 contenttype_sources += ['gosxcontenttype.c']
338 appinfo_sources += ['gosxappinfo.c']
339 if glib_have_os_x_9_or_later
340 unix_sources += ['gcocoanotificationbackend.c']
343 contenttype_sources += ['gcontenttype.c']
344 appinfo_sources += ['gdesktopappinfo.c']
345 gio_unix_include_headers += ['gdesktopappinfo.h']
347 internal_deps += [xdgmime_lib]
350 install_headers(gio_unix_include_headers, subdir : 'gio-unix-2.0/gio')
352 if glib_conf.has('HAVE_NETLINK')
354 'gnetworkmonitornetlink.c',
355 'gnetworkmonitornm.c',
360 # This is also used by tests/gdbus-daemon, so use files() to include the path
361 gdbus_daemon_sources = [
362 files('gdbusdaemon.c'),
363 gdbus_daemon_generated,
366 win32_sources = gdbus_daemon_sources
367 if host_system == 'windows'
368 appinfo_sources += ['gwin32appinfo.c']
369 contenttype_sources += ['gcontenttype-win32.c']
370 platform_deps += [cc.find_library('shlwapi'),
371 cc.find_library('dnsapi'),
375 'gwin32registrykey.c',
377 'gwin32volumemonitor.c',
378 'gwin32inputstream.c',
379 'gwin32outputstream.c',
382 gio_win32_include_headers = [
383 'gwin32inputstream.h',
384 'gwin32outputstream.h',
386 install_headers(gio_win32_include_headers, subdir : 'gio-win32-2.0/gio')
394 'gbufferedinputstream.c',
395 'gbufferedoutputstream.c',
398 'gcharsetconverter.c',
399 'gcontextspecificgroup.c',
401 'gconverterinputstream.c',
402 'gconverteroutputstream.c',
405 'gdatainputstream.c',
406 'gdataoutputstream.c',
409 'gdummyproxyresolver.c',
410 'gdummytlsbackend.c',
418 'gfileinputstream.c',
420 'gfilenamecompleter.c',
421 'gfileoutputstream.c',
423 'gfilterinputstream.c',
424 'gfilteroutputstream.c',
427 'ginetaddressmask.c',
428 'ginetsocketaddress.c',
437 'gmemoryinputstream.c',
438 'gmemoryoutputstream.c',
440 'gnativevolumemonitor.c',
441 'gnativesocketaddress.c',
445 'gnetworkmonitorbase.c',
449 'gpollableinputstream.c',
450 'gpollableoutputstream.c',
452 'gpollfilemonitor.c',
455 'gproxyaddressenumerator.c',
461 'gsimpleasyncresult.c',
463 'gsimplepermission.c',
466 'gsocketaddressenumerator.c',
468 'gsocketconnectable.c',
469 'gsocketconnection.c',
470 'gsocketcontrolmessage.c',
471 'gsocketinputstream.c',
473 'gsocketoutputstream.c',
474 'gsubprocesslauncher.c',
478 'gsimpleproxyresolver.c',
481 'gtcpwrapperconnection.c',
482 'gthreadedsocketservice.c',
484 'gthreadedresolver.c',
485 'gthreadedresolver.h',
488 'gtlsclientconnection.c',
491 'gtlsfiledatabase.c',
494 'gtlsserverconnection.c',
496 'gdtlsclientconnection.c',
497 'gdtlsserverconnection.c',
498 'gunionvolumemonitor.c',
503 'gzlibdecompressor.c',
508 gio_sources += appinfo_sources
509 gio_sources += contenttype_sources
510 gio_sources += unix_sources
511 gio_sources += win32_sources
512 gio_sources += application_sources
513 gio_sources += settings_sources
514 gio_sources += gdbus_sources
515 gio_sources += portal_sources
516 gio_sources += local_sources
519 if OS_WIN32_AND_DLL_COMPILATION
520 gio_win32_res = gio-win32-res.o
521 gio_win32_res_ldflag = -Wl,$(gio_win32_res)
524 gio-win32-res.o: gio.rc
525 '$(WINDRES) gio.rc $@
527 # This is read by gobject-introspection/misc/ and gtk-doc
528 gio-public-headers.txt: Makefile
529 '$(AM_V_GEN) echo $(gioinclude_HEADERS) $(giowin32include_HEADERS) $(giounixinclude_HEADERS) > $@.tmp && mv $@.tmp $@
531 gio.def: libgio-2.0.la
532 '$(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
534 gio-2.0.lib: libgio-2.0.la gio.def
535 '$(AM_V_GEN) lib.exe -machine:@LIB_EXE_MACHINE_FLAG@ -name:libgio-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:$(builddir)/gio.def -out:$@
538 gio_headers = files([
542 'gbufferedinputstream.h',
543 'gbufferedoutputstream.h',
547 'gcharsetconverter.h',
549 'gconverterinputstream.h',
550 'gconverteroutputstream.h',
552 'gdatainputstream.h',
553 'gdataoutputstream.h',
562 'gfileinputstream.h',
564 'gfilenamecompleter.h',
565 'gfileoutputstream.h',
567 'gfilterinputstream.h',
568 'gfilteroutputstream.h',
571 'ginetaddressmask.h',
572 'ginetsocketaddress.h',
576 'gio-autocleanups.h',
585 'gmemoryinputstream.h',
586 'gmemoryoutputstream.h',
588 'gnativevolumemonitor.h',
594 'gpollableinputstream.h',
595 'gpollableoutputstream.h',
599 'gproxyaddressenumerator.h',
604 'gsimpleasyncresult.h',
606 'gsimplepermission.h',
609 'gsocketaddressenumerator.h',
611 'gsocketconnectable.h',
612 'gsocketconnection.h',
613 'gsocketcontrolmessage.h',
617 'gsimpleproxyresolver.h',
620 'gsubprocesslauncher.h',
622 'gtcpwrapperconnection.h',
623 'gthreadedsocketservice.h',
627 'gtlsclientconnection.h',
630 'gtlsfiledatabase.h',
633 'gtlsserverconnection.h',
635 'gdtlsclientconnection.h',
636 'gdtlsserverconnection.h',
641 'gzlibdecompressor.h',
646 gio_headers += application_headers
647 gio_headers += settings_headers
648 gio_headers += gdbus_headers
649 install_headers(gio_headers, subdir : 'glib-2.0/gio/')
651 # We can't use gnome.mkenums() because the GNOME module looks for glib-mkenums
652 # in PATH, which means you can't bootstrap glib with its own glib-mkenums.
653 gioenumtypes_h = custom_target('gioenumtypes_h',
654 output : 'gioenumtypes.h',
658 install_dir : join_paths(get_option('includedir'), 'glib-2.0/gio'),
659 command : [python, glib_mkenums,
660 '--template', files('gioenumtypes.h.template'),
661 '@INPUT@', gnetworking_h])
663 gioenumtypes_c = custom_target('gioenumtypes_c',
664 output : 'gioenumtypes.c',
667 depends : [gioenumtypes_h],
668 command : [python, glib_mkenums,
669 '--template', files('gioenumtypes.c.template'),
670 '@INPUT@', gnetworking_h])
672 gioenumtypes_dep = declare_dependency(sources : [gioenumtypes_h])
675 if glib_conf.has('HAVE_SYS_INOTIFY_H') and have_func_inotify_init1
677 internal_deps += [ inotify_lib ]
681 if have_func_kqueue and have_func_kevent
683 internal_deps += [ kqueue_lib ]
686 if host_system == 'windows'
688 internal_deps += [ giowin32_lib ]
697 'completion/gapplication',
699 'completion/gsettings',
700 'completion/gresource'
702 install_dir: join_paths(get_option('datadir'), 'bash-completion/completions'))
705 gio_dtrace_obj = dtrace_obj_gen.process('gio_probes.d')
706 gio_dtrace_hdr = dtrace_hdr_gen.process('gio_probes.d')
712 libgio = shared_library('gio-2.0',
713 gioenumtypes_h, gioenumtypes_c, gnetworking_h, gio_sources,
714 gio_dtrace_hdr, gio_dtrace_obj,
715 version : library_version,
716 soversion : soversion,
718 include_directories : [configinc, gioinc],
719 link_with : internal_deps,
720 #libgio_2_0_la_LDFLAGS = $(GLIB_LINK_FLAGS)',
721 # '$(gio_win32_res_ldflag)',
724 dependencies : [libintl, libz_dep, libdl_dep, libmount_dep, libglib_dep,
725 libgobject_dep, libgmodule_dep] + platform_deps + network_libs,
727 # intl.lib is not compatible with SAFESEH
728 link_args : noseh_link_args,
731 libgio_dep = declare_dependency(link_with : libgio,
732 dependencies : [gioenumtypes_dep],
733 # We sadly need to export configinc here because everyone includes <gio/*.h>
734 include_directories : [configinc, gioinc])
736 # Dependencies used by executables below
737 libelf = dependency('libelf', version : '>= 0.8.12', required : false)
739 glib_conf.set('HAVE_LIBELF', 1)
742 gconstructor_as_data_h = custom_target('gconstructor_as_data.h',
743 input : ['data-to-c.py', files('../glib/gconstructor.h')],
744 output : ['gconstructor_as_data.h'],
745 command : [python, '@INPUT0@', '@INPUT1@', 'gconstructor_code', '@OUTPUT@'])
747 # Several installed executables
757 'gio-tool-monitor.c',
769 # FIXME: are all these HAVE_CONFIG_H needed/used here?
770 executable('gio', gio_tool_sources,
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('gresource', 'gresource-tool.c',
779 c_args : ['-DHAVE_CONFIG_H=1'],
780 # intl.lib is not compatible with SAFESEH
781 link_args : noseh_link_args,
782 dependencies : [libelf, libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
784 executable('gio-querymodules', 'gio-querymodules.c',
786 c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
787 # intl.lib is not compatible with SAFESEH
788 link_args : noseh_link_args,
789 dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
791 glib_compile_schemas = executable('glib-compile-schemas',
792 [gconstructor_as_data_h, 'gvdb/gvdb-builder.c', 'glib-compile-schemas.c'],
794 c_args : ['-DHAVE_CONFIG_H=1'],
795 # intl.lib is not compatible with SAFESEH
796 link_args : noseh_link_args,
797 dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
799 glib_compile_resources = executable('glib-compile-resources',
800 [gconstructor_as_data_h, 'gvdb/gvdb-builder.c', 'glib-compile-resources.c'],
802 c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
803 # intl.lib is not compatible with SAFESEH
804 link_args : noseh_link_args,
805 dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
807 executable('gsettings', 'gsettings-tool.c',
809 c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
810 # intl.lib is not compatible with SAFESEH
811 link_args : noseh_link_args,
812 dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
813 install_data('gschema.dtd',
814 install_dir : join_paths(get_option('datadir'), 'glib-2.0/schemas'))
816 install_data(['gschema.loc', 'gschema.its'],
817 install_dir : join_paths(get_option('datadir'), 'gettext/its'))
819 executable('gdbus', 'gdbus-tool.c',
821 c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
822 # intl.lib is not compatible with SAFESEH
823 link_args : noseh_link_args,
824 dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
826 if host_system != 'windows'
827 executable('gapplication', 'gapplication-tool.c',
829 c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
830 # intl.lib is not compatible with SAFESEH
831 link_args : noseh_link_args,
832 dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
836 gio_stp = configure_file(input : 'gio.stp.in',
837 output : '@0@.stp'.format(libgio.full_path().split('/').get(-1)),
838 configuration : stp_cdata,
839 install_dir : tapset_install_dir,
843 if host_system != 'windows'