2015-09-24 03:49:17 +00:00
|
|
|
{ stdenv, fetchurl, swig ? null, python2 ? null, python3 ? null }:
|
2013-02-24 10:19:35 +00:00
|
|
|
|
2015-09-24 03:49:17 +00:00
|
|
|
assert python2 != null || python3 != null -> swig != null;
|
2013-02-24 10:19:35 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "libcap-ng-${version}";
|
2015-09-24 03:49:17 +00:00
|
|
|
# When updating make sure to test that the version with
|
|
|
|
# all of the python bindings still works
|
2017-06-20 03:57:03 +00:00
|
|
|
version = "0.7.8";
|
2013-02-24 10:19:35 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "${meta.homepage}/${name}.tar.gz";
|
2017-06-20 03:57:03 +00:00
|
|
|
sha256 = "0pyhjxgsph3p28ayk4ynxab6wvzaqmazk1nkamx11m2w8jbzj6n2";
|
2013-02-24 10:19:35 +00:00
|
|
|
};
|
|
|
|
|
2015-09-24 03:49:17 +00:00
|
|
|
nativeBuildInputs = [ swig ];
|
|
|
|
buildInputs = [ python2 python3 ];
|
2013-02-24 10:19:35 +00:00
|
|
|
|
2015-09-24 03:49:17 +00:00
|
|
|
postPatch = ''
|
|
|
|
function get_header() {
|
|
|
|
echo -e "#include <$1>" | gcc -M -xc - | tr ' ' '\n' | grep "$1" | head -n 1
|
|
|
|
}
|
|
|
|
|
|
|
|
# Fix some hardcoding of header paths
|
|
|
|
sed -i "s,/usr/include/linux/capability.h,$(get_header linux/capability.h),g" bindings/python{,3}/Makefile.in
|
|
|
|
'';
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
(if python2 != null then "--with-python" else "--without-python")
|
|
|
|
(if python3 != null then "--with-python3" else "--without-python3")
|
|
|
|
];
|
|
|
|
|
|
|
|
meta = let inherit (stdenv.lib) platforms licenses maintainers; in {
|
2013-02-24 10:19:35 +00:00
|
|
|
description = "Library for working with POSIX capabilities";
|
|
|
|
homepage = http://people.redhat.com/sgrubb/libcap-ng/;
|
2015-09-24 03:49:17 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
license = licenses.lgpl21;
|
|
|
|
maintainers = with maintainers; [ wkennington ];
|
2013-02-24 10:19:35 +00:00
|
|
|
};
|
|
|
|
}
|