summaryrefslogtreecommitdiff
path: root/app-emulation/steam/files/steam-wrapper.sh
blob: 25936107e9e4cf65c2032faf6d94beb251a86e32 (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
#!/bin/bash

# Set a default STEAM_RUNTIME value.
: ${STEAM_RUNTIME:=@@STEAM_RUNTIME@@}
export STEAM_RUNTIME

# Gentoo's lsb-release doesn't set this.
export DISTRIB_RELEASE="@@PVR@@"

# Add paths to occasionally needed libraries not found in /usr/lib.
export LD_LIBRARY_PATH+="${LD_LIBRARY_PATH+:}@@GENTOO_LD_LIBRARY_PATH@@"

# Preload the extest library when running in a Wayland session.
[[ -f "@@GENTOO_X86_LIBDIR@@/libextest.so" && ${XDG_SESSION_TYPE} == wayland ]] &&
	export LD_PRELOAD+="${LD_PRELOAD+:}@@GENTOO_X86_LIBDIR@@/libextest.so"

# Preload libstdc++ on default-libcxx systems to avoid crashes. Loading the
# 64-bit library prevents Steam from working at all, so only load the 32-bit
# multlib library. Pure 32-bit systems are untested and may not work.
if grep -Fxqe --stdlib=libc++ /etc/clang/gentoo-runtimes.cfg 2>/dev/null; then
	IFS=:
	for GCC_LIB_DIR in $(gcc-config -L 2>/dev/null); do
		[[ ${GCC_LIB_DIR} == */32 ]] || continue
		export LD_PRELOAD+="${LD_PRELOAD+:}${GCC_LIB_DIR}/libstdc++.so"
	done
	unset IFS GCC_LIB_DIR
fi

# Steam renames LD_LIBRARY_PATH to SYSTEM_LD_LIBRARY_PATH and it then becomes
# ineffective against games. We unfortunately therefore have to force the value
# through via STEAM_RUNTIME_LIBRARY_PATH instead.
export STEAM_RUNTIME_LIBRARY_PATH="${LD_LIBRARY_PATH}"

. "${0%/*}"/../lib/steam/bin_steam.sh