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 <aszlig@redmoonstudios.org>
This commit is contained in:
aszlig 2013-06-24 08:37:33 +02:00
parent c53918b6f1
commit b574d0146f
No known key found for this signature in database
GPG Key ID: D0EBD0EC8C2DC961

View File

@ -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 { stdenv.mkDerivation rec {
name = "libselinux-${version}"; name = "libselinux-${version}";
@ -17,7 +23,8 @@ stdenv.mkDerivation rec {
patches = [ ./fPIC.patch ]; # libsemanage seems to need -fPIC everywhere patches = [ ./fPIC.patch ]; # libsemanage seems to need -fPIC everywhere
buildInputs = [ pkgconfig libsepol pcre ]; buildInputs = [ pkgconfig libsepol pcre ]
++ optionals enablePython [ swig python ];
prePatch = '' prePatch = ''
tar xvf ${patch_src} tar xvf ${patch_src}
@ -26,7 +33,12 @@ stdenv.mkDerivation rec {
done 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 = { meta = {
inherit (libsepol.meta) homepage platforms maintainers; inherit (libsepol.meta) homepage platforms maintainers;