diff --git a/games-util/steam-launcher/Manifest b/games-util/steam-launcher/Manifest index 300374786..eeede50a8 100644 --- a/games-util/steam-launcher/Manifest +++ b/games-util/steam-launcher/Manifest @@ -1 +1,2 @@ DIST steam_1.0.0.56.tar.gz 2899122 BLAKE2B a4955975b36d7916d634cd076356f61a90751bdda07aa87ea79ea2237c0b17b1377685f3d6ff41ad82e3921580dc4f3524fbfe45e5918a52c146ea4bd5393c5f SHA512 17fdd26b829a5860520d955326af88ebacda18183fbf9a70cbb38a9c593cc6c3e85237ec0be598e80a3e1d2bc4354a4933e372321ce0b8716ac481cfb3d7a5e0 +DIST steam_1.0.0.59.tar.gz 2899959 BLAKE2B e213cdd417b795f90b9ff6081a3b43b058068ba153b0fad8658d648d6ba8840a644956a666955a99dae2c3eae490059522053fd85a20046b95fd4c22d04255fa SHA512 c5cbe0849b93076bf375de86c78c351af5841163825f2581d54ef98d2501f002d35b18c93b95dba1a7c65444a137bdd5e30f63ca0e72ae6ad526b11a50018276 diff --git a/games-util/steam-launcher/files/libsteam-preload.c b/games-util/steam-launcher/files/libsteam-preload.c new file mode 100644 index 000000000..aeb621595 --- /dev/null +++ b/games-util/steam-launcher/files/libsteam-preload.c @@ -0,0 +1,69 @@ +/* Copyright 1999-2019 Gentoo Authors */ +/* Distributed under the terms of the GNU General Public License v2 */ + +#define _GNU_SOURCE + +#include +#include +#include +#include +#include + +#define STEAM_PRELOAD_QUOTE(name) #name +#define STEAM_PRELOAD_STR(macro) STEAM_PRELOAD_QUOTE(macro) +#define GLIBDIR_STR STEAM_PRELOAD_STR(GLIBDIR) + +int (*execve_real)(const char *filename, char *const argv[], char *const envp[]) = NULL; + +int execve(const char *filename, char *const argv[], char *const envp[]) { + if (execve_real == NULL) { + execve_real = dlsym(RTLD_NEXT, "execve"); + } + + if (strcmp(filename, "./steamwebhelper") == 0) { + fputs("Gentoo caught steamwebhelper invocation\n", stderr); + + unsigned int i; + for (i = 0; envp[i] != NULL; i++); + char **envp2 = malloc(sizeof(char*) * i); + + if (envp2 == NULL) { + errno = ENOMEM; + return -1; + } + + int ret; + char *llp = NULL; + + for (i = 0; envp[i] != NULL; i++) { + if (strncmp(envp[i], "LD_LIBRARY_PATH=", 16) == 0) { + const char *gl_ldpath = getenv("GL_LDPATH"); + + if (gl_ldpath) { + ret = asprintf(&llp, "LD_LIBRARY_PATH=%s:" GLIBDIR_STR ":%s", gl_ldpath, envp[i] + 16); + } else { + ret = asprintf(&llp, "LD_LIBRARY_PATH=" GLIBDIR_STR ":%s", envp[i] + 16); + } + + if (ret < 0) { + free(envp2); + errno = ENOMEM; + return -1; + } + + fprintf(stderr, "Gentoo reinvoking steamwebhelper with %s\n", llp); + envp2[i] = llp; + } else { + envp2[i] = envp[i]; + } + } + + envp2[i] = NULL; + ret = execve_real(filename, argv, envp2); + free(envp2); + free(llp); + return ret; + } else { + return execve_real(filename, argv, envp); + } +} diff --git a/games-util/steam-launcher/files/steam-libraries.patch b/games-util/steam-launcher/files/steam-libraries.patch new file mode 100644 index 000000000..f5bc93829 --- /dev/null +++ b/games-util/steam-launcher/files/steam-libraries.patch @@ -0,0 +1,35 @@ +diff -Naur a/steam b/steam +--- a/steam 2019-03-24 23:05:23.035074609 +0000 ++++ b/steam 2019-03-24 23:15:11.768471262 +0000 +@@ -17,6 +17,31 @@ + # Set up domain for script localization + export TEXTDOMAIN=steam + ++# Add paths to occasionally needed libraries not found in /usr/lib. ++export LD_LIBRARY_PATH+="${LD_LIBRARY_PATH+:}@@GENTOO_LD_LIBRARY_PATH@@" ++ ++# Steam appends /usr/lib32 to LD_LIBRARY_PATH. We need to make sure that ++# OpenGL implementation dir goes before that, so we need to append it to ++# user's LD_LIBRARY_PATH ourselves. But that's needed only with the new ++# eselect-opengl that uses 000opengl file. GL_LDPATH is also used by ++# by Gentoo's execve wrapper. ++if [[ -f /etc/env.d/000opengl ]]; then ++ export GL_LDPATH=$(. /etc/env.d/000opengl >/dev/null; echo "${LDPATH}") ++ ++ # Append only when GL_LDPATH is non-empty -- i.e. using nvidia or ati. ++ if [[ -n ${GL_LDPATH} ]]; then ++ LD_LIBRARY_PATH+=":${GL_LDPATH}" ++ else ++ unset GL_LDPATH ++ fi ++else ++ unset GL_LDPATH ++fi ++ ++# Preload Gentoo's execve wrapper so that steamwebhelper prefers system ++# libraries over older bundled libraries. ++[[ ${STEAM_RUNTIME} = 0 ]] && export LD_PRELOAD+="${LD_PRELOAD+:}@@GENTOO_LD_PRELOAD@@" ++ + function show_message() + { + style=$1 diff --git a/games-util/steam-launcher/steam-launcher-1.0.0.59.ebuild b/games-util/steam-launcher/steam-launcher-1.0.0.59.ebuild new file mode 100644 index 000000000..90c88a133 --- /dev/null +++ b/games-util/steam-launcher/steam-launcher-1.0.0.59.ebuild @@ -0,0 +1,178 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +# Please report bugs/suggestions on: https://github.com/anyc/steam-overlay +# or come to #gentoo-gamerlay in freenode IRC + +inherit desktop linux-info prefix toolchain-funcs udev xdg-utils + +DESCRIPTION="Installer, launcher and supplementary files for Valve's Steam client" +HOMEPAGE="http://steampowered.com" +SRC_URI="http://repo.steampowered.com/steam/pool/steam/s/steam/steam_${PV}.tar.gz" + +KEYWORDS="amd64 x86" +LICENSE="ValveSteamLicense" + +RESTRICT="bindist mirror" +SLOT="0" +IUSE="+steamruntime" + +RDEPEND=" + app-arch/tar + app-shells/bash + net-misc/curl + || ( + >=gnome-extra/zenity-3 + x11-terms/xterm + ) + + steamruntime? ( + virtual/opengl[abi_x86_32] + x11-libs/libX11[abi_x86_32] + x11-libs/libXau[abi_x86_32] + x11-libs/libxcb[abi_x86_32] + x11-libs/libXdmcp[abi_x86_32] + ) + !steamruntime? ( + >=games-util/steam-client-meta-0-r20190331[steamruntime?] + ) + + amd64? ( + >=sys-devel/gcc-4.6.0[multilib] + >=sys-libs/glibc-2.15[multilib] + ) + x86? ( + >=sys-devel/gcc-4.6.0 + >=sys-libs/glibc-2.15 + )" + +S=${WORKDIR}/steam/ + +PATCHES=( + "${FILESDIR}"/steam-runtime-default.patch + "${FILESDIR}"/steam-set-distrib-release.patch + "${FILESDIR}"/steam-fix-joystick-detection.patch + "${FILESDIR}"/steam-libraries.patch +) + +pkg_setup() { + linux-info_pkg_setup + + if ! { linux_config_exists && linux_chkconfig_present INPUT_UINPUT; }; then + ewarn "If you want to use the Steam controller, please make sure" + ewarn "CONFIG_INPUT_UINPUT is enabled in your kernel config." + + # Device Drivers + # -> Input device support + # -> Miscellaneous devices + # -> User level driver support + fi +} + +path_entries() { + local multilib=${1} + shift + + while true; do + echo -n ${EPREFIX}/usr/$(get_libdir)/${1}$(${multilib} && use amd64 && echo :${EPREFIX}/usr/$(ABI=x86 get_libdir)/${1}) + shift + + if [[ -n ${1} ]]; then + echo -n : + else + break + fi + done +} + +native_path_entries() { path_entries false "${@}"; } +multilib_path_entries() { path_entries true "${@}"; } + +src_prepare() { + xdg_environment_reset + default + + sed -i 's:TAG+="uaccess":\0, TAG+="udev-acl":g' \ + lib/udev/rules.d/60-steam-input.rules || die + + sed -i \ + -e "s#@@GENTOO_LD_LIBRARY_PATH@@#$(multilib_path_entries debiancompat fltk)#g" \ + -e "s#@@GENTOO_LD_PRELOAD@@#$(native_path_entries libsteam-preload.so)#g" \ + -e "s#@@STEAM_RUNTIME@@#$(usex steamruntime 1 0)#g" \ + steam || die + + # use steam launcher version as release number as it is a bit more helpful than the baselayout version + sed -i -e "s,export DISTRIB_RELEASE=\"2.2\",export DISTRIB_RELEASE=\"${PVR}\"," steam || die + + # Still need EPREFIX in the sed replacements above because the + # regular expression used by hprefixify doesn't match there. + hprefixify steam +} + +src_compile() { + $(tc-getCC) ${CFLAGS} ${LDFLAGS} -fPIC -DGLIBDIR="${EPREFIX}/usr/$(get_libdir)" -shared \ + "${FILESDIR}"/libsteam-preload.c -ldl -Wl,-soname=libsteam-preload.so -o libsteam-preload.so || die +} + +src_install() { + dobin steam + dolib.so libsteam-preload.so + + insinto /usr/lib/steam/ + doins bootstraplinux_ubuntu12_32.tar.xz + + udev_dorules lib/udev/rules.d/60-steam-input.rules lib/udev/rules.d/60-steam-vr.rules + + dodoc debian/changelog steam_subscriber_agreement.txt + doman steam.6 + + domenu steam.desktop + + cd icons/ || die + for s in * ; do + doicon -s ${s} ${s}/steam.png + done + + # tgz archive contains no separate pixmap, see #38 + doicon 48/steam_tray_mono.png +} + +pkg_postinst() { + xdg_icon_cache_update + xdg_desktop_database_update + udev_reload + + elog "Execute ${EPREFIX}/usr/bin/steam to download and install the actual" + elog "client into your home folder. After installation, the script" + elog "also starts the client from your home folder." + elog "" + + if use steamruntime; then + ewarn "You enabled the Steam runtime environment. Steam will use bundled" + ewarn "libraries instead of Gentoo's system libraries." + ewarn "" + else + elog "We disable STEAM_RUNTIME in order to ignore bundled libraries" + elog "and use installed system libraries instead. If you have problems," + elog "try starting Steam with: STEAM_RUNTIME=1 steam" + ewarn "" + ewarn "Notice: Valve only supports Steam with the runtime enabled!" + ewarn "" + fi + + if ! has_version "gnome-extra/zenity"; then + ewarn "Valve does not provide a xterm fallback for all calls of zenity." + ewarn "Please install gnome-extra/zenity for full support." + ewarn "" + fi + + ewarn "The Steam client and the games are _not_ controlled by Portage." + ewarn "Updates are handled by the client itself." +} + +pkg_postrm() { + xdg_icon_cache_update + xdg_desktop_database_update +}