2018-05-03 07:58:11 +02:00
|
|
|
{ stdenv, buildPackages, fetchurl, attr, perl, pam }:
|
2006-12-22 20:22:57 +01:00
|
|
|
|
2010-09-27 15:49:13 +02:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "libcap";
|
2019-04-18 04:15:06 +02:00
|
|
|
version = "2.27";
|
2013-08-23 09:55:51 +02:00
|
|
|
|
2006-12-22 20:22:57 +01:00
|
|
|
src = fetchurl {
|
2019-08-15 14:41:18 +02:00
|
|
|
url = "mirror://kernel/linux/libs/security/linux-privs/libcap2/${pname}-${version}.tar.xz";
|
2019-04-18 04:15:06 +02:00
|
|
|
sha256 = "0sj8kidl7qgf2qwxcbw1vadnlb30y4zvjzxswsmfdghq04npkhfs";
|
2006-12-22 20:22:57 +01:00
|
|
|
};
|
2013-08-23 09:55:51 +02:00
|
|
|
|
2018-05-03 07:58:11 +02:00
|
|
|
outputs = [ "out" "dev" "lib" "man" "doc" "pam" ];
|
2013-08-23 09:55:51 +02:00
|
|
|
|
2018-02-06 14:30:52 +01:00
|
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
|
|
|
nativeBuildInputs = [ perl ];
|
2016-04-19 23:12:45 +02:00
|
|
|
|
|
|
|
buildInputs = [ pam ];
|
|
|
|
|
2012-07-19 16:25:56 +02:00
|
|
|
propagatedBuildInputs = [ attr ];
|
2006-12-22 20:22:57 +01:00
|
|
|
|
2016-04-19 23:12:45 +02:00
|
|
|
makeFlags = [
|
|
|
|
"lib=lib"
|
2018-05-03 07:58:11 +02:00
|
|
|
"PAM_CAP=yes"
|
2018-02-06 14:30:52 +01:00
|
|
|
"BUILD_CC=$(CC_FOR_BUILD)"
|
|
|
|
"CC:=$(CC)"
|
2016-04-19 23:12:45 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2017-10-22 13:58:28 +02:00
|
|
|
# set prefixes
|
2016-04-19 23:12:45 +02:00
|
|
|
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"
|
|
|
|
'';
|
2010-09-27 15:49:13 +02:00
|
|
|
|
2019-11-05 02:10:31 +01:00
|
|
|
installFlags = [ "RAISE_SETFCAP=no" ];
|
2010-09-27 15:49:13 +02:00
|
|
|
|
2014-08-27 01:14:09 +02:00
|
|
|
postInstall = ''
|
2016-04-19 23:12:45 +02:00
|
|
|
rm "$lib"/lib/*.a
|
2019-08-15 14:41:18 +02:00
|
|
|
mkdir -p "$doc/share/doc/${pname}-${version}"
|
|
|
|
cp License "$doc/share/doc/${pname}-${version}/"
|
2016-04-19 23:12:45 +02:00
|
|
|
'' + stdenv.lib.optionalString (pam != null) ''
|
|
|
|
mkdir -p "$pam/lib/security"
|
|
|
|
mv "$lib"/lib/security "$pam/lib"
|
2014-08-27 01:14:09 +02:00
|
|
|
'';
|
2012-07-19 16:25:56 +02:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Library for working with POSIX capabilities";
|
|
|
|
platforms = stdenv.lib.platforms.linux;
|
2018-08-08 21:18:16 +02:00
|
|
|
license = stdenv.lib.licenses.bsd3;
|
2012-07-19 16:25:56 +02:00
|
|
|
};
|
2006-12-22 20:22:57 +01:00
|
|
|
}
|