mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-02 03:43:06 +00:00
8f82d69669
Fixes the build of pkgsStatic.libcap, as it was trying to link to the dinamic libc. From libcap-2.69/progs/Makefile: ... ifeq ($(LIBCSTATIC),yes) LDFLAGS = --static DEPS = ../libcap/libcap.a else # For this build variant override the LDFLAGS to link statically from # libraries within the build tree. If you never want this, use make # DYNAMIC=yes . Note, we can't reliably link statically against glibc # becasuse of https://sourceware.org/bugzilla/show_bug.cgi?id=12491 . LDFLAGS = -Wl,-Bstatic LDFLAGS_SUFFIX = -Wl,-Bdynamic DEPS = ../libcap/libcap.a endif ...
93 lines
2.1 KiB
Nix
93 lines
2.1 KiB
Nix
{ stdenv, lib, buildPackages, fetchurl, attr, runtimeShell
|
|
, usePam ? !isStatic, pam ? null
|
|
, isStatic ? stdenv.hostPlatform.isStatic
|
|
|
|
# passthru.tests
|
|
, bind
|
|
, chrony
|
|
, htop
|
|
, libgcrypt
|
|
, libvirt
|
|
, ntp
|
|
, qemu
|
|
, squid
|
|
, tor
|
|
, uwsgi
|
|
}:
|
|
|
|
assert usePam -> pam != null;
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "libcap";
|
|
version = "2.69";
|
|
|
|
src = fetchurl {
|
|
url = "mirror://kernel/linux/libs/security/linux-privs/libcap2/${pname}-${version}.tar.xz";
|
|
sha256 = "sha256-8xH489rYRpnQVm0db37JQ6kpiyj3FMrjyTHf1XSS1+s=";
|
|
};
|
|
|
|
outputs = [ "out" "dev" "lib" "man" "doc" ]
|
|
++ lib.optional usePam "pam";
|
|
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
|
|
|
buildInputs = lib.optional usePam pam;
|
|
|
|
propagatedBuildInputs = [ attr ];
|
|
|
|
makeFlags = [
|
|
"lib=lib"
|
|
"PAM_CAP=${if usePam then "yes" else "no"}"
|
|
"BUILD_CC=$(CC_FOR_BUILD)"
|
|
"CC:=$(CC)"
|
|
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
|
|
] ++ lib.optionals isStatic [ "SHARED=no" "LIBCSTATIC=yes" ];
|
|
|
|
postPatch = ''
|
|
patchShebangs ./progs/mkcapshdoc.sh
|
|
|
|
# use full path to bash
|
|
substituteInPlace progs/capsh.c --replace "/bin/bash" "${runtimeShell}"
|
|
|
|
# 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"
|
|
'';
|
|
|
|
installFlags = [ "RAISE_SETFCAP=no" ];
|
|
|
|
postInstall = ''
|
|
${lib.optionalString (!isStatic) ''rm "$lib"/lib/*.a''}
|
|
mkdir -p "$doc/share/doc/${pname}-${version}"
|
|
cp License "$doc/share/doc/${pname}-${version}/"
|
|
'' + lib.optionalString usePam ''
|
|
mkdir -p "$pam/lib/security"
|
|
mv "$lib"/lib/security "$pam/lib"
|
|
'';
|
|
|
|
passthru.tests = {
|
|
inherit
|
|
bind
|
|
chrony
|
|
htop
|
|
libgcrypt
|
|
libvirt
|
|
ntp
|
|
qemu
|
|
squid
|
|
tor
|
|
uwsgi;
|
|
};
|
|
|
|
meta = {
|
|
description = "Library for working with POSIX capabilities";
|
|
homepage = "https://sites.google.com/site/fullycapable";
|
|
platforms = lib.platforms.linux;
|
|
license = lib.licenses.bsd3;
|
|
};
|
|
}
|