1 { lib, stdenv, fetchurl, fetchpatch, buildPackages }:
3 stdenv.mkDerivation rec {
8 url = "https://github.com/BuGlessRB/procmail/archive/refs/tags/v${version}.tar.gz";
9 sha256 = "UU6kMzOXg+ld+TIeeUdx5Ih7mCOsVf2yRpcCz2m9OYk=";
13 # Fix clang-16 and gcc-14 build failures:
14 # https://github.com/BuGlessRB/procmail/pull/7
16 name = "clang-16.patch";
17 url = "https://github.com/BuGlessRB/procmail/commit/8cfd570fd14c8fb9983859767ab1851bfd064b64.patch";
18 hash = "sha256-CaQeDKwF0hNOrxioBj7EzkCdJdsq44KwkfA9s8xK88g=";
22 # getline is defined differently in glibc now. So rename it.
23 # Without the .PHONY target "make install" won't install anything on Darwin.
27 -e "s%^BASENAME.*%\BASENAME=$out%" \
28 -e "s%^LIBS=.*%LIBS=-lm%"
29 sed -e "s%getline%thisgetline%g" -i src/*.c src/*.h
33 '' + lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
34 substituteInPlace src/Makefile.0 \
35 --replace-fail '@./_autotst' '@${stdenv.hostPlatform.emulator buildPackages} ./_autotst'
37 _autotst() { ${stdenv.hostPlatform.emulator buildPackages} ./_autotst "$@"; } \
38 _locktst() { ${stdenv.hostPlatform.emulator buildPackages} ./_locktst "$@"; } \
42 # default target is binaries + manpages; manpages don't cross compile without more work.
43 makeFlags = lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ "bins" ];
44 installTargets = lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ "install.bin" ];
47 description = "Mail processing and filtering utility";
48 homepage = "https://github.com/BuGlessRB/procmail/";
49 license = licenses.gpl2;
50 platforms = platforms.unix;
51 maintainers = with maintainers; [ gebner ];