Files
nixpkgs/pkgs/os-specific/linux/policycoreutils/default.nix
T

66 lines
2.0 KiB
Nix
Raw Normal View History

2015-07-31 17:00:57 -07:00
{ stdenv, fetchurl, pythonPackages, gettext
, setools, libsepol, libselinux, libcap_ng, libsemanage, sepolgen
}:
2011-03-27 04:46:19 +00:00
2015-07-31 17:00:57 -07:00
stdenv.mkDerivation rec {
2011-03-27 04:46:19 +00:00
name = "policycoreutils-${version}";
2015-07-31 17:00:57 -07:00
version = "2.4";
2013-02-24 13:25:53 +01:00
inherit (libsepol) se_release se_url;
2011-03-27 04:46:19 +00:00
src = fetchurl {
2013-02-24 13:25:53 +01:00
url = "${se_url}/${se_release}/policycoreutils-${version}.tar.gz";
2015-07-31 17:00:57 -07:00
sha256 = "0y9l9k60iy21hj0lcvfdfxs1fxydg6d3pxp9rhy7hwr4y5vgh6dq";
2011-03-27 04:46:19 +00:00
};
patches = [ ./fix-printf-type.patch ];
2015-07-31 17:00:57 -07:00
postPatch = ''
# Fix references to libsepol.a
find . -name Makefile -exec sed -i 's,[^ ]*/libsepol.a,${libsepol}/lib/libsepol.a,g' {} \;
# Fix install references
2013-02-24 13:25:53 +01:00
substituteInPlace po/Makefile --replace /usr/bin/install install
2015-07-31 17:00:57 -07:00
# Fix references to /usr/share
grep -r '/usr/share' | awk -F: '{print $1}' | xargs sed -i "s,\(\$(DESTDIR)\)*/usr/share,$out/share,g"
# Fix sepolicy install
sed -i "s,\(setup.py install\).*,\1 --prefix=$out,g" sepolicy/Makefile
2013-02-24 13:25:53 +01:00
'';
2011-03-27 04:46:19 +00:00
2015-07-31 17:00:57 -07:00
nativeBuildInputs = [ pythonPackages.python gettext ];
buildInputs = [ setools libsepol libselinux libcap_ng libsemanage ];
pythonPath = [ libselinux sepolgen ];
2011-03-28 07:38:16 +00:00
2013-02-24 13:25:53 +01:00
preBuild = ''
2015-07-31 17:00:57 -07:00
makeFlagsArray+=("PREFIX=$out")
makeFlagsArray+=("DESTDIR=$out")
2013-02-24 13:25:53 +01:00
'';
2013-11-28 02:58:06 -06:00
# Creation of the system-config-selinux directory is broken
preInstall = ''
mkdir -p $out/share/system-config-selinux
'';
2015-07-31 17:00:57 -07:00
# Fix the python scripts to include paths to libraries
# NOTE: We are not using wrapPythonPrograms or makeWrapper as these scripts
# purge the environment as a security measure
postInstall = ''
grep -r '#!.*python' $out/bin | awk -F: '{print $1}' | xargs sed -i "1a \
import sys; \
sys.path.append('$(toPythonPath "$out")'); \
${stdenv.lib.flip stdenv.lib.concatMapStrings pythonPath (lib: ''
sys.path.append('$(toPythonPath "${lib}")'); \
'')}"
'';
2013-02-24 13:25:53 +01:00
NIX_CFLAGS_COMPILE = "-fstack-protector-all";
2014-08-21 17:29:51 +02:00
2011-03-27 04:46:19 +00:00
meta = with stdenv.lib; {
description = "SELinux policy core utilities";
license = licenses.gpl2;
2013-02-24 13:25:53 +01:00
inherit (libsepol.meta) homepage platforms maintainers;
2011-03-27 04:46:19 +00:00
};
2013-02-24 13:25:53 +01:00
}