Skip to content
Snippets Groups Projects
Commit c87c6bda authored by Simon McVittie's avatar Simon McVittie
Browse files

runtime: Add an option to skip generating missing locales


This is one of the slower parts of the whole process, and not all
games (or automated tests) even need it.

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent 230e7940
No related branches found
No related tags found
No related merge requests found
......@@ -437,8 +437,7 @@ pv_runtime_new (const char *source_files,
g_return_val_if_fail (source_files != NULL, NULL);
g_return_val_if_fail (bubblewrap != NULL, NULL);
g_return_val_if_fail (tools_dir != NULL, NULL);
g_return_val_if_fail ((flags & ~(PV_RUNTIME_FLAGS_HOST_GRAPHICS_STACK)) == 0,
NULL);
g_return_val_if_fail ((flags & ~(PV_RUNTIME_FLAGS_MASK)) == 0, NULL);
return g_initable_new (PV_TYPE_RUNTIME,
NULL,
......@@ -1082,7 +1081,8 @@ bind_runtime (PvRuntime *self,
/* This needs to be done after pv_runtime_use_host_graphics_stack()
* has decided whether to bring in the host system's libc. */
ensure_locales (self, self->any_libc_from_host, bwrap);
if (self->flags & PV_RUNTIME_FLAGS_GENERATE_LOCALES)
ensure_locales (self, self->any_libc_from_host, bwrap);
/* These can add data fds to @bwrap, so they must come last - after
* other functions stop using @bwrap as a basis for their own bwrap
......
......@@ -32,6 +32,7 @@
/**
* PvRuntimeFlags:
* @PV_RUNTIME_FLAGS_HOST_GRAPHICS_STACK: Use host system graphics stack
* @PV_RUNTIME_FLAGS_GENERATE_LOCALES: Generate missing locales
* @PV_RUNTIME_FLAGS_NONE: None of the above
*
* Flags affecting how we set up the runtime.
......@@ -39,9 +40,15 @@
typedef enum
{
PV_RUNTIME_FLAGS_HOST_GRAPHICS_STACK = (1 << 0),
PV_RUNTIME_FLAGS_GENERATE_LOCALES = (1 << 1),
PV_RUNTIME_FLAGS_NONE = 0
} PvRuntimeFlags;
#define PV_RUNTIME_FLAGS_MASK \
(PV_RUNTIME_FLAGS_HOST_GRAPHICS_STACK \
| PV_RUNTIME_FLAGS_GENERATE_LOCALES \
)
typedef struct _PvRuntime PvRuntime;
typedef struct _PvRuntimeClass PvRuntimeClass;
......
......@@ -320,6 +320,7 @@ static char **opt_env_if_host = NULL;
static char *opt_fake_home = NULL;
static char *opt_freedesktop_app_id = NULL;
static char *opt_steam_app_id = NULL;
static gboolean opt_generate_locales = TRUE;
static char *opt_home = NULL;
static gboolean opt_host_fallback = FALSE;
static gboolean opt_host_graphics = TRUE;
......@@ -508,6 +509,14 @@ static GOptionEntry options[] =
G_OPTION_FLAG_NONE, G_OPTION_ARG_STRING, &opt_steam_app_id,
"Make --unshare-home use ~/.var/app/com.steampowered.AppN "
"as home directory. [Default: $SteamAppId]", "N" },
{ "generate-locales", '\0',
G_OPTION_FLAG_NONE, G_OPTION_ARG_NONE, &opt_generate_locales,
"If using --runtime, attempt to generate any missing locales. "
"[Default, unless $PRESSURE_VESSEL_GENERATE_LOCALES is 0]",
NULL },
{ "no-generate-locales", '\0',
G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &opt_generate_locales,
"If using --runtime, don't generate any missing locales.", NULL },
{ "home", '\0',
G_OPTION_FLAG_NONE, G_OPTION_ARG_FILENAME, &opt_home,
"Use HOME as home directory. Implies --unshare-home. "
......@@ -725,6 +734,7 @@ main (int argc,
opt_remove_game_overlay = boolean_environment ("PRESSURE_VESSEL_REMOVE_GAME_OVERLAY",
FALSE);
opt_share_home = tristate_environment ("PRESSURE_VESSEL_SHARE_HOME");
opt_generate_locales = boolean_environment ("PRESSURE_VESSEL_GENERATE_LOCALES", TRUE);
opt_host_graphics = boolean_environment ("PRESSURE_VESSEL_HOST_GRAPHICS",
TRUE);
opt_share_pid = boolean_environment ("PRESSURE_VESSEL_SHARE_PID", TRUE);
......@@ -1060,6 +1070,9 @@ main (int argc,
{
PvRuntimeFlags flags = PV_RUNTIME_FLAGS_NONE;
if (opt_generate_locales)
flags |= PV_RUNTIME_FLAGS_GENERATE_LOCALES;
if (opt_host_graphics)
flags |= PV_RUNTIME_FLAGS_HOST_GRAPHICS_STACK;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment