about summary refs log tree commit diff
path: root/pkgs/development/libraries/libmilter/default.nix
blob: a06f3d4deca1c1c3cac09c429fca3fa95a05954f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{ lib, stdenv, fetchurl, m4, fixDarwinDylibNames }:

stdenv.mkDerivation rec {
  pname = "libmilter";
  version = "8.18.1";

  src = fetchurl {
    url = "ftp://ftp.sendmail.org/pub/sendmail/sendmail.${version}.tar.gz";
    sha256 = "sha256-y/HzCcOOSAb3zz6tJCYPF9H+j7YyVtE+2zzdGgmPB3A=";
  };

  buildPhase = ''
    mkdir -p $out/lib
    cd libmilter
    cat > a.m4 <<EOF
      define(\`confCC', \`$CC')
      define(\`confAR', \`$AR')
      define(\`confEBINDIR', \`$out/libexec')
      define(\`confINCLUDEDIR', \`$out/include')
      define(\`confLIBDIR', \`$out/lib')
      define(\`confMANROOT', \`$out/man/cat')
      define(\`confMANROOTMAN', \`$out/man/man')
      define(\`confMBINDIR', \`$out/sbin')
      define(\`confSBINDIR', \`$out/sbin')
      define(\`confSHAREDLIBDIR', \`$out/lib')
      define(\`confUBINDIR', \`$out/bin')
      define(\`confINCGRP', \`root')
      define(\`confLIBGRP', \`root')
      APPENDDEF(\`confENVDEF', \`-DNETINET6')
    EOF
    export MILTER_SOVER=1
    sh Build -f ./a.m4
  '';

  patches = [ ./install.patch ./sharedlib.patch ./darwin.patch ];

  nativeBuildInputs = [ m4 ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;

  postInstall = lib.optionalString stdenv.isDarwin ''
    fixDarwinDylibNames $out/lib/libmilter.*.1
  '';

  meta = with lib; {
    description = "Sendmail Milter mail filtering API library";
    platforms = platforms.unix;
    maintainers = with maintainers; [ fpletz ];
    license = licenses.sendmail;
  };
}