Skip to content
Snippets Groups Projects
Commit 3b55d6a2 authored by Ludovico de Nittis's avatar Ludovico de Nittis
Browse files

runtime: Use "/usr/share" as a fallback lib data directory


If the host system stores the shared libraries in a directory that is
not what we expect, we try as a last resort `/usr/share`, in an effort
to increase the number of OSs that we are able to cover.

For example this should help Exherbo to find the right libdrm and
drirc.d directories.

Fixes: #68

Signed-off-by: default avatarLudovico de Nittis <ludovico.denittis@collabora.com>
parent 89276c9a
No related branches found
No related tags found
1 merge request!272runtime: Use "/usr/share" as a fallback lib data directory
Pipeline #10359 passed
...@@ -3685,6 +3685,13 @@ pv_runtime_collect_lib_data (PvRuntime *self, ...@@ -3685,6 +3685,13 @@ pv_runtime_collect_lib_data (PvRuntime *self,
g_autofree gchar *dir = NULL; g_autofree gchar *dir = NULL;
g_autofree gchar *lib_multiarch = NULL; g_autofree gchar *lib_multiarch = NULL;
g_autofree gchar *dir_in_provider = NULL; g_autofree gchar *dir_in_provider = NULL;
g_autofree gchar *dir_in_provider_fallback = NULL;
/* If we are unable to find the lib data in the provider, we try as
* a last resort `/usr/share`. This should help for example Exherbo
* that uses the unusual `/usr/${gnu_tuple}/lib` path for shared
* libraries. */
dir_in_provider_fallback = g_build_filename ("/usr", "share", dir_basename, NULL);
dir = g_path_get_dirname (target); dir = g_path_get_dirname (target);
...@@ -3713,11 +3720,24 @@ pv_runtime_collect_lib_data (PvRuntime *self, ...@@ -3713,11 +3720,24 @@ pv_runtime_collect_lib_data (PvRuntime *self,
g_hash_table_add (data_in_provider, g_hash_table_add (data_in_provider,
g_steal_pointer (&dir_in_provider)); g_steal_pointer (&dir_in_provider));
} }
else if (_srt_file_test_in_sysroot (self->provider_in_current_namespace,
-1,
dir_in_provider_fallback,
G_FILE_TEST_IS_DIR))
{
g_hash_table_add (data_in_provider,
g_steal_pointer (&dir_in_provider_fallback));
}
else else
{ {
g_info ("We were expecting the %s directory in the provider to " if (g_strcmp0 (dir_in_provider, dir_in_provider_fallback) == 0)
"be located in \"%s/share/%s\", but instead it is " g_info ("We were expecting the %s directory in the provider to "
"missing", dir_basename, dir, dir_basename); "be located in \"%s\", but instead it is missing",
dir_basename, dir_in_provider);
else
g_info ("We were expecting the %s directory in the provider to "
"be located in \"%s\" or \"%s\", but instead it is missing",
dir_basename, dir_in_provider, dir_in_provider_fallback);
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment