From cba9d820e2a22a9515375b233f79278d36dd9d28 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Fri, 25 Sep 2020 13:50:54 +0100
Subject: [PATCH] Consolidate GLib backwards compatibility into s-r-t

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 helpers/check-locale.c                        |  2 +-
 helpers/meson.build                           |  2 +-
 pressure-vessel/adverb.c                      |  2 +-
 pressure-vessel/bwrap-lock.h                  |  2 +-
 pressure-vessel/bwrap.h                       |  2 +-
 pressure-vessel/elf-utils.c                   |  2 +-
 pressure-vessel/elf-utils.h                   |  2 +-
 pressure-vessel/flatpak-bwrap.c               |  2 +-
 pressure-vessel/flatpak-run-private.h         |  2 +-
 pressure-vessel/launch.c                      |  2 +-
 pressure-vessel/launcher.c                    |  2 +-
 pressure-vessel/launcher.h                    |  2 +-
 pressure-vessel/meson.build                   |  2 -
 pressure-vessel/resolve-in-sysroot.c          |  2 +-
 pressure-vessel/runtime.c                     |  2 +-
 pressure-vessel/runtime.h                     |  2 +-
 pressure-vessel/tree-copy.c                   |  2 +-
 pressure-vessel/utils.c                       |  2 +-
 pressure-vessel/wrap-interactive.h            |  2 +-
 pressure-vessel/wrap.c                        |  2 +-
 steam-runtime-tools/architecture.c            |  2 +-
 steam-runtime-tools/cpu-feature.c             |  2 +-
 steam-runtime-tools/desktop-entry.c           |  2 +-
 .../glib-backports-internal.h                 | 10 +--
 .../glib-backports.c                          |  2 +-
 steam-runtime-tools/glib-compat.h             | 67 -------------------
 steam-runtime-tools/graphics.c                |  2 +-
 steam-runtime-tools/library.c                 |  2 +-
 steam-runtime-tools/locale.c                  |  2 +-
 steam-runtime-tools/meson.build               |  2 +
 steam-runtime-tools/os.c                      |  2 +-
 steam-runtime-tools/runtime.c                 |  2 +-
 steam-runtime-tools/steam.c                   |  2 +-
 steam-runtime-tools/system-info.c             |  2 +-
 steam-runtime-tools/utils.c                   |  2 +-
 tests/adverb.c                                |  2 +-
 tests/check-requirements-cli.c                |  2 +-
 tests/meson.build                             |  8 +--
 tests/mock-container-capsule-capture-libs.c   |  2 +-
 tests/mock-debian-capsule-capture-libs.c      |  2 +-
 tests/mock-fedora-capsule-capture-libs.c      |  2 +-
 tests/pressure-vessel/bwrap-lock.c            |  2 +-
 tests/pressure-vessel/cheap-copy.c            |  2 +-
 tests/pressure-vessel/elf-get-soname.c        |  2 +-
 tests/pressure-vessel/helper.c                |  2 +-
 tests/pressure-vessel/resolve-in-sysroot.c    |  2 +-
 tests/pressure-vessel/utils.c                 |  2 +-
 .../wait-for-child-processes.c                |  2 +-
 tests/system-info-cli.c                       |  2 +-
 tests/system-info.c                           |  2 +-
 tests/test-utils.c                            |  2 +-
 51 files changed, 58 insertions(+), 123 deletions(-)
 rename pressure-vessel/glib-backports.h => steam-runtime-tools/glib-backports-internal.h (98%)
 rename {pressure-vessel => steam-runtime-tools}/glib-backports.c (99%)
 delete mode 100644 steam-runtime-tools/glib-compat.h

diff --git a/helpers/check-locale.c b/helpers/check-locale.c
index 52b7f2230..0bc19be37 100644
--- a/helpers/check-locale.c
+++ b/helpers/check-locale.c
@@ -29,7 +29,7 @@
 #include <glib.h>
 #include <json-glib/json-glib.h>
 
-#include "steam-runtime-tools/glib-compat.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 #include "steam-runtime-tools/utils-internal.h"
 
 #ifdef MOCK_CHECK_LOCALE
diff --git a/helpers/meson.build b/helpers/meson.build
index ea906175c..be8331aa4 100644
--- a/helpers/meson.build
+++ b/helpers/meson.build
@@ -35,7 +35,7 @@ executable(
   multiarch + '-check-locale',
   'check-locale.c',
   include_directories : project_include_dirs,
-  dependencies : [glib, json_glib],
+  dependencies : [glib, gio_unix, libglnx_dep, json_glib],
   install : true,
   install_dir : pkglibexecdir,
   # Use json-glib and GLib from the adjacent libdir, ignoring LD_LIBRARY_PATH
diff --git a/pressure-vessel/adverb.c b/pressure-vessel/adverb.c
index cec616196..73087bc89 100644
--- a/pressure-vessel/adverb.c
+++ b/pressure-vessel/adverb.c
@@ -35,7 +35,7 @@
 #include <glib/gstdio.h>
 #include <gio/gio.h>
 
-#include "glib-backports.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 #include "libglnx/libglnx.h"
 
 #include "bwrap-lock.h"
diff --git a/pressure-vessel/bwrap-lock.h b/pressure-vessel/bwrap-lock.h
index 41c5aba6e..58170f512 100644
--- a/pressure-vessel/bwrap-lock.h
+++ b/pressure-vessel/bwrap-lock.h
@@ -22,7 +22,7 @@
 #include <glib.h>
 #include <glib-object.h>
 
-#include "glib-backports.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 #include "libglnx/libglnx.h"
 
 /**
diff --git a/pressure-vessel/bwrap.h b/pressure-vessel/bwrap.h
index c8e5a5a9c..b4613da12 100644
--- a/pressure-vessel/bwrap.h
+++ b/pressure-vessel/bwrap.h
@@ -25,7 +25,7 @@
 #include "libglnx/libglnx.h"
 
 #include "flatpak-bwrap-private.h"
-#include "glib-backports.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 
 gboolean pv_bwrap_run_sync (FlatpakBwrap *bwrap,
                             int *exit_status_out,
diff --git a/pressure-vessel/elf-utils.c b/pressure-vessel/elf-utils.c
index 5fcb790bc..466003e58 100644
--- a/pressure-vessel/elf-utils.c
+++ b/pressure-vessel/elf-utils.c
@@ -26,7 +26,7 @@
 
 #include "libglnx/libglnx.h"
 
-#include "glib-backports.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 
 #define throw_elf_error(error, format, ...) \
   glnx_null_throw (error, format ": %s", ##__VA_ARGS__, elf_errmsg (elf_errno ()))
diff --git a/pressure-vessel/elf-utils.h b/pressure-vessel/elf-utils.h
index fa89652e7..cb0529cf8 100644
--- a/pressure-vessel/elf-utils.h
+++ b/pressure-vessel/elf-utils.h
@@ -25,7 +25,7 @@
 
 #include "libglnx/libglnx.h"
 
-#include "glib-backports.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (Elf, elf_end);
 
diff --git a/pressure-vessel/flatpak-bwrap.c b/pressure-vessel/flatpak-bwrap.c
index 2eaf9ca45..e3d0a482e 100644
--- a/pressure-vessel/flatpak-bwrap.c
+++ b/pressure-vessel/flatpak-bwrap.c
@@ -42,7 +42,7 @@
 #include "flatpak-utils-private.h"
 #include "flatpak-utils-base-private.h"
 
-#include "glib-backports.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 
 static void
 clear_fd (gpointer data)
diff --git a/pressure-vessel/flatpak-run-private.h b/pressure-vessel/flatpak-run-private.h
index ddc9a406c..1b42f9526 100644
--- a/pressure-vessel/flatpak-run-private.h
+++ b/pressure-vessel/flatpak-run-private.h
@@ -36,7 +36,7 @@
 #include "flatpak-context-private.h"
 #include "flatpak-bwrap-private.h"
 #include "flatpak-utils-private.h"
-#include "glib-backports.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 
 void flatpak_run_add_x11_args (FlatpakBwrap *bwrap,
                                gboolean      allowed);
diff --git a/pressure-vessel/launch.c b/pressure-vessel/launch.c
index 41413a077..7cdbe216a 100644
--- a/pressure-vessel/launch.c
+++ b/pressure-vessel/launch.c
@@ -39,7 +39,7 @@
 #include <gio/gio.h>
 #include <gio/gunixfdlist.h>
 
-#include "glib-backports.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 #include "libglnx/libglnx.h"
 
 #include "launcher.h"
diff --git a/pressure-vessel/launcher.c b/pressure-vessel/launcher.c
index 6e76b72d8..a30cdee0f 100644
--- a/pressure-vessel/launcher.c
+++ b/pressure-vessel/launcher.c
@@ -40,7 +40,7 @@
 #include <gio/gio.h>
 #include <gio/gunixfdlist.h>
 
-#include "glib-backports.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 #include "libglnx/libglnx.h"
 
 #include "flatpak-utils-base-private.h"
diff --git a/pressure-vessel/launcher.h b/pressure-vessel/launcher.h
index f85d94d6b..b36e3eca8 100644
--- a/pressure-vessel/launcher.h
+++ b/pressure-vessel/launcher.h
@@ -28,7 +28,7 @@
 #include <glib.h>
 #include <gio/gio.h>
 
-#include "glib-backports.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 #include "libglnx/libglnx.h"
 
 #include "launcher1.h"
diff --git a/pressure-vessel/meson.build b/pressure-vessel/meson.build
index e98d31880..c317ba281 100644
--- a/pressure-vessel/meson.build
+++ b/pressure-vessel/meson.build
@@ -86,8 +86,6 @@ pressure_vessel_utils = static_library(
     'flatpak-utils-base-private.h',
     'flatpak-utils.c',
     'flatpak-utils-private.h',
-    'glib-backports.c',
-    'glib-backports.h',
     'resolve-in-sysroot.c',
     'resolve-in-sysroot.h',
     'tree-copy.c',
diff --git a/pressure-vessel/resolve-in-sysroot.c b/pressure-vessel/resolve-in-sysroot.c
index 8fe6cadb3..4b25da6ae 100644
--- a/pressure-vessel/resolve-in-sysroot.c
+++ b/pressure-vessel/resolve-in-sysroot.c
@@ -25,7 +25,7 @@
 
 #include "libglnx/libglnx.h"
 
-#include "glib-backports.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 
 /* Enabling debug logging for this is rather too verbose, so only
  * enable it when actively debugging this module */
diff --git a/pressure-vessel/runtime.c b/pressure-vessel/runtime.c
index 679b5b1b9..d449eda5d 100644
--- a/pressure-vessel/runtime.c
+++ b/pressure-vessel/runtime.c
@@ -25,7 +25,7 @@
 
 /* Include these before steam-runtime-tools.h so that their backport of
  * G_DEFINE_AUTOPTR_CLEANUP_FUNC will be visible to it */
-#include "glib-backports.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 #include "libglnx/libglnx.h"
 
 #include <steam-runtime-tools/steam-runtime-tools.h>
diff --git a/pressure-vessel/runtime.h b/pressure-vessel/runtime.h
index a2412ac0d..7d5f226f8 100644
--- a/pressure-vessel/runtime.h
+++ b/pressure-vessel/runtime.h
@@ -23,7 +23,7 @@
 #include <glib/gstdio.h>
 #include <glib-object.h>
 
-#include "glib-backports.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 #include "libglnx/libglnx.h"
 
 #include "flatpak-bwrap-private.h"
diff --git a/pressure-vessel/tree-copy.c b/pressure-vessel/tree-copy.c
index 81160366e..80b014442 100644
--- a/pressure-vessel/tree-copy.c
+++ b/pressure-vessel/tree-copy.c
@@ -30,7 +30,7 @@
 
 #include "libglnx/libglnx.h"
 
-#include "glib-backports.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 #include "flatpak-bwrap-private.h"
 #include "flatpak-utils-base-private.h"
 #include "flatpak-utils-private.h"
diff --git a/pressure-vessel/utils.c b/pressure-vessel/utils.c
index ed6031589..73c98c94a 100644
--- a/pressure-vessel/utils.c
+++ b/pressure-vessel/utils.c
@@ -35,7 +35,7 @@
 
 #include "libglnx/libglnx.h"
 
-#include "glib-backports.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 #include "flatpak-bwrap-private.h"
 #include "flatpak-utils-base-private.h"
 #include "flatpak-utils-private.h"
diff --git a/pressure-vessel/wrap-interactive.h b/pressure-vessel/wrap-interactive.h
index 2170f5902..c0ff1a228 100644
--- a/pressure-vessel/wrap-interactive.h
+++ b/pressure-vessel/wrap-interactive.h
@@ -25,7 +25,7 @@
 #include "libglnx/libglnx.h"
 
 #include "flatpak-bwrap-private.h"
-#include "glib-backports.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 
 typedef enum
 {
diff --git a/pressure-vessel/wrap.c b/pressure-vessel/wrap.c
index 92827ea8b..831dabca3 100644
--- a/pressure-vessel/wrap.c
+++ b/pressure-vessel/wrap.c
@@ -29,7 +29,7 @@
 #include <locale.h>
 #include <stdlib.h>
 
-#include "glib-backports.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 #include "libglnx/libglnx.h"
 
 #include "bwrap.h"
diff --git a/steam-runtime-tools/architecture.c b/steam-runtime-tools/architecture.c
index 3c1fadf75..c3d1fffdf 100644
--- a/steam-runtime-tools/architecture.c
+++ b/steam-runtime-tools/architecture.c
@@ -26,7 +26,7 @@
 #include "steam-runtime-tools/architecture.h"
 #include "steam-runtime-tools/architecture-internal.h"
 
-#include "steam-runtime-tools/glib-compat.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 #include "steam-runtime-tools/utils.h"
 #include "steam-runtime-tools/utils-internal.h"
 
diff --git a/steam-runtime-tools/cpu-feature.c b/steam-runtime-tools/cpu-feature.c
index b231f850f..7730c6c5f 100644
--- a/steam-runtime-tools/cpu-feature.c
+++ b/steam-runtime-tools/cpu-feature.c
@@ -31,7 +31,7 @@
 #include <sys/types.h>
 #include <cpuid.h>
 
-#include "steam-runtime-tools/glib-compat.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 #include "steam-runtime-tools/utils.h"
 #include "steam-runtime-tools/utils-internal.h"
 
diff --git a/steam-runtime-tools/desktop-entry.c b/steam-runtime-tools/desktop-entry.c
index bb5b1af12..e98c75fcc 100644
--- a/steam-runtime-tools/desktop-entry.c
+++ b/steam-runtime-tools/desktop-entry.c
@@ -36,7 +36,7 @@
 
 #include "steam-runtime-tools/desktop-entry-internal.h"
 #include "steam-runtime-tools/enums.h"
-#include "steam-runtime-tools/glib-compat.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 #include "steam-runtime-tools/utils.h"
 
 /**
diff --git a/pressure-vessel/glib-backports.h b/steam-runtime-tools/glib-backports-internal.h
similarity index 98%
rename from pressure-vessel/glib-backports.h
rename to steam-runtime-tools/glib-backports-internal.h
index 73a587bce..2aeed2401 100644
--- a/pressure-vessel/glib-backports.h
+++ b/steam-runtime-tools/glib-backports-internal.h
@@ -22,6 +22,12 @@
 
 #include <glib.h>
 
+#include <libglnx.h>
+
+#if !GLIB_CHECK_VERSION (2, 42, 0)
+# define G_OPTION_FLAG_NONE (0)
+#endif
+
 #ifndef G_SPAWN_DEFAULT
 #define G_SPAWN_DEFAULT 0
 #endif
@@ -68,10 +74,6 @@ void my_g_ptr_array_insert (GPtrArray *arr,
                             gpointer data);
 #endif
 
-#if !GLIB_CHECK_VERSION (2, 42, 0)
-#define G_OPTION_FLAG_NONE 0
-#endif
-
 #if !GLIB_CHECK_VERSION(2, 36, 0)
 #define g_dbus_address_escape_value my_g_dbus_address_escape_value
 gchar *my_g_dbus_address_escape_value (const gchar *string);
diff --git a/pressure-vessel/glib-backports.c b/steam-runtime-tools/glib-backports.c
similarity index 99%
rename from pressure-vessel/glib-backports.c
rename to steam-runtime-tools/glib-backports.c
index 3a4694733..f6c9ab294 100644
--- a/pressure-vessel/glib-backports.c
+++ b/steam-runtime-tools/glib-backports.c
@@ -24,7 +24,7 @@
  * along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "glib-backports.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 
 #include <errno.h>
 #include <string.h>
diff --git a/steam-runtime-tools/glib-compat.h b/steam-runtime-tools/glib-compat.h
deleted file mode 100644
index adeac63fc..000000000
--- a/steam-runtime-tools/glib-compat.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*<private_header>*/
-/*
- * Copyright © 2019 Collabora Ltd.
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation files
- * (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#pragma once
-
-#include <glib.h>
-
-#if !GLIB_CHECK_VERSION (2, 42, 0)
-# define G_OPTION_FLAG_NONE (0)
-#endif
-
-#if !GLIB_CHECK_VERSION (2, 38, 0)
-# define G_SPAWN_DEFAULT (0)
-#endif
-
-#if !defined(g_steal_pointer)
-#define g_steal_pointer(x) _srt_steal_pointer (x)
-/* A simplified version of g_steal_pointer without type-safety. */
-static inline gpointer
-_srt_steal_pointer (gpointer pointer_to_pointer)
-{
-  gpointer *pp = pointer_to_pointer;
-  gpointer ret;
-
-  ret = *pp;
-  *pp = NULL;
-  return ret;
-}
-#endif
-
-#if !defined(g_clear_pointer)
-#define g_clear_pointer(x, destroy) \
-  _srt_clear_pointer (x, (GDestroyNotify) (void (*)(void)) destroy)
-/* A simplified version of g_clear_pointer without type-safety. */
-static inline void
-_srt_clear_pointer (gpointer pointer_to_pointer,
-                    GDestroyNotify destroy)
-{
-  gpointer *pp = pointer_to_pointer;
-  gpointer p = g_steal_pointer (pp);
-
-  if (p != NULL)
-    destroy (p);
-}
-#endif
diff --git a/steam-runtime-tools/graphics.c b/steam-runtime-tools/graphics.c
index 382465870..8eeb5c657 100644
--- a/steam-runtime-tools/graphics.c
+++ b/steam-runtime-tools/graphics.c
@@ -27,7 +27,7 @@
 
 #include "steam-runtime-tools/architecture.h"
 #include "steam-runtime-tools/enums.h"
-#include "steam-runtime-tools/glib-compat.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 #include "steam-runtime-tools/graphics-internal.h"
 #include "steam-runtime-tools/library-internal.h"
 #include "steam-runtime-tools/utils.h"
diff --git a/steam-runtime-tools/library.c b/steam-runtime-tools/library.c
index 8a522713e..3401b6987 100644
--- a/steam-runtime-tools/library.c
+++ b/steam-runtime-tools/library.c
@@ -27,7 +27,7 @@
 
 #include "steam-runtime-tools/architecture.h"
 #include "steam-runtime-tools/enums.h"
-#include "steam-runtime-tools/glib-compat.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 #include "steam-runtime-tools/library-internal.h"
 #include "steam-runtime-tools/utils.h"
 #include "steam-runtime-tools/utils-internal.h"
diff --git a/steam-runtime-tools/locale.c b/steam-runtime-tools/locale.c
index a4b9f9bab..f10a05c83 100644
--- a/steam-runtime-tools/locale.c
+++ b/steam-runtime-tools/locale.c
@@ -27,7 +27,7 @@
 
 #include "steam-runtime-tools/architecture.h"
 #include "steam-runtime-tools/enums.h"
-#include "steam-runtime-tools/glib-compat.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 #include "steam-runtime-tools/locale-internal.h"
 #include "steam-runtime-tools/utils-internal.h"
 
diff --git a/steam-runtime-tools/meson.build b/steam-runtime-tools/meson.build
index 417b3764a..eec30738c 100644
--- a/steam-runtime-tools/meson.build
+++ b/steam-runtime-tools/meson.build
@@ -28,6 +28,8 @@ libsteamrt_sources = [
     'cpu-feature.c',
     'desktop-entry-internal.h',
     'desktop-entry.c',
+    'glib-backports.c',
+    'glib-backports-internal.h',
     'graphics-internal.h',
     'graphics.c',
     'library-internal.h',
diff --git a/steam-runtime-tools/os.c b/steam-runtime-tools/os.c
index 5b4f9e894..e408e5430 100644
--- a/steam-runtime-tools/os.c
+++ b/steam-runtime-tools/os.c
@@ -27,7 +27,7 @@
 
 #include <string.h>
 
-#include "steam-runtime-tools/glib-compat.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 
 #include <glib.h>
 
diff --git a/steam-runtime-tools/runtime.c b/steam-runtime-tools/runtime.c
index 2578a44e7..82efce91a 100644
--- a/steam-runtime-tools/runtime.c
+++ b/steam-runtime-tools/runtime.c
@@ -36,7 +36,7 @@
 
 #include <glib/gstdio.h>
 
-#include "steam-runtime-tools/glib-compat.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 #include "steam-runtime-tools/utils.h"
 
 /**
diff --git a/steam-runtime-tools/steam.c b/steam-runtime-tools/steam.c
index e15ed2e33..47103d4f5 100644
--- a/steam-runtime-tools/steam.c
+++ b/steam-runtime-tools/steam.c
@@ -36,7 +36,7 @@
 
 #include "steam-runtime-tools/desktop-entry-internal.h"
 #include "steam-runtime-tools/enums.h"
-#include "steam-runtime-tools/glib-compat.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 #include "steam-runtime-tools/utils.h"
 #include "steam-runtime-tools/utils-internal.h"
 
diff --git a/steam-runtime-tools/system-info.c b/steam-runtime-tools/system-info.c
index fdfb25bdd..a4fab61ec 100644
--- a/steam-runtime-tools/system-info.c
+++ b/steam-runtime-tools/system-info.c
@@ -29,7 +29,7 @@
 #include "steam-runtime-tools/architecture-internal.h"
 #include "steam-runtime-tools/cpu-feature-internal.h"
 #include "steam-runtime-tools/desktop-entry-internal.h"
-#include "steam-runtime-tools/glib-compat.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 #include "steam-runtime-tools/graphics.h"
 #include "steam-runtime-tools/graphics-internal.h"
 #include "steam-runtime-tools/library-internal.h"
diff --git a/steam-runtime-tools/utils.c b/steam-runtime-tools/utils.c
index 3c88a429a..425de4faa 100644
--- a/steam-runtime-tools/utils.c
+++ b/steam-runtime-tools/utils.c
@@ -43,7 +43,7 @@
 
 #include <glib-object.h>
 #include <gio/gio.h>
-#include "steam-runtime-tools/glib-compat.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 
 #ifdef HAVE_GETAUXVAL
 #define getauxval_AT_SECURE() getauxval (AT_SECURE)
diff --git a/tests/adverb.c b/tests/adverb.c
index 6159c779f..3928eda84 100644
--- a/tests/adverb.c
+++ b/tests/adverb.c
@@ -33,7 +33,7 @@
 #include <glib.h>
 #include <gio/gio.h>
 
-#include "steam-runtime-tools/glib-compat.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 
 static gboolean opt_print_version = FALSE;
 static gboolean opt_ignore_sigchld = FALSE;
diff --git a/tests/check-requirements-cli.c b/tests/check-requirements-cli.c
index 75d294354..45cda5df8 100644
--- a/tests/check-requirements-cli.c
+++ b/tests/check-requirements-cli.c
@@ -27,7 +27,7 @@
 
 #include <libglnx.h>
 
-#include <steam-runtime-tools/glib-compat.h>
+#include <steam-runtime-tools/glib-backports-internal.h>
 
 #include <glib.h>
 #include <glib/gstdio.h>
diff --git a/tests/meson.build b/tests/meson.build
index 88bcd8720..6f08fa9dd 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -125,7 +125,7 @@ endforeach
 executable(
   'adverb',
   'adverb.c',
-  dependencies : [glib, gio],
+  dependencies : [glib, gio, gio_unix, libglnx_dep],
   include_directories : project_include_dirs,
   install : get_option('installed_tests'),
   install_dir : tests_dir,
@@ -180,7 +180,7 @@ executable(
     '-DMOCK_CHECK_LOCALE_HAVE_C_UTF8',
     '-DMOCK_CHECK_LOCALE_HAVE_EN_US',
   ],
-  dependencies : [glib, json_glib],
+  dependencies : [glib, gio_unix, libglnx_dep, json_glib],
   include_directories : project_include_dirs,
   install: true,
   install_dir : tests_dir
@@ -196,7 +196,7 @@ executable(
     '-DMOCK_CHECK_LOCALE_HAVE_EN_US',
     '-DMOCK_CHECK_LOCALE_LEGACY',
   ],
-  dependencies : [glib, json_glib],
+  dependencies : [glib, gio_unix, libglnx_dep, json_glib],
   include_directories : project_include_dirs,
   install: true,
   install_dir : tests_dir
@@ -208,7 +208,7 @@ executable(
   'mock-unamerican-check-locale',
   join_paths('..', 'helpers', 'check-locale.c'),
   c_args : ['-DMOCK_CHECK_LOCALE', '-DMOCK_CHECK_LOCALE_HAVE_C_UTF8'],
-  dependencies : [glib, json_glib],
+  dependencies : [glib, gio_unix, libglnx_dep, json_glib],
   include_directories : project_include_dirs,
   install: true,
   install_dir : tests_dir
diff --git a/tests/mock-container-capsule-capture-libs.c b/tests/mock-container-capsule-capture-libs.c
index 721498875..f6c087723 100644
--- a/tests/mock-container-capsule-capture-libs.c
+++ b/tests/mock-container-capsule-capture-libs.c
@@ -25,7 +25,7 @@
 
 #include <libglnx.h>
 
-#include <steam-runtime-tools/glib-compat.h>
+#include <steam-runtime-tools/glib-backports-internal.h>
 
 #include <errno.h>
 #include <stdio.h>
diff --git a/tests/mock-debian-capsule-capture-libs.c b/tests/mock-debian-capsule-capture-libs.c
index 03113e61b..da45ba841 100644
--- a/tests/mock-debian-capsule-capture-libs.c
+++ b/tests/mock-debian-capsule-capture-libs.c
@@ -23,7 +23,7 @@
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
-#include <steam-runtime-tools/glib-compat.h>
+#include <steam-runtime-tools/glib-backports-internal.h>
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/tests/mock-fedora-capsule-capture-libs.c b/tests/mock-fedora-capsule-capture-libs.c
index 4fe83b957..5e97bcaea 100644
--- a/tests/mock-fedora-capsule-capture-libs.c
+++ b/tests/mock-fedora-capsule-capture-libs.c
@@ -23,7 +23,7 @@
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
-#include <steam-runtime-tools/glib-compat.h>
+#include <steam-runtime-tools/glib-backports-internal.h>
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/tests/pressure-vessel/bwrap-lock.c b/tests/pressure-vessel/bwrap-lock.c
index dc64f8c9a..de00281d7 100644
--- a/tests/pressure-vessel/bwrap-lock.c
+++ b/tests/pressure-vessel/bwrap-lock.c
@@ -28,7 +28,7 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
-#include "glib-backports.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 #include "libglnx/libglnx.h"
 
 #include "bwrap-lock.h"
diff --git a/tests/pressure-vessel/cheap-copy.c b/tests/pressure-vessel/cheap-copy.c
index f9fc6b3d2..511d65c84 100644
--- a/tests/pressure-vessel/cheap-copy.c
+++ b/tests/pressure-vessel/cheap-copy.c
@@ -25,7 +25,7 @@
 
 #include "libglnx/libglnx.h"
 
-#include "glib-backports.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 #include "tree-copy.h"
 #include "utils.h"
 
diff --git a/tests/pressure-vessel/elf-get-soname.c b/tests/pressure-vessel/elf-get-soname.c
index 218623ed8..c7dff8579 100644
--- a/tests/pressure-vessel/elf-get-soname.c
+++ b/tests/pressure-vessel/elf-get-soname.c
@@ -25,7 +25,7 @@
 
 #include "libglnx/libglnx.h"
 
-#include "glib-backports.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 
 #include "elf-utils.h"
 #include "utils.h"
diff --git a/tests/pressure-vessel/helper.c b/tests/pressure-vessel/helper.c
index fa4264551..63ff8b58a 100644
--- a/tests/pressure-vessel/helper.c
+++ b/tests/pressure-vessel/helper.c
@@ -29,7 +29,7 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
-#include "glib-backports.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 #include "libglnx/libglnx.h"
 
 #include "utils.h"
diff --git a/tests/pressure-vessel/resolve-in-sysroot.c b/tests/pressure-vessel/resolve-in-sysroot.c
index f2af8354e..df57deab1 100644
--- a/tests/pressure-vessel/resolve-in-sysroot.c
+++ b/tests/pressure-vessel/resolve-in-sysroot.c
@@ -29,7 +29,7 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
-#include "glib-backports.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 #include "libglnx/libglnx.h"
 
 #include "resolve-in-sysroot.h"
diff --git a/tests/pressure-vessel/utils.c b/tests/pressure-vessel/utils.c
index 1625efb5a..5b396fa89 100644
--- a/tests/pressure-vessel/utils.c
+++ b/tests/pressure-vessel/utils.c
@@ -29,7 +29,7 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
-#include "glib-backports.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 #include "libglnx/libglnx.h"
 
 #include "tests/test-utils.h"
diff --git a/tests/pressure-vessel/wait-for-child-processes.c b/tests/pressure-vessel/wait-for-child-processes.c
index edd3d0307..8faf8e798 100644
--- a/tests/pressure-vessel/wait-for-child-processes.c
+++ b/tests/pressure-vessel/wait-for-child-processes.c
@@ -32,7 +32,7 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
-#include "glib-backports.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 #include "libglnx/libglnx.h"
 
 #include "tests/test-utils.h"
diff --git a/tests/system-info-cli.c b/tests/system-info-cli.c
index 34d06fabb..b3d6e71fc 100644
--- a/tests/system-info-cli.c
+++ b/tests/system-info-cli.c
@@ -27,7 +27,7 @@
 
 #include <steam-runtime-tools/steam-runtime-tools.h>
 
-#include <steam-runtime-tools/glib-compat.h>
+#include <steam-runtime-tools/glib-backports-internal.h>
 #include <steam-runtime-tools/json-glib-compat.h>
 
 #include <glib.h>
diff --git a/tests/system-info.c b/tests/system-info.c
index 5b11cdd10..9ba94ba51 100644
--- a/tests/system-info.c
+++ b/tests/system-info.c
@@ -28,7 +28,7 @@
 #include <steam-runtime-tools/steam-runtime-tools.h>
 #include "steam-runtime-tools/utils-internal.h"
 
-#include <steam-runtime-tools/glib-compat.h>
+#include <steam-runtime-tools/glib-backports-internal.h>
 
 #include <glib.h>
 #include <glib/gstdio.h>
diff --git a/tests/test-utils.c b/tests/test-utils.c
index 64f6bc8c9..7d8836d2e 100644
--- a/tests/test-utils.c
+++ b/tests/test-utils.c
@@ -30,7 +30,7 @@
 
 #include "libglnx/libglnx.h"
 
-#include "steam-runtime-tools/glib-compat.h"
+#include "steam-runtime-tools/glib-backports-internal.h"
 #include <steam-runtime-tools/steam-runtime-tools.h>
 #include "steam-runtime-tools/utils-internal.h"
 
-- 
GitLab