summaryrefslogtreecommitdiff
path: root/recipes/glib/glib-2.57-meson-backported-fixes.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/glib/glib-2.57-meson-backported-fixes.patch')
-rw-r--r--recipes/glib/glib-2.57-meson-backported-fixes.patch1881
1 files changed, 1881 insertions, 0 deletions
diff --git a/recipes/glib/glib-2.57-meson-backported-fixes.patch b/recipes/glib/glib-2.57-meson-backported-fixes.patch
new file mode 100644
index 00000000..012f53b8
--- /dev/null
+++ b/recipes/glib/glib-2.57-meson-backported-fixes.patch
@@ -0,0 +1,1881 @@
+From 07d2a2de8a67131d31dfe1093abc8920334c7f8b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?=
+ =?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
+Date: Wed, 11 Apr 2018 11:11:24 +0000
+Subject: [PATCH 01/24] W32 gstdio: Don't try to get reparse tag
+ unconditionally
+
+We do not need to use FindFirstFileW() to get a reparse tag if the
+file that is being examined is not a reparse point.
+
+This is a quick and relatively painless fix for the fact that
+FindFirstFileW() fails on root directories. Since root directories
+are unlikely to be reparse points (is it even possible?), not using
+this function on non-reparse-points just sidesteps the issue.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=795153
+---
+ glib/gstdio.c | 23 ++++++++++++++---------
+ 1 file changed, 14 insertions(+), 9 deletions(-)
+
+diff --git a/glib/gstdio.c b/glib/gstdio.c
+index 858d56999..faaa1bafd 100644
+--- a/glib/gstdio.c
++++ b/glib/gstdio.c
+@@ -209,18 +209,23 @@ _g_win32_stat_utf16_no_trailing_slashes (const gunichar2 *filename,
+ */
+ if (fd < 0)
+ {
+- HANDLE tmp = FindFirstFileW (filename,
+- &finddata);
++ memset (&finddata, 0, sizeof (finddata));
+
+- if (tmp == INVALID_HANDLE_VALUE)
++ if (handle_info.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
+ {
+- error_code = GetLastError ();
+- errno = w32_error_to_errno (error_code);
+- CloseHandle (file_handle);
+- return -1;
+- }
++ HANDLE tmp = FindFirstFileW (filename,
++ &finddata);
+
+- FindClose (tmp);
++ if (tmp == INVALID_HANDLE_VALUE)
++ {
++ error_code = GetLastError ();
++ errno = w32_error_to_errno (error_code);
++ CloseHandle (file_handle);
++ return -1;
++ }
++
++ FindClose (tmp);
++ }
+
+ if (is_symlink && !for_symlink)
+ {
+--
+2.17.0
+
+
+From 0a6ccdccb5078024ddc5aca72e4d5113ee851792 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Date: Tue, 10 Apr 2018 18:55:11 +0200
+Subject: [PATCH 02/24] gio: fix compilation without F_{S,G}ETPIPE_SZ
+
+Commit a5778ef7c51044147fe470ea1707dd297f44f880 broke compilation on
+architectures without F_SETPIPE_SZ and F_GETPIPE_SZ such as or1k.
+If those variables are undefined, put back previous behavior, buffer
+size set to 1024 * 64
+
+Fixes:
+ - http://autobuild.buildroot.net/results/398490e07343a931b25ca6ab5c90a75d7a073e9f
+
+(Modified by Philip Withnall <withnall@endlessm.com> to add an
+explanatory comment.)
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+
+https://bugzilla.gnome.org/show_bug.cgi?id=795133
+---
+ gio/gfile.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/gio/gfile.c b/gio/gfile.c
+index 334ad8ec3..a67aad383 100644
+--- a/gio/gfile.c
++++ b/gio/gfile.c
+@@ -3012,6 +3012,7 @@ splice_stream_with_progress (GInputStream *in,
+ if (!g_unix_open_pipe (buffer, FD_CLOEXEC, error))
+ return FALSE;
+
++#if defined(F_SETPIPE_SZ) && defined(F_GETPIPE_SZ)
+ /* Try a 1MiB buffer for improved throughput. If that fails, use the default
+ * pipe size. See: https://bugzilla.gnome.org/791457 */
+ buffer_size = fcntl (buffer[1], F_SETPIPE_SZ, 1024 * 1024);
+@@ -3029,6 +3030,13 @@ splice_stream_with_progress (GInputStream *in,
+ goto out;
+ }
+ }
++#else
++ /* If #F_GETPIPE_SZ isn’t available, assume we’re on Linux < 2.6.35,
++ * but ≥ 2.6.11, meaning the pipe capacity is 64KiB. Ignore the possibility of
++ * running on Linux < 2.6.11 (where the capacity was the system page size,
++ * typically 4KiB) because it’s ancient. See pipe(7). */
++ buffer_size = 1024 * 64;
++#endif
+
+ g_assert (buffer_size > 0);
+
+--
+2.17.0
+
+
+From e2939d5fa86f51d638051a76ab07e7d6d87cba68 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Date: Tue, 10 Apr 2018 19:18:57 +0200
+Subject: [PATCH 03/24] gobject: fix compilation with gcc <= 4.7
+
+On gcc 4.7, we got the following error:
+
+i686-nptl-linux-gnu-gcc --version
+> i686-nptl-linux-gnu-gcc (crosstool-NG 1.20.0) 4.7.4
+> $ echo '#include <glib-object.h>' | i686-nptl-linux-gnu-gcc -x c -I
+staging/usr/include/glib-2.0 -I staging/usr/lib/glib-2.0/include -Wall
+-Werror -c - -o /tmp/foo.o
+> In file included from
+staging/usr/include/glib-2.0/gobject/gbinding.h:29:0,
+> from staging/usr/include/glib-2.0/glib-object.h:23,
+> from <stdin>:1:
+> staging/usr/include/glib-2.0/gobject/gobject.h: In function
+'g_set_object':
+> staging/usr/include/glib-2.0/gobject/gobject.h:725:5: error: value
+computed is not used [-Werror=unused-value]
+> cc1: all warnings being treated as errors
+
+This error has been added by commit 3fae39a5d742afe73741f5fd7aa24e3ae8182f06
+So enable the new g_set_object definition only if gcc >= 4.8
+
+Fixes:
+ - http://autobuild.buildroot.net/results/b29a2f868438a2210873ea72f491db63175848be
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+
+https://bugzilla.gnome.org/show_bug.cgi?id=795138
+---
+ gobject/gobject.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gobject/gobject.h b/gobject/gobject.h
+index 9830663ce..838046fe0 100644
+--- a/gobject/gobject.h
++++ b/gobject/gobject.h
+@@ -507,7 +507,7 @@ GLIB_AVAILABLE_IN_ALL
+ void g_object_remove_weak_pointer (GObject *object,
+ gpointer *weak_pointer_location);
+
+-#if defined(__GNUC__) && !defined(__cplusplus) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_56
++#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)) && !defined(__cplusplus) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_56
+ /* Make reference APIs type safe with macros */
+ #define g_object_ref(Obj) ((__typeof__(Obj)) (g_object_ref) (Obj))
+ #define g_object_ref_sink(Obj) ((__typeof__(Obj)) (g_object_ref_sink) (Obj))
+--
+2.17.0
+
+
+From 1c6c488d519bccec1f723330e90a98c0ae095b84 Mon Sep 17 00:00:00 2001
+From: Xavier Claessens <xavier.claessens@collabora.com>
+Date: Mon, 23 Apr 2018 11:47:17 -0400
+Subject: [PATCH 04/24] struct ip_mreq_source definition is broken on Android
+ NDK <= r16
+
+This fix the build on Android r16 and older, see:
+https://issuetracker.google.com/issues/36987220
+
+https://bugzilla.gnome.org/show_bug.cgi?id=740791
+---
+ config.h.meson | 3 +++
+ configure.ac | 15 +++++++++++++++
+ gio/gsocket.c | 16 +++++++++++++---
+ gio/meson.build | 10 ++++++++++
+ 4 files changed, 41 insertions(+), 3 deletions(-)
+
+diff --git a/config.h.meson b/config.h.meson
+index d540cb801..8c3f3132e 100644
+--- a/config.h.meson
++++ b/config.h.meson
+@@ -15,6 +15,9 @@
+ /* poll doesn't work on devices */
+ #mesondefine BROKEN_POLL
+
++/* struct ip_mreq_source definition is broken on Android NDK <= r16 */
++#mesondefine BROKEN_IP_MREQ_SOURCE_STRUCT
++
+ /* Whether we're building a DLL and hence need symbols exported for a DLL */
+ #mesondefine DLL_EXPORT
+
+diff --git a/configure.ac b/configure.ac
+index 2013d198e..627022ef2 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -961,6 +961,21 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+ AC_MSG_RESULT(no)
+ ])
+
++AC_MSG_CHECKING([if ip_mreq_source.imr_interface has s_addr member])
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
++ [[
++ #include <netinet/in.h>
++ ]],
++ [[
++ struct ip_mreq_source mc_req_src;
++ mc_req_src.imr_interface.s_addr = 0;
++ ]])], [
++ AC_MSG_RESULT(yes)
++ ], [
++ AC_MSG_RESULT(no)
++ AC_DEFINE(BROKEN_IP_MREQ_SOURCE_STRUCT, 1, [struct ip_mreq_source definition is broken on Android NDK <= r16])
++])
++
+ AS_IF([test $glib_native_win32 = yes], [
+ # <wspiapi.h> in the Windows SDK and in mingw-w64 has wrappers for
+ # inline workarounds for getaddrinfo, getnameinfo and freeaddrinfo if
+diff --git a/gio/gsocket.c b/gio/gsocket.c
+index 06042d8a8..b4a941eb1 100644
+--- a/gio/gsocket.c
++++ b/gio/gsocket.c
+@@ -2380,6 +2380,13 @@ g_socket_multicast_group_operation_ssm (GSocket *socket,
+ case G_SOCKET_FAMILY_IPV4:
+ {
+ #ifdef IP_ADD_SOURCE_MEMBERSHIP
++
++#ifdef BROKEN_IP_MREQ_SOURCE_STRUCT
++#define S_ADDR_FIELD(src) src.imr_interface
++#else
++#define S_ADDR_FIELD(src) src.imr_interface.s_addr
++#endif
++
+ gint optname;
+ struct ip_mreq_source mc_req_src;
+
+@@ -2397,7 +2404,7 @@ g_socket_multicast_group_operation_ssm (GSocket *socket,
+ memset (&mc_req_src, 0, sizeof (mc_req_src));
+
+ /* By default use the default IPv4 multicast interface. */
+- mc_req_src.imr_interface.s_addr = g_htonl (INADDR_ANY);
++ S_ADDR_FIELD(mc_req_src) = g_htonl (INADDR_ANY);
+
+ if (iface)
+ {
+@@ -2412,7 +2419,7 @@ g_socket_multicast_group_operation_ssm (GSocket *socket,
+ return FALSE;
+ }
+ /* (0.0.0.iface_index) only works on Windows. */
+- mc_req_src.imr_interface.s_addr = g_htonl (iface_index);
++ S_ADDR_FIELD(mc_req_src) = g_htonl (iface_index);
+ #elif defined (HAVE_SIOCGIFADDR)
+ int ret;
+ struct ifreq ifr;
+@@ -2442,7 +2449,7 @@ g_socket_multicast_group_operation_ssm (GSocket *socket,
+ }
+
+ iface_addr = (struct sockaddr_in *) &ifr.ifr_addr;
+- mc_req_src.imr_interface.s_addr = iface_addr->sin_addr.s_addr;
++ S_ADDR_FIELD(mc_req_src) = iface_addr->sin_addr.s_addr;
+ #endif /* defined(G_OS_WIN32) && defined (HAVE_IF_NAMETOINDEX) */
+ }
+ memcpy (&mc_req_src.imr_multiaddr, g_inet_address_to_bytes (group),
+@@ -2455,6 +2462,9 @@ g_socket_multicast_group_operation_ssm (GSocket *socket,
+ join_group ? IP_ADD_SOURCE_MEMBERSHIP : IP_DROP_SOURCE_MEMBERSHIP;
+ result = setsockopt (socket->priv->fd, IPPROTO_IP, optname,
+ &mc_req_src, sizeof (mc_req_src));
++
++#undef S_ADDR_FIELD
++
+ #else
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+ join_group ?
+diff --git a/gio/meson.build b/gio/meson.build
+index 7817a4797..c83d8405f 100644
+--- a/gio/meson.build
++++ b/gio/meson.build
+@@ -154,6 +154,16 @@ if host_system != 'windows'
+ glib_conf.set('HAVE_SIOCGIFADDR', '/**/')
+ endif
+
++ if not cc.compiles('''#include <netinet/in.h>
++ int main(int argc, char ** argv) {
++ struct ip_mreq_source mc_req_src;
++ mc_req_src.imr_interface.s_addr = 0;
++ return 0;
++ }''',
++ name : 'ip_mreq_source.imr_interface has s_addr member')
++ glib_conf.set('BROKEN_IP_MREQ_SOURCE_STRUCT', 1)
++ endif
++
+ endif
+
+ network_args_string = ''
+--
+2.17.0
+
+
+From 73ad4e4669620a82350f2195b68e5b9d6ca67967 Mon Sep 17 00:00:00 2001
+From: Xavier Claessens <xavier.claessens@collabora.com>
+Date: Fri, 20 Apr 2018 12:09:32 -0400
+Subject: [PATCH 05/24] Meson: Add missing link on libintl in tests
+
+This fix undefined symbol link error when building for non-glibc
+platform. Applications must link on libintl, it is not a public
+dependency of libglib.
+
+On glibc platforms libintl is a not found dependency and is just ignored
+by meson, so it doesn't hurt to always have it.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=795406
+---
+ gio/tests/meson.build | 12 +++++++-----
+ 1 file changed, 7 insertions(+), 5 deletions(-)
+
+diff --git a/gio/tests/meson.build b/gio/tests/meson.build
+index 668839402..5aceb7c26 100644
+--- a/gio/tests/meson.build
++++ b/gio/tests/meson.build
+@@ -1,8 +1,10 @@
+-common_gio_tests_deps = [libglib_dep, libgmodule_dep, libgobject_dep, libgio_dep]
+-
+-if host_system == 'darwin'
+-common_gio_tests_deps += [libintl]
+-endif
++common_gio_tests_deps = [
++ libglib_dep,
++ libgmodule_dep,
++ libgobject_dep,
++ libgio_dep,
++ libintl
++]
+
+ subdir('gdbus-object-manager-example')
+
+--
+2.17.0
+
+
+From 42a091755f8faaed96d2a07ca57eecdb483d606c Mon Sep 17 00:00:00 2001
+From: Xavier Claessens <xavier.claessens@collabora.com>
+Date: Mon, 23 Apr 2018 10:33:44 -0400
+Subject: [PATCH 06/24] Fix build when pthread_getname_np is not available
+
+On Android _setname_ is always available but _getname_ is available only
+with API level >= 26.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=795406
+---
+ config.h.meson | 3 +++
+ configure.ac | 9 +++++++++
+ glib/tests/thread.c | 2 +-
+ meson.build | 18 ++++++++++--------
+ 4 files changed, 23 insertions(+), 9 deletions(-)
+
+diff --git a/config.h.meson b/config.h.meson
+index 8c3f3132e..57e1ef5fb 100644
+--- a/config.h.meson
++++ b/config.h.meson
+@@ -337,6 +337,9 @@
+ /* Have function pthread_setname_np with TID as argument */
+ #mesondefine HAVE_PTHREAD_SETNAME_NP_WITH_TID
+
++/* Have function pthread_getname_np */
++#mesondefine HAVE_PTHREAD_GETNAME_NP
++
+ /* Define to 1 if the system has the type `ptrdiff_t'. */
+ #mesondefine HAVE_PTRDIFF_T
+
+diff --git a/configure.ac b/configure.ac
+index 627022ef2..61d0544a6 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -2245,6 +2245,15 @@ AS_IF([ test x"$have_threads" = xposix], [
+ AC_DEFINE(HAVE_PTHREAD_SETNAME_NP_WITH_TID,1,
+ [Have function pthread_setname_np(pthread_t, const char*)])],
+ [AC_MSG_RESULT(no)])
++ AC_MSG_CHECKING(for pthread_getname_np(pthread_t, name, len))
++ AC_LINK_IFELSE(
++ [AC_LANG_PROGRAM(
++ [#include <pthread.h>],
++ [[char name[16]; pthread_getname_np(pthread_self(), name, 16);]])],
++ [AC_MSG_RESULT(yes)
++ AC_DEFINE(HAVE_PTHREAD_GETNAME_NP,1,
++ [Have function pthread_getname_np(pthread_t, name, len)])],
++ [AC_MSG_RESULT(no)])
+ CPPFLAGS="$glib_save_CPPFLAGS"
+ ])
+
+diff --git a/glib/tests/thread.c b/glib/tests/thread.c
+index 544783692..a79b9513f 100644
+--- a/glib/tests/thread.c
++++ b/glib/tests/thread.c
+@@ -174,7 +174,7 @@ test_thread5 (void)
+ static gpointer
+ thread6_func (gpointer data)
+ {
+-#ifdef HAVE_PTHREAD_SETNAME_NP_WITH_TID
++#if defined (HAVE_PTHREAD_SETNAME_NP_WITH_TID) && defined (HAVE_PTHREAD_GETNAME_NP)
+ char name[16];
+
+ pthread_getname_np (pthread_self(), name, 16);
+diff --git a/meson.build b/meson.build
+index d9bf2c46a..84fa5a18e 100644
+--- a/meson.build
++++ b/meson.build
+@@ -1400,6 +1400,11 @@ if host_system == 'windows'
+ glibconfig_conf.set('g_threads_impl_def', 'WIN32')
+ glib_conf.set('THREADS_WIN32', 1)
+ else
++ pthread_prefix = '''
++ #ifndef _GNU_SOURCE
++ # define _GNU_SOURCE
++ #endif
++ #include <pthread.h>'''
+ glibconfig_conf.set('g_threads_impl_def', 'POSIX')
+ glib_conf.set('THREADS_POSIX', 1)
+ if cc.has_header_symbol('pthread.h', 'pthread_attr_setstacksize')
+@@ -1411,11 +1416,11 @@ else
+ if cc.has_header_symbol('pthread.h', 'pthread_cond_timedwait_relative_np')
+ glib_conf.set('HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE_NP', 1)
+ endif
++ if cc.has_header_symbol('pthread.h', 'pthread_getname_np', prefix : pthread_prefix)
++ glib_conf.set('HAVE_PTHREAD_GETNAME_NP', 1)
++ endif
+ # Assume that pthread_setname_np is available in some form; same as configure
+- if cc.links('''#ifndef _GNU_SOURCE
+- # define _GNU_SOURCE
+- #endif
+- #include <pthread.h>
++ if cc.links(pthread_prefix + '''
+ int main() {
+ pthread_setname_np("example");
+ }''',
+@@ -1423,10 +1428,7 @@ else
+ dependencies : thread_dep)
+ # macOS and iOS
+ glib_conf.set('HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID', 1)
+- elif cc.links('''#ifndef _GNU_SOURCE
+- # define _GNU_SOURCE
+- #endif
+- #include <pthread.h>
++ elif cc.links(pthread_prefix + '''
+ int main() {
+ pthread_setname_np(pthread_self(), "example");
+ }''',
+--
+2.17.0
+
+
+From 5f59824d257b4f128a6ddc3c9405b252c5cd0e02 Mon Sep 17 00:00:00 2001
+From: Nirbheek Chauhan <nirbheek@centricular.com>
+Date: Sat, 5 May 2018 03:19:54 +0530
+Subject: [PATCH 07/24] meson: Update glib version
+
+---
+ meson.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/meson.build b/meson.build
+index 84fa5a18e..8f3cb91a1 100644
+--- a/meson.build
++++ b/meson.build
+@@ -1,5 +1,5 @@
+ project('glib', 'c', 'cpp',
+- version : '2.56.0',
++ version : '2.56.1',
+ meson_version : '>= 0.44.0',
+ default_options : [
+ 'warning_level=1',
+--
+2.17.0
+
+
+From 6330d09f07833bbea75b9bbe821d431891628c30 Mon Sep 17 00:00:00 2001
+From: Xavier Claessens <xavier.claessens@collabora.com>
+Date: Mon, 11 Dec 2017 14:47:04 -0500
+Subject: [PATCH 08/24] Meson: Use pkgconfig module to generate all pc files
+
+This requires improved pc file generator from meson 0.45.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=788773
+---
+ gio/meson.build | 39 +++++++++++++++++++++++++++++++++++++++
+ glib/meson.build | 14 ++++++++++++++
+ gmodule/meson.build | 32 ++++++++++++++++++++++++++++++++
+ gobject/meson.build | 9 +++++++++
+ gthread/meson.build | 9 +++++++++
+ meson.build | 31 ++++---------------------------
+ 6 files changed, 107 insertions(+), 27 deletions(-)
+
+diff --git a/gio/meson.build b/gio/meson.build
+index c83d8405f..ca544d93c 100644
+--- a/gio/meson.build
++++ b/gio/meson.build
+@@ -804,6 +804,45 @@ libgio = library('gio-2.0',
+ link_args : noseh_link_args,
+ )
+
++giomodulesdir = get_option('gio_module_dir')
++if giomodulesdir == ''
++ giomodulesdir = join_paths('${libdir}', 'gio', 'modules')
++endif
++
++pkg.generate(libraries : libgio,
++ requires : ['glib-2.0', 'gobject-2.0'],
++ variables : ['bindir=' + join_paths('${prefix}', get_option('bindir')),
++ 'giomoduledir=' + giomodulesdir,
++ 'glib_compile_schemas=' + join_paths('${bindir}', 'glib-compile-schemas'),
++ 'glib_compile_resources=' + join_paths('${bindir}', 'glib-compile-resources'),
++ 'gdbus_codegen=' + join_paths('${bindir}', 'gdbus-codegen')],
++ version : glib_version,
++ install_dir : glib_pkgconfigreldir,
++ filebase : 'gio-2.0',
++ name : 'GIO',
++ description : 'glib I/O library',
++)
++
++if host_system == 'windows'
++ pkg.generate(requires : ['gobject-2.0', 'gmodule-no-export-2.0', 'gio-2.0'],
++ subdirs : ['gio-win32-2.0'],
++ version : glib_version,
++ install_dir : glib_pkgconfigreldir,
++ filebase : 'gio-windows-2.0',
++ name : 'GIO Windows specific APIs',
++ description : 'Windows specific headers for glib I/O library',
++ )
++else
++ pkg.generate(requires : ['gobject-2.0', 'gio-2.0'],
++ subdirs : ['gio-unix-2.0'],
++ version : glib_version,
++ install_dir : glib_pkgconfigreldir,
++ filebase : 'gio-unix-2.0',
++ name : 'GIO unix specific APIs',
++ description : 'unix specific headers for glib I/O library',
++ )
++endif
++
+ libgio_dep = declare_dependency(link_with : libgio,
+ dependencies : [gioenumtypes_dep],
+ # We sadly need to export configinc here because everyone includes <gio/*.h>
+diff --git a/glib/meson.build b/glib/meson.build
+index 9df77b6f9..3b4caf8ce 100644
+--- a/glib/meson.build
++++ b/glib/meson.build
+@@ -249,6 +249,20 @@ libglib_dep = declare_dependency(
+ # We sadly need to export configinc here because everyone includes <glib/*.h>
+ include_directories : [configinc, glibinc])
+
++pkg.generate(libraries : libglib,
++ subdirs : ['glib-2.0'],
++ extra_cflags : ['-I${libdir}/glib-2.0/include'],
++ variables : ['bindir=' + join_paths('${prefix}', get_option('bindir')),
++ 'glib_genmarshal=' + join_paths('${bindir}', 'glib-genmarshal'),
++ 'gobject_query=' + join_paths('${bindir}', 'gobject-query'),
++ 'glib_mkenums=' + join_paths('${bindir}', 'glib-mkenums')],
++ version : glib_version,
++ install_dir : glib_pkgconfigreldir,
++ filebase : 'glib-2.0',
++ name : 'GLib',
++ description : 'C Utility Library',
++)
++
+ # On Windows, glib needs a spawn helper for g_spawn* API
+ if host_system == 'windows'
+ if host_machine.cpu_family() == 'x86'
+diff --git a/gmodule/meson.build b/gmodule/meson.build
+index 03c689e3a..3b57fb477 100644
+--- a/gmodule/meson.build
++++ b/gmodule/meson.build
+@@ -104,5 +104,37 @@ libgmodule = library('gmodule-2.0',
+ dependencies : [libdl_dep, libglib_dep],
+ c_args : ['-DG_LOG_DOMAIN="GModule"', '-DG_DISABLE_DEPRECATED'] + glib_hidden_visibility_args)
+
++supported_var = 'gmodule_supported=@0@'.format(g_module_impl != '0')
++
++pkg.generate(libraries : [libgmodule, thread_dep],
++ requires : ['glib-2.0'],
++ version : glib_version,
++ variables : [supported_var],
++ install_dir : glib_pkgconfigreldir,
++ filebase : 'gmodule-no-export-2.0',
++ name : 'GModule',
++ description : 'Dynamic module loader for GLib',
++)
++
++pkg.generate(libraries : [libgmodule],
++ requires : ['glib-2.0'],
++ version : glib_version,
++ variables : [supported_var],
++ install_dir : glib_pkgconfigreldir,
++ filebase : 'gmodule-export-2.0',
++ name : 'GModule',
++ description : 'Dynamic module loader for GLib',
++)
++
++pkg.generate(libraries : [libgmodule],
++ requires : ['glib-2.0'],
++ version : glib_version,
++ variables : [supported_var],
++ install_dir : glib_pkgconfigreldir,
++ filebase : 'gmodule-2.0',
++ name : 'GModule',
++ description : 'Dynamic module loader for GLib',
++)
++
+ libgmodule_dep = declare_dependency(link_with : libgmodule,
+ include_directories : gmoduleinc)
+diff --git a/gobject/meson.build b/gobject/meson.build
+index f1ab8fd46..98e306d7f 100644
+--- a/gobject/meson.build
++++ b/gobject/meson.build
+@@ -71,6 +71,15 @@ libgobject = library('gobject-2.0',
+ dependencies : [libintl, libffi_dep, libglib_dep],
+ c_args : ['-DG_LOG_DOMAIN="GLib-GObject"', '-DGOBJECT_COMPILATION'] + glib_hidden_visibility_args)
+
++pkg.generate(libraries : libgobject,
++ requires : ['glib-2.0'],
++ version : glib_version,
++ install_dir : glib_pkgconfigreldir,
++ filebase : 'gobject-2.0',
++ name : 'GObject',
++ description : 'GLib Type, Object, Parameter and Signal Library',
++)
++
+ libgobject_dep = declare_dependency(link_with : libgobject,
+ include_directories : gobjectinc)
+
+diff --git a/gthread/meson.build b/gthread/meson.build
+index 8d4696d29..3787dba3b 100644
+--- a/gthread/meson.build
++++ b/gthread/meson.build
+@@ -19,3 +19,12 @@ libgthread = library('gthread-2.0',
+ install : true,
+ dependencies : [libglib_dep],
+ c_args : ['-DG_LOG_DOMAIN="GThread"' ] + glib_hidden_visibility_args)
++
++pkg.generate(libraries : [libgthread, thread_dep],
++ requires : ['glib-2.0'],
++ version : glib_version,
++ install_dir : glib_pkgconfigreldir,
++ filebase : 'gthread-2.0',
++ name : 'GThread',
++ description : 'Thread support for GLib',
++)
+diff --git a/meson.build b/meson.build
+index 8f3cb91a1..543f91704 100644
+--- a/meson.build
++++ b/meson.build
+@@ -1,6 +1,6 @@
+ project('glib', 'c', 'cpp',
+ version : '2.56.1',
+- meson_version : '>= 0.44.0',
++ meson_version : '>= 0.45.0',
+ default_options : [
+ 'warning_level=1',
+ 'c_std=gnu89'
+@@ -1679,8 +1679,8 @@ if libmount_dep.length() != 0
+ endif
+ glib_conf.set('GIO_MODULE_DIR', glib_giomodulesdir)
+ # FIXME: Missing:
+-# @G_MODULE_LIBS@ @COCOA_LIBS@ @CARBON_LIBS@ @G_LIBS_EXTRA@
+-# @PCRE_REQUIRES@ @GLIB_EXTRA_CFLAGS@ @G_THREAD_CFLAGS@
++# @COCOA_LIBS@ @CARBON_LIBS@ @G_LIBS_EXTRA@ @GLIB_EXTRA_CFLAGS@
++# @G_MODULE_LDFLAGS@
+
+ # Tracing: dtrace
+ want_dtrace = get_option('dtrace')
+@@ -1726,6 +1726,7 @@ if want_systemtap and enable_dtrace
+ endif
+
+
++pkg = import('pkgconfig')
+ windows = import('windows')
+ subdir('glib')
+ subdir('gobject')
+@@ -1737,30 +1738,6 @@ if xgettext.found()
+ endif
+ subdir('tests')
+
+-# Configure and install pkg-config files
+-pc_files = [
+- 'gobject-2.0.pc',
+- 'glib-2.0.pc',
+- 'gthread-2.0.pc',
+- 'gmodule-2.0.pc',
+- 'gmodule-export-2.0.pc',
+- 'gmodule-no-export-2.0.pc',
+- 'gio-2.0.pc',
+-]
+-if host_system == 'windows'
+- pc_files += ['gio-windows-2.0.pc']
+-else
+- pc_files += ['gio-unix-2.0.pc']
+-endif
+-
+-foreach pc : pc_files
+- configure_file(input : pc + '.in',
+- install : true,
+- install_dir : glib_pkgconfigreldir,
+- output : pc,
+- configuration : glib_conf)
+-endforeach
+-
+ # NOTE: We skip glib-zip.in because the filenames it assumes don't match ours
+
+ # Install glib-gettextize executable, if a UNIX-style shell is found
+--
+2.17.0
+
+
+From 31427ef282de6700e8a4aec354048a77f98b0c53 Mon Sep 17 00:00:00 2001
+From: Xavier Claessens <xavier.claessens@collabora.com>
+Date: Thu, 4 Jan 2018 15:55:59 -0500
+Subject: [PATCH 09/24] Meson: Add carbon and cocoa flags into glib and gio pc
+ files
+
+https://bugzilla.gnome.org/show_bug.cgi?id=788773
+---
+ gio/meson.build | 1 +
+ glib/meson.build | 3 ++-
+ meson.build | 14 +++++---------
+ 3 files changed, 8 insertions(+), 10 deletions(-)
+
+diff --git a/gio/meson.build b/gio/meson.build
+index ca544d93c..9e663d6ef 100644
+--- a/gio/meson.build
++++ b/gio/meson.build
+@@ -810,6 +810,7 @@ if giomodulesdir == ''
+ endif
+
+ pkg.generate(libraries : libgio,
++ libraries_private : [osx_ldflags],
+ requires : ['glib-2.0', 'gobject-2.0'],
+ variables : ['bindir=' + join_paths('${prefix}', get_option('bindir')),
+ 'giomoduledir=' + giomodulesdir,
+diff --git a/glib/meson.build b/glib/meson.build
+index 3b4caf8ce..9d186201d 100644
+--- a/glib/meson.build
++++ b/glib/meson.build
+@@ -234,7 +234,7 @@ libglib = library('glib-2.0',
+ soversion : soversion,
+ install : true,
+ # intl.lib is not compatible with SAFESEH
+- link_args : platform_ldflags + noseh_link_args,
++ link_args : noseh_link_args,
+ include_directories : configinc,
+ link_with : [charset_lib, gnulib_lib],
+ dependencies : [pcre, thread_dep, libintl, librt] + libiconv + platform_deps,
+@@ -250,6 +250,7 @@ libglib_dep = declare_dependency(
+ include_directories : [configinc, glibinc])
+
+ pkg.generate(libraries : libglib,
++ libraries_private : [osx_ldflags],
+ subdirs : ['glib-2.0'],
+ extra_cflags : ['-I${libdir}/glib-2.0/include'],
+ variables : ['bindir=' + join_paths('${prefix}', get_option('bindir')),
+diff --git a/meson.build b/meson.build
+index 543f91704..357dd0322 100644
+--- a/meson.build
++++ b/meson.build
+@@ -494,7 +494,7 @@ if host_system == 'linux'
+ endif
+ endif
+
+-platform_ldflags=[]
++osx_ldflags = []
+
+ # Mac OS X Carbon support
+ glib_have_carbon = cc.compiles('''#include <Carbon/Carbon.h>
+@@ -505,14 +505,11 @@ glib_have_os_x_9_or_later = false
+
+ if glib_have_carbon
+ glib_conf.set('HAVE_CARBON', true)
+- CARBON_LIBS='-Wl,-framework,Carbon' # FIXME: propagate to .pc files as well
+- platform_ldflags += [CARBON_LIBS]
++ osx_ldflags += '-Wl,-framework,Carbon'
+ glib_have_os_x_9_or_later = cc.compiles('''#include <AvailabilityMacros.h>
+ #if MAC_OS_X_VERSION_MIN_REQUIRED < 1090
+ #error Compiling for minimum OS X version before 10.9
+ #endif''', name : 'OS X 9 or later')
+-else
+- CARBON_LIBS=''
+ endif
+
+ # Mac OS X Cocoa support
+@@ -524,12 +521,11 @@ glib_have_cocoa = cc.compiles('''#include <Cocoa/Cocoa.h>
+
+ if glib_have_cocoa
+ glib_conf.set('HAVE_COCOA', true)
+- COCOA_LIBS='-Wl,-framework,Foundation -Wl,-framework,AppKit' # FIXME: propagate to .pc files as well
+- platform_ldflags += [COCOA_LIBS]
+-else
+- COCOA_LIBS=''
++ osx_ldflags += '-Wl,-framework,Foundation -Wl,-framework,AppKit'
+ endif
+
++add_project_link_arguments(osx_ldflags, language : 'c')
++
+ # Check for futex(2)
+ if cc.links('''#include <linux/futex.h>
+ #include <sys/syscall.h>
+--
+2.17.0
+
+
+From 6bb223ea27ec7a2d5e9dfd041e0b0489ef492770 Mon Sep 17 00:00:00 2001
+From: Xavier Claessens <xavier.claessens@collabora.com>
+Date: Fri, 6 Apr 2018 13:46:15 -0400
+Subject: [PATCH 10/24] Meson: Use cc.compute_int() instead of running our own
+ code
+
+When cross compiling we cannot run code, and meson has code to compute
+int values without executing code.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=794898
+---
+ meson.build | 73 +++++++++++++++++++----------------------------------
+ 1 file changed, 26 insertions(+), 47 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index 357dd0322..f9af7070e 100644
+--- a/meson.build
++++ b/meson.build
+@@ -1281,54 +1281,43 @@ endif
+ has_winsock2 = cc.has_header('winsock2.h')
+
+ if has_syspoll and has_systypes
+- templ = '''#include<sys/poll.h>
+-#include<sys/types.h>
+-#include<stdio.h>
+-int main(int argc, char **argv) {
+- printf("%d\n", (int)@0@);
+- return 0;
+-}'''
++ poll_includes = '''
++ #include<sys/poll.h>
++ #include<sys/types.h>'''
+ elif has_winsock2
+- templ = '''#define _WIN32_WINNT 0x0600
+-#include <stdio.h>
+-#include <winsock2.h>
+-int main(int argc, char **argv) {
+- printf("%d\n", (int)@0@);
+- return 0;
+-}'''
++ poll_includes = '''
++ #define _WIN32_WINNT 0x0600
++ #include <winsock2.h>'''
+ else
+ # FIXME?
+ error('FIX POLL* defines')
+ endif
+
+-value_POLLIN = cc.run(templ.format('POLLIN'), name : 'POLLIN value').stdout().strip()
+-value_POLLOUT = cc.run(templ.format('POLLOUT'), name : 'POLLOUT value').stdout().strip()
+-value_POLLPRI = cc.run(templ.format('POLLPRI'), name : 'POLLPRI value').stdout().strip()
+-value_POLLERR = cc.run(templ.format('POLLERR'), name : 'POLLERR value').stdout().strip()
+-value_POLLHUP = cc.run(templ.format('POLLHUP'), name : 'POLLHUP value').stdout().strip()
+-value_POLLNVAL = cc.run(templ.format('POLLNVAL'), name : 'POLLNVAL value').stdout().strip()
+-
+-glibconfig_conf.set('g_pollin', value_POLLIN)
+-glibconfig_conf.set('g_pollout', value_POLLOUT)
+-glibconfig_conf.set('g_pollpri', value_POLLPRI)
+-glibconfig_conf.set('g_pollerr', value_POLLERR)
+-glibconfig_conf.set('g_pollhup', value_POLLHUP)
+-glibconfig_conf.set('g_pollnval', value_POLLNVAL)
++poll_defines = [
++ [ 'POLLIN', 'g_pollin' ],
++ [ 'POLLOUT', 'g_pollout' ],
++ [ 'POLLPRI', 'g_pollpri' ],
++ [ 'POLLERR', 'g_pollerr' ],
++ [ 'POLLHUP', 'g_pollhup' ],
++ [ 'POLLNVAL', 'g_pollnval' ],
++]
++foreach d : poll_defines
++ val = cc.compute_int(d[0], prefix: poll_includes)
++ glibconfig_conf.set(d[1], val)
++endforeach
+
+ # Internet address families
+ # FIXME: what about Cygwin (G_WITH_CYGWIN)
+ if host_system == 'windows'
+- glib_inet_includes= '''
+-#include <winsock2.h>
+-'''
++ inet_includes = '''
++ #include <winsock2.h>'''
+ else
+- glib_inet_includes='''
+-#include <sys/types.h>
+-#include <sys/socket.h>
+-'''
++ inet_includes = '''
++ #include <sys/types.h>
++ #include <sys/socket.h>'''
+ endif
+
+-net_defines = [
++inet_defines = [
+ [ 'AF_UNIX', 'g_af_unix' ],
+ [ 'AF_INET', 'g_af_inet' ],
+ [ 'AF_INET6', 'g_af_inet6' ],
+@@ -1336,18 +1325,8 @@ net_defines = [
+ [ 'MSG_PEEK', 'g_msg_peek' ],
+ [ 'MSG_DONTROUTE', 'g_msg_dontroute' ],
+ ]
+-foreach d : net_defines
+- templ = '''@0@
+-#include <stdio.h>
+-int main(int argc, char **argv) {
+- printf("%d\n", (int)@1@);
+- return 0;
+-}'''
+- # FIXME: fix for cross-compilation
+- if not meson.has_exe_wrapper()
+- error('Fix sys define detection for cross build')
+- endif
+- val = cc.run(templ.format(glib_inet_includes, d[0]), name : d[0] + ' value').stdout().strip()
++foreach d : inet_defines
++ val = cc.compute_int(d[0], prefix: inet_includes)
+ glibconfig_conf.set(d[1], val)
+ endforeach
+
+--
+2.17.0
+
+
+From fea853d2b1f0a31f486314a31f969d5e37f2cc0b Mon Sep 17 00:00:00 2001
+From: Xavier Claessens <xavier.claessens@collabora.com>
+Date: Mon, 2 Apr 2018 23:01:25 -0400
+Subject: [PATCH 11/24] Meson: Get results from cross file properties if cannot
+ run code
+
+When cross compiling and not exe wrapper has been defined cc.run() raise
+an exception. Avoid this by taking the value from [properties] in the
+cross file and provide sensible default if the variable is not defined.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=794898
+---
+ meson.build | 53 ++++++++++++++++++++++++++++++++---------------------
+ 1 file changed, 32 insertions(+), 21 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index f9af7070e..44ebf5ca6 100644
+--- a/meson.build
++++ b/meson.build
+@@ -10,6 +10,8 @@ project('glib', 'c', 'cpp',
+ cc = meson.get_compiler('c')
+ cxx = meson.get_compiler('cpp')
+
++cc_can_run = not meson.is_cross_build() or meson.has_exe_wrapper()
++
+ if cc.get_id() == 'msvc'
+ # Ignore several spurious warnings for things glib does very commonly
+ # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it
+@@ -673,10 +675,15 @@ main(void)
+ exit(1);
+ }'''
+
+- rres = cc.run(vsnprintf_c99_test_code, name : 'C99 vsnprintf')
+- if rres.compiled() and rres.returncode() == 0
+- glib_conf.set('HAVE_C99_VSNPRINTF', 1)
+- have_good_vsnprintf = true
++ if cc_can_run
++ rres = cc.run(vsnprintf_c99_test_code, name : 'C99 vsnprintf')
++ if rres.compiled() and rres.returncode() == 0
++ glib_conf.set('HAVE_C99_VSNPRINTF', 1)
++ have_good_vsnprintf = true
++ endif
++ else
++ have_good_vsnprintf = meson.get_cross_property('have_c99_vsnprintf', false)
++ glib_conf.set('HAVE_C99_VSNPRINTF', have_good_vsnprintf)
+ endif
+
+ snprintf_c99_test_code = '''
+@@ -715,10 +722,15 @@ main(void)
+ exit(1);
+ }'''
+
+- rres = cc.run(snprintf_c99_test_code, name : 'C99 snprintf')
+- if rres.compiled() and rres.returncode() == 0
+- glib_conf.set('HAVE_C99_SNPRINTF', 1)
+- have_good_snprintf = true
++ if cc_can_run
++ rres = cc.run(snprintf_c99_test_code, name : 'C99 snprintf')
++ if rres.compiled() and rres.returncode() == 0
++ glib_conf.set('HAVE_C99_SNPRINTF', 1)
++ have_good_snprintf = true
++ endif
++ else
++ have_good_snprintf = meson.get_cross_property('have_c99_snprintf', false)
++ glib_conf.set('HAVE_C99_SNPRINTF', have_good_snprintf)
+ endif
+ endif
+
+@@ -1219,16 +1231,13 @@ va_list_val_copy_prog = '''
+ return 0;
+ }'''
+
+-# We do this in two steps so if compilation fails already it looks less alarming
+-glib_va_val_copy = false
+-if cc.compiles(va_list_val_copy_prog, name : 'va_lists can be copied as values')
+- # FIXME: what to do when cross-compiling?
+- if cc.run(va_list_val_copy_prog, name : 'va_lists can be copied as values').returncode() == 0
+- glib_va_val_copy = true
+- endif
++if cc_can_run
++ rres = cc.run(va_list_val_copy_prog, name : 'va_lists can be copied as values')
++ glib_va_val_copy = rres.returncode() == 0
++else
++ glib_va_val_copy = meson.get_cross_property('va_val_copy', true)
+ endif
+ if not glib_va_val_copy
+- glib_va_val_copy = false
+ glib_vacopy = glib_vacopy + '\n#define G_VA_COPY_AS_ARRAY 1'
+ glib_conf.set('G_VA_COPY_AS_ARRAY', 1)
+ endif
+@@ -1414,7 +1423,6 @@ else
+ endif
+ endif
+
+-# FIXME: how to do this when cross-compiling?
+ # FIXME: we should make it print the result and always return 0, so that
+ # the output in meson shows up as green
+ stack_grows_check_prog = '''
+@@ -1432,13 +1440,16 @@ stack_grows_check_prog = '''
+ f (100);
+ return b > a ? 0 : 1;
+ }'''
+-stack_grows_run_result = cc.run(stack_grows_check_prog, name : 'stack grows check')
+-if stack_grows_run_result.compiled() and stack_grows_run_result.returncode() == 0
+- glibconfig_conf.set('G_HAVE_GROWING_STACK', 1)
++
++if cc_can_run
++ rres = cc.run(stack_grows_check_prog, name : 'stack grows check')
++ growing_stack = rres.returncode() == 0
+ else
+- glibconfig_conf.set('G_HAVE_GROWING_STACK', 0)
++ growing_stack = meson.get_cross_property('growing_stack', false)
+ endif
+
++glibconfig_conf.set('G_HAVE_GROWING_STACK', growing_stack)
++
+ # Tests for iconv
+ #
+ # USE_LIBICONV_GNU: Using GNU libiconv
+--
+2.17.0
+
+
+From bbdf3549b708135595e9ebd5e37368f8e898dc89 Mon Sep 17 00:00:00 2001
+From: Xavier Claessens <xavier.claessens@collabora.com>
+Date: Wed, 28 Mar 2018 21:37:38 -0400
+Subject: [PATCH 12/24] Meson: Define G_ENABLE_DEBUG and friends
+
+https://bugzilla.gnome.org/show_bug.cgi?id=794790
+---
+ meson.build | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/meson.build b/meson.build
+index 44ebf5ca6..0f43cb6b9 100644
+--- a/meson.build
++++ b/meson.build
+@@ -2,6 +2,7 @@ project('glib', 'c', 'cpp',
+ version : '2.56.1',
+ meson_version : '>= 0.45.0',
+ default_options : [
++ 'buildtype=debugoptimized',
+ 'warning_level=1',
+ 'c_std=gnu89'
+ ]
+@@ -149,6 +150,15 @@ glibconfig_conf.set('glib_os', glib_os)
+ # for dependencies that don't normally come with pkg-config files for Visual Studio builds
+ buildtype = get_option('buildtype')
+
++glib_debug_cflags = []
++if buildtype.startswith('debug')
++ glib_debug_cflags += ['-DG_ENABLE_DEBUG']
++elif buildtype == 'release'
++ glib_debug_cflags += ['-DG_DISABLE_CAST_CHECKS']
++endif
++
++add_project_arguments(glib_debug_cflags, language: 'c')
++
+ # check for header files
+
+ headers = [
+--
+2.17.0
+
+
+From 78f517328bc7646ab9d4d71584f1ba832b127fa3 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?=
+ =?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
+Date: Sat, 31 Mar 2018 13:59:55 +0000
+Subject: [PATCH 13/24] Force W32-specific POLL* constant values in meson
+
+The winsock2-using test does work perfectly, however this is a new
+thing that didn't exist in autotools-based builds of glib in the past.
+Autotools builds used the generic case where values were just defined
+to some agreed-upon numbers, and this is what all autotools-glib
+binaries and binaries built against autotools-glib (since these
+values go into public glibconfig.h header) use. At least one value,
+G_POLLIN, is different, thus breaking ABI if some binaries are
+built with autotools and the others are built with meson.
+
+Force meson buildscript to use the same G_POLL* constant values
+for Windows builds that autotools builds use.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=794687
+---
+ meson.build | 33 +++++++++++++++++++++++----------
+ 1 file changed, 23 insertions(+), 10 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index 0f43cb6b9..375537afc 100644
+--- a/meson.build
++++ b/meson.build
+@@ -1313,17 +1313,30 @@ else
+ endif
+
+ poll_defines = [
+- [ 'POLLIN', 'g_pollin' ],
+- [ 'POLLOUT', 'g_pollout' ],
+- [ 'POLLPRI', 'g_pollpri' ],
+- [ 'POLLERR', 'g_pollerr' ],
+- [ 'POLLHUP', 'g_pollhup' ],
+- [ 'POLLNVAL', 'g_pollnval' ],
++ [ 'POLLIN', 'g_pollin', 1 ],
++ [ 'POLLOUT', 'g_pollout', 4 ],
++ [ 'POLLPRI', 'g_pollpri', 2 ],
++ [ 'POLLERR', 'g_pollerr', 8 ],
++ [ 'POLLHUP', 'g_pollhup', 16 ],
++ [ 'POLLNVAL', 'g_pollnval', 32 ],
+ ]
+-foreach d : poll_defines
+- val = cc.compute_int(d[0], prefix: poll_includes)
+- glibconfig_conf.set(d[1], val)
+-endforeach
++
++if has_syspoll and has_systypes
++ foreach d : poll_defines
++ val = cc.compute_int(d[0], prefix: poll_includes)
++ glibconfig_conf.set(d[1], val)
++ endforeach
++elif has_winsock2
++ # Due to a missed bug in configure.ac the poll test
++ # never succeeded on Windows and used some pre-defined
++ # values as a fallback. Keep using them to maintain
++ # ABI compatibility with autotools builds of glibs
++ # and with *any* glib-using code compiled against them,
++ # since these values end up in a public header glibconfig.h.
++ foreach d : poll_defines
++ glibconfig_conf.set(d[1], d[2])
++ endforeach
++endif
+
+ # Internet address families
+ # FIXME: what about Cygwin (G_WITH_CYGWIN)
+--
+2.17.0
+
+
+From 41cbd73be8a00863d083415f1f210f934ce86c38 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?=
+ =?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
+Date: Tue, 10 Apr 2018 22:46:53 +0000
+Subject: [PATCH 14/24] Link gdatetime test to libintl
+
+gdatetime testcase uses glib (which uses libintl), but *alsi* calls
+libintl functions on its own, as part of the testing process.
+Therefore it must be linked to libintl like any other program that
+uses it.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=794556
+---
+ glib/tests/meson.build | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/glib/tests/meson.build b/glib/tests/meson.build
+index 4ac3620b8..7df9b23ee 100644
+--- a/glib/tests/meson.build
++++ b/glib/tests/meson.build
+@@ -110,6 +110,9 @@ foreach test_name : glib_tests
+ if test_name == 'regex'
+ deps += [pcre]
+ endif
++ if test_name == 'gdatetime'
++ deps += [libintl]
++ endif
+ exe = executable(test_name, '@0@.c'.format(test_name),
+ c_args : ['-DPCRE_STATIC'] + test_cargs,
+ dependencies : deps,
+--
+2.17.0
+
+
+From 0cfaf08db805f225af44f0cd0631402e23dd697d Mon Sep 17 00:00:00 2001
+From: Nirbheek Chauhan <nirbheek@centricular.com>
+Date: Mon, 7 May 2018 15:07:47 +0530
+Subject: [PATCH 15/24] config.h.meson: Add some missing #mesondefines
+
+The compiler checks were being completely ignored.
+---
+ config.h.meson | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/config.h.meson b/config.h.meson
+index 57e1ef5fb..b780a3e36 100644
+--- a/config.h.meson
++++ b/config.h.meson
+@@ -226,6 +226,12 @@
+ /* Define to 1 if you have the `kqueue' function. */
+ #mesondefine HAVE_KQUEUE
+
++/* Check for nl_langinfo and abbreviated alternative month names */
++#mesondefine HAVE_LANGINFO_ABALTMON
++
++/* Check for nl_langinfo and alternative month names */
++#mesondefine HAVE_LANGINFO_ALTMON
++
+ /* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
+ #mesondefine HAVE_LANGINFO_CODESET
+
+@@ -629,6 +635,9 @@
+ /* Define if you have the 'wchar_t' type. */
+ #mesondefine HAVE_WCHAR_T
+
++/* Define if you Have wcrtomb() */
++#mesondefine HAVE_WCRTOMB
++
+ /* Define to 1 if you have the `wcslen' function. */
+ #mesondefine HAVE_WCSLEN
+
+--
+2.17.0
+
+
+From 984a843463efd75aa5afb4f3f74c342e55a7f94a Mon Sep 17 00:00:00 2001
+From: Nirbheek Chauhan <nirbheek@centricular.com>
+Date: Mon, 7 May 2018 15:08:51 +0530
+Subject: [PATCH 16/24] meson: Add name for atomic test so it shows up in
+ configure
+
+---
+ meson.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/meson.build b/meson.build
+index 375537afc..39e5f33ed 100644
+--- a/meson.build
++++ b/meson.build
+@@ -1387,7 +1387,7 @@ atomictest = '''void func() {
+ __sync_bool_compare_and_swap (&atomic, 2, 3);
+ }
+ '''
+-if cc.compiles(atomictest)
++if cc.compiles(atomictest, name : 'atomic ops')
+ glibconfig_conf.set('G_ATOMIC_LOCK_FREE', true)
+ else
+ if host_machine.cpu_family() == 'x86' and cc.compiles(atomictest, args : '-march=i486')
+--
+2.17.0
+
+
+From 8d826d1e9bcb8bd21ef34e532191df39365a1e01 Mon Sep 17 00:00:00 2001
+From: Nirbheek Chauhan <nirbheek@centricular.com>
+Date: Mon, 7 May 2018 15:19:36 +0530
+Subject: [PATCH 17/24] meson: Fix checks for posix_memalign and stpcpy
+
+The 'no-builtin' checks were just plain wrong. For accurate detection of
+functions, use has_function with a header in the prefix. This fixes
+posix_memalign detection on Android and on MinGW.
+
+This also allows cross-files to override the result by setting
+`has_function_stpcpy = false`, etc in [extra properties]
+---
+ meson.build | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index 39e5f33ed..f4bf5b89b 100644
+--- a/meson.build
++++ b/meson.build
+@@ -310,7 +310,6 @@ endif
+ functions = [
+ 'alloca',
+ 'mmap',
+- 'posix_memalign',
+ 'memalign',
+ 'valloc',
+ 'fsync',
+@@ -322,7 +321,6 @@ functions = [
+ 'lstat',
+ 'strsignal',
+ 'vsnprintf',
+- 'stpcpy',
+ 'poll',
+ 'vasprintf',
+ 'setenv',
+@@ -413,6 +411,16 @@ foreach f : functions
+ endif
+ endforeach
+
++# Check that stpcpy() is usable; must use header
++if cc.has_function('stpcpy', prefix : '#include <string.h>')
++ glib_conf.set('HAVE_STPCPY', 1)
++endif
++
++# Check that posix_memalign() is usable; must use header
++if cc.has_function('posix_memalign', prefix : '#include <stdlib.h>')
++ glib_conf.set('HAVE_POSIX_MEMALIGN', 1)
++endif
++
+ # Check whether strerror_r returns char *
+ if have_func_strerror_r
+ if cc.compiles('''#define _GNU_SOURCE
+--
+2.17.0
+
+
+From 299cfad74bb6114984a7b546eced45665e1f905f Mon Sep 17 00:00:00 2001
+From: Nirbheek Chauhan <nirbheek@centricular.com>
+Date: Wed, 9 May 2018 17:13:34 +0530
+Subject: [PATCH 18/24] meson: Fix atomic ops check
+
+It should link, not just compile. This is what configure does too.
+---
+ meson.build | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index f4bf5b89b..1fc8f339d 100644
+--- a/meson.build
++++ b/meson.build
+@@ -1395,10 +1395,10 @@ atomictest = '''void func() {
+ __sync_bool_compare_and_swap (&atomic, 2, 3);
+ }
+ '''
+-if cc.compiles(atomictest, name : 'atomic ops')
++if cc.links(atomictest, name : 'atomic ops')
+ glibconfig_conf.set('G_ATOMIC_LOCK_FREE', true)
+ else
+- if host_machine.cpu_family() == 'x86' and cc.compiles(atomictest, args : '-march=i486')
++ if host_machine.cpu_family() == 'x86' and cc.links(atomictest, args : '-march=i486')
+ error('GLib must be built with -march=i486 or later.')
+ endif
+ glibconfig_conf.set('G_ATOMIC_LOCK_FREE', false)
+--
+2.17.0
+
+
+From c44d4eaa205797751c75f2c87433ce97647b3b5c Mon Sep 17 00:00:00 2001
+From: Xavier Claessens <xavier.claessens@collabora.com>
+Date: Sun, 13 May 2018 19:22:51 -0400
+Subject: [PATCH 19/24] Meson: libintl is a public dependency of glib-2.0
+
+On non-glibc platforms gettext is provided by extra libintl dependency.
+We wrongly thought libintl is an internal dependency and applications
+needs to explicitly link on it, but turns out that breaks many
+applications and with autotools the .pc generated actually has -lintl in
+public "Libs:".
+
+https://bugzilla.gnome.org/show_bug.cgi?id=796085
+---
+ gio/meson.build | 16 ++++++++--------
+ gio/tests/meson.build | 1 -
+ glib/meson.build | 12 ++++++------
+ gobject/meson.build | 5 +++--
+ 4 files changed, 17 insertions(+), 17 deletions(-)
+
+diff --git a/gio/meson.build b/gio/meson.build
+index 9e663d6ef..c02170eaf 100644
+--- a/gio/meson.build
++++ b/gio/meson.build
+@@ -796,7 +796,7 @@ libgio = library('gio-2.0',
+ link_with : internal_deps,
+ #libgio_2_0_la_LDFLAGS = $(GLIB_LINK_FLAGS)',
+ # '$(gio_win32_res_ldflag)',
+- dependencies : [libintl, libz_dep, libdl_dep, libmount_dep, libglib_dep,
++ dependencies : [libz_dep, libdl_dep, libmount_dep, libglib_dep,
+ libgobject_dep, libgmodule_dep, selinux_dep, xattr_dep,
+ platform_deps, network_libs],
+ c_args : gio_c_args,
+@@ -896,13 +896,13 @@ executable('gio', gio_tool_sources,
+ c_args : gio_c_args,
+ # intl.lib is not compatible with SAFESEH
+ link_args : noseh_link_args,
+- dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
++ dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
+
+ executable('gresource', 'gresource-tool.c',
+ install : true,
+ # intl.lib is not compatible with SAFESEH
+ link_args : noseh_link_args,
+- dependencies : [libelf, libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
++ dependencies : [libelf, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
+
+ executable('gio-querymodules', 'gio-querymodules.c', 'giomodule-priv.c',
+ install : true,
+@@ -916,7 +916,7 @@ glib_compile_schemas = executable('glib-compile-schemas',
+ install : true,
+ # intl.lib is not compatible with SAFESEH
+ link_args : noseh_link_args,
+- dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
++ dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
+
+ glib_compile_resources = executable('glib-compile-resources',
+ [gconstructor_as_data_h, 'gvdb/gvdb-builder.c', 'glib-compile-resources.c'],
+@@ -924,14 +924,14 @@ glib_compile_resources = executable('glib-compile-resources',
+ c_args : gio_c_args,
+ # intl.lib is not compatible with SAFESEH
+ link_args : noseh_link_args,
+- dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
++ dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
+
+ executable('gsettings', 'gsettings-tool.c',
+ install : true,
+ c_args : gio_c_args,
+ # intl.lib is not compatible with SAFESEH
+ link_args : noseh_link_args,
+- dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
++ dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
+ install_data('gschema.dtd',
+ install_dir : join_paths(get_option('datadir'), 'glib-2.0/schemas'))
+
+@@ -943,7 +943,7 @@ executable('gdbus', 'gdbus-tool.c',
+ c_args : gio_c_args,
+ # intl.lib is not compatible with SAFESEH
+ link_args : noseh_link_args,
+- dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
++ dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
+
+ if host_system != 'windows'
+ executable('gapplication', 'gapplication-tool.c',
+@@ -951,7 +951,7 @@ if host_system != 'windows'
+ c_args : gio_c_args,
+ # intl.lib is not compatible with SAFESEH
+ link_args : noseh_link_args,
+- dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
++ dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
+ endif
+
+ if enable_systemtap
+diff --git a/gio/tests/meson.build b/gio/tests/meson.build
+index 5aceb7c26..f66b9ed22 100644
+--- a/gio/tests/meson.build
++++ b/gio/tests/meson.build
+@@ -3,7 +3,6 @@ common_gio_tests_deps = [
+ libgmodule_dep,
+ libgobject_dep,
+ libgio_dep,
+- libintl
+ ]
+
+ subdir('gdbus-object-manager-example')
+diff --git a/glib/meson.build b/glib/meson.build
+index 9d186201d..ea9bf41ce 100644
+--- a/glib/meson.build
++++ b/glib/meson.build
+@@ -245,11 +245,11 @@ libglib_dep = declare_dependency(
+ link_with : libglib,
+ # thread_dep doesn't get pulled in from libglib atm,
+ # see https://github.com/mesonbuild/meson/issues/1426
+- dependencies : [thread_dep],
++ dependencies : [thread_dep, libintl],
+ # We sadly need to export configinc here because everyone includes <glib/*.h>
+ include_directories : [configinc, glibinc])
+
+-pkg.generate(libraries : libglib,
++pkg.generate(libraries : [libglib, libintl],
+ libraries_private : [osx_ldflags],
+ subdirs : ['glib-2.0'],
+ extra_cflags : ['-I${libdir}/glib-2.0/include'],
+@@ -271,23 +271,23 @@ if host_system == 'windows'
+ install : true,
+ gui_app : true,
+ include_directories : configinc,
+- dependencies : [libintl, libglib_dep])
++ dependencies : [libglib_dep])
+ executable('gspawn-win32-helper-console', 'gspawn-win32-helper.c',
+ install : true,
+ c_args : ['-DHELPER_CONSOLE'],
+ include_directories : configinc,
+- dependencies : [libintl, libglib_dep])
++ dependencies : [libglib_dep])
+ else
+ executable('gspawn-win64-helper', 'gspawn-win32-helper.c',
+ install : true,
+ gui_app : true,
+ include_directories : configinc,
+- dependencies : [libintl, libglib_dep])
++ dependencies : [libglib_dep])
+ executable('gspawn-win64-helper-console', 'gspawn-win32-helper.c',
+ install : true,
+ c_args : ['-DHELPER_CONSOLE'],
+ include_directories : configinc,
+- dependencies : [libintl, libglib_dep])
++ dependencies : [libglib_dep])
+ endif
+ else
+ gtester = executable('gtester', 'gtester.c',
+diff --git a/gobject/meson.build b/gobject/meson.build
+index 98e306d7f..1bf0e005d 100644
+--- a/gobject/meson.build
++++ b/gobject/meson.build
+@@ -68,8 +68,9 @@ libgobject = library('gobject-2.0',
+ soversion : soversion,
+ install : true,
+ include_directories : [configinc],
+- dependencies : [libintl, libffi_dep, libglib_dep],
+- c_args : ['-DG_LOG_DOMAIN="GLib-GObject"', '-DGOBJECT_COMPILATION'] + glib_hidden_visibility_args)
++ dependencies : [libffi_dep, libglib_dep],
++ c_args : ['-DG_LOG_DOMAIN="GLib-GObject"', '-DGOBJECT_COMPILATION'] + glib_hidden_visibility_args,
++)
+
+ pkg.generate(libraries : libgobject,
+ requires : ['glib-2.0'],
+--
+2.17.0
+
+
+From a40fc3d549736d35d2af354e16f50ef85aee0304 Mon Sep 17 00:00:00 2001
+From: Nirbheek Chauhan <nirbheek@centricular.com>
+Date: Wed, 16 May 2018 14:38:20 +0530
+Subject: [PATCH 20/24] Revert "build: meson: add warning flags"
+
+This reverts commit 9d24c8b223ec4253e3c6a2e14001de61fa993dbb.
+
+Breaks build with clang on macOS
+---
+ meson.build | 21 ---------------------
+ 1 file changed, 21 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index 1fc8f339d..4c2daede2 100644
+--- a/meson.build
++++ b/meson.build
+@@ -281,27 +281,6 @@ foreach m : struct_members
+ endif
+ endforeach
+
+-# Compiler flags
+-if cc.get_id() == 'gcc' or cc.get_id() == 'clang'
+- test_c_args = [
+- '-Wall',
+- '-Wduplicated-branches',
+- '-Wstrict-prototypes',
+- '-Werror=declaration-after-statement',
+- '-Werror=format=2',
+- '-Werror=format-security',
+- '-Werror=implicit-function-declaration',
+- '-Werror=init-self',
+- '-Werror=missing-include-dirs',
+- '-Werror=missing-prototypes',
+- '-Werror=pointer-arith',
+- ]
+-else
+- test_c_args = []
+-endif
+-
+-add_project_arguments(cc.get_supported_arguments(test_c_args), language: 'c')
+-
+ # Windows Support (Vista+)
+ if host_system == 'windows'
+ glib_conf.set('_WIN32_WINNT', '0x0601')
+--
+2.17.0
+
+
+From 6e522714ba2f08fd3705d6cb5302f5e6d56c4868 Mon Sep 17 00:00:00 2001
+From: Philip Withnall <withnall@endlessm.com>
+Date: Wed, 16 May 2018 12:16:17 +0100
+Subject: [PATCH 21/24] build: Fix test for G_ATOMIC_LOCK_FREE in meson.build
+
+Commit 3e96523e6b did not entirely fix the test, as the compiled test
+code did not have a main() function, so failed to link with:
+
+ /usr/lib/gcc/x86_64-redhat-linux/7/../../../../lib64/crt1.o: In function `_start':
+(.text+0x20): undefined reference to `main'
+collect2: error: ld returned 1 exit status
+
+This caused an invalid mixtures of builtin and non-builtin atomics/locks
+to be used, which caused deadlocks in a number of tests.
+
+Fix the atomic ops test in meson.build, and the unit tests all start
+working again.
+
+Signed-off-by: Philip Withnall <withnall@endlessm.com>
+
+https://bugzilla.gnome.org/show_bug.cgi?id=796164
+---
+ meson.build | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/meson.build b/meson.build
+index 4c2daede2..608d2c426 100644
+--- a/meson.build
++++ b/meson.build
+@@ -1369,9 +1369,10 @@ glibconfig_conf.set('G_ATOMIC_OP_MEMORY_BARRIER_NEEDED', glib_memory_barrier_nee
+ # to abort and advise the user to fix their CFLAGS. It's better to do
+ # that then to silently fall back on emulated atomic ops just because
+ # the user had the wrong build environment.
+-atomictest = '''void func() {
++atomictest = '''int main() {
+ volatile int atomic = 2;
+ __sync_bool_compare_and_swap (&atomic, 2, 3);
++ return 0;
+ }
+ '''
+ if cc.links(atomictest, name : 'atomic ops')
+--
+2.17.0
+
+
+From 979a5635a5fa2cd4066230d81e226a8dccc4df4c Mon Sep 17 00:00:00 2001
+From: Nirbheek Chauhan <nirbheek@centricular.com>
+Date: Wed, 16 May 2018 14:26:11 +0530
+Subject: [PATCH 22/24] meson: Fix error message for iconv detection
+
+---
+ meson.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/meson.build b/meson.build
+index 608d2c426..11ae73919 100644
+--- a/meson.build
++++ b/meson.build
+@@ -1496,7 +1496,7 @@ else
+ endif
+
+ if not found_iconv
+- error('No iconv() implementation found in C library or libiconv')
++ error('iconv implementation "@0@" not found'.format(iconv_opt))
+ endif
+
+ endif
+--
+2.17.0
+
+
+From 8ce9fd057fe865115c46ee27bdc239989ffc274e Mon Sep 17 00:00:00 2001
+From: Nirbheek Chauhan <nirbheek@centricular.com>
+Date: Sun, 6 May 2018 15:29:09 +0530
+Subject: [PATCH 23/24] gwin32: Fix detection of MinGW32 vs MinGW-w64
+
+__MINGW32__ is defined on all MinGW variants including MinGW-w64.
+__MINGW64_VERSION_MAJOR is only defined on MinGW-w64.
+
+This difference is important because on MinGW-w64 we must #include
+winternl.h because including ntdef.h results in compiler errors
+about symbol redefinition, and the header warns that it is deprecated
+and may be removed in the future.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=795849
+---
+ glib/gwin32.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/glib/gwin32.c b/glib/gwin32.c
+index cc6da5f99..a176514b1 100644
+--- a/glib/gwin32.c
++++ b/glib/gwin32.c
+@@ -59,8 +59,8 @@
+ #ifdef _MSC_VER
+ #pragma comment (lib, "ntoskrnl.lib")
+ #endif
+-#elif defined (__MINGW32__)
+-/* mingw-w64, not MinGW, has winternl.h */
++#elif defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
++/* mingw-w64 must use winternl.h, but not MinGW */
+ #include <ntdef.h>
+ #else
+ #include <winternl.h>
+--
+2.17.0
+
+
+From 66c34c6ec2dcf60dab876659e0019b3f153fa1ea Mon Sep 17 00:00:00 2001
+From: Xavier Claessens <xavier.claessens@collabora.com>
+Date: Fri, 20 Apr 2018 12:10:18 -0400
+Subject: [PATCH 24/24] Tests: gsubprocess: Do not use stdin/stdout variables
+
+https://bugzilla.gnome.org/show_bug.cgi?id=795406
+---
+ gio/tests/gsubprocess.c | 54 ++++++++++++++++++++---------------------
+ 1 file changed, 27 insertions(+), 27 deletions(-)
+
+diff --git a/gio/tests/gsubprocess.c b/gio/tests/gsubprocess.c
+index ad65a1df7..ac7051d6d 100644
+--- a/gio/tests/gsubprocess.c
++++ b/gio/tests/gsubprocess.c
+@@ -333,7 +333,7 @@ test_echo1 (void)
+ GError **error = &local_error;
+ GSubprocess *proc;
+ GPtrArray *args;
+- GInputStream *stdout;
++ GInputStream *stdout_stream;
+ gchar *result;
+
+ args = get_test_subprocess_args ("echo", "hello", "world!", NULL);
+@@ -341,9 +341,9 @@ test_echo1 (void)
+ g_ptr_array_free (args, TRUE);
+ g_assert_no_error (local_error);
+
+- stdout = g_subprocess_get_stdout_pipe (proc);
++ stdout_stream = g_subprocess_get_stdout_pipe (proc);
+
+- result = splice_to_string (stdout, error);
++ result = splice_to_string (stdout_stream, error);
+ g_assert_no_error (local_error);
+
+ g_assert_cmpstr (result, ==, "hello" LINEEND "world!" LINEEND);
+@@ -360,7 +360,7 @@ test_echo_merged (void)
+ GError **error = &local_error;
+ GSubprocess *proc;
+ GPtrArray *args;
+- GInputStream *stdout;
++ GInputStream *stdout_stream;
+ gchar *result;
+
+ args = get_test_subprocess_args ("echo-stdout-and-stderr", "merge", "this", NULL);
+@@ -370,8 +370,8 @@ test_echo_merged (void)
+ g_ptr_array_free (args, TRUE);
+ g_assert_no_error (local_error);
+
+- stdout = g_subprocess_get_stdout_pipe (proc);
+- result = splice_to_string (stdout, error);
++ stdout_stream = g_subprocess_get_stdout_pipe (proc);
++ result = splice_to_string (stdout_stream, error);
+ g_assert_no_error (local_error);
+
+ g_assert_cmpstr (result, ==, "merge\nmerge\nthis\nthis\n");
+@@ -1087,7 +1087,7 @@ test_env (void)
+ GSubprocessLauncher *launcher;
+ GSubprocess *proc;
+ GPtrArray *args;
+- GInputStream *stdout;
++ GInputStream *stdout_stream;
+ gchar *result;
+ gchar *envp[] = { "ONE=1", "TWO=1", "THREE=3", "FOUR=1", NULL };
+ gchar **split;
+@@ -1106,9 +1106,9 @@ test_env (void)
+ g_ptr_array_free (args, TRUE);
+ g_assert_no_error (local_error);
+
+- stdout = g_subprocess_get_stdout_pipe (proc);
++ stdout_stream = g_subprocess_get_stdout_pipe (proc);
+
+- result = splice_to_string (stdout, error);
++ result = splice_to_string (stdout_stream, error);
+ split = g_strsplit (result, "\n", -1);
+ g_assert_cmpstr (g_environ_getenv (split, "ONE"), ==, "1");
+ g_assert_cmpstr (g_environ_getenv (split, "TWO"), ==, "2");
+@@ -1131,7 +1131,7 @@ test_env_inherit (void)
+ GSubprocessLauncher *launcher;
+ GSubprocess *proc;
+ GPtrArray *args;
+- GInputStream *stdout;
++ GInputStream *stdout_stream;
+ gchar *result;
+ gchar **split;
+
+@@ -1153,9 +1153,9 @@ test_env_inherit (void)
+ g_ptr_array_free (args, TRUE);
+ g_assert_no_error (local_error);
+
+- stdout = g_subprocess_get_stdout_pipe (proc);
++ stdout_stream = g_subprocess_get_stdout_pipe (proc);
+
+- result = splice_to_string (stdout, error);
++ result = splice_to_string (stdout_stream, error);
+ split = g_strsplit (result, "\n", -1);
+ g_assert_null (g_environ_getenv (split, "TEST_ENV_INHERIT1"));
+ g_assert_cmpstr (g_environ_getenv (split, "TEST_ENV_INHERIT2"), ==, "2");
+@@ -1175,7 +1175,7 @@ test_cwd (void)
+ GSubprocessLauncher *launcher;
+ GSubprocess *proc;
+ GPtrArray *args;
+- GInputStream *stdout;
++ GInputStream *stdout_stream;
+ gchar *result;
+ const char *basename;
+
+@@ -1188,9 +1188,9 @@ test_cwd (void)
+ g_ptr_array_free (args, TRUE);
+ g_assert_no_error (local_error);
+
+- stdout = g_subprocess_get_stdout_pipe (proc);
++ stdout_stream = g_subprocess_get_stdout_pipe (proc);
+
+- result = splice_to_string (stdout, error);
++ result = splice_to_string (stdout_stream, error);
+
+ basename = g_strrstr (result, "/");
+ g_assert (basename != NULL);
+@@ -1211,7 +1211,7 @@ test_stdout_file (void)
+ GPtrArray *args;
+ GFile *tmpfile;
+ GFileIOStream *iostream;
+- GOutputStream *stdin;
++ GOutputStream *stdin_stream;
+ const char *test_data = "this is some test data\n";
+ char *tmp_contents;
+ char *tmp_file_path;
+@@ -1229,12 +1229,12 @@ test_stdout_file (void)
+ g_ptr_array_free (args, TRUE);
+ g_assert_no_error (local_error);
+
+- stdin = g_subprocess_get_stdin_pipe (proc);
++ stdin_stream = g_subprocess_get_stdin_pipe (proc);
+
+- g_output_stream_write_all (stdin, test_data, strlen (test_data), NULL, NULL, error);
++ g_output_stream_write_all (stdin_stream, test_data, strlen (test_data), NULL, NULL, error);
+ g_assert_no_error (local_error);
+
+- g_output_stream_close (stdin, NULL, error);
++ g_output_stream_close (stdin_stream, NULL, error);
+ g_assert_no_error (local_error);
+
+ g_subprocess_wait_check (proc, NULL, error);
+@@ -1264,7 +1264,7 @@ test_stdout_fd (void)
+ GFile *tmpfile;
+ GFileIOStream *iostream;
+ GFileDescriptorBased *descriptor_stream;
+- GOutputStream *stdin;
++ GOutputStream *stdin_stream;
+ const char *test_data = "this is some test data\n";
+ char *tmp_contents;
+
+@@ -1281,12 +1281,12 @@ test_stdout_fd (void)
+
+ g_clear_object (&iostream);
+
+- stdin = g_subprocess_get_stdin_pipe (proc);
++ stdin_stream = g_subprocess_get_stdin_pipe (proc);
+
+- g_output_stream_write_all (stdin, test_data, strlen (test_data), NULL, NULL, error);
++ g_output_stream_write_all (stdin_stream, test_data, strlen (test_data), NULL, NULL, error);
+ g_assert_no_error (local_error);
+
+- g_output_stream_close (stdin, NULL, error);
++ g_output_stream_close (stdin_stream, NULL, error);
+ g_assert_no_error (local_error);
+
+ g_subprocess_wait_check (proc, NULL, error);
+@@ -1320,7 +1320,7 @@ test_child_setup (void)
+ GPtrArray *args;
+ GFile *tmpfile;
+ GFileIOStream *iostream;
+- GOutputStream *stdin;
++ GOutputStream *stdin_stream;
+ const char *test_data = "this is some test data\n";
+ char *tmp_contents;
+ int fd;
+@@ -1339,12 +1339,12 @@ test_child_setup (void)
+
+ g_clear_object (&iostream);
+
+- stdin = g_subprocess_get_stdin_pipe (proc);
++ stdin_stream = g_subprocess_get_stdin_pipe (proc);
+
+- g_output_stream_write_all (stdin, test_data, strlen (test_data), NULL, NULL, error);
++ g_output_stream_write_all (stdin_stream, test_data, strlen (test_data), NULL, NULL, error);
+ g_assert_no_error (local_error);
+
+- g_output_stream_close (stdin, NULL, error);
++ g_output_stream_close (stdin_stream, NULL, error);
+ g_assert_no_error (local_error);
+
+ g_subprocess_wait_check (proc, NULL, error);
+--
+2.17.0
+