Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
steam-runtime-tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
steamrt
steam-runtime-tools
Commits
dd7c036c
Commit
dd7c036c
authored
4 years ago
by
Simon McVittie
Browse files
Options
Downloads
Plain Diff
Merge branch 'wip/search_cwd' into 'master'
pressure-vessel: respect STEAM_COMPAT_FLAGS=search-cwd Closes
#46
See merge request
!206
parents
31a4a520
f32f230a
No related branches found
No related tags found
1 merge request
!206
pressure-vessel: respect STEAM_COMPAT_FLAGS=search-cwd
Pipeline
#9716
failed
4 years ago
Stage: build
Stage: relocatable-install
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pressure-vessel/runtime.c
+11
-0
11 additions, 0 deletions
pressure-vessel/runtime.c
pressure-vessel/runtime.h
+3
-0
3 additions, 0 deletions
pressure-vessel/runtime.h
pressure-vessel/wrap.c
+40
-0
40 additions, 0 deletions
pressure-vessel/wrap.c
with
54 additions
and
0 deletions
pressure-vessel/runtime.c
+
11
−
0
View file @
dd7c036c
...
...
@@ -4665,6 +4665,17 @@ pv_runtime_set_search_paths (PvRuntime *self,
pv_search_path_append
(
ld_library_path
,
ld_path
);
}
if
(
self
->
flags
&
PV_RUNTIME_FLAGS_SEARCH_CWD
)
{
const
gchar
*
install_path
=
g_environ_getenv
(
self
->
original_environ
,
"STEAM_COMPAT_INSTALL_PATH"
);
if
(
install_path
!=
NULL
)
pv_search_path_append
(
ld_library_path
,
install_path
);
else
g_debug
(
"The environment variable
\"
STEAM_COMPAT_INSTALL_PATH
\"
is not set, "
"we can't append the game install path to LD_LIBRARY_PATH."
);
}
/* If the runtime is Debian-based, make sure we search where ncurses-base
* puts terminfo, even if we're using a non-Debian-based libtinfo.so.6. */
terminfo_path
=
g_build_filename
(
self
->
source_files
,
"lib"
,
"terminfo"
,
...
...
This diff is collapsed.
Click to expand it.
pressure-vessel/runtime.h
+
3
−
0
View file @
dd7c036c
...
...
@@ -42,6 +42,7 @@
* @PV_RUNTIME_FLAGS_UNPACK_ARCHIVE: Source is an archive, not a deployment
* @PV_RUNTIME_FLAGS_FLATPAK_SUBSANDBOX: The runtime will be used in a
* Flatpak subsandbox
* @PV_RUNTIME_FLAGS_SEARCH_CWD: Append the game install path to LD_LIBRARY_PATH
* @PV_RUNTIME_FLAGS_NONE: None of the above
*
* Flags affecting how we set up the runtime.
...
...
@@ -56,6 +57,7 @@ typedef enum
PV_RUNTIME_FLAGS_COPY_RUNTIME
=
(
1
<<
5
),
PV_RUNTIME_FLAGS_UNPACK_ARCHIVE
=
(
1
<<
6
),
PV_RUNTIME_FLAGS_FLATPAK_SUBSANDBOX
=
(
1
<<
7
),
PV_RUNTIME_FLAGS_SEARCH_CWD
=
(
1
<<
8
),
PV_RUNTIME_FLAGS_NONE
=
0
}
PvRuntimeFlags
;
...
...
@@ -68,6 +70,7 @@ typedef enum
| PV_RUNTIME_FLAGS_COPY_RUNTIME \
| PV_RUNTIME_FLAGS_UNPACK_ARCHIVE \
| PV_RUNTIME_FLAGS_FLATPAK_SUBSANDBOX \
| PV_RUNTIME_FLAGS_SEARCH_CWD \
)
typedef
struct
_PvRuntime
PvRuntime
;
...
...
This diff is collapsed.
Click to expand it.
pressure-vessel/wrap.c
+
40
−
0
View file @
dd7c036c
...
...
@@ -723,6 +723,18 @@ append_preload_module (const char *variable,
return
TRUE
;
}
/*
* check_main_program:
*
* Return %TRUE if the command to execute is the main program.
*/
static
gboolean
check_main_program
(
int
argc
,
char
*
argv
[])
{
return
g_getenv
(
"SteamAppId"
)
!=
NULL
;
}
static
gboolean
opt_host_ld_preload_cb
(
const
gchar
*
option_name
,
const
gchar
*
value
,
...
...
@@ -1277,6 +1289,8 @@ main (int argc,
g_auto
(
GStrv
)
original_environ
=
NULL
;
int
original_argc
=
argc
;
gboolean
is_flatpak_env
=
g_file_test
(
"/.flatpak-info"
,
G_FILE_TEST_IS_REGULAR
);
gboolean
is_main_program
;
gboolean
search_cwd
=
FALSE
;
g_autoptr
(
FlatpakBwrap
)
flatpak_subsandbox
=
NULL
;
g_autoptr
(
FlatpakBwrap
)
flatpak_run_on_host
=
NULL
;
g_autoptr
(
PvEnviron
)
container_env
=
NULL
;
...
...
@@ -1291,6 +1305,7 @@ main (int argc,
g_autofree
gchar
*
cwd_l
=
NULL
;
g_autofree
gchar
*
cwd_p_host
=
NULL
;
const
gchar
*
home
;
const
gchar
*
steam_compat_flags
;
g_autofree
gchar
*
tools_dir
=
NULL
;
g_autoptr
(
PvRuntime
)
runtime
=
NULL
;
g_autoptr
(
FILE
)
original_stdout
=
NULL
;
...
...
@@ -1326,6 +1341,8 @@ main (int argc,
if
(
is_flatpak_env
)
opt_copy_runtime
=
TRUE
;
is_main_program
=
check_main_program
(
argc
,
argv
);
/* Set defaults */
opt_batch
=
pv_boolean_environment
(
"PRESSURE_VESSEL_BATCH"
,
FALSE
);
/* Process COPY_RUNTIME_INFO first so that COPY_RUNTIME and VARIABLE_DIR
...
...
@@ -1881,6 +1898,23 @@ main (int argc,
}
}
steam_compat_flags
=
g_getenv
(
"STEAM_COMPAT_FLAGS"
);
if
(
steam_compat_flags
!=
NULL
)
{
g_auto
(
GStrv
)
flags
=
g_strsplit
(
steam_compat_flags
,
","
,
-
1
);
for
(
i
=
0
;
flags
[
i
]
!=
NULL
;
i
++
)
{
if
(
g_strcmp0
(
flags
[
i
],
"search-cwd"
)
==
0
)
/* This option is used to append the game install path to
* LD_LIBRARY_PATH for legacy purposes, to cope with games that
* relied on the old behaviour of LD_LIBRARY_PATH of ending with
* a colon, which ld.so interprets as the current working directory. */
search_cwd
=
TRUE
;
else
g_info
(
"STEAM_COMPAT_FLAGS has the unexpected flag
\"
%s
\"
"
,
flags
[
i
]);
}
}
if
(
opt_runtime
!=
NULL
||
opt_runtime_archive
!=
NULL
)
{
PvRuntimeFlags
flags
=
PV_RUNTIME_FLAGS_NONE
;
...
...
@@ -1908,6 +1942,12 @@ main (int argc,
if
(
flatpak_subsandbox
!=
NULL
)
flags
|=
PV_RUNTIME_FLAGS_FLATPAK_SUBSANDBOX
;
/* Only if we are running the main program, append the working directory
* of the game to LD_LIBRARY_PATH. This option is not intended for the
* setup phase. */
if
(
search_cwd
&&
is_main_program
)
flags
|=
PV_RUNTIME_FLAGS_SEARCH_CWD
;
if
(
opt_runtime
!=
NULL
)
{
/* already checked for mutually exclusive options */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment