summaryrefslogtreecommitdiff
path: root/app-emulation/steam/files/redcore-steam
blob: c73ad8c20a7516e8b9e2bcb53e24242715cad608 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env bash

# steam-runtime is a somewhat a mess bundled with old libraries
# due to this reason, system native graphic drivers may not load
#
# if we remove some bundled libs and preload some system libs
# system native graphic drivers will be able to load
#
# however we must do this everytime when we launch steam, because
# steam-runtime is being fixed right away by steam client


source /lib/gentoo/functions.sh

do_remove () {
	einfo "Removing bundled libraries (libxcb, libstdc++, libgcc_s)"
	find /home/$USER/.local/share/Steam -name 'libxcb*' -type f | grep -v installed | xargs rm -rf
	find /home/$USER/.local/share/Steam -name 'libstdc++.so.6*' -type f | grep -v installed | xargs rm -rf
	find /home/$USER/.local/share/Steam -name 'libgcc_s*' -type f | grep -v installed | xargs rm -rf
}

do_preload () {
	einfo "Preloading system libraries (libstdc++, libgcc_s)"
	export LD_PRELOAD='/usr/lib32/gcc/x86_64-pc-linux-gnu/8.2.0/32/libstdc++.so.6 /usr/lib32/gcc/x86_64-pc-linux-gnu/8.2.0/32/libgcc_s.so.1 /usr/lib64/gcc/x86_64-pc-linux-gnu/8.2.0/libgcc_s.so.1 /usr/lib64/gcc/x86_64-pc-linux-gnu/8.2.0/32/libstdc++.so.6'
}

do_nvidia () {
	if [[ "$(lsmod|grep nvidia)" ]] ; then
		einfo "Preloading nvidia libraries"
		export LD_LIBRARY_PATH='$LD_LIBRARY_PATH:/usr/lib32/opengl/nvidia/lib:/usr/lib64/opengl/nvidia/lib'
		export __GLVND_DISALLOW_PATCHING=1
	fi
}

launch_steam () {
	do_remove
	do_preload
	do_nvidia
	export DISPLAY=:0
	steam
}

launch_steam