Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchurl, pkg-config, bison, flex, libsepol, libselinux, bzip2, audit 2, enablePython ? true, swig ? null, python ? null 3}: 4 5with lib; 6 7stdenv.mkDerivation rec { 8 pname = "libsemanage"; 9 version = "3.5"; 10 inherit (libsepol) se_url; 11 12 src = fetchurl { 13 url = "${se_url}/${version}/libsemanage-${version}.tar.gz"; 14 sha256 = "sha256-9TU05QJHU4KA7Q12xs6B2Ps5Ob1kytuJ2hDbpC5A3Zw="; 15 }; 16 17 outputs = [ "out" "dev" "man" ] ++ optional enablePython "py"; 18 19 strictDeps = true; 20 21 nativeBuildInputs = [ bison flex pkg-config ] ++ optional enablePython swig; 22 buildInputs = [ libsepol libselinux bzip2 audit ] 23 ++ optional enablePython python; 24 25 makeFlags = [ 26 "PREFIX=$(out)" 27 "INCLUDEDIR=$(dev)/include" 28 "MAN3DIR=$(man)/share/man/man3" 29 "MAN5DIR=$(man)/share/man/man5" 30 "PYTHON=python" 31 "PYPREFIX=python" 32 "PYTHONLIBDIR=$(py)/${python.sitePackages}" 33 "DEFAULT_SEMANAGE_CONF_LOCATION=$(out)/etc/selinux/semanage.conf" 34 ]; 35 36 # The following turns the 'clobbered' error into a warning 37 # which should fix the following error: 38 # 39 # semanage_store.c: In function 'semanage_exec_prog': 40 # semanage_store.c:1278:6: error: variable 'i' might be clobbered by 'longjmp' or 'vfork' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wclobbered-Werror=clobbered8;;] 41 # 1278 | int i; 42 # | ^ 43 # cc1: all warnings being treated as errors 44 env.NIX_CFLAGS_COMPILE = toString [ "-Wno-error=clobbered" ]; 45 46 installTargets = [ "install" ] ++ optionals enablePython [ "install-pywrap" ]; 47 48 enableParallelBuilding = true; 49 50 meta = removeAttrs libsepol.meta ["outputsToInstall"] // { 51 description = "Policy management tools for SELinux"; 52 license = lib.licenses.lgpl21; 53 }; 54}