1 { lib, stdenv, fetchurl, fetchpatch, pam, openssl }:
4 name = "uw-imap-2007f";
7 url = "ftp://ftp.cac.washington.edu/imap/imap-2007f.tar.gz";
8 sha256 = "0a2a00hbakh0640r2wdpnwr8789z59wnk7rfsihh3j0vbhmmmqak";
11 makeFlags = [ (if stdenv.isDarwin
13 else "lnp") ] # Linux with PAM modules;
14 # -fPIC is required to compile php with imap on x86_64 systems
15 ++ lib.optional stdenv.isx86_64 "EXTRACFLAGS=-fPIC"
16 ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ "CC=${stdenv.hostPlatform.config}-gcc" "RANLIB=${stdenv.hostPlatform.config}-ranlib" ];
18 hardeningDisable = [ "format" ];
20 buildInputs = [ openssl ]
21 ++ lib.optional (!stdenv.isDarwin) pam;
23 patches = [ (fetchpatch {
24 url = "https://salsa.debian.org/holmgren/uw-imap/raw/dcb42981201ea14c2d71c01ebb4a61691b6f68b3/debian/patches/1006_openssl1.1_autoverify.patch";
25 sha256 = "09xb58awvkhzmmjhrkqgijzgv7ia381ablf0y7i1rvhcqkb5wga7";
29 sed -i src/osdep/unix/Makefile -e 's,/usr/local/ssl,${openssl.dev},'
30 sed -i src/osdep/unix/Makefile -e 's,^SSLCERTS=.*,SSLCERTS=/etc/ssl/certs,'
31 sed -i src/osdep/unix/Makefile -e 's,^SSLLIB=.*,SSLLIB=${openssl.out}/lib,'
34 NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin
35 "-I${openssl.dev}/include/openssl";
38 mkdir -p $out/bin $out/lib $out/include/c-client
39 cp c-client/*.h osdep/unix/*.h c-client/linkage.c c-client/auths.c $out/include/c-client/
40 cp c-client/c-client.a $out/lib/libc-client.a
41 cp mailutil/mailutil imapd/imapd dmail/dmail mlock/mlock mtest/mtest tmail/tmail \
42 tools/{an,ua} $out/bin
46 homepage = "https://www.washington.edu/imap/";
47 description = "UW IMAP toolkit - IMAP-supporting software developed by the UW";
48 license = lib.licenses.asl20;
49 platforms = with lib.platforms; linux;
55 } // lib.optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform) {
56 # This is set here to prevent rebuilds on native compilation.
57 # Configure phase is a no-op there, because this package doesn't use ./configure scripts.
59 echo "Cross-compilation, injecting make flags"
60 makeFlagsArray+=("ARRC=${stdenv.hostPlatform.config}-ar rc")