1{ lib, stdenv, fetchurl, gettext, libsepol, libselinux, libsemanage }:
2
3stdenv.mkDerivation rec {
4 pname = "policycoreutils";
5 version = "2.9";
6 inherit (libsepol) se_release se_url;
7
8 src = fetchurl {
9 url = "${se_url}/${se_release}/policycoreutils-${version}.tar.gz";
10 sha256 = "0yqg5ws5gbl1cbn8msxdk1c3ilmmx58qg5dx883kqyq0517k8g65";
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 ];
24
25 makeFlags = [
26 "PREFIX=$(out)"
27 "SBINDIR=$(out)/sbin"
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}