• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1gio_c_args = [
2  '-DG_LOG_DOMAIN="GLib-GIO"',
3  '-DGIO_COMPILATION',
4  '-DGIO_MODULE_DIR="@0@"'.format(glib_giomodulesdir),
5  '-DLOCALSTATEDIR="@0@"'.format(glib_localstatedir),
6]
7
8gio_c_args += glib_hidden_visibility_args
9
10# FIXME: Install empty glib_giomodulesdir
11
12gnetworking_h_conf = configuration_data()
13
14gnetworking_h_nameser_compat_include = ''
15
16if host_system not in ['windows', 'android']
17  # Don't check for C_IN on Android since it does not define it in public
18  # headers, we define it ourselves wherever necessary
19  if not cc.compiles('''#include <sys/types.h>
20                        #include <arpa/nameser.h>
21                        int qclass = C_IN;''',
22                     name : 'C_IN in public headers (no arpa/nameser_compat.h needed)')
23    if cc.compiles('''#include <sys/types.h>
24                      #include <arpa/nameser.h>
25                      #include <arpa/nameser_compat.h>
26                      int qclass = C_IN;''',
27                   name : 'arpa/nameser_compat.h needed for C_IN')
28      gnetworking_h_nameser_compat_include = '#include <arpa/nameser_compat.h>'
29    else
30      error('Could not find required includes for ARPA C_IN')
31    endif
32  endif
33endif
34
35network_libs = [ ]
36network_args = [ ]
37if host_system != 'windows'
38  # res_query()
39  res_query_test = '''#include <resolv.h>
40                      int main (int argc, char ** argv) {
41                        return res_query("test", 0, 0, (void *)0, 0);
42                      }'''
43  res_query_test_full = '''#include <sys/types.h>
44                           #include <netinet/in.h>
45                           #include <arpa/nameser.h>
46                        ''' + res_query_test
47  if not cc.links(res_query_test_full, name : 'res_query()')
48    if cc.links(res_query_test_full, args : '-lresolv', name : 'res_query() in -lresolv')
49      network_libs += [ cc.find_library('resolv') ]
50      network_args += [ '-lresolv' ]
51    elif cc.links(res_query_test, args : '-lbind', name : 'res_query() in -lbind')
52      network_libs += [ cc.find_library('bind') ]
53      network_args += [ '-lbind' ]
54    elif cc.links(res_query_test, args : '-lsocket', name : 'res_query() in -lsocket')
55      network_libs += [ cc.find_library('socket') ]
56      network_args += [ '-lsocket' ]
57    else
58      error('Could not find res_query()')
59    endif
60  endif
61
62  # socket()
63  socket_test = '''#include <sys/types.h>
64                   #include <sys/socket.h>
65                   int main (int argc, char ** argv) {
66                     return socket(1, 2, 3);
67                   }'''
68  if not cc.links(socket_test, name : 'socket()')
69    if cc.links(socket_test, args : '-lsocket', name : 'socket() in -lsocket')
70      network_libs += [ cc.find_library('socket') ]
71      network_args += [ '-lsocket' ]
72    else
73      error('Could not find socket()')
74    endif
75  endif
76
77  # res_init()
78  if cc.links('''#include <sys/types.h>
79                 #include <netinet/in.h>
80                 #include <arpa/nameser.h>
81                 #include <resolv.h>
82                 int main (int argc, char ** argv) {
83                   return res_init();
84                 }''', args : network_args, name : 'res_init()')
85    glib_conf.set('HAVE_RES_INIT', 1)
86  endif
87
88  # res_nclose()
89  if cc.links('''#include <sys/types.h>
90                 #include <netinet/in.h>
91                 #include <arpa/nameser.h>
92                 #include <resolv.h>
93                 int main (int argc, char ** argv) {
94                   struct __res_state res;
95                   res_nclose(&res);
96                   return 0;
97                 }''', args : network_args, name : 'res_nclose()')
98    glib_conf.set('HAVE_RES_NCLOSE', 1)
99  endif
100
101  # res_ndestroy()
102  if cc.links('''#include <sys/types.h>
103                 #include <netinet/in.h>
104                 #include <arpa/nameser.h>
105                 #include <resolv.h>
106                 int main (int argc, char ** argv) {
107                   struct __res_state res;
108                   res_ndestroy(&res);
109                   return 0;
110                 }''', args : network_args, name : 'res_ndestroy()')
111    glib_conf.set('HAVE_RES_NDESTROY', 1)
112  endif
113
114  # res_ninit()
115  if cc.links('''#include <sys/types.h>
116                 #include <netinet/in.h>
117                 #include <arpa/nameser.h>
118                 #include <resolv.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)
124  endif
125
126  # res_nquery()
127  if cc.links('''#include <sys/types.h>
128                 #include <netinet/in.h>
129                 #include <arpa/nameser.h>
130                 #include <resolv.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)
136  endif
137
138  if cc.has_type('struct ip_mreqn', prefix : '#include <netinet/in.h>')
139    glib_conf.set('HAVE_IP_MREQN', 1)
140  endif
141
142  if cc.compiles('''#include <sys/ioctl.h>
143                    #include <net/if.h>
144                    int main (int argc, char ** argv) {
145                      struct ifreq ifr;
146                      ioctl(0, SIOCGIFADDR, &ifr);
147                      return 0;
148                    }''',
149                 name : 'ioctl with request SIOCGIFADDR')
150    glib_conf.set('HAVE_SIOCGIFADDR', '/**/')
151  endif
152
153endif
154
155if host_system == 'android'
156  # struct ip_mreq_source definition is broken on Android NDK <= r16
157  # See https://bugzilla.gnome.org/show_bug.cgi?id=740791
158  if not cc.compiles('''#include <netinet/in.h>
159                        int main(int argc, char ** argv) {
160                          struct ip_mreq_source mc_req_src;
161                          mc_req_src.imr_interface.s_addr = 0;
162                          return 0;
163                        }''',
164                        name : 'ip_mreq_source.imr_interface has s_addr member')
165    glib_conf.set('BROKEN_IP_MREQ_SOURCE_STRUCT', 1)
166  endif
167endif
168
169gnetworking_h_conf.set('NAMESER_COMPAT_INCLUDE', gnetworking_h_nameser_compat_include)
170
171gnetworking_h = configure_file(input : 'gnetworking.h.in',
172                               output : 'gnetworking.h',
173                               install_dir : join_paths(get_option('includedir'), 'glib-2.0/gio'),
174                               configuration : gnetworking_h_conf)
175
176gdbus_headers = files(
177  'gdbusauthobserver.h',
178  'gcredentials.h',
179  'gdbusutils.h',
180  'gdbuserror.h',
181  'gdbusaddress.h',
182  'gdbusconnection.h',
183  'gdbusmessage.h',
184  'gdbusnameowning.h',
185  'gdbusnamewatching.h',
186  'gdbusproxy.h',
187  'gdbusintrospection.h',
188  'gdbusmethodinvocation.h',
189  'gdbusserver.h',
190  'gdbusinterface.h',
191  'gdbusinterfaceskeleton.h',
192  'gdbusobject.h',
193  'gdbusobjectskeleton.h',
194  'gdbusobjectproxy.h',
195  'gdbusobjectmanager.h',
196  'gdbusobjectmanagerclient.h',
197  'gdbusobjectmanagerserver.h',
198  'gtestdbus.h',
199)
200
201gdbus_sources = files(
202  'gdbusutils.c',
203  'gdbusaddress.c',
204  'gdbusauthobserver.c',
205  'gdbusauth.c',
206  'gdbusauthmechanism.c',
207  'gdbusauthmechanismanon.c',
208  'gdbusauthmechanismexternal.c',
209  'gdbusauthmechanismsha1.c',
210  'gdbuserror.c',
211  'gdbusconnection.c',
212  'gdbusmessage.c',
213  'gdbusnameowning.c',
214  'gdbusnamewatching.c',
215  'gdbusproxy.c',
216  'gdbusprivate.c',
217  'gdbusintrospection.c',
218  'gdbusmethodinvocation.c',
219  'gdbusserver.c',
220  'gdbusinterface.c',
221  'gdbusinterfaceskeleton.c',
222  'gdbusobject.c',
223  'gdbusobjectskeleton.c',
224  'gdbusobjectproxy.c',
225  'gdbusobjectmanager.c',
226  'gdbusobjectmanagerclient.c',
227  'gdbusobjectmanagerserver.c',
228  'gtestdbus.c',
229)
230
231# Generate gdbus-codegen
232subdir('gdbus-2.0/codegen')
233
234# Generate xdp-dbus.{c,h}
235xdp_dbus_generated = custom_target('xdp-dbus',
236    input : ['org.freedesktop.portal.Documents.xml',
237             'org.freedesktop.portal.OpenURI.xml',
238             'org.freedesktop.portal.ProxyResolver.xml',
239             'org.freedesktop.portal.Trash.xml'],
240    output : ['xdp-dbus.h', 'xdp-dbus.c'],
241    depend_files : gdbus_codegen_built_files,
242    command : [python, gdbus_codegen,
243               '--interface-prefix', 'org.freedesktop.portal.',
244               '--output-directory', '@OUTDIR@',
245               '--generate-c-code', 'xdp-dbus',
246               '--c-namespace', 'GXdp',
247               '@INPUT@'])
248
249# Generate gdbus-generated.{c,h}
250gdbus_daemon_generated = custom_target('gdbus-daemon-generated',
251    input : ['dbus-daemon.xml'],
252    output : ['gdbus-daemon-generated.h', 'gdbus-daemon-generated.c'],
253    depend_files : gdbus_codegen_built_files,
254    command : [python, gdbus_codegen,
255               '--interface-prefix', 'org.',
256               '--output-directory', '@OUTDIR@',
257               '--generate-c-code', 'gdbus-daemon-generated',
258               '--c-namespace', '_G', '@INPUT@'])
259
260settings_headers = files(
261  'gsettingsbackend.h',
262  'gsettingsschema.h',
263  'gsettings.h',
264)
265
266settings_sources = files(
267  'gvdb/gvdb-reader.c',
268  'gdelayedsettingsbackend.c',
269  'gkeyfilesettingsbackend.c',
270  'gmemorysettingsbackend.c',
271  'gnullsettingsbackend.c',
272  'gsettingsbackend.c',
273  'gsettingsschema.c',
274  'gsettings-mapping.c',
275  'gsettings.c',
276)
277
278if host_system == 'windows'
279  settings_sources += files('gregistrysettingsbackend.c')
280endif
281
282application_headers = files(
283  'gapplication.h',
284  'gapplicationcommandline.h',
285
286  'gactiongroup.h',
287  'gactionmap.h',
288  'gsimpleactiongroup.h',
289  'gremoteactiongroup.h',
290  'gactiongroupexporter.h',
291  'gdbusactiongroup.h',
292  'gaction.h',
293  'gpropertyaction.h',
294  'gsimpleaction.h',
295
296  'gmenumodel.h',
297  'gmenu.h',
298  'gmenuexporter.h',
299  'gdbusmenumodel.h',
300  'gnotification.h',
301)
302
303application_sources = files(
304  'gapplication.c',
305  'gapplicationcommandline.c',
306  'gapplicationimpl-dbus.c',
307
308  'gactiongroup.c',
309  'gactionmap.c',
310  'gsimpleactiongroup.c',
311  'gremoteactiongroup.c',
312  'gactiongroupexporter.c',
313  'gdbusactiongroup.c',
314  'gaction.c',
315  'gpropertyaction.c',
316  'gsimpleaction.c',
317
318  'gmenumodel.c',
319  'gmenu.c',
320  'gmenuexporter.c',
321  'gdbusmenumodel.c',
322  'gnotification.c',
323  'gnotificationbackend.c',
324)
325
326local_sources = files(
327  'ghttpproxy.c',
328  'glocalfile.c',
329  'glocalfileenumerator.c',
330  'glocalfileinfo.c',
331  'glocalfileinputstream.c',
332  'glocalfilemonitor.c',
333  'glocalfileoutputstream.c',
334  'glocalfileiostream.c',
335  'glocalvfs.c',
336  'gsocks4proxy.c',
337  'gsocks4aproxy.c',
338  'gsocks5proxy.c',
339  'thumbnail-verify.c',
340)
341
342platform_deps = []
343internal_deps = []
344# TODO: internal_objects is a workaround for
345# <https://github.com/mesonbuild/meson/issues/3934> and
346# <https://github.com/mesonbuild/meson/issues/3937>. When we can depend
347# on a meson version where those are fixed, revert the commit that
348# introduced this workaround.
349internal_objects = []
350appinfo_sources = []
351contenttype_sources = []
352portal_sources = []
353unix_sources = []
354win32_sources = []
355
356# This is also used by tests/gdbus-daemon, so use files() to include the path
357gdbus_daemon_sources = [
358  files('gdbusdaemon.c'),
359  gdbus_daemon_generated,
360]
361
362if host_system != 'windows'
363  unix_sources = files(
364    'gfiledescriptorbased.c',
365    'giounix-private.c',
366    'gunixconnection.c',
367    'gunixcredentialsmessage.c',
368    'gunixfdlist.c',
369    'gunixfdmessage.c',
370    'gunixmount.c',
371    'gunixmounts.c',
372    'gunixsocketaddress.c',
373    'gunixvolume.c',
374    'gunixvolumemonitor.c',
375    'gunixinputstream.c',
376    'gunixoutputstream.c',
377    'gfdonotificationbackend.c',
378    'ggtknotificationbackend.c',
379  )
380
381  portal_sources = [files(
382    'gdocumentportal.c',
383    'gopenuriportal.c',
384    'gmemorymonitorportal.c',
385    'gnetworkmonitorportal.c',
386    'gproxyresolverportal.c',
387    'gtrashportal.c',
388    'gportalsupport.c',
389    'gportalnotificationbackend.c'),
390    xdp_dbus_generated
391  ]
392
393  gio_unix_include_headers = files(
394    'gfiledescriptorbased.h',
395    'gunixconnection.h',
396    'gunixcredentialsmessage.h',
397    'gunixmounts.h',
398    'gunixfdlist.h',
399    'gunixfdmessage.h',
400    'gunixinputstream.h',
401    'gunixoutputstream.h',
402    'gunixsocketaddress.h',
403  )
404
405  if glib_have_cocoa
406    settings_sources += files('gnextstepsettingsbackend.m')
407    contenttype_sources += files('gosxcontenttype.m')
408    appinfo_sources += files('gosxappinfo.m')
409    if glib_have_os_x_9_or_later
410      unix_sources += files('gcocoanotificationbackend.m')
411    endif
412    application_headers += files('gosxappinfo.h')
413  else
414    contenttype_sources += files('gcontenttype.c')
415    appinfo_sources += files('gdesktopappinfo.c')
416    gio_unix_include_headers += files('gdesktopappinfo.h')
417  endif
418
419  subdir('xdgmime')
420  internal_deps += [xdgmime_lib]
421  internal_objects += [xdgmime_lib.extract_all_objects()]
422
423  install_headers(gio_unix_include_headers, subdir : 'gio-unix-2.0/gio')
424
425  if glib_conf.has('HAVE_NETLINK')
426    unix_sources += files(
427      'gnetworkmonitornetlink.c',
428      'gnetworkmonitornm.c',
429    )
430  endif
431else
432  appinfo_sources += files('gwin32appinfo.c')
433  contenttype_sources += files('gcontenttype-win32.c')
434  platform_deps += [cc.find_library('shlwapi'),
435                    cc.find_library('dnsapi'),
436                    iphlpapi_dep,
437                    winsock2]
438  platform_deps += uwp_gio_deps
439
440  win32_sources += files(
441    'gwin32registrykey.c',
442    'gwin32mount.c',
443    'gwin32volumemonitor.c',
444    'gwin32inputstream.c',
445    'gwin32outputstream.c',
446    'gwin32file-sync-stream.c',
447    'gwin32packageparser.c',
448    'gwin32networkmonitor.c',
449    'gwin32networkmonitor.h',
450    'gwin32notificationbackend.c',
451  )
452
453  gio_win_rc = configure_file(
454    input: 'gio.rc.in',
455    output: 'gio.rc',
456    configuration: glibconfig_conf,
457  )
458  gio_win_res = windows.compile_resources(gio_win_rc)
459  win32_sources += [gio_win_res]
460
461  gio_win32_include_headers = files(
462    'gwin32inputstream.h',
463    'gwin32outputstream.h',
464  )
465  install_headers(gio_win32_include_headers, subdir : 'gio-win32-2.0/gio')
466endif
467
468gio_sources = files(
469  'gappinfo.c',
470  'gasynchelper.c',
471  'gasyncinitable.c',
472  'gasyncresult.c',
473  'gbufferedinputstream.c',
474  'gbufferedoutputstream.c',
475  'gbytesicon.c',
476  'gcancellable.c',
477  'gcharsetconverter.c',
478  'gcontextspecificgroup.c',
479  'gconverter.c',
480  'gconverterinputstream.c',
481  'gconverteroutputstream.c',
482  'gcredentials.c',
483  'gdatagrambased.c',
484  'gdatainputstream.c',
485  'gdataoutputstream.c',
486  'gdrive.c',
487  'gdummyfile.c',
488  'gdummyproxyresolver.c',
489  'gdummytlsbackend.c',
490  'gemblem.c',
491  'gemblemedicon.c',
492  'gfile.c',
493  'gfileattribute.c',
494  'gfileenumerator.c',
495  'gfileicon.c',
496  'gfileinfo.c',
497  'gfileinputstream.c',
498  'gfilemonitor.c',
499  'gfilenamecompleter.c',
500  'gfileoutputstream.c',
501  'gfileiostream.c',
502  'gfilterinputstream.c',
503  'gfilteroutputstream.c',
504  'gicon.c',
505  'ginetaddress.c',
506  'ginetaddressmask.c',
507  'ginetsocketaddress.c',
508  'ginitable.c',
509  'ginputstream.c',
510  'gioerror.c',
511  'giomodule.c',
512  'giomodule-priv.c',
513  'gioscheduler.c',
514  'giostream.c',
515  'gloadableicon.c',
516  'gmarshal-internal.c',
517  'gmount.c',
518  'gmemorymonitor.c',
519  'gmemorymonitordbus.c',
520  'gmemoryinputstream.c',
521  'gmemoryoutputstream.c',
522  'gmountoperation.c',
523  'gnativesocketaddress.c',
524  'gnativevolumemonitor.c',
525  'gnetworkaddress.c',
526  'gnetworking.c',
527  'gnetworkmonitor.c',
528  'gnetworkmonitorbase.c',
529  'gnetworkservice.c',
530  'goutputstream.c',
531  'gpermission.c',
532  'gpollableinputstream.c',
533  'gpollableoutputstream.c',
534  'gpollableutils.c',
535  'gpollfilemonitor.c',
536  'gproxy.c',
537  'gproxyaddress.c',
538  'gproxyaddressenumerator.c',
539  'gproxyresolver.c',
540  'gresolver.c',
541  'gresource.c',
542  'gresourcefile.c',
543  'gseekable.c',
544  'gsimpleasyncresult.c',
545  'gsimpleiostream.c',
546  'gsimplepermission.c',
547  'gsimpleproxyresolver.c',
548  'gsocket.c',
549  'gsocketaddress.c',
550  'gsocketaddressenumerator.c',
551  'gsocketclient.c',
552  'gsocketconnectable.c',
553  'gsocketconnection.c',
554  'gsocketcontrolmessage.c',
555  'gsocketinputstream.c',
556  'gsocketlistener.c',
557  'gsocketoutputstream.c',
558  'gsocketservice.c',
559  'gsrvtarget.c',
560  'gsubprocesslauncher.c',
561  'gsubprocess.c',
562  'gtask.c',
563  'gtcpconnection.c',
564  'gtcpwrapperconnection.c',
565  'gthemedicon.c',
566  'gthreadedsocketservice.c',
567  'gthreadedresolver.c',
568  'gthreadedresolver.h',
569  'gtlsbackend.c',
570  'gtlscertificate.c',
571  'gtlsclientconnection.c',
572  'gtlsconnection.c',
573  'gtlsdatabase.c',
574  'gtlsfiledatabase.c',
575  'gtlsinteraction.c',
576  'gtlspassword.c',
577  'gtlsserverconnection.c',
578  'gdtlsconnection.c',
579  'gdtlsclientconnection.c',
580  'gdtlsserverconnection.c',
581  'gunionvolumemonitor.c',
582  'gvfs.c',
583  'gvolume.c',
584  'gvolumemonitor.c',
585  'gzlibcompressor.c',
586  'gzlibdecompressor.c',
587  'glistmodel.c',
588  'gliststore.c',
589  '../glib/gtrace.c',
590)
591
592gio_sources += appinfo_sources
593gio_sources += contenttype_sources
594gio_sources += gdbus_daemon_sources
595gio_sources += unix_sources
596gio_sources += win32_sources
597gio_sources += application_sources
598gio_sources += settings_sources
599gio_sources += gdbus_sources
600gio_sources += portal_sources
601gio_sources += local_sources
602
603MISSING_STUFF = '''
604# This is read by gobject-introspection/misc/ and gtk-doc
605gio-public-headers.txt: Makefile
606  '$(AM_V_GEN) echo $(gioinclude_HEADERS) $(giowin32include_HEADERS) $(giounixinclude_HEADERS) > $@.tmp && mv $@.tmp $@
607
608gio.def: libgio-2.0.la
609  '$(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
610
611gio-2.0.lib: libgio-2.0.la gio.def
612  '$(AM_V_GEN) lib.exe -machine:@LIB_EXE_MACHINE_FLAG@ -name:libgio-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:$(builddir)/gio.def -out:$@
613'''
614
615gio_headers = files(
616  'gappinfo.h',
617  'gasyncinitable.h',
618  'gasyncresult.h',
619  'gbufferedinputstream.h',
620  'gbufferedoutputstream.h',
621  'gbytesicon.h',
622  'gcancellable.h',
623  'gcontenttype.h',
624  'gcharsetconverter.h',
625  'gconverter.h',
626  'gconverterinputstream.h',
627  'gconverteroutputstream.h',
628  'gdatagrambased.h',
629  'gdatainputstream.h',
630  'gdataoutputstream.h',
631  'gdrive.h',
632  'gemblem.h',
633  'gemblemedicon.h',
634  'gfile.h',
635  'gfileattribute.h',
636  'gfileenumerator.h',
637  'gfileicon.h',
638  'gfileinfo.h',
639  'gfileinputstream.h',
640  'gfilemonitor.h',
641  'gfilenamecompleter.h',
642  'gfileoutputstream.h',
643  'gfileiostream.h',
644  'gfilterinputstream.h',
645  'gfilteroutputstream.h',
646  'gicon.h',
647  'ginetaddress.h',
648  'ginetaddressmask.h',
649  'ginetsocketaddress.h',
650  'ginitable.h',
651  'ginputstream.h',
652  'gio.h',
653  'gio-autocleanups.h',
654  'gioenums.h',
655  'gioerror.h',
656  'giomodule.h',
657  'gioscheduler.h',
658  'giostream.h',
659  'giotypes.h',
660  'gloadableicon.h',
661  'gmount.h',
662  'gmemoryinputstream.h',
663  'gmemorymonitor.h',
664  'gmemoryoutputstream.h',
665  'gmountoperation.h',
666  'gnativesocketaddress.h',
667  'gnativevolumemonitor.h',
668  'gnetworkaddress.h',
669  'gnetworkmonitor.h',
670  'gnetworkservice.h',
671  'goutputstream.h',
672  'gpermission.h',
673  'gpollableinputstream.h',
674  'gpollableoutputstream.h',
675  'gpollableutils.h',
676  'gproxy.h',
677  'gproxyaddress.h',
678  'gproxyaddressenumerator.h',
679  'gproxyresolver.h',
680  'gresolver.h',
681  'gresource.h',
682  'gseekable.h',
683  'gsimpleasyncresult.h',
684  'gsimpleiostream.h',
685  'gsimplepermission.h',
686  'gsimpleproxyresolver.h',
687  'gsocket.h',
688  'gsocketaddress.h',
689  'gsocketaddressenumerator.h',
690  'gsocketclient.h',
691  'gsocketconnectable.h',
692  'gsocketconnection.h',
693  'gsocketcontrolmessage.h',
694  'gsocketlistener.h',
695  'gsocketservice.h',
696  'gsrvtarget.h',
697  'gsubprocess.h',
698  'gsubprocesslauncher.h',
699  'gtask.h',
700  'gtcpconnection.h',
701  'gtcpwrapperconnection.h',
702  'gthemedicon.h',
703  'gthreadedsocketservice.h',
704  'gtlsbackend.h',
705  'gtlscertificate.h',
706  'gtlsclientconnection.h',
707  'gtlsconnection.h',
708  'gtlsdatabase.h',
709  'gtlsfiledatabase.h',
710  'gtlsinteraction.h',
711  'gtlspassword.h',
712  'gtlsserverconnection.h',
713  'gdtlsconnection.h',
714  'gdtlsclientconnection.h',
715  'gdtlsserverconnection.h',
716  'gvfs.h',
717  'gvolume.h',
718  'gvolumemonitor.h',
719  'gzlibcompressor.h',
720  'gzlibdecompressor.h',
721  'glistmodel.h',
722  'gliststore.h',
723)
724
725gio_headers += application_headers
726gio_headers += settings_headers
727gio_headers += gdbus_headers
728install_headers(gio_headers, subdir : 'glib-2.0/gio/')
729
730# We can't use gnome.mkenums() because the GNOME module looks for glib-mkenums
731# in PATH, which means you can't bootstrap glib with its own glib-mkenums.
732gioenumtypes_h = custom_target('gioenumtypes_h',
733  output : 'gioenumtypes.h',
734  capture : true,
735  input : gio_headers,
736  install : true,
737  install_dir : join_paths(get_option('includedir'), 'glib-2.0/gio'),
738  command : [python, glib_mkenums,
739             '--template', files('gioenumtypes.h.template'),
740             '@INPUT@', gnetworking_h])
741
742gioenumtypes_c = custom_target('gioenumtypes_c',
743  output : 'gioenumtypes.c',
744  capture : true,
745  input : gio_headers,
746  depends : [gioenumtypes_h],
747  command : [python, glib_mkenums,
748             '--template', files('gioenumtypes.c.template'),
749             '@INPUT@', gnetworking_h])
750
751gioenumtypes_dep = declare_dependency(sources : [gioenumtypes_h, glib_enumtypes_h])
752
753# inotify
754if glib_conf.has('HAVE_SYS_INOTIFY_H') and have_func_inotify_init1
755  subdir('inotify')
756  internal_deps += [ inotify_lib ]
757  internal_objects += [inotify_lib.extract_all_objects()]
758endif
759
760# kevent
761if have_func_kqueue and have_func_kevent
762  subdir('kqueue')
763  internal_deps += [ kqueue_lib ]
764  internal_objects += [kqueue_lib.extract_all_objects()]
765endif
766
767if host_system == 'windows'
768  subdir('win32')
769  internal_deps += [ giowin32_lib ]
770  internal_objects += [giowin32_lib.extract_all_objects()]
771endif
772
773if have_bash
774  bash_comp_inst_dir = ''
775  if bash_comp_dep.found()
776    bash_comp_dir_override = bash_comp_dep.version().version_compare('>= 2.10') ? ['datadir', get_option('datadir')] : ['prefix', get_option('prefix')]
777    bash_comp_inst_dir = bash_comp_dep.get_pkgconfig_variable('completionsdir', define_variable: bash_comp_dir_override)
778  endif
779
780  if bash_comp_inst_dir == ''
781    message('Found bash-completion but the .pc file did not set \'completionsdir\', fallback to a predefined path')
782    bash_comp_inst_dir = join_paths(get_option('datadir'), 'bash-completion/completions')
783  endif
784
785  install_data([
786    'completion/gapplication',
787    'completion/gdbus',
788    'completion/gio',
789    'completion/gsettings',
790    'completion/gresource'
791  ],
792  install_dir: bash_comp_inst_dir)
793endif
794
795if enable_dtrace
796  gio_dtrace_obj = dtrace_obj_gen.process('gio_probes.d')
797  gio_dtrace_hdr = dtrace_hdr_gen.process('gio_probes.d')
798else
799  gio_dtrace_obj = []
800  gio_dtrace_hdr = []
801endif
802
803libgio = library('gio-2.0',
804  gioenumtypes_h, gioenumtypes_c, gnetworking_h, gio_sources,
805  gio_dtrace_hdr, gio_dtrace_obj,
806  objects : internal_objects,
807  version : library_version,
808  soversion : soversion,
809  darwin_versions : darwin_versions,
810  install : true,
811  include_directories : [configinc, gioinc],
812  #  '$(gio_win32_res_ldflag)',
813  dependencies : [libz_dep, libdl_dep, libmount_dep, libglib_dep,
814                  libgobject_dep, libgmodule_dep, selinux_dep, xattr_dep,
815                  platform_deps, network_libs, libsysprof_capture_dep],
816  c_args : gio_c_args,
817  objc_args : gio_c_args,
818  # intl.lib is not compatible with SAFESEH
819  link_args : [noseh_link_args, glib_link_flags],
820)
821
822if get_option('gio_module_dir') != ''
823  pkgconfig_giomodulesdir = join_paths('${prefix}', get_option('gio_module_dir'))
824else
825  pkgconfig_giomodulesdir = join_paths('${libdir}', 'gio', 'modules')
826endif
827
828schemas_subdir = join_paths('glib-2.0', 'schemas')
829
830libgio_dep = declare_dependency(link_with : libgio,
831  dependencies : [libgmodule_dep, libgobject_dep, gioenumtypes_dep],
832  include_directories : [gioinc])
833
834pkg.generate(libgio,
835  libraries_private : [osx_ldflags],
836  requires : ['glib-2.0', 'gobject-2.0'],
837  variables : ['datadir=' + join_paths('${prefix}', get_option('datadir')),
838               'schemasdir=' + join_paths('${datadir}', schemas_subdir),
839               'bindir=' + join_paths('${prefix}', get_option('bindir')),
840               'giomoduledir=' + pkgconfig_giomodulesdir,
841               'gio=' + join_paths('${bindir}', 'gio'),
842               'gio_querymodules=' + join_paths('${bindir}', 'gio-querymodules'),
843               'glib_compile_schemas=' + join_paths('${bindir}', 'glib-compile-schemas'),
844               'glib_compile_resources=' + join_paths('${bindir}', 'glib-compile-resources'),
845               'gdbus=' + join_paths('${bindir}', 'gdbus'),
846               'gdbus_codegen=' + join_paths('${bindir}', 'gdbus-codegen'),
847               'gresource=' + join_paths('${bindir}', 'gresource'),
848               'gsettings=' + join_paths('${bindir}', 'gsettings')],
849  version : glib_version,
850  install_dir : glib_pkgconfigreldir,
851  filebase : 'gio-2.0',
852  name : 'GIO',
853  description : 'glib I/O library',
854)
855
856if meson.version().version_compare('>=0.54.0')
857  meson.override_dependency('gio-2.0', libgio_dep)
858endif
859
860
861if host_system == 'windows'
862  pkg.generate(requires : ['gobject-2.0', 'gmodule-no-export-2.0', 'gio-2.0'],
863    subdirs : ['gio-win32-2.0'],
864    version : glib_version,
865    install_dir : glib_pkgconfigreldir,
866    filebase : 'gio-windows-2.0',
867    name : 'GIO Windows specific APIs',
868    description : 'Windows specific headers for glib I/O library',
869  )
870  if meson.version().version_compare('>=0.54.0')
871    meson.override_dependency('gio-win32-2.0', libgio_dep)
872  endif
873else
874  pkg.generate(requires : ['gobject-2.0', 'gio-2.0'],
875    subdirs : ['gio-unix-2.0'],
876    version : glib_version,
877    install_dir : glib_pkgconfigreldir,
878    filebase : 'gio-unix-2.0',
879    name : 'GIO unix specific APIs',
880    description : 'unix specific headers for glib I/O library',
881  )
882  if meson.version().version_compare('>=0.54.0')
883    meson.override_dependency('gio-unix-2.0', libgio_dep)
884  endif
885endif
886
887if host_system == 'windows'
888  # Hack till https://github.com/mesonbuild/meson/issues/2324 is fixed
889  libgiounix_dep = dependency('', required : false)
890  libgiowin32_dep = libgio_dep
891else
892  libgiowin32_dep = dependency('', required : false)
893  libgiounix_dep = libgio_dep
894endif
895
896# Dependencies used by executables below
897have_libelf = false
898libelf = dependency('libelf', version : '>= 0.8.12', required : get_option ('libelf'))
899if libelf.found()
900  have_libelf = true
901else
902  # This fallback is necessary on *BSD. elfutils isn't the only libelf
903  # implementation, and *BSD usually includes their own libelf as a system
904  # library which doesn't have a corresponding .pc file.
905  libelf = cc.find_library('elf', required : get_option ('libelf'))
906  have_libelf = libelf.found()
907  have_libelf = have_libelf and cc.has_function('elf_begin', dependencies : libelf)
908  have_libelf = have_libelf and cc.has_function('elf_getshdrstrndx', dependencies : libelf)
909  have_libelf = have_libelf and cc.has_function('elf_getshdrnum', dependencies : libelf)
910  have_libelf = have_libelf and cc.has_header('libelf.h')
911endif
912
913if have_libelf
914  glib_conf.set('HAVE_LIBELF', 1)
915else
916  libelf = []
917endif
918
919gconstructor_as_data_h = custom_target('gconstructor_as_data.h',
920    input : ['data-to-c.py', files('../glib/gconstructor.h')],
921    output : ['gconstructor_as_data.h'],
922    command : [python, '@INPUT0@', '@INPUT1@', 'gconstructor_code', '@OUTPUT@'])
923
924# Several installed executables
925gio_tool_sources = [
926  'gio-tool.c',
927  'gio-tool.h',
928  'gio-tool-cat.c',
929  'gio-tool-copy.c',
930  'gio-tool-info.c',
931  'gio-tool-launch.c',
932  'gio-tool-list.c',
933  'gio-tool-mime.c',
934  'gio-tool-mkdir.c',
935  'gio-tool-monitor.c',
936  'gio-tool-mount.c',
937  'gio-tool-move.c',
938  'gio-tool-open.c',
939  'gio-tool-rename.c',
940  'gio-tool-remove.c',
941  'gio-tool-save.c',
942  'gio-tool-set.c',
943  'gio-tool-trash.c',
944  'gio-tool-tree.c',
945]
946
947executable('gio', gio_tool_sources,
948  install : true,
949  c_args : gio_c_args,
950  # intl.lib is not compatible with SAFESEH
951  link_args : noseh_link_args,
952  dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
953
954executable('gresource', 'gresource-tool.c',
955  install : true,
956  # intl.lib is not compatible with SAFESEH
957  link_args : noseh_link_args,
958  dependencies : [libelf, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
959
960gio_querymodules = executable('gio-querymodules', 'gio-querymodules.c', 'giomodule-priv.c',
961  install : true,
962  c_args : gio_c_args,
963  # intl.lib is not compatible with SAFESEH
964  link_args : noseh_link_args,
965  install_dir: glib_libexecdir,
966  dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
967
968glib_compile_schemas = executable('glib-compile-schemas',
969  ['gvdb/gvdb-builder.c', 'glib-compile-schemas.c'],
970  install : true,
971  # intl.lib is not compatible with SAFESEH
972  link_args : noseh_link_args,
973  dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
974
975glib_compile_resources = executable('glib-compile-resources',
976  [gconstructor_as_data_h, 'gvdb/gvdb-builder.c', 'glib-compile-resources.c'],
977  install : true,
978  c_args : gio_c_args,
979  # intl.lib is not compatible with SAFESEH
980  link_args : noseh_link_args,
981  dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
982
983# Cannot override those programs in cross compilation case because they are
984# native executables that cannot be run on the build machine.
985# See https://gitlab.gnome.org/GNOME/glib/issues/1859.
986if not meson.is_cross_build()
987  meson.override_find_program('glib-compile-schemas', glib_compile_schemas)
988  meson.override_find_program('glib-compile-resources', glib_compile_resources)
989  meson.override_find_program('gio-querymodules', gio_querymodules)
990endif
991
992executable('gsettings', 'gsettings-tool.c',
993  install : true,
994  c_args : gio_c_args,
995  # intl.lib is not compatible with SAFESEH
996  link_args : noseh_link_args,
997  dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
998install_data('gschema.dtd',
999  install_dir : join_paths(get_option('datadir'), schemas_subdir))
1000
1001install_data(['gschema.loc', 'gschema.its'],
1002  install_dir : join_paths(get_option('datadir'), 'gettext/its'))
1003
1004executable('gdbus', 'gdbus-tool.c',
1005  install : true,
1006  c_args : gio_c_args,
1007  # intl.lib is not compatible with SAFESEH
1008  link_args : noseh_link_args,
1009  dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
1010
1011if host_system != 'windows' and not glib_have_cocoa
1012  executable('gapplication', 'gapplication-tool.c',
1013    install : true,
1014    c_args : gio_c_args,
1015    # intl.lib is not compatible with SAFESEH
1016    link_args : noseh_link_args,
1017    dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
1018endif
1019
1020if enable_systemtap
1021  gio_stp = configure_file(input : 'gio.stp.in',
1022    output : '@0@.stp'.format(libgio.full_path().split('/').get(-1)),
1023    configuration : stp_cdata,
1024    install_dir : tapset_install_dir,
1025  )
1026endif
1027
1028subdir('fam')
1029if build_tests
1030    subdir('tests')
1031endif
1032
1033# The following is an example for building internal marshallers that are used
1034# by GIO. We cannot guarantee glib-genmarshal availability while building GLib
1035# so they are pre-generated and placed into gmarshal-internal.[ch].
1036#
1037# gmarshal_internal = gnome.genmarshal('gmarshal-internal',
1038#   sources: 'gmarshal-internal.list',
1039#   prefix: '_g_cclosure_marshal',
1040#   valist_marshallers: true,
1041#   internal: true,
1042# )
1043