diff --git a/pkgs/os-specific/linux/libcap-ng/default.nix b/pkgs/os-specific/linux/libcap-ng/default.nix index 3670f06e5439..ea54f1a39fd1 100644 --- a/pkgs/os-specific/linux/libcap-ng/default.nix +++ b/pkgs/os-specific/linux/libcap-ng/default.nix @@ -1,22 +1,40 @@ -{ stdenv, fetchurl, python }: +{ stdenv, fetchurl, swig ? null, python2 ? null, python3 ? null }: -assert stdenv.isLinux; +assert python2 != null || python3 != null -> swig != null; stdenv.mkDerivation rec { name = "libcap-ng-${version}"; - version = "0.7.3"; + # When updating make sure to test that the version with + # all of the python bindings still works + version = "0.7.7"; src = fetchurl { url = "${meta.homepage}/${name}.tar.gz"; - sha256 = "1cavlcrpqi4imkmagjhw65br8rv2fsbhf68mm3lczr51sg44392w"; + sha256 = "0syhyrixk7fqvwis3k7iddn75g0qxysc1q5fifvzccxk7774jmb1"; }; - buildInputs = [ python ]; # ToDo? optional swig for python bindings + nativeBuildInputs = [ swig ]; + buildInputs = [ python2 python3 ]; - meta = { + 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 { description = "Library for working with POSIX capabilities"; homepage = http://people.redhat.com/sgrubb/libcap-ng/; - platforms = stdenv.lib.platforms.linux; - license = stdenv.lib.licenses.lgpl21; + platforms = platforms.linux; + license = licenses.lgpl21; + maintainers = with maintainers; [ wkennington ]; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index bccccc12baeb..bb9392f90531 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9921,7 +9921,11 @@ let libcap_manpages = callPackage ../os-specific/linux/libcap/man.nix { }; - libcap_ng = callPackage ../os-specific/linux/libcap-ng { }; + libcap_ng = callPackage ../os-specific/linux/libcap-ng { + swig = null; # Currently not using the python2/3 bindings + python2 = null; # Currently not using the python2 bindings + python3 = null; # Currently not using the python3 bindings + }; libnscd = callPackage ../os-specific/linux/libnscd { };