summary refs log tree commit diff
path: root/pkgs/os-specific/linux/libselinux
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2013-06-24 08:37:33 +0200
committeraszlig <aszlig@redmoonstudios.org>2013-06-24 10:33:17 +0200
commitb574d0146fdd1077d637dbf9433c569dfb533622 (patch)
tree21d453e4b58e98f70d203cb0af5305ec1872e27d /pkgs/os-specific/linux/libselinux
parentc53918b6f1eaa4dc033db319b695c4e78e43c697 (diff)
downloadnixpkgs-b574d0146fdd1077d637dbf9433c569dfb533622.tar
nixpkgs-b574d0146fdd1077d637dbf9433c569dfb533622.tar.gz
nixpkgs-b574d0146fdd1077d637dbf9433c569dfb533622.tar.bz2
nixpkgs-b574d0146fdd1077d637dbf9433c569dfb533622.tar.lz
nixpkgs-b574d0146fdd1077d637dbf9433c569dfb533622.tar.xz
nixpkgs-b574d0146fdd1077d637dbf9433c569dfb533622.tar.zst
nixpkgs-b574d0146fdd1077d637dbf9433c569dfb533622.zip
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>
Diffstat (limited to 'pkgs/os-specific/linux/libselinux')
-rw-r--r--pkgs/os-specific/linux/libselinux/default.nix18
1 files changed, 15 insertions, 3 deletions
diff --git a/pkgs/os-specific/linux/libselinux/default.nix b/pkgs/os-specific/linux/libselinux/default.nix
index 873065d5424..01935e76632 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;