libcap: replace old split with multi-output
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
{ stdenv, fetchurl, attr, perl }:
|
||||
{ stdenv, fetchurl, attr, perl, pam ? null }:
|
||||
assert pam != null -> stdenv.isLinux;
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "libcap-${version}";
|
||||
@@ -9,19 +10,46 @@ stdenv.mkDerivation rec {
|
||||
sha256 = "0qjiqc5pknaal57453nxcbz3mn1r4hkyywam41wfcglq3v2qlg39";
|
||||
};
|
||||
|
||||
outputs = [ "dev" "out" ];
|
||||
outputs = [ "dev" "lib" "doc" "out" ]
|
||||
++ stdenv.lib.optional (pam != null) "pam";
|
||||
|
||||
nativeBuildInputs = [ perl ];
|
||||
|
||||
buildInputs = [ pam ];
|
||||
|
||||
propagatedBuildInputs = [ attr ];
|
||||
|
||||
preConfigure = "cd libcap";
|
||||
makeFlags = [
|
||||
"lib=lib"
|
||||
(stdenv.lib.optional (pam != null) "PAM_CAP=yes")
|
||||
];
|
||||
|
||||
makeFlags = "lib=lib prefix=$(out)";
|
||||
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
|
||||
'';
|
||||
|
||||
preInstall = ''
|
||||
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"
|
||||
'';
|
||||
|
||||
installFlags = "RAISE_SETFCAP=no";
|
||||
|
||||
postInstall = ''
|
||||
rm "$out"/lib/*.a
|
||||
mkdir -p "$dev/share/doc/${name}"
|
||||
cp ../License "$dev/share/doc/${name}/License"
|
||||
rm "$lib"/lib/*.a
|
||||
mkdir -p "$doc/share/doc/${name}"
|
||||
cp License "$doc/share/doc/${name}/"
|
||||
'' + stdenv.lib.optionalString (pam != null) ''
|
||||
mkdir -p "$pam/lib/security"
|
||||
mv "$lib"/lib/security "$pam/lib"
|
||||
'';
|
||||
|
||||
meta = {
|
||||
|
||||
Reference in New Issue
Block a user