[glib/wip/meson: 9/35] meson: Port to latest master (2.51.0)



commit 5e06e0a9f01881d9f754496e901df1c5d0a93fbb
Author: Nirbheek Chauhan <nirbheek centricular com>
Date:   Wed Dec 21 06:34:47 2016 +0530

    meson: Port to latest master (2.51.0)
    
    Also remove headers from some gio sources. Headers do not need to be
    added to the list of sources.
    
    + various smaller self-explanatory fixes.

 docs/reference/gio/meson.build |    9 +++++
 gio/meson.build                |   78 +++++++++++++++++++++++++++++----------
 glib/meson.build               |    2 +-
 gobject/meson.build            |    2 +-
 meson.build                    |   34 +++++++++++++++---
 meson_options.txt              |    1 +
 6 files changed, 99 insertions(+), 27 deletions(-)
---
diff --git a/docs/reference/gio/meson.build b/docs/reference/gio/meson.build
index 1a0edbe..57dcac3 100644
--- a/docs/reference/gio/meson.build
+++ b/docs/reference/gio/meson.build
@@ -202,6 +202,15 @@ if get_option('with-man')
     install: true,
     install_dir: man1_dir,
   )
+
+  custom_target('gio',
+    input: 'gio.xml',
+    output: 'gio.1',
+    command: xsltproc_command,
+    install: true,
+    install_dir: man1_dir,
+  )
+
   custom_target('gdbus-codegen-man',
     input: 'gdbus-codegen.xml',
     output: 'gdbus-codegen.1',
diff --git a/gio/meson.build b/gio/meson.build
index 7d15451..7fa3968 100644
--- a/gio/meson.build
+++ b/gio/meson.build
@@ -165,6 +165,22 @@ gdbus_sources = [
 # Generate gdbus-codegen
 subdir('gdbus-2.0/codegen')
 
+# Generate xdp-dbus.{c,h}
+xdp_dbus_generated = custom_target('xdp-dbus',
+    input : ['org.freedesktop.portal.Documents.xml',
+             'org.freedesktop.portal.NetworkMonitor.xml',
+             'org.freedesktop.portal.ProxyResolver.xml'],
+    output : ['xdp-dbus.h', 'xdp-dbus.c'],
+    command : [python, gdbus_codegen,
+               '--interface-prefix', 'org.freedesktop.portal.',
+               '--generate-c-code', '@OUTDIR@/xdp-dbus',
+               '--c-namespace', 'GXdp',
+               '--annotate', 'org.freedesktop.portal.Documents.Add()',
+                             'org.gtk.GDBus.C.UnixFD', 'true',
+               '--annotate', 'org.freedesktop.portal.Documents.AddNamed()',
+                             'org.gtk.GDBus.C.UnixFD', 'true',
+               '@INPUT@'])
+
 # Generate gdbus-generated.{c,h}
 gdbus_daemon_generated = custom_target('gdbus-daemon-generated',
     input : ['dbus-daemon.xml'],
@@ -247,38 +263,26 @@ application_sources = [
 
 local_sources = [
   'ghttpproxy.c',
-  'ghttpproxy.h',
   'glocalfile.c',
-  'glocalfile.h',
   'glocalfileenumerator.c',
-  'glocalfileenumerator.h',
   'glocalfileinfo.c',
-  'glocalfileinfo.h',
   'glocalfileinputstream.c',
-  'glocalfileinputstream.h',
   'glocalfilemonitor.c',
-  'glocalfilemonitor.h',
   'glocalfileoutputstream.c',
-  'glocalfileoutputstream.h',
   'glocalfileiostream.c',
-  'glocalfileiostream.h',
   'glocalvfs.c',
-  'glocalvfs.h',
   'gsocks4proxy.c',
-  'gsocks4proxy.h',
   'gsocks4aproxy.c',
-  'gsocks4aproxy.h',
   'gsocks5proxy.c',
-  'gsocks5proxy.h',
-  'thumbnail-verify.h',
   'thumbnail-verify.c',
 ]
 
 platform_deps = []
 internal_deps = []
 appinfo_sources = []
-
+portal_sources = []
 unix_sources = []
+
 if host_system != 'windows'
   appinfo_sources += ['gdesktopappinfo.c']
   subdir('xdgmime')
@@ -290,21 +294,26 @@ if host_system != 'windows'
     'gunixfdlist.c',
     'gunixfdmessage.c',
     'gunixmount.c',
-    'gunixmount.h',
     'gunixmounts.c',
     'gunixsocketaddress.c',
     'gunixvolume.c',
-    'gunixvolume.h',
     'gunixvolumemonitor.c',
-    'gunixvolumemonitor.h',
     'gunixinputstream.c',
     'gunixoutputstream.c',
     'gcontenttype.c',
-    'gcontenttypeprivate.h',
     'gfdonotificationbackend.c',
     'ggtknotificationbackend.c',
   ]
 
+  portal_sources = [
+    'gdocumentportal.c',
+    'gnetworkmonitorportal.c',
+    'gproxyresolverportal.c',
+    'gportalsupport.c',
+    'gportalnotificationbackend.c',
+    xdp_dbus_generated
+  ]
+
   # FIXME
   #if OS_COCOA
   #unix_sources += gcocoanotificationbackend.c
@@ -485,6 +494,7 @@ gio_sources += win32_sources
 gio_sources += application_sources
 gio_sources += settings_sources
 gio_sources += gdbus_sources
+gio_sources += portal_sources
 gio_sources += local_sources
 
 MISSING_STUFF = '''
@@ -682,8 +692,8 @@ libgio = shared_library('gio-2.0',
   #  '$(gio_win32_res_ldflag)',
   #$(SELINUX_LIBS)
   #$(XATTR_LIBS)
-  dependencies : [libintl, libz_dep, libdl_dep, libglib_dep, libgobject_dep,
-                  libgmodule_dep] + platform_deps + network_libs,
+  dependencies : [libintl, libz_dep, libdl_dep, libmount_dep, libglib_dep,
+                  libgobject_dep, libgmodule_dep] + platform_deps + network_libs,
   c_args : gio_c_args,
   # intl.lib is not compatible with SAFESEH
   link_args : noseh_link_args,
@@ -706,6 +716,34 @@ gconstructor_as_data_h = custom_target('gconstructor_as_data.h',
     command : [python, '@INPUT0@', '@INPUT1@', 'gconstructor_code', '@OUTPUT@'])
 
 # Several installed executables
+gio_tool_sources = [
+  'gio-tool.c',
+  'gio-tool.h',
+  'gio-tool-cat.c',
+  'gio-tool-copy.c',
+  'gio-tool-info.c',
+  'gio-tool-list.c',
+  'gio-tool-mime.c',
+  'gio-tool-mkdir.c',
+  'gio-tool-monitor.c',
+  'gio-tool-mount.c',
+  'gio-tool-move.c',
+  'gio-tool-open.c',
+  'gio-tool-rename.c',
+  'gio-tool-remove.c',
+  'gio-tool-save.c',
+  'gio-tool-set.c',
+  'gio-tool-trash.c',
+  'gio-tool-tree.c',
+]
+
+executable('gio', gio_tool_sources,
+  install : true,
+  c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
+  # intl.lib is not compatible with SAFESEH
+  link_args : noseh_link_args,
+  dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
+
 executable('gresource', 'gresource-tool.c',
   install : true,
   c_args : ['-DHAVE_CONFIG_H=1'],
diff --git a/glib/meson.build b/glib/meson.build
index 9477a6f..6dc7109 100644
--- a/glib/meson.build
+++ b/glib/meson.build
@@ -252,7 +252,7 @@ else
 endif
 
 install_data('gtester-report', install_dir : get_option('bindir'))
-install_data('glib.py', install_dir : join_paths(glib_pkgdatadir, 'gdb'))
+install_data('glib_gdb.py', install_dir : join_paths(glib_pkgdatadir, 'gdb'))
 
 gdb_conf = configuration_data()
 gdb_conf.set('datadir', glib_datadir)
diff --git a/gobject/meson.build b/gobject/meson.build
index 99505d2..979f4e6 100644
--- a/gobject/meson.build
+++ b/gobject/meson.build
@@ -83,7 +83,7 @@ glib_genmarshal = executable('glib-genmarshal',
   c_args : ['-DHAVE_CONFIG_H=1'],
   dependencies : [libglib_dep, libgobject_dep])
 
-install_data('gobject.py', install_dir : join_paths(glib_pkgdatadir + 'gdb'))
+install_data('gobject_gdb.py', install_dir : join_paths(glib_pkgdatadir + 'gdb'))
 gdb_conf = configuration_data()
 gdb_conf.set('datadir', glib_datadir)
 configure_file(
diff --git a/meson.build b/meson.build
index 0e63fb2..9c42efb 100644
--- a/meson.build
+++ b/meson.build
@@ -106,11 +106,11 @@ if get_option('default_library') != 'static'
     glib_conf.set('DLL_EXPORT', true)
     if cc.get_id() == 'msvc'
       glib_conf.set('_GLIB_EXTERN', '__declspec(dllexport) extern')
-    else
+    elif cc.has_argument('-fvisibility=hidden')
       glib_conf.set('_GLIB_EXTERN', '__attribute__((visibility("default"))) __declspec(dllexport) extern')
       add_global_arguments('-fvisibility=hidden', language : 'c')
     endif
-  else
+  elif cc.has_argument('-fvisibility=hidden')
     glib_conf.set('_GLIB_EXTERN', '__attribute__((visibility("default"))) extern')
     add_global_arguments('-fvisibility=hidden', language : 'c')
   endif
@@ -165,7 +165,7 @@ headers = [
   ['sys/mntctl.h', 'HAVE_SYS_mntctl_H'],
   ['fstab.h', 'HAVE_FSTAB_H'],
   ['linux/magic.h', 'HAVE_LINUX_MAGIC_H'],
-  ['sys/prctl.h', 'HAVE_SYS_PRCTL_H'],
+  ['termios.h', 'HAVE_TERMIOS_H'],
   ['dirent.h', 'HAVE_DIRENT_H'], # Some versions of MSC lack these
   ['sys/time.h', 'HAVE_SYS_TIME_H'], # Some versions of MSC lack these
   ['sys/times.h', 'HAVE_SYS_TIMES_H'],
@@ -454,7 +454,7 @@ if have_func_statfs
                         #endif
                         void some_func (void) {
                           struct statfs st;
-                          statfs(NULL, &st);
+                          statfs("/", &st);
                         }''', name : 'number of arguments to statfs() (n=2)')
     glib_conf.set('STATFS_ARGS', 2)
   elif cc.compiles(glib_conf_prefix + '''
@@ -473,7 +473,7 @@ if have_func_statfs
                           #endif
                           void some_func (void) {
                             struct statfs st;
-                            statfs(NULL, &st, sizeof (st), 0);
+                            statfs("/", &st, sizeof (st), 0);
                           }''', name : 'number of arguments to statfs() (n=4)')
     glib_conf.set('STATFS_ARGS', 4)
   else
@@ -872,6 +872,7 @@ glib_conf.set('ALIGNOF_GUINT64', guint64_align)
 
 if host_system == 'windows'
   glibconfig_conf.set('g_pid_type', 'void*')
+  glibconfig_conf.set('G_PID_FORMAT', '"p"')
   if host_machine.cpu_family() == 'x86_64'
     glibconfig_conf.set('g_pollfd_format', '"%#I64x"')
   else
@@ -879,6 +880,7 @@ if host_system == 'windows'
   endif
 else
   glibconfig_conf.set('g_pid_type', 'int')
+  glibconfig_conf.set('G_PID_FORMAT', '"i"')
   glibconfig_conf.set('g_pollfd_format', '"%d"')
 endif
 
@@ -1275,6 +1277,22 @@ libz_dep = dependency('zlib')
 # Only used on non-glibc targets
 libintl = cc.find_library('intl', required : false)
 
+# libmount is only used by gio, but we need to fetch the libs to generate the
+# pkg-config file below
+libmount_dep = []
+libmount_opt = get_option('enable-libmount')
+if libmount_opt != 'no'
+  libmount_dep = [dependency('mount', version : '>=2.28', required : false)]
+  if not libmount_dep[0].found()
+    libmount_dep = [cc.find_library('mount')]
+    libmount_h = cc.has_header('libmount/libmount.h')
+    libmount_needed = libmount_opt == 'yes' and host_system == 'linux'
+    if libmount_needed and (not libmount_dep[0].found() or not libmount_h)
+      error('Need libmount but couldn\'t find it')
+    endif
+  endif
+endif
+
 if host_system == 'windows'
   winsock2 = cc.find_library('ws2_32')
 endif
@@ -1311,6 +1329,9 @@ endif
 if pcre.found()
   glib_conf.set('PCRE_LIBS', '-lpcre')
 endif
+if libmount_dep.length() == 1 and libmount_dep[0].found()
+  glib_conf.set('LIBMOUNT_LIBS', '-lmount')
+endif
 glib_conf.set('GIO_MODULE_DIR', '${libdir}/gio/modules')
 # FIXME: Missing:
 # @G_MODULE_LIBS@ @SELINUX_LIBS@ @COCOA_LIBS@ @CARBON_LIBS@ @G_LIBS_EXTRA@
@@ -1359,6 +1380,9 @@ configure_file(input : 'glib-gettextize.in',
 # Install m4 macros that other projects use
 install_data('m4macros/glib-2.0.m4', 'm4macros/glib-gettext.m4', 'm4macros/gsettings.m4',
   install_dir : join_paths(get_option('datadir'), 'aclocal'))
+# Install Valgrind suppression file
+install_data('glib.supp',
+  install_dir : join_paths(get_option('datadir'), 'glib-2.0', 'valgrind'))
 
 configure_file(input : 'config.h.meson',
   output : 'config.h',
diff --git a/meson_options.txt b/meson_options.txt
index 0034ec0..2c987de 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,2 +1,3 @@
 option('with-docs', type : 'boolean', value : false)
 option('with-man', type : 'boolean', value : true)
+option('enable-libmount', type : 'combo', choices : ['auto', 'yes', 'no'], value : 'yes')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]