systemd: nixpkgs-fmt
This was recently introduced, and apparently not nixpkgs-fmt'ed. While there's no global consensus on nixpkgs-fmt'ing everything, indenting this by 2 more spaces won't hurt.
This commit is contained in:
parent
49cb525712
commit
f61a3bf8e8
@ -160,83 +160,87 @@ stdenv.mkDerivation {
|
|||||||
--replace \
|
--replace \
|
||||||
"find_program('objcopy'" \
|
"find_program('objcopy'" \
|
||||||
"find_program('${stdenv.cc.bintools.targetPrefix}objcopy'"
|
"find_program('${stdenv.cc.bintools.targetPrefix}objcopy'"
|
||||||
'' + (let
|
'' + (
|
||||||
|
let
|
||||||
|
# The folllowing dlopen patches ensure that all the features that are
|
||||||
|
# implemented via dlopen(3) are available (or explicitly deactivated) by
|
||||||
|
# pointing dlopen to the absolute store path instead of relying on the
|
||||||
|
# linkers runtime lookup code.
|
||||||
|
#
|
||||||
|
# All of the dlopen calls have to be handled. When new ones are introduced
|
||||||
|
# by upstream (or one of our patches) they must be explicitly declared,
|
||||||
|
# otherwise the build will fail.
|
||||||
|
#
|
||||||
|
# As of systemd version 247 we've seen a few errors like `libpcre2.… not
|
||||||
|
# found` when using e.g. --grep with journalctl. Those errors should
|
||||||
|
# become less unexpected now.
|
||||||
|
#
|
||||||
|
# There are generally two classes of dlopen(3) calls. Those that we want to
|
||||||
|
# support and those that should be deactivated / unsupported. This change
|
||||||
|
# enforces that we handle all dlopen calls explicitly. Meaning: There is
|
||||||
|
# not a single dlopen call in the source code tree that we did not
|
||||||
|
# explicitly handle.
|
||||||
|
#
|
||||||
|
# In order to do this we introduced a list of attributes that maps from
|
||||||
|
# shared object name to the package that contains them. The package can be
|
||||||
|
# null meaning the reference should be nuked and the shared object will
|
||||||
|
# never be loadable during runtime (because it points at an invalid store
|
||||||
|
# path location).
|
||||||
|
#
|
||||||
|
# To get a list of dynamically loaded libraries issue something like
|
||||||
|
# `grep -ri 'dlopen("lib' $src` and update the below list.
|
||||||
|
dlopenLibs = [
|
||||||
|
# We did never provide support for libxkbcommon & qrencode
|
||||||
|
{ name = "libxkbcommon.so.0"; pkg = null; }
|
||||||
|
{ name = "libqrencode.so.4"; pkg = null; }
|
||||||
|
|
||||||
# The folllowing dlopen patches ensure that all the features that are
|
# We did not provide libpwquality before so it is safe to disable it for
|
||||||
# implemented via dlopen(3) are available (or explicitly deactivated) by
|
# now.
|
||||||
# pointing dlopen to the absolute store path instead of relying on the
|
{ name = "libpwquality.so.1"; pkg = null; }
|
||||||
# linkers runtime lookup code.
|
|
||||||
#
|
|
||||||
# All of the dlopen calls have to be handled. When new ones are introduced
|
|
||||||
# by upstream (or one of our patches) they must be explicitly declared,
|
|
||||||
# otherwise the build will fail.
|
|
||||||
#
|
|
||||||
# As of systemd version 247 we've seen a few errors like `libpcre2.… not
|
|
||||||
# found` when using e.g. --grep with journalctl. Those errors should
|
|
||||||
# become less unexpected now.
|
|
||||||
#
|
|
||||||
# There are generally two classes of dlopen(3) calls. Those that we want to
|
|
||||||
# support and those that should be deactivated / unsupported. This change
|
|
||||||
# enforces that we handle all dlopen calls explicitly. Meaning: There is
|
|
||||||
# not a single dlopen call in the source code tree that we did not
|
|
||||||
# explicitly handle.
|
|
||||||
#
|
|
||||||
# In order to do this we introduced a list of attributes that maps from
|
|
||||||
# shared object name to the package that contains them. The package can be
|
|
||||||
# null meaning the reference should be nuked and the shared object will
|
|
||||||
# never be loadable during runtime (because it points at an invalid store
|
|
||||||
# path location).
|
|
||||||
#
|
|
||||||
# To get a list of dynamically loaded libraries issue something like
|
|
||||||
# `grep -ri 'dlopen("lib' $src` and update the below list.
|
|
||||||
dlopenLibs = [
|
|
||||||
# We did never provide support for libxkbcommon & qrencode
|
|
||||||
{ name = "libxkbcommon.so.0"; pkg = null; }
|
|
||||||
{ name = "libqrencode.so.4"; pkg = null; }
|
|
||||||
|
|
||||||
# We did not provide libpwquality before so it is safe to disable it for
|
# Only include cryptsetup if it is enabled. We might not be able to
|
||||||
# now.
|
# provide it during "bootstrap" in e.g. the minimal systemd build as
|
||||||
{ name = "libpwquality.so.1"; pkg = null; }
|
# cryptsetup has udev (aka systemd) in it's dependencies.
|
||||||
|
{ name = "libcryptsetup.so.12"; pkg = if withCryptsetup then cryptsetup else null; }
|
||||||
|
|
||||||
# Only include cryptsetup if it is enabled. We might not be able to
|
# We are using libidn2 so we only provide that and ignore the others.
|
||||||
# provide it during "bootstrap" in e.g. the minimal systemd build as
|
# Systemd does this decision during configure time and uses ifdef's to
|
||||||
# cryptsetup has udev (aka systemd) in it's dependencies.
|
# enable specific branches. We can safely ignore (nuke) the libidn "v1"
|
||||||
{ name = "libcryptsetup.so.12"; pkg = if withCryptsetup then cryptsetup else null; }
|
# libraries.
|
||||||
|
{ name = "libidn2.so.0"; pkg = libidn2; }
|
||||||
|
{ name = "libidn.so.12"; pkg = null; }
|
||||||
|
{ name = "libidn.so.11"; pkg = null; }
|
||||||
|
|
||||||
# We are using libidn2 so we only provide that and ignore the others.
|
# journalctl --grep requires libpcre so lets provide it
|
||||||
# Systemd does this decision during configure time and uses ifdef's to
|
{ name = "libpcre2-8.so.0"; pkg = pcre2; }
|
||||||
# enable specific branches. We can safely ignore (nuke) the libidn "v1"
|
];
|
||||||
# libraries.
|
|
||||||
{ name = "libidn2.so.0"; pkg = libidn2; }
|
|
||||||
{ name = "libidn.so.12"; pkg = null; }
|
|
||||||
{ name = "libidn.so.11"; pkg = null; }
|
|
||||||
|
|
||||||
# journalctl --grep requires libpcre so lets provide it
|
patchDlOpen = dl:
|
||||||
{ name = "libpcre2-8.so.0"; pkg = pcre2; }
|
let
|
||||||
];
|
library = "${lib.makeLibraryPath [ dl.pkg ]}/${dl.name}";
|
||||||
|
in
|
||||||
patchDlOpen = dl: let
|
if dl.pkg == null then ''
|
||||||
library = "${lib.makeLibraryPath [dl.pkg]}/${dl.name}";
|
# remove the dependency on the library by replacing it with an invalid path
|
||||||
in if dl.pkg == null then ''
|
for file in $(grep -lr 'dlopen("${dl.name}"' src); do
|
||||||
# remove the dependency on the library by replacing it with an invalid path
|
echo "patching dlopen(\"${dl.name}\", …) in $file to an invalid store path ("/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-not-implemented/${dl.name}")…"
|
||||||
for file in $(grep -lr 'dlopen("${dl.name}"' src); do
|
substituteInPlace "$file" --replace 'dlopen("${dl.name}"' 'dlopen("/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-not-implemented/${dl.name}"'
|
||||||
echo "patching dlopen(\"${dl.name}\", …) in $file to an invalid store path ("/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-not-implemented/${dl.name}")…"
|
done
|
||||||
substituteInPlace "$file" --replace 'dlopen("${dl.name}"' 'dlopen("/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-not-implemented/${dl.name}"'
|
'' else ''
|
||||||
done
|
# ensure that the library we provide actually exists
|
||||||
'' else ''
|
if ! [ -e ${library} ]; then
|
||||||
# ensure that the library we provide actually exists
|
echo 'The shared library `${library}` does not exist but was given as subtitute for `${dl.name}`'
|
||||||
if ! [ -e ${library} ]; then
|
exit 1
|
||||||
echo 'The shared library `${library}` does not exist but was given as subtitute for `${dl.name}`'
|
fi
|
||||||
exit 1
|
# make the path to the dependency explicit
|
||||||
fi
|
for file in $(grep -lr 'dlopen("${dl.name}"' src); do
|
||||||
# make the path to the dependency explicit
|
echo "patching dlopen(\"${dl.name}\", …) in $file to ${library}…"
|
||||||
for file in $(grep -lr 'dlopen("${dl.name}"' src); do
|
substituteInPlace "$file" --replace 'dlopen("${dl.name}"' 'dlopen("${library}"'
|
||||||
echo "patching dlopen(\"${dl.name}\", …) in $file to ${library}…"
|
done
|
||||||
substituteInPlace "$file" --replace 'dlopen("${dl.name}"' 'dlopen("${library}"'
|
'';
|
||||||
done
|
in
|
||||||
'';
|
# patch all the dlopen calls to contain absolute paths to the libraries
|
||||||
in # patch all the dlopen calls to contain absolute paths to the libraries
|
lib.concatMapStringsSep "\n" patchDlOpen dlopenLibs
|
||||||
lib.concatMapStringsSep "\n" patchDlOpen dlopenLibs)
|
)
|
||||||
# finally ensure that there are no left-over dlopen calls that we didn't handle
|
# finally ensure that there are no left-over dlopen calls that we didn't handle
|
||||||
+ ''
|
+ ''
|
||||||
if grep -qr 'dlopen("[^/]' src; then
|
if grep -qr 'dlopen("[^/]' src; then
|
||||||
|
Loading…
Reference in New Issue
Block a user