@@ -0,0 +1,50 @@
4+# Optional Dependencies
9+ mkFlag = trueStr: falseStr: cond: name: val:
10+ if cond == null then null else
11+ "--${if cond != false then trueStr else falseStr}${name}${if val != null && cond != false then "=${val}" else ""}";
12+ mkWith = mkFlag "with-" "without-";
14+ shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null;
16+ optLibcap = shouldUsePkg libcap;
18+stdenv.mkDerivation rec {
19+ name = "libgcrypt-1.5.4";
22+ url = "mirror://gnupg/libgcrypt/${name}.tar.bz2";
23+ sha256 = "0czvqxkzd5y872ipy6s010ifwdwv29sqbnqc4pf56sd486gqvy6m";
26+ buildInputs = [ libgpgerror optLibcap ];
29+ (mkWith (optLibcap != null) "capabilities" null)
32+ # Make sure libraries are correct for .pc and .la files
33+ # Also make sure includes are fixed for callers who don't use libgpgcrypt-config
35+ sed -i 's,#include <gpg-error.h>,#include "${libgpgerror}/include/gpg-error.h",g' $out/include/gcrypt.h
36+ '' + stdenv.lib.optionalString (!stdenv.isDarwin && optLibcap != null) ''
37+ sed -i 's,\(-lcap\),-L${optLibcap}/lib \1,' $out/lib/libgcrypt.la
42+ meta = with stdenv.lib; {
43+ homepage = https://www.gnu.org/software/libgcrypt/;
44+ description = "General-pupose cryptographic library";
45+ license = licenses.lgpl2Plus;
46+ platforms = platforms.all;
47+ maintainers = with maintainers; [ wkennington ];
48+ repositories.git = git://git.gnupg.org/libgcrypt.git;