2023-07-25 16:12:44 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonApplication,
|
|
|
|
pkgsBuildTarget,
|
|
|
|
python,
|
|
|
|
minijail,
|
|
|
|
}:
|
2022-07-16 13:34:58 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
targetClang = pkgsBuildTarget.targetPackages.clangStdenv.cc;
|
|
|
|
in
|
2020-03-27 07:11:12 +00:00
|
|
|
|
|
|
|
buildPythonApplication {
|
|
|
|
pname = "minijail-tools";
|
|
|
|
inherit (minijail) version src;
|
|
|
|
|
2022-07-16 13:34:58 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace Makefile --replace /bin/echo echo
|
|
|
|
'';
|
|
|
|
|
|
|
|
postConfigure = ''
|
|
|
|
substituteInPlace tools/compile_seccomp_policy.py \
|
|
|
|
--replace "'constants.json'" "'$out/share/constants.json'"
|
|
|
|
'';
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
make libconstants.gen.c libsyscalls.gen.c
|
|
|
|
${targetClang}/bin/${targetClang.targetPrefix}cc -S -emit-llvm \
|
|
|
|
libconstants.gen.c libsyscalls.gen.c
|
2023-11-06 01:38:24 +00:00
|
|
|
${python.pythonOnBuildForHost.interpreter} tools/generate_constants_json.py \
|
2022-07-16 13:34:58 +00:00
|
|
|
--output constants.json \
|
|
|
|
libconstants.gen.ll libsyscalls.gen.ll
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/share
|
|
|
|
cp -v constants.json $out/share/constants.json
|
|
|
|
'';
|
|
|
|
|
2020-03-27 07:11:12 +00:00
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://android.googlesource.com/platform/external/minijail/+/refs/heads/master/tools/";
|
|
|
|
description = "Set of tools for minijail";
|
|
|
|
license = licenses.asl20;
|
|
|
|
inherit (minijail.meta) maintainers platforms;
|
|
|
|
};
|
|
|
|
}
|