mirror of
https://github.com/swaywm/sway.git
synced 2024-11-22 07:51:28 +00:00
Add support for installing binaries with DT_RPATH
It's better to use DT_RPATH dynamic section of the elf binary to store the paths of libraries to load instead of overwriting LD_LIBRARY_PATH for the whole environment, causing surprises. This solution is much more transparent and perfectly suitable for running contained installations of wayland/wlroots/sway. The code unsetting the LD_LIBRARY_PATH/LD_PRELOAD was also deleted as it's a placebo security at best - we should trust the execution path that leads us to running sway, and it's way too late to care about those variables since we already started executing our compositor, thus we would be compromised anyway.
This commit is contained in:
parent
f1dbdce0b2
commit
eed0bc3ebd
11
meson.build
11
meson.build
|
@ -128,7 +128,16 @@ else
|
||||||
endif
|
endif
|
||||||
add_project_arguments('-DSWAY_VERSION=@0@'.format(version), language: 'c')
|
add_project_arguments('-DSWAY_VERSION=@0@'.format(version), language: 'c')
|
||||||
|
|
||||||
add_project_arguments('-D_LD_LIBRARY_PATH="@0@"'.format(get_option('ld-library-path')), language: 'c')
|
if get_option('use_rpath')
|
||||||
|
if get_option('custom_rpath') == ''
|
||||||
|
# default to platform specific libdir, one level up from the binary
|
||||||
|
rpathdir = join_paths('$ORIGIN', '..', '$LIB')
|
||||||
|
else
|
||||||
|
rpathdir = get_option('custom_rpath')
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
rpathdir = ''
|
||||||
|
endif
|
||||||
|
|
||||||
sway_inc = include_directories('include')
|
sway_inc = include_directories('include')
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
option('sway-version', type : 'string', description: 'The version string reported in `sway --version`.')
|
option('sway-version', type : 'string', description: 'The version string reported in `sway --version`.')
|
||||||
option('ld-library-path', type: 'string', value: '', description: 'The LD_LIBRARY_PATH environment variable.')
|
option('use_rpath', type: 'boolean', value: false, description: 'install binaries with rpath set')
|
||||||
|
option('custom_rpath', type: 'string', value: '', description: 'override rpath with a custom one')
|
||||||
option('default-wallpaper', type: 'boolean', value: true, description: 'Install the default wallpaper.')
|
option('default-wallpaper', type: 'boolean', value: true, description: 'Install the default wallpaper.')
|
||||||
option('zsh-completions', type: 'boolean', value: true, description: 'Install zsh shell completions.')
|
option('zsh-completions', type: 'boolean', value: true, description: 'Install zsh shell completions.')
|
||||||
option('bash-completions', type: 'boolean', value: true, description: 'Install bash shell completions.')
|
option('bash-completions', type: 'boolean', value: true, description: 'Install bash shell completions.')
|
||||||
|
|
|
@ -241,14 +241,6 @@ int main(int argc, char **argv) {
|
||||||
" --get-socketpath Gets the IPC socket path and prints it, then exits.\n"
|
" --get-socketpath Gets the IPC socket path and prints it, then exits.\n"
|
||||||
"\n";
|
"\n";
|
||||||
|
|
||||||
// Security:
|
|
||||||
unsetenv("LD_PRELOAD");
|
|
||||||
#ifdef _LD_LIBRARY_PATH
|
|
||||||
setenv("LD_LIBRARY_PATH", _LD_LIBRARY_PATH, 1);
|
|
||||||
#else
|
|
||||||
unsetenv("LD_LIBRARY_PATH");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int c;
|
int c;
|
||||||
while (1) {
|
while (1) {
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
|
|
|
@ -187,5 +187,6 @@ executable(
|
||||||
include_directories: [sway_inc],
|
include_directories: [sway_inc],
|
||||||
dependencies: sway_deps,
|
dependencies: sway_deps,
|
||||||
link_with: [lib_sway_common],
|
link_with: [lib_sway_common],
|
||||||
|
install_rpath : rpathdir,
|
||||||
install: true
|
install: true
|
||||||
)
|
)
|
||||||
|
|
|
@ -24,5 +24,6 @@ executable(
|
||||||
wlroots,
|
wlroots,
|
||||||
],
|
],
|
||||||
link_with: [lib_sway_common, lib_sway_client],
|
link_with: [lib_sway_common, lib_sway_client],
|
||||||
|
install_rpath : rpathdir,
|
||||||
install: true
|
install: true
|
||||||
)
|
)
|
||||||
|
|
|
@ -14,5 +14,6 @@ executable(
|
||||||
wlroots,
|
wlroots,
|
||||||
],
|
],
|
||||||
link_with: [lib_sway_common, lib_sway_client],
|
link_with: [lib_sway_common, lib_sway_client],
|
||||||
|
install_rpath : rpathdir,
|
||||||
install: true
|
install: true
|
||||||
)
|
)
|
||||||
|
|
|
@ -14,5 +14,6 @@ executable(
|
||||||
swayidle_deps,
|
swayidle_deps,
|
||||||
],
|
],
|
||||||
link_with: [lib_sway_common, lib_sway_client],
|
link_with: [lib_sway_common, lib_sway_client],
|
||||||
|
install_rpath : rpathdir,
|
||||||
install: true
|
install: true
|
||||||
)
|
)
|
||||||
|
|
|
@ -33,6 +33,7 @@ executable('swaylock',
|
||||||
include_directories: [sway_inc],
|
include_directories: [sway_inc],
|
||||||
dependencies: dependencies,
|
dependencies: dependencies,
|
||||||
link_with: [lib_sway_common, lib_sway_client],
|
link_with: [lib_sway_common, lib_sway_client],
|
||||||
|
install_rpath : rpathdir,
|
||||||
install: true
|
install: true
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -4,5 +4,6 @@ executable(
|
||||||
include_directories: [sway_inc],
|
include_directories: [sway_inc],
|
||||||
dependencies: [jsonc, wlroots],
|
dependencies: [jsonc, wlroots],
|
||||||
link_with: [lib_sway_common],
|
link_with: [lib_sway_common],
|
||||||
|
install_rpath : rpathdir,
|
||||||
install: true
|
install: true
|
||||||
)
|
)
|
||||||
|
|
|
@ -19,5 +19,6 @@ executable(
|
||||||
wlroots,
|
wlroots,
|
||||||
],
|
],
|
||||||
link_with: [lib_sway_common, lib_sway_client],
|
link_with: [lib_sway_common, lib_sway_client],
|
||||||
|
install_rpath : rpathdir,
|
||||||
install: true
|
install: true
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue