@@ -0,0 +1,37 @@
1+{ buildPecl, lib, gpgme, file, gnupg }:
2+
3+buildPecl {
4+ pname = "gnupg";
5+
6+ version = "1.5.0";
7+ sha256 = "0r0akrjjf9i460z11llybdr6sg2rlcz38nwfy0yqz443ljdggxfl";
8+
9+ buildInputs = [ gpgme ];
10+ checkInputs = [ gnupg ];
11+
12+ postPhpize = ''
13+ substituteInPlace configure \
14+ --replace '/usr/bin/file' '${file}/bin/file' \
15+ --replace 'SEARCH_PATH="/usr/local /usr /opt"' 'SEARCH_PATH="${gpgme.dev}"'
16+ '';
17+
18+ postConfigure = with lib; ''
19+ substituteInPlace Makefile \
20+ --replace 'run-tests.php' 'run-tests.php -q --offline'
21+ substituteInPlace tests/gnupg_res_init_file_name.phpt \
22+ --replace '/usr/bin/gpg' '${gnupg}/bin/gpg' \
23+ --replace 'string(12)' 'string(${toString (stringLength "${gnupg}/bin/gpg")})'
24+ substituteInPlace tests/gnupg_oo_init_file_name.phpt \
25+ --replace '/usr/bin/gpg' '${gnupg}/bin/gpg' \
26+ --replace 'string(12)' 'string(${toString (stringLength "${gnupg}/bin/gpg")})'
27+ '';
28+
29+ doCheck = true;
30+
31+ meta = with lib; {
32+ description = "PHP wrapper for GpgME library that provides access to GnuPG";
33+ license = licenses.bsd3;
34+ homepage = "https://pecl.php.net/package/gnupg";
35+ maintainers = with maintainers; [ taikx4 ] ++ teams.php.members;
36+ };
37+}