summary refs log tree commit diff
path: root/pkgs/os-specific/linux/libcap-ng/default.nix
diff options
context:
space:
mode:
authorWilliam A. Kennington III <william@wkennington.com>2015-09-23 20:49:17 -0700
committerWilliam A. Kennington III <william@wkennington.com>2015-09-23 20:49:19 -0700
commit2dc9cb1120cc172055601182e76ee4759cd22fe9 (patch)
tree7df0299b9aa3f5971276ebf6fd14428c9969fd30 /pkgs/os-specific/linux/libcap-ng/default.nix
parent09d336ea5ec198663011eac93b30649fcc5f294c (diff)
downloadnixpkgs-2dc9cb1120cc172055601182e76ee4759cd22fe9.tar
nixpkgs-2dc9cb1120cc172055601182e76ee4759cd22fe9.tar.gz
nixpkgs-2dc9cb1120cc172055601182e76ee4759cd22fe9.tar.bz2
nixpkgs-2dc9cb1120cc172055601182e76ee4759cd22fe9.tar.lz
nixpkgs-2dc9cb1120cc172055601182e76ee4759cd22fe9.tar.xz
nixpkgs-2dc9cb1120cc172055601182e76ee4759cd22fe9.tar.zst
nixpkgs-2dc9cb1120cc172055601182e76ee4759cd22fe9.zip
libcap-ng: 0.7.3 -> 0.7.7
Also support swig + python bindings
Diffstat (limited to 'pkgs/os-specific/linux/libcap-ng/default.nix')
-rw-r--r--pkgs/os-specific/linux/libcap-ng/default.nix34
1 files changed, 26 insertions, 8 deletions
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 ];
   };
 }