about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/networking/uwimap/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/networking/uwimap/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/networking/uwimap/default.nix39
1 files changed, 20 insertions, 19 deletions
diff --git a/nixpkgs/pkgs/tools/networking/uwimap/default.nix b/nixpkgs/pkgs/tools/networking/uwimap/default.nix
index a10a779097a5..e9bfb368cc06 100644
--- a/nixpkgs/pkgs/tools/networking/uwimap/default.nix
+++ b/nixpkgs/pkgs/tools/networking/uwimap/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchurl, fetchpatch, pam, openssl }:
+{ lib, stdenv, fetchurl, fetchpatch, pam, openssl, libkrb5 }:
 
 stdenv.mkDerivation rec {
   pname = "uw-imap";
@@ -9,17 +9,21 @@ stdenv.mkDerivation rec {
     sha256 = "0a2a00hbakh0640r2wdpnwr8789z59wnk7rfsihh3j0vbhmmmqak";
   };
 
-  makeFlags = [ (if stdenv.isDarwin
+  makeFlags = [
+    "CC=${stdenv.cc.targetPrefix}cc"
+    "RANLIB=${stdenv.cc.targetPrefix}ranlib"
+    (if stdenv.isDarwin
     then "osx"
-    else "lnp") ]  # Linux with PAM modules;
-    # -fPIC is required to compile php with imap on x86_64 systems
-    ++ lib.optional stdenv.isx86_64 "EXTRACFLAGS=-fPIC"
-    ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ "CC=${stdenv.hostPlatform.config}-gcc" "RANLIB=${stdenv.hostPlatform.config}-ranlib" ];
+    else "lnp") # Linux with PAM modules;
+  ] ++ lib.optional stdenv.isx86_64 "EXTRACFLAGS=-fPIC"; # -fPIC is required to compile php with imap on x86_64 systems
+
 
   hardeningDisable = [ "format" ];
 
-  buildInputs = [ openssl ]
-    ++ lib.optional (!stdenv.isDarwin) pam;
+  buildInputs = [
+    openssl
+    (if stdenv.isDarwin then libkrb5 else pam)  # Matches the make target.
+  ];
 
   patches = [ (fetchpatch {
     url = "https://salsa.debian.org/holmgren/uw-imap/raw/dcb42981201ea14c2d71c01ebb4a61691b6f68b3/debian/patches/1006_openssl1.1_autoverify.patch";
@@ -32,7 +36,11 @@ stdenv.mkDerivation rec {
     sed -i src/osdep/unix/Makefile -e 's,^SSLLIB=.*,SSLLIB=${lib.getLib openssl}/lib,'
   '';
 
-  NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin
+  preConfigure = ''
+    makeFlagsArray+=("ARRC=${stdenv.cc.targetPrefix}ar rc")
+  '';
+
+  env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin
     "-I${openssl.dev}/include/openssl";
 
   installPhase = ''
@@ -43,21 +51,14 @@ stdenv.mkDerivation rec {
       tools/{an,ua} $out/bin
   '';
 
-  meta = {
+  meta = with lib; {
     homepage = "https://www.washington.edu/imap/";
     description = "UW IMAP toolkit - IMAP-supporting software developed by the UW";
-    license = lib.licenses.asl20;
-    platforms = with lib.platforms; linux;
+    license = licenses.asl20;
+    platforms = platforms.unix;
   };
 
   passthru = {
     withSSL = true;
   };
-} // lib.optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform) {
-  # This is set here to prevent rebuilds on native compilation.
-  # Configure phase is a no-op there, because this package doesn't use ./configure scripts.
-  configurePhase = ''
-    echo "Cross-compilation, injecting make flags"
-    makeFlagsArray+=("ARRC=${stdenv.hostPlatform.config}-ar rc")
-  '';
 }