@@ -1,64 +1,33 @@
1−{ stdenv, fetchurl, pythonPackages, gettext
2−, setools, libsepol, libselinux, libcap_ng, libsemanage, sepolgen
1+{ stdenv, fetchurl, gettext, libsepol, libselinux, libsemanage }:
5stdenv.mkDerivation rec {
3stdenv.mkDerivation rec {
6 name = "policycoreutils-${version}";
4 name = "policycoreutils-${version}";
7− version = "2.4";
5+ version = "2.7";
8 inherit (libsepol) se_release se_url;
6 inherit (libsepol) se_release se_url;
10 src = fetchurl {
8 src = fetchurl {
11 url = "${se_url}/${se_release}/policycoreutils-${version}.tar.gz";
9 url = "${se_url}/${se_release}/policycoreutils-${version}.tar.gz";
12− sha256 = "0y9l9k60iy21hj0lcvfdfxs1fxydg6d3pxp9rhy7hwr4y5vgh6dq";
10+ sha256 = "1x742c7lkw30namhkw87yg7z384qzqjz0pvmqs0lk19v6958l6qa";
15− patches = [ ./fix-printf-type.patch ];
17 postPatch = ''
13 postPatch = ''
18− # Fix references to libsepol.a
19− find . -name Makefile -exec sed -i 's,[^ ]*/libsepol.a,${libsepol}/lib/libsepol.a,g' {} \;
21 # Fix install references
14 # Fix install references
22− substituteInPlace po/Makefile --replace /usr/bin/install install
15+ substituteInPlace po/Makefile \
23−
16+ --replace /usr/bin/install install --replace /usr/share /share
24− # Fix references to /usr/share
17+ substituteInPlace newrole/Makefile --replace /usr/share /share
25− grep -r '/usr/share' | awk -F: '{print $1}' | xargs sed -i "s,\(\$(DESTDIR)\)*/usr/share,$out/share,g"
27− # Fix sepolicy install
28− sed -i "s,\(setup.py install\).*,\1 --prefix=$out,g" sepolicy/Makefile
31− sed -i 's|-m 4755|-m 755|' sandbox/Makefile
34− nativeBuildInputs = [ pythonPackages.python gettext ];
20+ nativeBuildInputs = [ gettext ];
35− buildInputs = [ setools libsepol libselinux libcap_ng libsemanage ];
21+ buildInputs = [ libsepol libselinux libsemanage ];
36− pythonPath = [ libselinux sepolgen ];
38 preBuild = ''
23 preBuild = ''
39 makeFlagsArray+=("PREFIX=$out")
24 makeFlagsArray+=("PREFIX=$out")
40 makeFlagsArray+=("DESTDIR=$out")
25 makeFlagsArray+=("DESTDIR=$out")
26+ makeFlagsArray+=("BASHCOMPLETIONDIR=$out/share/bash-completion/completions")
27+ makeFlagsArray+=("LOCALEDIR=$out/share/locale")
28+ makeFlagsArray+=("MAN5DIR=$out/share/man/man5")
43− # Creation of the system-config-selinux directory is broken
45− mkdir -p $out/share/system-config-selinux
48− # Fix the python scripts to include paths to libraries
49− # NOTE: We are not using wrapPythonPrograms or makeWrapper as these scripts
50− # purge the environment as a security measure
52− grep -r '#!.*python' $out/bin | awk -F: '{print $1}' | xargs sed -i "1a \
54− sys.path.append('$(toPythonPath "$out")'); \
55− ${stdenv.lib.flip stdenv.lib.concatMapStrings pythonPath (lib: ''
56− sys.path.append('$(toPythonPath "${lib}")'); \
60− NIX_CFLAGS_COMPILE = "-fstack-protector-all";
62 meta = with stdenv.lib; {
31 meta = with stdenv.lib; {
63 description = "SELinux policy core utilities";
32 description = "SELinux policy core utilities";
64 license = licenses.gpl2;
33 license = licenses.gpl2;