nixpkgs/pkgs/os-specific/linux/libcap/default.nix

61 lines
1.6 KiB
Nix
Raw Normal View History

{ stdenv, buildPackages, fetchurl, attr, perl, pam }:
stdenv.mkDerivation rec {
pname = "libcap";
version = "2.27";
2013-08-23 07:55:51 +00:00
src = fetchurl {
url = "mirror://kernel/linux/libs/security/linux-privs/libcap2/${pname}-${version}.tar.xz";
sha256 = "0sj8kidl7qgf2qwxcbw1vadnlb30y4zvjzxswsmfdghq04npkhfs";
};
2013-08-23 07:55:51 +00:00
outputs = [ "out" "dev" "lib" "man" "doc" "pam" ];
2013-08-23 07:55:51 +00:00
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ perl ];
buildInputs = [ pam ];
propagatedBuildInputs = [ attr ];
makeFlags = [
"lib=lib"
"PAM_CAP=yes"
"BUILD_CC=$(CC_FOR_BUILD)"
"CC:=$(CC)"
];
prePatch = ''
# use relative bash path
substituteInPlace progs/capsh.c --replace "/bin/bash" "bash"
# ensure capsh can find bash in $PATH
substituteInPlace progs/capsh.c --replace execve execvpe
# set prefixes
substituteInPlace Make.Rules \
--replace 'prefix=/usr' "prefix=$lib" \
--replace 'exec_prefix=' "exec_prefix=$out" \
--replace 'lib_prefix=$(exec_prefix)' "lib_prefix=$lib" \
--replace 'inc_prefix=$(prefix)' "inc_prefix=$dev" \
--replace 'man_prefix=$(prefix)' "man_prefix=$doc"
'';
2019-11-05 01:10:31 +00:00
installFlags = [ "RAISE_SETFCAP=no" ];
2014-08-26 23:14:09 +00:00
postInstall = ''
rm "$lib"/lib/*.a
mkdir -p "$doc/share/doc/${pname}-${version}"
cp License "$doc/share/doc/${pname}-${version}/"
'' + stdenv.lib.optionalString (pam != null) ''
mkdir -p "$pam/lib/security"
mv "$lib"/lib/security "$pam/lib"
2014-08-26 23:14:09 +00:00
'';
meta = {
description = "Library for working with POSIX capabilities";
platforms = stdenv.lib.platforms.linux;
2018-08-08 19:18:16 +00:00
license = stdenv.lib.licenses.bsd3;
};
}