about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/misc/procmail/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/misc/procmail/default.nix')
-rw-r--r--nixpkgs/pkgs/applications/misc/procmail/default.nix13
1 files changed, 12 insertions, 1 deletions
diff --git a/nixpkgs/pkgs/applications/misc/procmail/default.nix b/nixpkgs/pkgs/applications/misc/procmail/default.nix
index 661bbd22be85..3bd280766b16 100644
--- a/nixpkgs/pkgs/applications/misc/procmail/default.nix
+++ b/nixpkgs/pkgs/applications/misc/procmail/default.nix
@@ -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/";