2018-03-14 05:25:41 -07:00
|
|
|
{ stdenv, fetchurl, pcre, pkgconfig, libsepol
|
2015-07-31 17:00:57 -07:00
|
|
|
, enablePython ? true, swig ? null, python ? null
|
2013-06-23 23:37:33 -07:00
|
|
|
}:
|
|
|
|
|
|
|
|
assert enablePython -> swig != null && python != null;
|
|
|
|
|
|
|
|
with stdenv.lib;
|
2006-08-27 11:05:18 -07:00
|
|
|
|
2011-03-26 21:45:38 -07:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "libselinux-${version}";
|
2018-03-14 05:25:41 -07:00
|
|
|
version = "2.7";
|
2013-02-24 04:25:53 -08:00
|
|
|
inherit (libsepol) se_release se_url;
|
2011-03-26 21:45:38 -07:00
|
|
|
|
2006-08-27 11:05:18 -07:00
|
|
|
src = fetchurl {
|
2013-02-24 04:25:53 -08:00
|
|
|
url = "${se_url}/${se_release}/libselinux-${version}.tar.gz";
|
2018-03-14 05:25:41 -07:00
|
|
|
sha256 = "0mwcq78v6ngbq06xmb9dvilpg0jnl2vs9fgrpakhmmiskdvc1znh";
|
2006-08-27 11:05:18 -07:00
|
|
|
};
|
|
|
|
|
2017-09-05 14:26:13 -07:00
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
|
|
|
buildInputs = [ libsepol pcre ]
|
2013-06-23 23:37:33 -07:00
|
|
|
++ optionals enablePython [ swig python ];
|
2011-03-26 21:45:38 -07:00
|
|
|
|
2018-03-14 05:25:41 -07:00
|
|
|
# drop fortify here since package uses it by default, leading to compile error:
|
|
|
|
# command-line>:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
|
|
|
|
hardeningDisable = [ "fortify" ];
|
2016-08-19 08:30:22 -07:00
|
|
|
|
2013-06-23 23:37:33 -07:00
|
|
|
postPatch = optionalString enablePython ''
|
|
|
|
sed -i -e 's|\$(LIBDIR)/libsepol.a|${libsepol}/lib/libsepol.a|' src/Makefile
|
|
|
|
'';
|
|
|
|
|
2018-03-14 05:25:41 -07:00
|
|
|
# fix install locations
|
2015-07-31 12:40:17 -07:00
|
|
|
preBuild = ''
|
|
|
|
makeFlagsArray+=("PREFIX=$out")
|
|
|
|
makeFlagsArray+=("DESTDIR=$out")
|
2018-03-14 05:25:41 -07:00
|
|
|
makeFlagsArray+=("MAN3DIR=$out/share/man/man3")
|
|
|
|
makeFlagsArray+=("MAN5DIR=$out/share/man/man5")
|
|
|
|
makeFlagsArray+=("MAN8DIR=$out/share/man/man8")
|
2018-03-20 06:52:37 -07:00
|
|
|
makeFlagsArray+=("PYSITEDIR=$out/lib/${python.libPrefix}/site-packages")
|
2013-11-28 00:58:06 -08:00
|
|
|
'';
|
|
|
|
|
2015-07-31 12:40:17 -07:00
|
|
|
installTargets = [ "install" ] ++ optional enablePython "install-pywrap";
|
|
|
|
|
|
|
|
meta = libsepol.meta // {
|
|
|
|
description = "SELinux core library";
|
2013-02-24 04:25:53 -08:00
|
|
|
};
|
2006-08-27 11:05:18 -07:00
|
|
|
}
|