1{ lib, stdenv, fetchurl, gettext, libsepol, libselinux, libsemanage, libxcrypt }:
2
3stdenv.mkDerivation rec {
4 pname = "policycoreutils";
5 version = "3.3";
6 inherit (libsepol) se_url;
7
8 src = fetchurl {
9 url = "${se_url}/${version}/policycoreutils-${version}.tar.gz";
10 sha256 = "0y0hl32b2ks7r0fhbx3k2j1gqqms5aplyasjs3fz50caxl6096a1";
11 };
12
13 postPatch = ''
14 # Fix install references
15 substituteInPlace po/Makefile \
16 --replace /usr/bin/install install --replace /usr/share /share
17 substituteInPlace newrole/Makefile --replace /usr/share /share
18
19 sed -i -e '39i#include <crypt.h>' run_init/run_init.c
20 '';
21
22 nativeBuildInputs = [ gettext ];
23 buildInputs = [ libsepol libselinux libsemanage libxcrypt ];
24
25 makeFlags = [
26 "PREFIX=$(out)"
27 "SBINDIR=$(out)/bin"
28 "ETCDIR=$(out)/etc"
29 "BASHCOMPLETIONDIR=$out/share/bash-completion/completions"
30 "LOCALEDIR=$(out)/share/locale"
31 "MAN5DIR=$(out)/share/man/man5"
32 ];
33
34 meta = with lib; {
35 description = "SELinux policy core utilities";
36 license = licenses.gpl2;
37 inherit (libsepol.meta) homepage platforms maintainers;
38 };
39}