s6-linux-init: fix cross compilation

Co-authored-by: sternenseemann <sternenseemann@systemli.org>
This commit is contained in:
Adam Joseph 2024-04-16 11:36:31 +02:00 committed by sternenseemann
parent 31dddc574f
commit 4b46c7e8eb
1 changed files with 16 additions and 1 deletions

View File

@ -1,4 +1,11 @@
{ lib, skawarePackages, skalibs, execline, s6 }:
{ lib
, stdenv
, skawarePackages
, skalibs
, execline
, s6
, targetPackages
}:
skawarePackages.buildPackage {
pname = "s6-linux-init";
@ -25,6 +32,14 @@ skawarePackages.buildPackage {
"--with-dynlib=${s6.out}/lib"
];
# See ../s6-rc/default.nix for an explanation
postConfigure = lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) ''
substituteInPlace src/init/s6-linux-init-maker.c \
--replace-fail '<execline/config.h>' '"${targetPackages.execline.dev}/include/execline/config.h"' \
--replace-fail '<s6/config.h>' '"${targetPackages.s6.dev}/include/s6/config.h"' \
--replace-fail '<s6-linux-init/config.h>' '"${targetPackages.s6-linux-init.dev}/include/s6-linux-init/config.h"'
'';
postInstall = ''
# remove all s6 executables from build directory
rm $(find -name "s6-*" -type f -mindepth 1 -maxdepth 1 -executable)