depot/third_party/nixpkgs/pkgs/tools/system/minijail/tools.nix
Default email 02cf88bb76 Project import generated by Copybara.
GitOrigin-RevId: c4a0efdd5a728e20791b8d8d2f26f90ac228ee8d
2022-08-12 15:06:08 +03:00

40 lines
1.1 KiB
Nix

{ lib, stdenv, buildPythonApplication, pkgsBuildTarget, python, minijail }:
let
targetClang = pkgsBuildTarget.targetPackages.clangStdenv.cc;
in
buildPythonApplication {
pname = "minijail-tools";
inherit (minijail) version src;
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
${python.pythonForBuild.interpreter} tools/generate_constants_json.py \
--output constants.json \
libconstants.gen.ll libsyscalls.gen.ll
'';
postInstall = ''
mkdir -p $out/share
cp -v constants.json $out/share/constants.json
'';
meta = with lib; {
homepage = "https://android.googlesource.com/platform/external/minijail/+/refs/heads/master/tools/";
description = "A set of tools for minijail";
license = licenses.asl20;
inherit (minijail.meta) maintainers platforms;
};
}