at v192 42 lines 1.4 kB view raw
1{ lib, stdenv, fetchurl, libgpgerror, enableCapabilities ? false, libcap }: 2 3assert enableCapabilities -> stdenv.isLinux; 4 5stdenv.mkDerivation rec { 6 name = "libgcrypt-1.6.4"; 7 8 src = fetchurl { 9 url = "mirror://gnupg/libgcrypt/${name}.tar.bz2"; 10 sha256 = "09k06gs27gxfha07sa9rpf4xh6mvphj9sky7n09ymx75w9zjrg69"; 11 }; 12 13 buildInputs = 14 [ libgpgerror ] 15 ++ lib.optional enableCapabilities libcap; 16 17 # Make sure libraries are correct for .pc and .la files 18 # Also make sure includes are fixed for callers who don't use libgpgcrypt-config 19 postInstall = '' 20 sed -i 's,#include <gpg-error.h>,#include "${libgpgerror}/include/gpg-error.h",g' $out/include/gcrypt.h 21 '' + stdenv.lib.optionalString enableCapabilities '' 22 sed -i 's,\(-lcap\),-L${libcap}/lib \1,' $out/lib/libgcrypt.la 23 ''; 24 25 # TODO: figure out why this is even necessary and why the missing dylib only crashes 26 # random instead of every test 27 preCheck = stdenv.lib.optionalString stdenv.isDarwin '' 28 mkdir -p $out/lib 29 cp src/.libs/libgcrypt.20.dylib $out/lib 30 ''; 31 32 doCheck = true; 33 34 meta = { 35 homepage = https://www.gnu.org/software/libgcrypt/; 36 description = "General-pupose cryptographic library"; 37 license = lib.licenses.lgpl2Plus; 38 platforms = lib.platforms.all; 39 maintainers = [ lib.maintainers.wkennington ]; 40 repositories.git = git://git.gnupg.org/libgcrypt.git; 41 }; 42}