Avoid libelf dependency in critical-path code
-
library: Refactor parsing inspect-library output in a separate function
This will be useful for a subsequent commit where we will need to call inspect-library a second time. It allows us to minimize code duplication.
-
library: Refactor inspect-library arguments in a separate function
This is in preparation to handle different inspect-library arguments without duplicating the necessary code.
-
library: Separate the libelf based checks into a separate helper
libelf.so.1
is usually always available in the host system because it is a dependency of several core packages, e.g. mesa.
However on some less traditional distributions, like NixOS or Gentoo, this might not always be the case.
We can't compile inspect-library
with an RPATH
because we want to
load libraries as the host system does. And this means that
libelf.so.1
needs to be picked from the host system and we can't use
the version included in pressure-vessel.
For this reason we move the libelf based checks into a separate helper and keep that dependency out of the critical path to identify the graphics drivers.
Effectively, this commit brings back inspect-library.c
to the version
we had with af6b41e0
-
inspect-library: Refactor several functions into a separate file
Move the shared functions between
inspect-library
andinspect-library-supplement
into a common separate file. This helps to avoid duplicating code between the two helpers.
After a first round of review we should ask the NixOS users that were affected by this issue to test it with their old Steam package declaration that didn't include libelf.so.1
.