procmail: support cross compilation

This commit is contained in:
Colin 2024-02-13 07:21:40 +00:00
parent 38905fc7ee
commit e70105cf83

View File

@ -1,4 +1,4 @@
{ lib, stdenv, fetchurl, fetchpatch }:
{ lib, stdenv, fetchurl, fetchpatch, buildPackages }:
stdenv.mkDerivation rec {
pname = "procmail";
@ -30,8 +30,19 @@ stdenv.mkDerivation rec {
sed -e "3i\
.PHONY: install
" -i Makefile
'' + lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
substituteInPlace src/Makefile.0 \
--replace-fail '@./_autotst' '@${stdenv.hostPlatform.emulator buildPackages} ./_autotst'
sed -e '3i\
_autotst() { ${stdenv.hostPlatform.emulator buildPackages} ./_autotst "$@"; } \
_locktst() { ${stdenv.hostPlatform.emulator buildPackages} ./_locktst "$@"; } \
' -i src/autoconf
'';
# default target is binaries + manpages; manpages don't cross compile without more work.
makeFlags = lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ "bins" ];
installTargets = lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ "install.bin" ];
meta = with lib; {
description = "Mail processing and filtering utility";
homepage = "https://github.com/BuGlessRB/procmail/";