18 , pythonSupport ? false
21 # only for passthru.tests
26 inherit (stdenv.hostPlatform) system;
28 stdenv.mkDerivation rec {
33 url = "mirror://gnupg/gpgme/${pname}-${version}.tar.bz2";
34 hash = "sha256-Nh1OrkfOkl26DqVpr0DntSxkXEri5l5WIb8bbN2LDp4=";
38 # Fix compilation on i686, would not be needed after 1.18.1 releases, https://dev.gnupg.org/T5522
39 ./t-addexistingsubkey-i686.patch
40 # https://dev.gnupg.org/rMc4cf527ea227edb468a84bf9b8ce996807bd6992
41 ./fix_gpg_list_keys.diff
42 # https://lists.gnupg.org/pipermail/gnupg-devel/2020-April/034591.html
44 name = "0001-Fix-python-tests-on-non-Linux.patch";
45 url = "https://lists.gnupg.org/pipermail/gnupg-devel/attachments/20200415/f7be62d1/attachment.obj";
46 sha256 = "00d4sxq63601lzdp2ha1i8fvybh7dzih4531jh8bx07fab3sw65g";
48 # Support Python 3.10 version detection without distutils, https://dev.gnupg.org/D545
49 ./python-310-detection-without-distutils.patch
50 # Find correct version string for Python >= 3.10, https://dev.gnupg.org/D546
51 ./python-find-version-string-above-310.patch
52 # Fix a test after disallowing compressed signatures in gpg (PR #180336)
53 ./test_t-verify_double-plaintext.patch
55 # Disable python tests on Darwin as they use gpg (see configureFlags below)
56 ] ++ lib.optional stdenv.isDarwin ./disable-python-tests.patch
57 # Fix _AC_UNDECLARED_WARNING for autoconf>=2.70
58 # See https://lists.gnupg.org/pipermail/gnupg-devel/2020-November/034643.html
59 ++ lib.optional stdenv.cc.isClang ./fix-clang-autoconf-undeclared-warning.patch;
61 outputs = [ "out" "dev" "info" ];
63 outputBin = "dev"; # gpgme-config; not so sure about gpgme-tool
70 ] ++ lib.optionals pythonSupport [
77 propagatedBuildInputs = [
82 ] ++ lib.optionals (qtbase != null) [
91 buildPackages.stdenv.cc
94 dontWrapQtApps = true;
97 "--enable-fixed-path=${gnupg}/bin"
98 "--with-libgpg-error-prefix=${libgpg-error.dev}"
99 "--with-libassuan-prefix=${libassuan.dev}"
100 ] ++ lib.optional pythonSupport "--enable-languages=python"
101 # Tests will try to communicate with gpg-agent instance via a UNIX socket
102 # which has a path length limit. Nix on darwin is using a build directory
103 # that already has quite a long path and the resulting socket path doesn't
104 # fit in the limit. https://github.com/NixOS/nix/pull/1085
105 ++ lib.optionals stdenv.isDarwin [ "--disable-gpg-test" ];
107 NIX_CFLAGS_COMPILE = toString (
108 # qgpgme uses Q_ASSERT which retains build inputs at runtime unless
109 # debugging is disabled
110 lib.optional (qtbase != null) "-DQT_NO_DEBUG"
111 # https://www.gnupg.org/documentation/manuals/gpgme/Largefile-Support-_0028LFS_0029.html
112 ++ lib.optional stdenv.hostPlatform.is32bit "-D_FILE_OFFSET_BITS=64"
115 # prevent tests from being run during the buildPhase
116 makeFlags = [ "tests=" ];
120 checkFlags = [ "-C" "tests" ];
123 python = python3.pkgs.gpgme;
124 qt = libsForQt5.qgpgme;
128 homepage = "https://gnupg.org/software/gpgme/index.html";
129 changelog = "https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gpgme.git;f=NEWS;hb=gpgme-${version}";
130 description = "Library for making GnuPG easier to use";
132 GnuPG Made Easy (GPGME) is a library designed to make access to GnuPG
133 easier for applications. It provides a High-Level Crypto API for
134 encryption, decryption, signing, signature verification and key
137 license = with licenses; [ lgpl21Plus gpl3Plus ];
138 platforms = platforms.unix;
139 maintainers = with maintainers; [ dotlambda ];