From b574d0146fdd1077d637dbf9433c569dfb533622 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 24 Jun 2013 08:37:33 +0200 Subject: [PATCH] libselinux: Add option to enable Python support. The reason this is optional is because we might want to use it for bootstrapping in some constellations. And we really don't want whole lot of dependencies in those situations. Signed-off-by: aszlig --- pkgs/os-specific/linux/libselinux/default.nix | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/pkgs/os-specific/linux/libselinux/default.nix b/pkgs/os-specific/linux/libselinux/default.nix index 873065d54244..01935e766324 100644 --- a/pkgs/os-specific/linux/libselinux/default.nix +++ b/pkgs/os-specific/linux/libselinux/default.nix @@ -1,4 +1,10 @@ -{ stdenv, fetchurl, pkgconfig, libsepol, pcre }: +{ stdenv, fetchurl, pkgconfig, libsepol, pcre +, enablePython ? false, swig ? null, python ? null +}: + +assert enablePython -> swig != null && python != null; + +with stdenv.lib; stdenv.mkDerivation rec { name = "libselinux-${version}"; @@ -17,7 +23,8 @@ stdenv.mkDerivation rec { patches = [ ./fPIC.patch ]; # libsemanage seems to need -fPIC everywhere - buildInputs = [ pkgconfig libsepol pcre ]; + buildInputs = [ pkgconfig libsepol pcre ] + ++ optionals enablePython [ swig python ]; prePatch = '' tar xvf ${patch_src} @@ -26,7 +33,12 @@ stdenv.mkDerivation rec { done ''; - preInstall = '' makeFlags="$makeFlags PREFIX=$out DESTDIR=$out" ''; + postPatch = optionalString enablePython '' + sed -i -e 's|\$(LIBDIR)/libsepol.a|${libsepol}/lib/libsepol.a|' src/Makefile + ''; + + installFlags = [ "PREFIX=$(out)" "DESTDIR=$(out)" "LIBSEPOLDIR=${libsepol}" ]; + installTargets = [ "install" ] ++ optional enablePython "install-pywrap"; meta = { inherit (libsepol.meta) homepage platforms maintainers;