From 262ca8a664e234aa49265de29c15379e23876f62 Mon Sep 17 00:00:00 2001 From: Simon McVittie <smcv@collabora.com> Date: Fri, 8 Nov 2019 11:42:30 +0000 Subject: [PATCH] system-info: Find steamrt expectations relative to libsrt If steam-runtime-system-info is run from an unpacked LD_LIBRARY_PATH Steam Runtime, we want it to find that runtime's library expectations. In particular, when using "steam-native" on Arch Linux, we want to diagnose whether the system-wide libraries provided by Arch Linux are compatible with the ones from the real Steam Runtime. Signed-off-by: Simon McVittie <smcv@collabora.com> --- steam-runtime-tools/system-info.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/steam-runtime-tools/system-info.c b/steam-runtime-tools/system-info.c index ae2144d21..603f6a741 100644 --- a/steam-runtime-tools/system-info.c +++ b/steam-runtime-tools/system-info.c @@ -581,6 +581,9 @@ get_environ (SrtSystemInfo *self) return environ; } +/* Path components from ${prefix} to steamrt expectations */ +#define STEAMRT_EXPECTATIONS "lib", "steamrt", "expectations" + static gboolean ensure_expectations (SrtSystemInfo *self) { @@ -589,16 +592,26 @@ ensure_expectations (SrtSystemInfo *self) if (self->expectations == NULL) { const char *runtime; - const char *sysroot = "/"; - gchar *def; + gchar *def = NULL; runtime = g_environ_getenv (get_environ (self), "STEAM_RUNTIME"); if (runtime != NULL && runtime[0] == '/') - sysroot = runtime; + { + def = g_build_filename (runtime, "usr", STEAMRT_EXPECTATIONS, + NULL); + } + + if (def == NULL) + { + runtime = _srt_find_myself (NULL, NULL); + + if (runtime != NULL) + def = g_build_filename (runtime, STEAMRT_EXPECTATIONS, NULL); + } - def = g_build_filename (sysroot, "usr", "lib", "steamrt", - "expectations", NULL); + if (def == NULL) + def = g_build_filename ("/usr", STEAMRT_EXPECTATIONS, NULL); if (g_file_test (def, G_FILE_TEST_IS_DIR)) self->expectations = g_steal_pointer (&def); -- GitLab