From 2dc9cb1120cc172055601182e76ee4759cd22fe9 Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Wed, 23 Sep 2015 20:49:17 -0700 Subject: libcap-ng: 0.7.3 -> 0.7.7 Also support swig + python bindings --- pkgs/os-specific/linux/libcap-ng/default.nix | 34 +++++++++++++++++++++------- 1 file changed, 26 insertions(+), 8 deletions(-) (limited to 'pkgs/os-specific/linux/libcap-ng/default.nix') diff --git a/pkgs/os-specific/linux/libcap-ng/default.nix b/pkgs/os-specific/linux/libcap-ng/default.nix index 3670f06e543..ea54f1a39fd 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 ]; }; } -- cgit 1.4.1