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 04:46:12 +00:00
2015-07-31 19:40:31 +00:00
stdenv . mkDerivation rec {
2019-08-15 12:41:18 +00:00
pname = " l i b s e m a n a g e " ;
2021-11-12 09:20:45 +00:00
version = " 3 . 3 " ;
inherit ( libsepol ) se_url ;
2011-03-27 04:46:12 +00:00
src = fetchurl {
2021-11-12 09:20:45 +00:00
url = " ${ se_url } / ${ version } / l i b s e m a n a g e - ${ version } . t a r . g z " ;
sha256 = " 1 s 3 w b 6 6 l 4 7 b l c 1 5 s 6 l k q s 1 1 j 9 l 8 p y c d q q b b 0 3 x 3 v p f r l z 9 d f r l 4 4 " ;
2019-08-17 17:08:49 +00:00
} ;
outputs = [ " o u t " " d e v " " m a n " ] ++ optional enablePython " p y " ;
2011-03-27 04:46:12 +00:00
2021-11-12 11:01:57 +00:00
strictDeps = true ;
nativeBuildInputs = [ bison flex pkg-config ] ++ optional enablePython swig ;
2018-07-17 20:11:16 +00:00
buildInputs = [ libsepol libselinux bzip2 audit ]
2021-11-12 11:01:57 +00:00
++ optional enablePython python ;
2015-07-31 20:02:41 +00:00
2019-08-17 17:08:49 +00: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 "
2021-11-12 11:01:57 +00:00
" P Y P R E F I X = p y t h o n "
2019-08-17 17:08:49 +00:00
" 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 " ] ;
2021-11-12 15:54:29 +00:00
enableParallelBuilding = true ;
2018-07-29 21:22:56 +00:00
meta = removeAttrs libsepol . meta [ " o u t p u t s T o I n s t a l l " ] // {
2011-03-27 04:46:12 +00: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 04:46:12 +00:00
} ;
2013-02-24 12:25:53 +00:00
}