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.NetworkMonitor.xml',
174 'org.freedesktop.portal.ProxyResolver.xml'],
175 output : ['xdp-dbus.h', 'xdp-dbus.c'],
176 command : [python, gdbus_codegen,
177 '--interface-prefix', 'org.freedesktop.portal.',
178 '--generate-c-code', '@OUTDIR@/xdp-dbus',
179 '--c-namespace', 'GXdp',
180 '--annotate', 'org.freedesktop.portal.Documents.Add()',
181 'org.gtk.GDBus.C.UnixFD', 'true',
182 '--annotate', 'org.freedesktop.portal.Documents.AddNamed()',
183 'org.gtk.GDBus.C.UnixFD', 'true',
186 # Generate gdbus-generated.{c,h}
187 gdbus_daemon_generated = custom_target('gdbus-daemon-generated',
188 input : ['dbus-daemon.xml'],
189 output : ['gdbus-daemon-generated.h', 'gdbus-daemon-generated.c'],
190 command : [python, gdbus_codegen,
191 '--interface-prefix', 'org.',
192 '--generate-c-code', '@OUTDIR@/gdbus-daemon-generated',
193 '--c-namespace', '_G', '@INPUT@'])
195 settings_headers = files([
196 'gsettingsbackend.h',
202 'gvdb/gvdb-reader.c',
203 'gdelayedsettingsbackend.c',
204 'gkeyfilesettingsbackend.c',
205 'gmemorysettingsbackend.c',
206 'gnullsettingsbackend.c',
207 'gsettingsbackend.c',
209 'gsettings-mapping.c',
213 if host_system == 'windows'
214 settings_sources += [ 'gregistrysettingsbackend.c' ]
219 #settings_sources += [ 'gnextstepsettingsbackend.c' ]
222 application_headers = files([
224 'gapplicationcommandline.h',
228 'gsimpleactiongroup.h',
229 'gremoteactiongroup.h',
230 'gactiongroupexporter.h',
231 'gdbusactiongroup.h',
243 application_sources = [
245 'gapplicationcommandline.c',
246 'gapplicationimpl-dbus.c',
250 'gsimpleactiongroup.c',
251 'gremoteactiongroup.c',
252 'gactiongroupexporter.c',
253 'gdbusactiongroup.c',
263 'gnotificationbackend.c',
269 'glocalfileenumerator.c',
271 'glocalfileinputstream.c',
272 'glocalfilemonitor.c',
273 'glocalfileoutputstream.c',
274 'glocalfileiostream.c',
279 'thumbnail-verify.c',
288 if host_system != 'windows'
289 appinfo_sources += ['gdesktopappinfo.c']
291 internal_deps += [xdgmime_lib]
293 'gfiledescriptorbased.c',
295 'gunixcredentialsmessage.c',
300 'gunixsocketaddress.c',
302 'gunixvolumemonitor.c',
303 'gunixinputstream.c',
304 'gunixoutputstream.c',
306 'gfdonotificationbackend.c',
307 'ggtknotificationbackend.c',
312 'gnetworkmonitorportal.c',
313 'gproxyresolverportal.c',
315 'gportalnotificationbackend.c',
321 #unix_sources += gcocoanotificationbackend.c
324 gio_unix_include_headers = [
326 'gfiledescriptorbased.h',
328 'gunixcredentialsmessage.h',
332 'gunixinputstream.h',
333 'gunixoutputstream.h',
334 'gunixsocketaddress.h',
336 install_headers(gio_unix_include_headers, subdir : 'gio-unix-2.0/gio')
338 if glib_conf.has('HAVE_NETLINK')
340 'gnetworkmonitornetlink.c',
341 'gnetworkmonitornm.c',
346 # This is also used by tests/gdbus-daemon, so use files() to include the path
347 gdbus_daemon_sources = [
348 files('gdbusdaemon.c'),
349 gdbus_daemon_generated,
352 win32_sources = gdbus_daemon_sources
353 if host_system == 'windows'
354 appinfo_sources += ['gwin32appinfo.c']
355 platform_deps += [cc.find_library('shlwapi'),
356 cc.find_library('dnsapi'),
357 cc.find_library('iphlpapi'),
360 'gwin32registrykey.c',
361 'gcontenttype-win32.c',
363 'gwin32volumemonitor.c',
364 'gwin32inputstream.c',
365 'gwin32outputstream.c',
368 gio_win32_include_headers = [
369 'gwin32inputstream.h',
370 'gwin32outputstream.h',
372 install_headers(gio_win32_include_headers, subdir : 'gio-win32-2.0/gio')
380 'gbufferedinputstream.c',
381 'gbufferedoutputstream.c',
384 'gcharsetconverter.c',
385 'gcontextspecificgroup.c',
387 'gconverterinputstream.c',
388 'gconverteroutputstream.c',
391 'gdatainputstream.c',
392 'gdataoutputstream.c',
395 'gdummyproxyresolver.c',
396 'gdummytlsbackend.c',
404 'gfileinputstream.c',
406 'gfilenamecompleter.c',
407 'gfileoutputstream.c',
409 'gfilterinputstream.c',
410 'gfilteroutputstream.c',
413 'ginetaddressmask.c',
414 'ginetsocketaddress.c',
423 'gmemoryinputstream.c',
424 'gmemoryoutputstream.c',
426 'gnativevolumemonitor.c',
427 'gnativesocketaddress.c',
431 'gnetworkmonitorbase.c',
435 'gpollableinputstream.c',
436 'gpollableoutputstream.c',
438 'gpollfilemonitor.c',
441 'gproxyaddressenumerator.c',
447 'gsimpleasyncresult.c',
449 'gsimplepermission.c',
452 'gsocketaddressenumerator.c',
454 'gsocketconnectable.c',
455 'gsocketconnection.c',
456 'gsocketcontrolmessage.c',
457 'gsocketinputstream.c',
459 'gsocketoutputstream.c',
460 'gsubprocesslauncher.c',
464 'gsimpleproxyresolver.c',
467 'gtcpwrapperconnection.c',
468 'gthreadedsocketservice.c',
470 'gthreadedresolver.c',
471 'gthreadedresolver.h',
474 'gtlsclientconnection.c',
477 'gtlsfiledatabase.c',
480 'gtlsserverconnection.c',
482 'gdtlsclientconnection.c',
483 'gdtlsserverconnection.c',
484 'gunionvolumemonitor.c',
489 'gzlibdecompressor.c',
494 gio_sources += appinfo_sources
495 gio_sources += unix_sources
496 gio_sources += win32_sources
497 gio_sources += application_sources
498 gio_sources += settings_sources
499 gio_sources += gdbus_sources
500 gio_sources += portal_sources
501 gio_sources += local_sources
504 if OS_WIN32_AND_DLL_COMPILATION
505 gio_win32_res = gio-win32-res.o
506 gio_win32_res_ldflag = -Wl,$(gio_win32_res)
509 gio-win32-res.o: gio.rc
510 '$(WINDRES) gio.rc $@
512 # This is read by gobject-introspection/misc/ and gtk-doc
513 gio-public-headers.txt: Makefile
514 '$(AM_V_GEN) echo $(gioinclude_HEADERS) $(giowin32include_HEADERS) $(giounixinclude_HEADERS) > $@.tmp && mv $@.tmp $@
516 gio.def: libgio-2.0.la
517 '$(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
519 gio-2.0.lib: libgio-2.0.la gio.def
520 '$(AM_V_GEN) lib.exe -machine:@LIB_EXE_MACHINE_FLAG@ -name:libgio-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:$(builddir)/gio.def -out:$@
523 gio_headers = files([
527 'gbufferedinputstream.h',
528 'gbufferedoutputstream.h',
532 'gcharsetconverter.h',
534 'gconverterinputstream.h',
535 'gconverteroutputstream.h',
537 'gdatainputstream.h',
538 'gdataoutputstream.h',
547 'gfileinputstream.h',
549 'gfilenamecompleter.h',
550 'gfileoutputstream.h',
552 'gfilterinputstream.h',
553 'gfilteroutputstream.h',
556 'ginetaddressmask.h',
557 'ginetsocketaddress.h',
561 'gio-autocleanups.h',
570 'gmemoryinputstream.h',
571 'gmemoryoutputstream.h',
573 'gnativevolumemonitor.h',
579 'gpollableinputstream.h',
580 'gpollableoutputstream.h',
584 'gproxyaddressenumerator.h',
589 'gsimpleasyncresult.h',
591 'gsimplepermission.h',
594 'gsocketaddressenumerator.h',
596 'gsocketconnectable.h',
597 'gsocketconnection.h',
598 'gsocketcontrolmessage.h',
602 'gsimpleproxyresolver.h',
605 'gsubprocesslauncher.h',
607 'gtcpwrapperconnection.h',
608 'gthreadedsocketservice.h',
612 'gtlsclientconnection.h',
615 'gtlsfiledatabase.h',
618 'gtlsserverconnection.h',
620 'gdtlsclientconnection.h',
621 'gdtlsserverconnection.h',
626 'gzlibdecompressor.h',
631 gio_headers += application_headers
632 gio_headers += settings_headers
633 gio_headers += gdbus_headers
634 install_headers(gio_headers, subdir : 'glib-2.0/gio/')
636 gio_build_mkenum = find_program('build_mkenum.py')
638 gioenumtypes_h = custom_target('gioenumtypes_h',
639 output : 'gioenumtypes.h',
642 install_dir : join_paths(get_option('includedir'), 'glib-2.0/gio'),
643 command : [gio_build_mkenum, python, glib_mkenums,
644 '@OUTPUT@', meson.current_source_dir(),
645 '@INPUT@', gnetworking_h])
647 gioenumtypes_c = custom_target('gioenumtypes_c',
648 output : 'gioenumtypes.c',
650 depends : [gioenumtypes_h],
651 command : [gio_build_mkenum, python, glib_mkenums,
652 '@OUTPUT@', meson.current_source_dir(),
653 '@INPUT@', gnetworking_h])
655 gioenumtypes_dep = declare_dependency(sources : [gioenumtypes_h])
658 if glib_conf.has('HAVE_SYS_INOTIFY_H') and have_func_inotify_init1
660 internal_deps += [ inotify_lib ]
664 if have_func_kqueue and have_func_kevent
666 internal_deps += [ kqueue_lib ]
669 if host_system == 'windows'
671 internal_deps += [ giowin32_lib ]
680 'completion/gapplication',
682 'completion/gsettings',
683 'completion/gresource'
685 install_dir: join_paths(get_option('datadir'), 'bash-completion/completions'))
688 gio_dtrace_obj = dtrace_obj_gen.process('gio_probes.d')
689 gio_dtrace_hdr = dtrace_hdr_gen.process('gio_probes.d')
695 libgio = shared_library('gio-2.0',
696 gioenumtypes_h, gioenumtypes_c, gnetworking_h, gio_sources,
697 gio_dtrace_hdr, gio_dtrace_obj,
698 version : library_version,
699 soversion : soversion,
701 include_directories : [configinc, gioinc],
702 link_with : internal_deps,
703 #libgio_2_0_la_LDFLAGS = $(GLIB_LINK_FLAGS)',
704 # '$(gio_win32_res_ldflag)',
707 dependencies : [libintl, libz_dep, libdl_dep, libmount_dep, libglib_dep,
708 libgobject_dep, libgmodule_dep] + platform_deps + network_libs,
710 # intl.lib is not compatible with SAFESEH
711 link_args : noseh_link_args,
714 libgio_dep = declare_dependency(link_with : libgio,
715 dependencies : [gioenumtypes_dep],
716 # We sadly need to export configinc here because everyone includes <gio/*.h>
717 include_directories : [configinc, gioinc])
719 # Dependencies used by executables below
720 libelf = dependency('libelf', version : '>= 0.8.12', required : false)
722 glib_conf.set('HAVE_LIBELF', 1)
725 gconstructor_as_data_h = custom_target('gconstructor_as_data.h',
726 input : ['data-to-c.py', meson.source_root() + '/glib/gconstructor.h'],
727 output : ['gconstructor_as_data.h'],
728 command : [python, '@INPUT0@', '@INPUT1@', 'gconstructor_code', '@OUTPUT@'])
730 # Several installed executables
740 'gio-tool-monitor.c',
752 # FIXME: are all these HAVE_CONFIG_H needed/used here?
753 executable('gio', gio_tool_sources,
755 c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
756 # intl.lib is not compatible with SAFESEH
757 link_args : noseh_link_args,
758 dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
760 executable('gresource', 'gresource-tool.c',
762 c_args : ['-DHAVE_CONFIG_H=1'],
763 # intl.lib is not compatible with SAFESEH
764 link_args : noseh_link_args,
765 dependencies : [libelf, libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
767 executable('gio-querymodules', 'gio-querymodules.c',
769 c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
770 # intl.lib is not compatible with SAFESEH
771 link_args : noseh_link_args,
772 dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
774 executable('glib-compile-schemas',
775 [gconstructor_as_data_h, 'gvdb/gvdb-builder.c', 'glib-compile-schemas.c'],
777 c_args : ['-DHAVE_CONFIG_H=1'],
778 # intl.lib is not compatible with SAFESEH
779 link_args : noseh_link_args,
780 dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
782 glib_compile_resources = executable('glib-compile-resources',
783 [gconstructor_as_data_h, 'gvdb/gvdb-builder.c', 'glib-compile-resources.c'],
785 c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
786 # intl.lib is not compatible with SAFESEH
787 link_args : noseh_link_args,
788 dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
790 executable('gsettings', 'gsettings-tool.c',
792 c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
793 # intl.lib is not compatible with SAFESEH
794 link_args : noseh_link_args,
795 dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
796 install_data('gschema.dtd',
797 install_dir : join_paths(get_option('datadir'), 'glib-2.0/schemas'))
799 install_data(['gschema.loc', 'gschema.its'],
800 install_dir : join_paths(get_option('datadir'), 'gettext/its'))
802 executable('gdbus', 'gdbus-tool.c',
804 c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
805 # intl.lib is not compatible with SAFESEH
806 link_args : noseh_link_args,
807 dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
809 if host_system != 'windows'
810 executable('gapplication', 'gapplication-tool.c',
812 c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
813 # intl.lib is not compatible with SAFESEH
814 link_args : noseh_link_args,
815 dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
819 gio_stp = configure_file(input : 'gio.stp.in',
820 output : '@0@.stp'.format(libgio.full_path().split('/').get(-1)),
821 configuration : stp_cdata,
822 install_dir : tapset_install_dir,
826 if host_system != 'windows'