1{ lib, stdenv, fetchFromGitHub, autoreconfHook, fetchpatch }:
2
3with lib;
4
5stdenv.mkDerivation rec {
6 pname = "libspf2";
7 version = "2.2.12";
8
9 src = fetchFromGitHub {
10 owner = "helsinki-systems";
11 repo = "libspf2";
12 rev = "v${version}";
13 sha256 = "03iiaafdcwh220pqignk407h6klrakwz0zkb8iwk6nkwipkwvhsx";
14 };
15
16 patches = [
17 # glibc-2.34 compat
18 (fetchpatch {
19 url = "https://raw.githubusercontent.com/gentoo/gentoo/dbb8a5c9f749cc11e61cfe558f164b165cbc30cb/mail-filter/libspf2/files/libspf2-1.2.11-undefined-dn_.patch";
20 sha256 = "sha256-6JVVkVGCcFJsNeBdVTPcLhW4KoHLY4ai/KXDMliXgPA=";
21 })
22 ];
23
24 postPatch = ''
25 # disable static bins compilation
26 sed -i \
27 -e '/bin_PROGRAMS/s/spfquery_static//' src/spfquery/Makefile.am \
28 -e '/bin_PROGRAMS/s/spftest_static//' src/spftest/Makefile.am \
29 -e '/bin_PROGRAMS/s/spfd_static//' src/spfd/Makefile.am \
30 -e '/bin_PROGRAMS/s/spf_example_static//' src/spf_example/Makefile.am
31 '';
32
33 # autoreconf necessary because we modified automake files
34 nativeBuildInputs = [ autoreconfHook ];
35
36 doCheck = true;
37
38 meta = {
39 description = "Implementation of the Sender Policy Framework for SMTP " +
40 "authorization (Helsinki Systems fork)";
41 homepage = "https://github.com/helsinki-systems/libspf2";
42 license = with licenses; [ lgpl21Plus bsd2 ];
43 maintainers = with maintainers; [ pacien ajs124 das_j ];
44 platforms = platforms.all;
45 };
46}