2021-01-19 06:50:56 +00:00
{ lib , stdenv , fetchurl , pkg-config , bison , flex , libsepol , libselinux , bzip2 , audit
2018-03-14 12:43:48 +00:00
, enablePython ? true , swig ? null , python ? null
} :
2021-01-15 14:45:37 +00:00
with lib ;
2011-03-27 05:46:12 +01:00
2015-07-31 20:40:31 +01:00
stdenv . mkDerivation rec {
2019-08-15 13:41:18 +01:00
pname = " l i b s e m a n a g e " ;
2019-08-17 18:08:49 +01:00
version = " 2 . 9 " ;
2013-02-24 12:25:53 +00:00
inherit ( libsepol ) se_release se_url ;
2011-03-27 05:46:12 +01:00
src = fetchurl {
2013-02-24 12:25:53 +00:00
url = " ${ se_url } / ${ se_release } / l i b s e m a n a g e - ${ version } . t a r . g z " ;
2019-08-17 18:08:49 +01:00
sha256 = " 0 7 5 w 6 y 3 l 9 h i y 5 h i c g w r m i j y x m h f y d 1 r 7 c n c 0 8 q x y g 4 j 4 6 j f k 8 x i 5 " ;
} ;
outputs = [ " o u t " " d e v " " m a n " ] ++ optional enablePython " p y " ;
2011-03-27 05:46:12 +01:00
2021-01-19 06:50:56 +00:00
nativeBuildInputs = [ bison flex pkg-config ] ;
2018-07-17 21:11:16 +01:00
buildInputs = [ libsepol libselinux bzip2 audit ]
2018-03-14 12:43:48 +00:00
++ optionals enablePython [ swig python ] ;
2015-07-31 21:02:41 +01:00
2019-08-17 18:08:49 +01:00
makeFlags = [
" P R E F I X = $ ( o u t ) "
" I N C L U D E D I R = $ ( d e v ) / i n c l u d e "
" M A N 3 D I R = $ ( m a n ) / s h a r e / m a n / m a n 3 "
" M A N 5 D I R = $ ( m a n ) / s h a r e / m a n / m a n 5 "
" P Y T H O N = p y t h o n "
" P Y T H O N L I B D I R = $ ( p y ) / ${ python . sitePackages } "
" D E F A U L T _ S E M A N A G E _ C O N F _ L O C A T I O N = $ ( o u t ) / e t c / s e l i n u x / s e m a n a g e . c o n f "
] ;
2013-02-24 12:25:53 +00:00
2021-02-08 13:08:17 +00:00
# The following turns the 'clobbered' error into a warning
# which should fix the following error:
#
# semanage_store.c: In function 'semanage_exec_prog':
# 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;; ]
# 1278 | int i;
# | ^
# cc1: all warnings being treated as errors
NIX_CFLAGS_COMPILE = [ " - W n o - e r r o r = c l o b b e r e d " ] ;
2018-03-14 12:43:48 +00:00
installTargets = [ " i n s t a l l " ] ++ optionals enablePython [ " i n s t a l l - p y w r a p " ] ;
2018-07-29 22:22:56 +01:00
meta = removeAttrs libsepol . meta [ " o u t p u t s T o I n s t a l l " ] // {
2011-03-27 05:46:12 +01:00
description = " P o l i c y m a n a g e m e n t t o o l s f o r S E L i n u x " ;
2021-01-15 14:45:37 +00:00
license = lib . licenses . lgpl21 ;
2011-03-27 05:46:12 +01:00
} ;
2013-02-24 12:25:53 +00:00
}