2013-06-24 06:37:33 +00:00
|
|
|
{ stdenv, fetchurl, pkgconfig, libsepol, pcre
|
|
|
|
, enablePython ? false, swig ? null, python ? null
|
|
|
|
}:
|
|
|
|
|
|
|
|
assert enablePython -> swig != null && python != null;
|
|
|
|
|
|
|
|
with stdenv.lib;
|
2006-08-27 18:05:18 +00:00
|
|
|
|
2011-03-27 04:45:38 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "libselinux-${version}";
|
2014-02-24 20:31:30 +00:00
|
|
|
version = "2.2.2";
|
2013-02-24 12:25:53 +00:00
|
|
|
inherit (libsepol) se_release se_url;
|
2011-03-27 04:45:38 +00:00
|
|
|
|
2006-08-27 18:05:18 +00:00
|
|
|
src = fetchurl {
|
2013-02-24 12:25:53 +00:00
|
|
|
url = "${se_url}/${se_release}/libselinux-${version}.tar.gz";
|
2014-02-24 20:31:30 +00:00
|
|
|
sha256 = "0gjs5cqwhqzmf0avnn0343ip69153k9z35vbp03sjvc02qs3darh";
|
2006-08-27 18:05:18 +00:00
|
|
|
};
|
|
|
|
|
2013-06-24 06:37:33 +00:00
|
|
|
buildInputs = [ pkgconfig libsepol pcre ]
|
|
|
|
++ optionals enablePython [ swig python ];
|
2011-03-27 04:45:38 +00:00
|
|
|
|
2013-06-24 06:37:33 +00:00
|
|
|
postPatch = optionalString enablePython ''
|
|
|
|
sed -i -e 's|\$(LIBDIR)/libsepol.a|${libsepol}/lib/libsepol.a|' src/Makefile
|
|
|
|
'';
|
|
|
|
|
2013-11-28 08:58:06 +00:00
|
|
|
installFlags = [ "PREFIX=$(out)" "DESTDIR=$(out)" ];
|
2013-06-24 06:37:33 +00:00
|
|
|
installTargets = [ "install" ] ++ optional enablePython "install-pywrap";
|
2013-02-24 12:25:53 +00:00
|
|
|
|
2013-11-28 08:58:06 +00:00
|
|
|
# TODO: Figure out why the build incorrectly links libselinux.so
|
|
|
|
postInstall = ''
|
|
|
|
rm $out/lib/libselinux.so
|
|
|
|
ln -s libselinux.so.1 $out/lib/libselinux.so
|
|
|
|
'';
|
|
|
|
|
2013-02-24 12:25:53 +00:00
|
|
|
meta = {
|
|
|
|
inherit (libsepol.meta) homepage platforms maintainers;
|
|
|
|
};
|
2006-08-27 18:05:18 +00:00
|
|
|
}
|