73 Commits
Author SHA1 Message Date
Ikey Doherty d1b7a86867 Bump version to 0.4.1
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-11 16:19:59 +01:00
Ikey Doherty 0c252321e3 Document config properly for use-libintercept
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-11 16:18:06 +01:00
Ikey Doherty b9d677dee1 Let the fine folks know where they can get LSI
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-11 16:02:33 +01:00
Ikey Doherty 86fbf11040 Merge pull request #12 from alunux/master
Use `value` instead `default` keyword in with-shim build option
2017-10-11 14:30:42 +01:00
La Ode Muh. Fadlun Akbar ec67c801ad meson_options: Use value instead default keyword in with-shim option 2017-10-11 17:45:01 +07:00
Ikey Doherty 0a02c111a0 Can't go to bed with that looking me in the face.
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-11 02:57:58 +01:00
Ikey Doherty 48a9bac406 Fix up RST remnants, add some more debugging info
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-11 02:47:37 +01:00
Ikey Doherty 8de8962099 Improve README formatting
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-11 02:42:40 +01:00
Ikey Doherty de9380dc8d Make the README somewhat useful.
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-11 02:40:46 +01:00
Ikey Doherty 9bd423fb34 intercept: Dedupe the list
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-11 01:58:20 +01:00
Ikey Doherty 75d2e9cc45 Restore option for controlling libcxx abi for LD_PRELOAD, fixes steam runtime
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-11 01:28:48 +01:00
Ikey Doherty 7d0acc9891 Add script to magically make a tarball, bump version to 0.4
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-11 00:32:29 +01:00
Ikey Doherty 7bae532d85 Update README with details about the intercept library
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-11 00:23:16 +01:00
Ikey Doherty 4f332c9acf Update mkgobuildy to install directly to the system
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-11 00:16:54 +01:00
Ikey Doherty f2dddd9f88 intercept: Catch the last of the SDL offenders like steamwebhelper
This now ensures steamwebhelper is also using our SDL as it was previously
loading from a relative location. This actually fixes issues on my local
system whereby the steam trailer videos couldn't full screen properly,
now using our own SDL, they can.

Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-11 00:15:52 +01:00
Ikey Doherty 94d5c6d939 intercept: Pretty print stuff
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 23:38:12 +01:00
Ikey Doherty f4564e2ab8 intercept: Be spammy only on demand, and provide relevant information
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 23:33:11 +01:00
Ikey Doherty 8d85cb3bed Fix storage of the use-libintercept setting
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 23:28:40 +01:00
Ikey Doherty fb2e84cb97 frontend: Teach UI how to control the libintercept setting
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 23:23:48 +01:00
Ikey Doherty e1f2783d11 shim: Allow disabling libintercept from config
Note libintercept requires that we use the native runtime, otherwise very
bad things will happen. ™

Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 23:18:11 +01:00
Ikey Doherty 13afbe69c3 lsi: Teach configuration about libintercept toggle
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 23:17:29 +01:00
Ikey Doherty b458346f5a Fix invalid date range for copyright assignment
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 23:12:53 +01:00
Ikey Doherty bf4fcfe533 Fix another trace of autotools
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 23:11:39 +01:00
Ikey Doherty b7ba890433 Start updating README for meson
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 23:10:47 +01:00
Ikey Doherty faa0c3a154 Nuke ancient TODO that knows not of which it speaks
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 23:06:32 +01:00
Ikey Doherty 99e54dd74b Drastically simplify gitignore..
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 23:05:58 +01:00
Ikey Doherty 5d18366a17 Nuke old autotools cruft
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 23:05:30 +01:00
Ikey Doherty 6154f2373c Allow installing .desktop files once more
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 23:03:51 +01:00
Ikey Doherty fe80861f66 frontend: Fix linking once more
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 23:00:12 +01:00
Ikey Doherty 38ec05ce98 Move lsi into new subdir to be reused as static lib
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 22:59:33 +01:00
Ikey Doherty d983f8ebdf Add currently failing build for frontend
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 22:54:51 +01:00
Ikey Doherty 4d3abc5e37 Enable GTK frontend, don't build Shim for 32-bit
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 22:52:45 +01:00
Ikey Doherty 47e50b789f shim: Only set LD_AUDIT if we were built with libintercept enabled
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 22:51:40 +01:00
Ikey Doherty 9905a2bc81 intercept: Allow controlling build of this library
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 22:50:28 +01:00
Ikey Doherty 11e1d8ae5f shim: Build lsi-steam or not at all, depending on meson options
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 22:46:19 +01:00
Ikey Doherty 00e78f705e Only build frontend and look for GTK if its requested
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 22:44:02 +01:00
Ikey Doherty 54c685bb1a Set things up to be configured via meson options
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 22:42:07 +01:00
Ikey Doherty a61e22d677 shim: When using native runtime, load liblsi-intercept in LD_AUDIT
liblsi-intercept has a simple job of stopping Steam from trying to
replace all of the system libraries in a mish-mash approach. Even when
we have STEAM_RUNTIME=0, and even with the advent of the new "prefer host
libraries" system, the internal replacements and pinning system actually
break massively.

To counteract this issue, we use our own rtld-audit implementation when
launching the real Steam, which will severely restrict which libraries the
main Steam binaries are actually allowed to load. This is on a whitelist
basis and ensures that the host libraries will be used where appropriate,
i.e. SDL, X11, etc. This prevents compatibility issues as well as the random
crashes we're now seeing with Steam beta.

Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 22:31:25 +01:00
Ikey Doherty 93b0f82279 Hack stuff up so we can build shim again
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 22:27:54 +01:00
Ikey Doherty d870577a55 intercept: Add missing modelines
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 22:07:15 +01:00
Ikey Doherty fd252e265d Move common helpers to common.h to fix compilation warnings
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 22:07:02 +01:00
Ikey Doherty 3684dfe11e intercept: More unused code
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 22:04:22 +01:00
Ikey Doherty d5b31dbf54 intercept: That guy is unused
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 22:03:43 +01:00
Ikey Doherty f6dcc30d33 shim: Ensure we disable GTK_MODULES (thanks @cybre!)
Same reason as XMODIFIERS - it'll stop Steam starting up properly

Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 21:56:11 +01:00
Ikey Doherty 7a2670f3e1 intercept: Completely clamp down on Steam, allow only Steam's own libs
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 21:54:59 +01:00
Ikey Doherty 61d9296a6c Let's pretend that one didnt happen
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 21:07:36 +01:00
Ikey Doherty f2bbe963b6 Clean up script so LD_AUDIT is a thing again
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 20:52:12 +01:00
Ikey Doherty 4547d8582a One more test to ensure this isnt environment related
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 20:50:50 +01:00
Ikey Doherty 1db376fa38 Turns out fatal is bad always because Steam is bad. Also, preload again
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 20:45:36 +01:00
Ikey Doherty 0bf704fc79 We like segfaults
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 20:44:08 +01:00
Ikey Doherty cf023ffb6a Ensure XMODIFIERS go bye bye
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 20:42:53 +01:00
Ikey Doherty 4b36347ade Remove unused define
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 20:41:51 +01:00
Ikey Doherty d3469e3eb0 intercept: Add quick hack which *should* work
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 20:37:19 +01:00
Ikey Doherty 29081c492d Make build script a bit more robust..
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 20:32:52 +01:00
Ikey Doherty ac76372b84 Add helper script so we can easily test liblsi-intercept
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 20:31:26 +01:00
Ikey Doherty 6b107f33b5 Ensure we can build everything now.
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 20:29:13 +01:00
Ikey Doherty ba8ae8f384 Add mkgobuildy to handle dual builds..
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 20:26:33 +01:00
Ikey Doherty d77ad58934 Remove intercept-emul32 because meson is weak a.f.
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 20:24:47 +01:00
Ikey Doherty 2aae934271 Ensure we can build 32-bit and 64-bit libraries together
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 20:16:11 +01:00
Ikey Doherty 12d5268252 Split emul32 into new dir
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 20:07:59 +01:00
Ikey Doherty 15253b97df Fail massively. But progress.
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 20:06:02 +01:00
Ikey Doherty 8dd27f6f24 intercept: Actually compile..
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 20:02:28 +01:00
Ikey Doherty f21559ee78 Make config.h work again
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 20:01:47 +01:00
Ikey Doherty 5b17fe9447 Start teaching intercept how to build (not complete.)
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 19:56:37 +01:00
Ikey Doherty 9ca7ffdd85 Get two nicas building, native and emul32
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 19:52:06 +01:00
Ikey Doherty 3b552ec17d Begin meson conversion.. Not yet building anything
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 19:46:00 +01:00
Ikey Doherty a3226a293c intercept: Build a static override table
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 19:15:21 +01:00
Ikey Doherty 9c40a9d106 intercept: Account for more processes
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 19:13:06 +01:00
Ikey Doherty 49d68c52a7 intercept: Teach intercept how to override libSDL2
This doesn't actually work properly yet as we need to build dual libraries
for 32-bit and 64-bit to ensure LD_AUDIT is non-fatal.

Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 19:09:30 +01:00
Ikey Doherty d20c230067 Begin basic libintercept design
This is the very start of our adventure into rtld-audit, and effectively
we'll have liblsi-intercept loaded by LD_AUDIT via our Steam LSI shim, and
when we find an interesting process, we'll match that process name and
activate ourselves.

In future, we'll want to blacklist Steam from being able to load duplicated
libraries on the system, i.e. libSDL, to resolve a number of crashes.

Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 18:17:14 +01:00
Ikey Doherty bd4707f3ca Fix nica submodule URI
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-10 14:53:26 +01:00
Ikey Doherty 1a70578cb1 shim: Work around Steam client's SDL regression with XMODIFIERS
The version of SDL shipping with Valve's Steam Client has a regression
that fails to correctly `SDL_InitSubSystem` whenever `XMODIFIERS` is set,
talking to dbus objects with no set address.

Relevant issue: ValveSoftware/steam-for-linux#501

This change will ensure that SDL can initialise correctly on startup,
and no longer make users suffer crashes.

Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-10-09 20:03:08 +01:00
Ikey Doherty 7995688ea2 Convert README to MD, and explain what LSI is, underp formatting
This resolves issue #6

Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2016-12-27 08:00:49 +00:00
26 changed files with 763 additions and 445 deletions
+2 -19
View File
@@ -1,19 +1,2 @@
Makefile
Makefile.in
aclocal.m4
autom4te.cache/
build-aux/
config.*
configure
libtool
stamp-h1
m4/*.m4
.deps
.dirstamp
*.o
*.lo
*.la
.libs
/steam
/lsi-steam
/lsi-settings
/buildroot/
/build/
+1 -1
View File
@@ -1,3 +1,3 @@
[submodule "src/libnica"]
path = src/libnica
url = git@github.com:ikeydoherty/libnica.git
url = git@github.com:intel/libnica.git
-99
View File
@@ -1,99 +0,0 @@
EXTRA_DIST = \
LICENSE.LGPL2.1 \
README.rst \
data/lsi-settings.desktop \
data/lsi-steam.desktop
AM_CFLAGS = \
-fstack-protector -Wall -pedantic \
-Wstrict-prototypes -Wundef -fno-common \
-Werror-implicit-function-declaration \
-Wformat -Wformat-security -Werror=format-security \
-Wno-conversion -Wunused-variable -Wunreachable-code \
-Wall -W -D_FORTIFY_SOURCE=2 -std=c99
AM_CPPFLAGS = \
-I $(top_srcdir)/src \
-I $(top_srcdir)/src/shim \
-I $(top_srcdir)/src/libnica/src/include \
-DSYSTEMCONFDIR=\"$(sysconfdir)\" \
-DVENDORDIR=\"$(datadir)/defaults/linux-steam-integration\"
SUBDIRS = src/libnica
noinst_LTLIBRARIES = \
liblsi.la
bin_PROGRAMS =
desktopdir = $(datadir)/applications
desktop_DATA =
if HAVE_FRONTEND
bin_PROGRAMS += lsi-settings
lsi_settings_SOURCES = \
src/frontend/main.c
lsi_settings_CFLAGS = \
$(GTK_CFLAGS) \
$(AM_CFLAGS) \
-DGDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_4 \
-DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_4
lsi_settings_LDADD = \
liblsi.la \
$(GTK_LIBS)
desktopdir = $(datadir)/applications
desktop_DATA += \
data/lsi-settings.desktop
endif
# Convenience library for shared LSI functions
liblsi_la_SOURCES = \
src/shim/lsi.h \
src/shim/lsi.c
liblsi_la_CFLAGS = \
$(AM_CFLAGS) \
-I$(top_srcdir)/src/libnica/src/include/nica
liblsi_la_LIBADD = \
src/libnica/libnica.la
# Replace the main steam binary with our own steam file
if REPLACE_STEAM
bin_PROGRAMS += steam
steam_SOURCES = \
src/shim/shim.c
steam_LDADD = \
src/libnica/libnica.la \
liblsi.la
steam_CFLAGS = \
$(AM_CFLAGS)
else
# Don't replace steam - use a non conflicting filename
bin_PROGRAMS += lsi-steam
lsi_steam_SOURCES = \
src/shim/shim.c
lsi_steam_LDADD = \
src/libnica/libnica.la \
liblsi.la
lsi_steam_CFLAGS = \
$(AM_CFLAGS)
# Install custom .desktop file for steam
desktop_DATA += \
data/lsi-steam.desktop
endif
+239
View File
@@ -0,0 +1,239 @@
linux-steam-integration
-----------------------
Linux Steam Integration is a software package aimed squarely at Linux distribution developers.
It is designed to offer a far better Steam* experience than the stock client, doing away with old
integration issues and crashes.
### Native Libraries
LSI enforces the use of host-native libraries, both in the Steam Client (via `lsi-intercept`) and
games themselves. This ensures Steam integrates properly, games run with the latest libraries
and users get the best performance.
Currently the officially provided Steam runtime is based on very old Ubuntu 12.04 packages,
and has some cherry-picked updates (SDL, for example). This causes lots of integration issues
on most newer distributions, such as broken client behaviour with full screen videos, outright
crashes on startup, mismatched C++ ABI, missing sound, ugly menus, broken font rendering,
poor performance, etc.
In a nut shell, LSI will force most of Steam over to using native libraries. The intercept
system is new as of 0.4, and will be extended in future to allow improving certain games
on a process-name whitelisting basis.
### Configurable
You can easily toggle the use of the native runtime or the runtime provided with the official
Steam package distribution. LSI doesn't butcher any files, so your local Steam directory does
not need to be repaired or reinstalled. Just run `lsi-settings` and restart Steam.
Currently you can control whether the native runtime is used, force 32-bit mode for some troublesome
ports, and control whether the intercept library is enabled (which will undo the various library
mangling tricks of the Steam distribution to force the usage of the system libs via rtld-audit)
### Portable
You can (and should) stick this into any distro. Hit us up if you need help integrating, or need some
portability changes made. We won't bite.
### Going beyond LSI
LSI solves a great many issues, however there is then still a responsibility for the integrating distribution
to provide basic ABI compatibility, as well as being functionally comparable to the "stock" runtime.
Our future plans will basically involve creating a project based around LSI and a specially produced,
optimised Steam runtime, usable on all Linux distributions.
If you want to be part of that effort - and help bring a modern, optimised gaming experience to your Linux
users, please get in contact. Let's do this once, and do it right.
### We're not them.
This project, and by extension Solus, is not officially endorsed by, or affiliated with, Steam*, or its parent company, Valve*.
Linux Steam Integration is a [Solus project](https://solus-project.com/)
![logo](https://build.solus-project.com/logo.png)
## Getting LSI
LSI may not yet be available for your distribution, however some community maintained repositories do exist.
- [Arch Linux](https://aur.archlinux.org/packages/linux-steam-integration/)
- [Fedora](https://copr.fedorainfracloud.org/coprs/alunux/linux-steam-integration/)
- Solus uses LSI by default, just install the steam package.
## Integrating LSI
To correctly integrate LSI, your Steam package will require modification. LSI must provide the `/usr/bin/steam binary`, so your Steam package must move the main launcher to a shadow location.
For users who do not have access to LSI in their distribution, because it has not been integrated yet, please configure with `-Dwith-shim=co-exist` to preserve your existing Steam integrity. Then use the "LSI Steam" shortcut in your menu to launch Steam via LSI.
**Configuring LSI build**
There are a number of meson configure options you should be aware of when integrating LSI correctly. The prominent ones are explained here.
`-Dwith-shim= none | co-exist | replacement`
Control behaviour of the shim build. `none` will disable building the main
shim, required for actually launching Steam in the first place.
`co-exist` will ensure this does not conflict with the `/usr/bin/steam`
path, providing a new `lsi-steam` binary and desktop file.
`replacement` will provide a drop-in replacement `/usr/bin/steam` binary
shim responsible for bootstrapping Steam via LSI. This will require you
to mask the original steam binary to a new location.
The default value for this option is::
replacement
`-Dwith-steam-binary=$PATH`
Set the absolute path for the shadowed Steam binary.
LSI will execv Steam after it has initialised the environment.
Note that execv, not execvp, is used, to mask programs that may be
in the `$PATH`, hence requiring an absolute path.
The default value for this option is:
/usr/lib/steam/steam
This option is only applicable for distribution integrators, when
Steam replacement is enabled.
`-Dwith-preload-libs=$LIBS`
A colon separated list of libraries that are required to launch Steam
when using its own runtime. LSI enables users to switch back to the Steam
runtime, and in this instance we manage the LD_PRELOAD environmental variable.
Ensure this is correct, and escape $LIB for correct Linux usage.
The default value for this option is:
/usr/\$LIB/libX11.so.6:/usr/\$LIB/libstdc++.so.6
`-Dwith-new-libcxx-abi=$boolean`
Enable this if your distribution uses a recent libstdc++ build, from
GCC 6 or higher.
`-Dwith-frontend=$boolean`
A small UI application is shipped to enable configuration of LSI, which presents
a simple GTK3 Dialog to the user. It is not enabled by default, it is up
to the integrator to decide if they wish to employ lsi-settings, or implement
an alternative.
The lsi-settings application will only ever write new configurations to the
**user** settings file, and requires no special permissions.
The default value for this option is:
false
## How LSI Works
LSI provides a /usr/bin/steam binary to be used in place of the existing Steam script, which will then correctly set up the environment before swapping the process for the Steam process.
When using a full build of LSI, the bootstrap shim will force a correct environment, removing any issues that can cause various older SDL versions to kill Steam. Additionally it will then
force `STEAM_RUNTIME=0` if this is set in the config (default behaviour).
When using the native runtime, and the `intercept` library is enabled, the LSI shim will also set up `LD_AUDIT` to use `liblsi-intercept`. This library will intercept all dynamic linking operations
for the main Steam binaries and override their behaviour, allowing Steam to only load a handful of vendored libraries (`libav` fork) as well as its own private libraries. It is then forced to use
system libraries for everything else. This means the Steam client, web helper, etc, will use the native SDL, X11, fixing many bugs with video playback, font rendering and such.
If you are packaging LSI for a distribution, please ensure you provide both a 32-bit and 64-bit build of the intercept library so that the entirety of Steam's library (`.so`) mechanism is tightly
controlled by LSI. See the scripts in the root directory of this repository for examples of how to do this.
Configuration options can be placed in an INI-style configuration file in a series of locations, which are ordered by priority in a cascade::
~/.config/linux-steam-integration.conf
/etc/linux-steam-integration.conf
/usr/share/defaults/linux-steam-integration/linux-steam-integration.conf
The user configuration takes immediate priority. Secondly we have the system-wide configuration for affecting all accounts, and lastly the vendor configuration, which may be provided by the integrator.
Currently this INI file supports three options. The root section in this INI file must be `[Steam]`.
`use-native-runtime = $boolean`
If set to a true boolean value, (yes/true/on), the host OS's native runtime
will be used instead of the Steam provided runtime. If this is set to
a false boolean value (no/false/off), then the startup will be modified
to export the relevant `LD_PRELOAD` and `STEAM_RUNTIME` settings.
The default value of this variable is true.
`force-32bit = $boolean`
If set to a true boolean value (yes/true/on), the shadowed Steam binary will
be run via the `linux32` command. This will force the `steam` process
and all children to believe they are running on a 32-bit system. This
may be useful for 64-bit games that are buggy only on 64-bit.
If this is set to a false boolean value (no/false/off), then the
shadowed Steam binary will be directly executed. Note that on 32-bit
OSs this setting is ignored.
The default value of this variable is false.
`use-libintercept = $boolean`
If set to a true boolean value (yes/true/on), the `liblsi-intercept.so`
library will be utilised to control dynamic linking within the Steam client
and associated processes.
Note this requires `use-native-runtime` to be set.
The default value of this variable is true.
## Common issues
Virtually all issues will come down to having the right dependencies. LSI puts an emphasis on
host-first libraries, so make sure all the correct libraries are available for both 32-bit and
64-bit.
Steam has both 32-bit and 64-bit processes/libraries, having the full dependency set for both
the client and common games/engines is a must.
### Missing tray icon for Steam client using native OS runtime
Ensure you have the 32-bit version of libappindicator installed. This is required for the tray icon. libappindicator falls back to a standard X11 tray icon in the absence of desktop appindicator support.
Related issue: [Steam tray icon missing #2](https://github.com/solus-project/linux-steam-integration/issues/2)
### Steam fails to launch with libintercept/native-runtime
Make sure you enable full debugging when first assigning dependencies to your runtime package:
```bash
$ LSI_DEBUG=1 steam
# If you use co-exist option:
$ LSI_DEBUG=1 lsi-steam
```
## License
`src/shim src/frontend src/lsi src/intercept`:
Copyright © 2016-2017 Ikey Doherty
linux-steam-integration is available under the terms of the `LGPL-2.1`
`data/lsi-steam.desktop`:
This file borrows translations from the official `steam.desktop` launcher.
These are copyright of Valve*.
See `LICENSE.LGPL2.1 <LICENSE.LGPL2.1>`_ for more details
* Some names may be claimed as the property of others.
-158
View File
@@ -1,158 +0,0 @@
linux-steam-integration
-----------------------
A helper shim to enable better Steam* integration on Linux systems.
This is part of an effort by Solus to enhance Steam for everyone.
This project, and by extension Solus, is not officially endorsed by, or
affiliated with, Steam*, or its parent company, Valve*.
Linux Steam Integration (LSI) is a `Solus Project <https://solus-project.com/>`_
.. image:: https://build.solus-project.com/logo.png
:align: center
:alt: LSI is a Solus Project
Integrating LSI
===============
To correctly integrate LSI, your Steam package will require modification.
LSI must provide the /usr/bin/steam binary, so your Steam package must
move the main launcher to a shadow location.
For users who do not have access to LSI in their distribution, because it has
not been integrated yet, please configure with ``--disable-replace-steam`` to
preserve your existing Steam integrity. Then use the "LSI Steam" shortcut in
your menu to launch Steam via LSI.
**Configuring LSI build**
There are a number of configure options you should be aware of when integrating
LSI correctly. The prominent ones are explained here.
``--disable-replace-steam``
This will disable building a ``steam`` binary, and instead build an
``lsi-steam`` binary, and install ``lsi-steam.desktop``. Use this
option if you are not a distribution integrator, and wish to use
LSI yourself.
``--with-real-steam-binary=$NAME``
Set the absolute path for the shadowed Steam binary.
LSI will execv Steam after it has initialised the environment.
Note that execv, not execvp, is used, to mask programs that may be
in the ``$PATH``, hence requiring an absolute path.
The default value for this option is::
/usr/lib/steam/steam
This option is only applicable for distribution integrators, when
Steam replacement is enabled.
``--with-preload-libs=$LIBS``
A colon separated list of libraries that are required to launch Steam
when using its own runtime. LSI enables users to switch back to the Steam
runtime, and in this instance we manage the LD_PRELOAD environmental variable.
Ensure this is correct, and escape $LIB for correct Linux usage.
The default value for this option is::
/usr/\$LIB/libX11.so.6:/usr/\$LIB/libstdc++.so.6
``--enable-frontend``
A small UI application is shipped to enable configuration of LSI, which presents
a simple GTK3 Dialog to the user. It is not enabled by default, it is up
to the integrator to decide if they wish to employ lsi-settings, or implement
an alternative.
The lsi-settings application will only ever write new configurations to the
**user** settings file, and requires no special permissions.
The default value for this option is::
disabled
**How LSI Works**
LSI provides a /usr/bin/steam binary to be used in place of the existing Steam script,
which will then correctly set up the environment before swapping the process for the
Steam process.
Configuration options can be placed in an INI-style configuration file in a series
of locations, which are ordered by priority in a cascade::
~/.config/linux-steam-integration.conf
/etc/linux-steam-integration.conf
/usr/share/defaults/linux-steam-integration/linux-steam-integration.conf
The user configuration takes immediate priority. Secondly we have the system-wide
configuration for affecting all accounts, and lastly the vendor configuration,
which may be provided by the integrator.
Currently this INI file supports two options. The root section in this INI file
must be ``[Steam]``.
``use-native-runtime = $boolean``
If set to a true boolean value, (yes/true/on), the host OS's native runtime
will be used instead of the Steam provided runtime. If this is set to
a false boolean value (no/false/off), then the startup will be modified
to export the relevant ``LD_PRELOAD`` and ``STEAM_RUNTIME`` settings.
The default value of this variable is ``true``.
``force-32bit = $boolean``
If set to a true boolean value (yes/true/on), the shadowed Steam binary will
be run via the ``linux32`` command. This will force the ``steam`` process
and all children to believe they are running on a 32-bit system. This
may be useful for 64-bit games that are buggy only on 64-bit.
If this is set to a false boolean value (no/false/off), then the
shadowed Steam binary will be directly executed. Note that on 32-bit
OSs this setting is ignored.
The default value of this variable is ``false``.
Common issues
=============
**Missing tray icon for Steam client using native OS runtime**
Ensure you have the 32-bit version of libappindicator installed. This
is required for the tray icon. libappindicator falls back to a standard
X11 tray icon in the absence of desktop appindicator support.
Related issue: `Steam tray icon missing #2 <https://github.com/solus-project/linux-steam-integration/issues/2>`_
License
-------
``src/shim src/frontend``::
Copyright © 2016 Ikey Doherty
linux-steam-integration is available under the terms of the `LGPL-2.1`
``data/lsi-steam.desktop``::
This file borrows translations from the official ``steam.desktop`` launcher.
These are copyright of Valve*.
See `LICENSE.LGPL2.1 <LICENSE.LGPL2.1>`_ for more details
* Some names may be claimed as the property of others.
-20
View File
@@ -1,20 +0,0 @@
LSI is still in its infancy, currently only at a 0.1 release. The time to
release was dramatic due to an absolute requirement for non-broken Steam
to accompany the Solus 1.2 release
Going forward, there are more items that need implementing to start shaving
more rough edges off of Linux gaming.
Immediate LSI worklist:
- [x] Add configurable shim to replace /usr/bin/steam, relying on shadowed launcher
- [x] Add super-basic UI to configure said shim
- [x] Shove out a 0.1 for Solus 1.2
- [ ] Replace existing /usr/bin/steam entirely and decouple the tight runtime logic
that is currently enforced.
- [ ] Remove requirement for steam.sh $bindir/steam entirely - allowing parallel clients.
LSI becomes more self contained and no longer needs to prop up Steam, but replaces
much of the support tools.
- [ ] Replace the existing Steam "run.sh" style launch facilities
- [ ] Get to a point that current ubuntu12_32 runtime is no longer required or
wanted.
-14
View File
@@ -1,14 +0,0 @@
#!/bin/sh
set -e
autoreconf --force --install --symlink --warnings=all
args="\
--sysconfdir=/etc \
--localstatedir=/var \
--prefix=/usr \
--enable-silent-rules"
./configure CFLAGS="-g -O1 $CFLAGS" $args "$@"
make clean
-119
View File
@@ -1,119 +0,0 @@
AC_INIT([linux-steam-integration], 0.3, [ikey@solus-project.com], [linux-steam-integration], [https://github.com/solus-project/linux-steam-integration/issues])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([-Wno-portability no-dist-gzip dist-xz foreign subdir-objects])
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CC_STDC
LT_PREREQ(2.2)
AC_CONFIG_HEADERS([config.h])
AC_PREFIX_DEFAULT(/usr/local)
AM_SILENT_RULES([yes])
LT_INIT([disable-static])
AC_CONFIG_MACRO_DIR([m4])
# Turn on the nica submodule support
AM_CONDITIONAL([NICA_SUBMODULE], true)
AM_CONDITIONAL([COVERAGE], false)
AC_CONFIG_FILES([Makefile
src/libnica/Makefile])
# Check if we're using the new C++ ABI, which will require LD_PRELOAD magic
AC_LANG_PUSH([C++])
AC_MSG_CHECKING(['_GLIBCXX_USE_CXX11_ABI' value])
AC_COMPUTE_INT([LSI_NEW_CXX_ABI], [_GLIBCXX_USE_CXX11_ABI], [[#include <string>]], [LSI_NEW_CXX_ABI=0])
AC_MSG_RESULT([$LSI_NEW_CXX_ABI])
AC_LANG_POP([C++])
if test x$LSI_NEW_CXX_ABI = "x1"; then
use_new_abi="yes"
AC_DEFINE([LSI_USE_NEW_ABI], [1], [Using new C++ ABI])
else
use_new_abi="no"
fi
# Source: https://mail.gnome.org/archives/commits-list/2012-September/msg01730.html
# adl_RECURSIVE_EVAL(VALUE, RESULT)
# =================================
# Interpolate the VALUE in loop until it doesn't change,
# and set the result to $RESULT.
# WARNING: It's easy to get an infinite loop with some unsane input.
# For example ${datadir} becomes ${datarootdir}, and then ${prefix}/share, and
# finally ${prefix} is replaced by the prefix.
AC_DEFUN([adl_RECURSIVE_EVAL],
[_lcl_receval="$1"
$2=`(test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
_lcl_receval_old=''
while test "[$]_lcl_receval_old" != "[$]_lcl_receval"; do
_lcl_receval_old="[$]_lcl_receval"
eval _lcl_receval="\"[$]_lcl_receval\""
done
echo "[$]_lcl_receval")`])
# 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"])
adl_RECURSIVE_EVAL(["$steambin"], [STEAMBIN])
AC_SUBST(STEAMBIN)
AC_DEFINE_UNQUOTED(STEAM_BINARY, "$STEAMBIN",
[The location of the real Steam binary])
# The LD_PRELOAD list required to integrate gracefully with the official Steam Runtime
AC_ARG_WITH([preload-libs], AS_HELP_STRING([--with-preload-libs],
[the preload libs to use with Steams own runtime]), [preloadlibs="${withval}"],
[preloadlibs="/usr/\$LIB/libxcb.so.1:/usr/\$LIB/libX11.so.6:/usr/\$LIB/libstdc++.so.6"])
AC_DEFINE_UNQUOTED([LSI_PRELOAD_LIBS], "$preloadlibs",
[Libraries to preload with Steams runtime])
m4_define([gtk_required_version], [3.4.0])
# Check if frontend is requested
have_frontend="no"
AC_ARG_ENABLE(frontend, AS_HELP_STRING([--enable-frontend], [enable GTK frontend]))
if test "x$enable_frontend" = "xyes" ; then
PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= gtk_required_version])
AC_DEFINE([HAVE_FRONTEND], [1], [Enabled GTK+ frontend])
have_frontend="yes"
fi
AM_CONDITIONAL([HAVE_FRONTEND], [test x$have_frontend = "xyes"])
# Whether LSI should stand in for steam binary
replace_steam="yes"
AC_ARG_ENABLE(replace-steam, AS_HELP_STRING([--disable-replace-steam], [disable Steam binary replacement]))
if test "x$enable_replace_steam" = "xno"; then
replace_steam="no"
fi
if test "x$replace_steam" = "xyes" ; then
AC_DEFINE([REPLACE_STEAM], [1], [Steam binary will be replaced])
fi
AM_CONDITIONAL([REPLACE_STEAM], [test x$replace_steam = "xyes"])
AC_OUTPUT
AC_MSG_RESULT([
linux-steam-integration $VERSION
========
prefix: ${prefix}
libdir: ${libdir}
sysconfdir: ${sysconfdir}
exec_prefix: ${exec_prefix}
bindir: ${bindir}
datarootdir: ${datarootdir}
New C++ ABI: ${use_new_abi}
Replace Steam: ${replace_steam}
Real Steam binary: ${STEAMBIN}
GTK+ Frontend: ${have_frontend}
preload-libs: ${preloadlibs}
compiler: ${CC}
cflags: ${CFLAGS}
ldflags: ${LDFLAGS}
])
+17
View File
@@ -0,0 +1,17 @@
appsdir = join_paths(datadir, 'applications')
# If frontend is enabled, install lsi-settings.desktop
if with_frontend == true
install_data(
'lsi-settings.desktop',
install_dir: appsdir,
)
endif
# If we need to co-exist, install alternative .desktop file (not conflicting with Steam)
if shim_behaviour == 'co-exist'
install_data(
'lsi-steam.desktop',
install_dir: appsdir,
)
endif
-1
View File
@@ -1 +0,0 @@
+74
View File
@@ -0,0 +1,74 @@
project(
'linux-steam-integration',
['c'],
version: '0.4.1',
license: [
'LGPL-2.1',
],
default_options: [
'c_std=c99',
],
)
am_cflags = [
'-fstack-protector',
'-pedantic',
'-Wstrict-prototypes',
'-Wundef',
'-fno-common',
'-Werror-implicit-function-declaration',
'-Wformat',
'-Wformat-security',
'-Werror=format-security',
'-Wno-conversion',
'-Wunused-variable',
'-Wunreachable-code',
'-Wall',
'-W',
'-D_FORTIFY_SOURCE=2',
]
add_global_arguments(am_cflags, language: 'c')
dep_gtk3 = dependency('gtk+-3.0', version: '>= 3.4.0')
cdata = configuration_data()
cdata.set_quoted('PACKAGE_NAME', meson.project_name())
prefix = get_option('prefix')
datadir = join_paths(prefix, get_option('datadir'))
vendordir = join_paths(datadir, 'defaults', meson.project_name())
sysconfdir = join_paths(prefix, get_option('sysconfdir'))
cdata.set_quoted('SYSTEMCONFDIR', sysconfdir)
cdata.set_quoted('VENDORDIR', vendordir)
# Configurables
cdata.set_quoted('LSI_PRELOAD_LIBS', get_option('with-preload-libs'))
cdata.set_quoted('STEAM_BINARY', get_option('with-steam-binary'))
shim_behaviour = get_option('with-shim')
if shim_behaviour == 'replacement'
cdata.set('REPLACE_STEAM', '1')
endif
with_libintercept = get_option('with-libintercept')
if with_libintercept == true
cdata.set('HAVE_LIBINTERCEPT', '1')
endif
with_frontend = get_option('with-frontend')
if get_option('with-new-libcxx-abi') == true
cdata.set('LSI_USE_NEW_ABI', '1')
endif
config_h = configure_file(
configuration: cdata,
output: 'config.h',
)
config_h_dir = include_directories('.')
subdir('data')
subdir('src')
+8
View File
@@ -0,0 +1,8 @@
option('with-shim', type : 'combo', choices : ['replacement', 'co-exist', 'none'], value: 'replacement',
description : 'control how the shim is deployed')
option('with-steam-binary', type: 'string', description: 'Set the path to the Steam binary', value: '/usr/lib/steam/steam')
option('with-frontend', type: 'boolean', description: 'Build the LSI Settings UI', value: false)
option('with-preload-libs', type: 'string', description: 'Colon separated list of libraries required to launch Steam games',
value: '/usr/\$LIB/libxcb.so.1:/usr/\$LIB/libX11.so.6:/usr/\$LIB/libstdc++.so.6')
option('with-libintercept', type: 'boolean', description: 'Enable libintercept library for controlling Steam linking', value: true)
option('with-new-libcxx-abi', type: 'boolean', description: 'Enable when using the new libstdc++ ABI', value: false)
Executable
+18
View File
@@ -0,0 +1,18 @@
#!/bin/bash
set -e
if [[ ! -d buildroot/build32 ]]; then
CC="gcc -m32" linux32 meson buildroot/build32 --prefix=/usr --sysconfdir=/etc --datadir=/usr/share --libdir=/usr/lib32 -Dwith-shim=none -Dwith-new-libcxx-abi=true
fi
if [[ ! -d buildroot/build64 ]]; then
meson buildroot/build64 --prefix=/usr --sysconfdir=/etc --datadir=/usr/share --libdir=/usr/lib64 -Dwith-shim=replacement -Dwith-steam-binary=/usr/lib64/steam/steam -Dwith-frontend=true -Dwith-new-libcxx-abi=true
fi
ninja -C buildroot/build32
ninja -C buildroot/build64
sudo ninja -C buildroot/build32 install
sudo ninja -C buildroot/build64 install
Executable
+14
View File
@@ -0,0 +1,14 @@
#!/bin/bash
set -e
git submodule init
git submodule update
# Script for ikey because he went with meson. *shrug*
VERSION="0.4"
NAME="linux-steam-integration"
git-archive-all.sh --format tar --prefix ${NAME}-${VERSION}/ --verbose -t HEAD ${NAME}-${VERSION}.tar
xz -9 "${NAME}-${VERSION}.tar"
gpg --armor --detach-sign "${NAME}-${VERSION}.tar.xz"
gpg --verify "${NAME}-${VERSION}.tar.xz.asc"
+35
View File
@@ -0,0 +1,35 @@
/*
* This file is part of linux-steam-integration.
*
* Copyright © 2016-2017 Ikey Doherty
*
* linux-steam-integration is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*/
#pragma once
#define _GNU_SOURCE
/* Mark a variable/argument as unused to skip warnings */
#define __lsi_unused__ __attribute__((unused))
/* Force inlining of a function */
#define __lsi_inline__ __attribute__((always_inline))
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
/*
* Editor modelines - https://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 8
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=8 tabstop=8 expandtab:
* :indentSize=8:tabSize=8:noTabs=true:
*/
+23 -1
View File
@@ -1,7 +1,7 @@
/*
* This file is part of linux-steam-integration.
*
* Copyright © 2016 Ikey Doherty
* Copyright © 2016-2017 Ikey Doherty <ikey@solus-project.com>
*
* linux-steam-integration is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License as
@@ -17,6 +17,7 @@
#include <string.h>
#include <sys/stat.h>
#include "config.h"
#include "lsi.h"
static inline void _align_label(GtkWidget *label)
@@ -40,6 +41,9 @@ int main(int argc, char **argv)
GtkWidget *image = NULL;
GtkWidget *check_native = NULL;
GtkWidget *check_emul32 = NULL;
#ifdef HAVE_LIBINTERCEPT
GtkWidget *check_intercept = NULL;
#endif
GtkWidget *label = NULL;
GtkSettings *settings = NULL;
int response = 0;
@@ -110,6 +114,17 @@ int main(int argc, char **argv)
gtk_widget_set_sensitive(label, is_x86_64);
gtk_widget_set_sensitive(check_emul32, is_x86_64);
#ifdef HAVE_LIBINTERCEPT
label = gtk_label_new("Use liblsi-intercept to override Steam's library loading mechanism");
_align_label(label);
gtk_widget_set_tooltip_text(label,
"This can help with many library issues with the core client");
gtk_grid_attach(GTK_GRID(grid), label, 1, 3, 1, 1);
check_intercept = gtk_switch_new();
gtk_grid_attach(GTK_GRID(grid), check_intercept, 2, 3, 1, 1);
#endif
gtk_container_set_border_width(GTK_CONTAINER(grid), 6);
gtk_widget_set_margin_bottom(grid, 18);
@@ -122,6 +137,10 @@ int main(int argc, char **argv)
gtk_switch_set_active(GTK_SWITCH(check_native), lconfig.use_native_runtime);
gtk_switch_set_active(GTK_SWITCH(check_emul32), lconfig.force_32);
#ifdef HAVE_LIBINTERCEPT
gtk_switch_set_active(GTK_SWITCH(check_intercept), lconfig.use_libintercept);
#endif
/* Run the dialog */
gtk_widget_show_all(container);
response = gtk_dialog_run(GTK_DIALOG(dialog));
@@ -134,6 +153,9 @@ int main(int argc, char **argv)
/* Get the config from the UI */
lconfig.use_native_runtime = gtk_switch_get_active(GTK_SWITCH(check_native));
lconfig.force_32 = gtk_switch_get_active(GTK_SWITCH(check_emul32));
#ifdef HAVE_LIBINTERCEPT
lconfig.use_libintercept = gtk_switch_get_active(GTK_SWITCH(check_intercept));
#endif
/* Cleanup */
gtk_widget_destroy(dialog);
+18
View File
@@ -0,0 +1,18 @@
if with_frontend == true
dep_gtk3 = dependency('gtk+-3.0', version: '>= 3.4.0')
frontend_sources = [
'main.c',
]
frontend = executable(
'lsi-settings',
sources: frontend_sources + nica_sources,
include_directories: nica_includes,
dependencies: [
dep_gtk3,
link_lsi,
],
install: true,
)
endif
+190
View File
@@ -0,0 +1,190 @@
/*
* This file is part of linux-steam-integration.
*
* Copyright © 2016-2017 Ikey Doherty <ikey@solus-project.com>
*
* linux-steam-integration is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*/
#define _GNU_SOURCE
#include <link.h>
#include <stdio.h>
#include <stdlib.h>
#include "../common.h"
#include "nica/nica.h"
/**
* Is this a process we're actually interested in?
*/
static bool process_supported = false;
static const char *matched_process = NULL;
/**
* Determine the basename'd process
*/
static inline char *get_process_name(void)
{
autofree(char) *realp = NULL;
char *basep = NULL;
realp = realpath("/proc/self/exe", NULL);
if (!realp) {
return false;
}
basep = basename(realp);
return strdup(basep);
}
/**
* Find out if we're being executed by a process we actually need to override,
* otherwise we'd not be loaded by rtld-audit
*/
static bool is_intercept_candidate(void)
{
static const char *wanted_processes[] = {
"html5app_steam",
"opengl-program",
"steam",
"steamwebhelper",
};
autofree(char) *nom = NULL;
nom = get_process_name();
if (!nom) {
return false;
}
for (size_t i = 0; i < ARRAY_SIZE(wanted_processes); i++) {
if (streq(wanted_processes[i], nom)) {
matched_process = wanted_processes[i];
if (!getenv("LSI_DEBUG")) {
return true;
}
fprintf(stderr,
"\033[32;1m[LSI:%s]\033[0m: debug: loading libintercept from LSI\n",
matched_process);
return true;
}
}
return false;
}
/**
* la_version is our main entry point and will only continue if our
* process is explicitly Steam
*/
_nica_public_ unsigned int la_version(unsigned int supported_version)
{
/* Unfortunately glibc will die if we tell it to skip us .. */
process_supported = is_intercept_candidate();
return supported_version;
}
/**
* emit_overriden lib is used to pretty-print the debug when we blacklist
* a vendored library
*/
static void emit_overriden_lib(const char *lib_name)
{
fprintf(stderr,
"\033[32;1m[LSI:%s]\033[0m: debug: blacklisted loading of vendored library: "
"\033[34;1m%s\033[0m\n",
matched_process,
lib_name);
}
/**
* la_objsearch will allow us to blacklist certain LD_LIBRARY_PATH duplicate
* libraries being loaded by the Steam client, such as the broken libSDL shipped
* as a private vendored lib
*/
_nica_public_ char *la_objsearch(const char *name, __lsi_unused__ uintptr_t *cookie,
__lsi_unused__ unsigned int flag)
{
/* We don't know about this process, so have glibc do its thing as normal */
if (!process_supported) {
return (char *)name;
}
/* Patterns we'll permit Steam to privately load */
static const char *steam_allowed[] = {
/* general */
"libicui18n.so",
"libicuuc.so",
"libavcodec.so.",
"libavformat.so.",
"libavresample.so.",
"libavutil.so.",
"libswscale.so.",
/* core plugins */
"chromehtml.so",
"crashhandler.so",
"filesystem_stdio.so",
"friendsui.so",
"gameoverlayrenderer.so",
"gameoverlayui.so",
"libaudio.so",
"libmiles.so",
"libopenvr_api.so",
"liboverride.so",
"libsteam.so",
"libtier0_s.so",
"libv8.so",
"libvideo.so",
"libvstdlib_s.so",
"serverbrowser.so",
"steamclient.so",
"steamoverlayvulkanlayer.so",
"steamservice.so",
"steamui.so",
"vgui2_s.so",
/* big picture mode */
"panorama",
"libpangoft2-1.0.so",
"libpango-1.0.so",
/* steamwebhelper */
"libcef.so",
};
/* Find out if it exists */
bool file_exists = nc_file_exists(name);
/* Find out if its a Steam private lib.. These are relative "./" files too! */
if (name && (strstr(name, "/Steam/") || strncmp(name, "./", 2) == 0)) {
for (size_t i = 0; i < ARRAY_SIZE(steam_allowed); i++) {
if (strstr(name, steam_allowed[i])) {
return (char *)name;
}
}
/* If LSI_DEBUG is set, spam it. */
if (getenv("LSI_DEBUG") && file_exists) {
emit_overriden_lib(name);
}
return NULL;
}
return (char *)name;
}
/*
* Editor modelines - https://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 8
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=8 tabstop=8 expandtab:
* :indentSize=8:tabSize=8:noTabs=true:
*/
+15
View File
@@ -0,0 +1,15 @@
# Only build libintercept if told to!
if with_libintercept == true
intercept_sources = [
'main.c',
]
main_intercept = shared_library(
'lsi-intercept',
sources: intercept_sources + nica_sources,
include_directories: nica_includes,
install: true,
)
endif
+12 -3
View File
@@ -1,7 +1,7 @@
/*
* This file is part of linux-steam-integration.
*
* Copyright © 2016 Ikey Doherty
* Copyright © 2016-2017 Ikey Doherty <ikey@solus-project.com>
*
* linux-steam-integration is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License as
@@ -143,6 +143,13 @@ bool lsi_config_load(LsiConfig *config)
map_val = NULL;
}
/* Do we want libintercept? */
map_val = nc_hashmap_get(nc_hashmap_get(mconfig, "Steam"), "use-libintercept");
if (map_val) {
config->use_libintercept = lsi_is_boolean_true(map_val);
map_val = NULL;
}
/* Check if 32-bit is being forced */
map_val = nc_hashmap_get(nc_hashmap_get(mconfig, "Steam"), "force-32bit");
if (map_val) {
@@ -178,9 +185,10 @@ bool lsi_config_store(LsiConfig *config)
return false;
}
if (fprintf(fp,
"[Steam]\nuse-native-runtime = %s\nforce-32bit = %s\n",
"[Steam]\nuse-native-runtime = %s\nforce-32bit = %s\nuse-libintercept = %s\n",
lsi_bool_to_string(config->use_native_runtime),
lsi_bool_to_string(config->force_32)) < 0) {
lsi_bool_to_string(config->force_32),
lsi_bool_to_string(config->use_libintercept)) < 0) {
return false;
}
return true;
@@ -194,6 +202,7 @@ void lsi_config_load_defaults(LsiConfig *config)
* things that LSI knows about */
config->force_32 = false;
config->use_native_runtime = true;
config->use_libintercept = true;
}
void lsi_report_failure(const char *s, ...)
+4 -9
View File
@@ -1,7 +1,7 @@
/*
* This file is part of linux-steam-integration.
*
* Copyright © 2016 Ikey Doherty
* Copyright © 2016-2017 Ikey Doherty <ikey@solus-project.com>
*
* linux-steam-integration is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License as
@@ -16,25 +16,20 @@
#include <fcntl.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <unistd.h>
#include "../common.h"
#include "config.h"
/* Mark a variable/argument as unused to skip warnings */
#define __lsi_unused__ __attribute__((unused))
/* Force inlining of a function */
#define __lsi_inline__ __attribute__((always_inline))
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
/**
* Current Linux Steam Integration settings.
*/
typedef struct LsiConfig {
bool force_32; /**<Do we force 32-bit? */
bool use_native_runtime; /**<Do we force our native runtime? */
bool use_libintercept; /**<Do we force libintercept? */
} LsiConfig;
/**
+18
View File
@@ -0,0 +1,18 @@
# Only build liblsi if told to!
if shim_behaviour != 'none' or with_frontend == true
lsi_sources = [
'lsi.c',
]
lib_lsi = static_library(
'lsi-lsi',
sources: lsi_sources + nica_sources,
include_directories: nica_includes,
)
link_lsi = declare_dependency(
link_with: lib_lsi,
include_directories: include_directories('.'),
)
endif
+22
View File
@@ -0,0 +1,22 @@
# Track how to build nica, as we actually build it twice..
nica_sources = [
'../libnica/src/array.c',
'../libnica/src/hashmap.c',
'../libnica/src/files.c',
'../libnica/src/inifile.c',
'../libnica/src/list.c',
'../libnica/src/nc-string.c',
'../libnica/src/util.c',
]
nica_includes = [
include_directories('libnica/src/include'),
include_directories('libnica/src/include/nica'),
config_h_dir,
]
subdir('lsi')
subdir('frontend')
subdir('intercept')
subdir('shim')
+21
View File
@@ -0,0 +1,21 @@
if shim_behaviour == 'replacement'
shim_target_name = 'steam'
else
shim_target_name = 'lsi-steam'
endif
if shim_behaviour != 'none'
shim_sources = [
'shim.c',
]
shim = executable(
shim_target_name,
sources: shim_sources + nica_sources,
include_directories: nica_includes,
dependencies: [
link_lsi,
],
install: true,
)
endif
+20 -1
View File
@@ -1,7 +1,7 @@
/*
* This file is part of linux-steam-integration.
*
* Copyright © 2016 Ikey Doherty
* Copyright © 2016-2017 Ikey Doherty <ikey@solus-project.com>
*
* linux-steam-integration is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License as
@@ -26,6 +26,12 @@
*/
#define EMUL32BIN "linux32"
/**
* Audit path is used for the libintercept library to ensure Steam only uses the
* host SDL, etc.
*/
#define AUDIT_PATH "/usr/\$LIB/liblsi-intercept.so"
int main(int argc, char **argv)
{
LsiConfig config = { 0 };
@@ -59,6 +65,12 @@ int main(int argc, char **argv)
if (config.use_native_runtime) {
/* Explicitly disable the runtime */
setenv("STEAM_RUNTIME", "0", 1);
#ifdef HAVE_LIBINTERCEPT
/* Only use libintercept in combination with native runtime! */
if (config.use_libintercept) {
setenv("LD_AUDIT", AUDIT_PATH, 1);
}
#endif
} else {
/* Only preload when needed. */
if (lsi_system_requires_preload()) {
@@ -71,6 +83,13 @@ int main(int argc, char **argv)
* usage of dbus by Steam. Help them out */
setenv("DBUS_FATAL_WARNINGS", "0", 1);
/* A recent regression is to interpret XMODIFIERS and then fail to
* make it beyond `SDL_InitSubSystem` due to `InitIME` failing to
* properly use D-BUS ...
*/
unsetenv("XMODIFIERS");
unsetenv("GTK_MODULES");
memset(&n_argv, 0, sizeof(char *) * (argc + 2));
/* If we're 64-bit and 32-bit is forced, proxy via linux32 */
Executable
+12
View File
@@ -0,0 +1,12 @@
#!/bin/bash
set -e
env -i DBUS_SESSION_ADDRESS=$DBUS_SESSION_ADDRESS \
PATH=$PATH \
DISPLAY=$DISPLAY \
HOME=$HOME \
USER=$USER \
USERNAME=$USERNAME \
LD_AUDIT="`pwd`/buildroot/install/usr/\$LIB/liblsi-intercept.so" \
LD_PRELOAD="/usr/\$LIB/libxcb.so.1:/usr/\$LIB/libX11.so.6:/usr/\$LIB/libstdc++.so.6" \
DBUS_FATAL_WARNINGS=0 \
STEAM_RUNTIME=0 /usr/lib64/steam/steam