2021-01-15 15:45:37 +01:00
|
|
|
{ lib, stdenv, fetchurl, swig ? null, python2 ? null, python3 ? null }:
|
2013-02-24 11:19:35 +01:00
|
|
|
|
2015-09-24 05:49:17 +02:00
|
|
|
assert python2 != null || python3 != null -> swig != null;
|
2013-02-24 11:19:35 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "libcap-ng";
|
2015-09-24 05:49:17 +02:00
|
|
|
# When updating make sure to test that the version with
|
|
|
|
# all of the python bindings still works
|
2021-01-07 17:29:15 +01:00
|
|
|
version = "0.8.2";
|
2013-02-24 11:19:35 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2019-08-15 14:41:18 +02:00
|
|
|
url = "${meta.homepage}/${pname}-${version}.tar.gz";
|
2021-01-07 17:29:15 +01:00
|
|
|
sha256 = "1sasp1n154aqy9fz0knlb966svm7xg1zjhg1vr4q839bgjvq7h2j";
|
2013-02-24 11:19:35 +01:00
|
|
|
};
|
|
|
|
|
2015-09-24 05:49:17 +02:00
|
|
|
nativeBuildInputs = [ swig ];
|
|
|
|
buildInputs = [ python2 python3 ];
|
2013-02-24 11:19:35 +01:00
|
|
|
|
2015-09-24 05:49:17 +02: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")
|
|
|
|
];
|
|
|
|
|
2021-01-15 15:45:37 +01:00
|
|
|
meta = let inherit (lib) platforms licenses; in {
|
2013-02-24 11:19:35 +01:00
|
|
|
description = "Library for working with POSIX capabilities";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://people.redhat.com/sgrubb/libcap-ng/";
|
2015-09-24 05:49:17 +02:00
|
|
|
platforms = platforms.linux;
|
|
|
|
license = licenses.lgpl21;
|
2013-02-24 11:19:35 +01:00
|
|
|
};
|
|
|
|
}
|