From f294cbc50435d0921657ee3bb2032d099cba6a38 Mon Sep 17 00:00:00 2001 From: Ikey Doherty Date: Fri, 27 May 2016 01:35:08 +0100 Subject: [PATCH] Make Steam binary location configurable Signed-off-by: Ikey Doherty --- configure.ac | 9 +++++++++ src/shim/shim.c | 13 ++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 32ea0d2..6981b95 100644 --- a/configure.ac +++ b/configure.ac @@ -27,6 +27,14 @@ else use_new_abi="no" fi +# Shadow location of real Steam +AC_ARG_WITH([real-steam-binary], AS_HELP_STRING([--with-real-steam-binary], + [the real Steam binary to use]), [steambin=${withval}], + [steambin="$libdir/steam/steam"]) + +AC_SUBST(steambin) +AC_DEFINE_UNQUOTED(STEAM_BINARY, "$steambin", + [The location of the real Steam binary]) AC_OUTPUT AC_MSG_RESULT([ @@ -41,6 +49,7 @@ AC_MSG_RESULT([ datarootdir: ${datarootdir} New C++ ABI: ${use_new_abi} + Real Steam binary: ${steambin} compiler: ${CC} cflags: ${CFLAGS} diff --git a/src/shim/shim.c b/src/shim/shim.c index 251e1f9..1b8ef87 100644 --- a/src/shim/shim.c +++ b/src/shim/shim.c @@ -11,17 +11,18 @@ #define _GNU_SOURCE +#include #include #include #include #include +#include "config.h" #include "lsi.h" /** * Temporary. */ -#define STEAM_BIN "/usr/bin/steam" #define EMUL32BIN "/usr/bin/linux32" int main(int argc, char **argv) @@ -58,12 +59,12 @@ int main(int argc, char **argv) if (config.force_32 && is_x86_64) { exec_command = EMUL32BIN; n_argv[0] = EMUL32BIN; - n_argv[1] = STEAM_BIN; + n_argv[1] = STEAM_BINARY; off = 1; } else { - /* Directly call STEAM_BIN */ - exec_command = STEAM_BIN; - n_argv[0] = STEAM_BIN; + /* Directly call STEAM_BINARY */ + exec_command = STEAM_BINARY; + n_argv[0] = STEAM_BINARY; } /* Point arguments to arguments passed to us */ @@ -74,6 +75,8 @@ int main(int argc, char **argv) /* Go execute steam. */ if (execv(exec_command, (char **)n_argv) < 0) { + /* TODO: Use Zenity when we have a UI */ + fprintf(stderr, "Failed to launch Steam: %s [%s]\n", strerror(errno), STEAM_BINARY); return EXIT_FAILURE; } }