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