11 stdenv.mkDerivation rec {
16 url = "ftp://ftp.cac.washington.edu/imap/imap-${version}.tar.gz";
17 sha256 = "0a2a00hbakh0640r2wdpnwr8789z59wnk7rfsihh3j0vbhmmmqak";
21 "CC=${stdenv.cc.targetPrefix}cc"
22 "RANLIB=${stdenv.cc.targetPrefix}ranlib"
23 (if stdenv.hostPlatform.isDarwin then "osx" else "lnp") # Linux with PAM modules;
24 ] ++ lib.optional stdenv.hostPlatform.isx86_64 "EXTRACFLAGS=-fPIC"; # -fPIC is required to compile php with imap on x86_64 systems
26 hardeningDisable = [ "format" ];
30 (if stdenv.hostPlatform.isDarwin then libkrb5 else pam) # Matches the make target.
35 url = "https://salsa.debian.org/holmgren/uw-imap/raw/dcb42981201ea14c2d71c01ebb4a61691b6f68b3/debian/patches/1006_openssl1.1_autoverify.patch";
36 sha256 = "09xb58awvkhzmmjhrkqgijzgv7ia381ablf0y7i1rvhcqkb5wga7";
38 # Required to build with newer versions of clang. Fixes call to undeclared functions errors
39 # and incompatible function pointer conversions.
46 sed -i src/osdep/unix/Makefile -e 's,/usr/local/ssl,${openssl.dev},'
47 sed -i src/osdep/unix/Makefile -e 's,^SSLCERTS=.*,SSLCERTS=/etc/ssl/certs,'
48 sed -i src/osdep/unix/Makefile -e 's,^SSLLIB=.*,SSLLIB=${lib.getLib openssl}/lib,'
50 # utime takes a struct utimbuf rather than an array of time_t[2]
51 # convert time_t tp[2] to a struct utimbuf where
52 # tp[0] -> tp.actime and tp[1] -> tp.modtime, where actime and modtime are
56 -e 's/time_t tp\[2]/struct utimbuf tp/' \
57 -e 's/\<tp\[0]/tp.actime/g' \
58 -e 's/\<tp\[1]/tp.modtime/g' \
59 -e 's/\(utime *([-a-z>]*\),tp)/\1,\&tp)/' \
60 src/osdep/unix/{mbx.c,mh.c,mmdf.c,mtx.c,mx.c,tenex.c,unix.c}
64 makeFlagsArray+=("ARRC=${stdenv.cc.targetPrefix}ar rc")
67 env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin "-I${openssl.dev}/include/openssl";
70 mkdir -p $out/bin $out/lib $out/include/c-client
71 cp c-client/*.h osdep/unix/*.h c-client/linkage.c c-client/auths.c $out/include/c-client/
72 cp c-client/c-client.a $out/lib/libc-client.a
73 cp mailutil/mailutil imapd/imapd dmail/dmail mlock/mlock mtest/mtest tmail/tmail \
74 tools/{an,ua} $out/bin
78 homepage = "https://www.washington.edu/imap/";
79 description = "UW IMAP toolkit - IMAP-supporting software developed by the UW";
80 license = licenses.asl20;
81 platforms = platforms.unix;