2022-10-06 18:32:54 +00:00
|
|
|
{ lib, stdenv, fetchurl, fetchpatch, pam, openssl, libkrb5 }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "uw-imap";
|
|
|
|
version = "2007f";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2021-08-05 21:33:18 +00:00
|
|
|
url = "ftp://ftp.cac.washington.edu/imap/imap-${version}.tar.gz";
|
2020-04-24 23:36:52 +00:00
|
|
|
sha256 = "0a2a00hbakh0640r2wdpnwr8789z59wnk7rfsihh3j0vbhmmmqak";
|
|
|
|
};
|
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
makeFlags = [
|
|
|
|
"CC=${stdenv.cc.targetPrefix}cc"
|
|
|
|
"RANLIB=${stdenv.cc.targetPrefix}ranlib"
|
|
|
|
(if stdenv.isDarwin
|
2020-04-24 23:36:52 +00:00
|
|
|
then "osx"
|
2023-04-29 16:46:19 +00:00
|
|
|
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
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
hardeningDisable = [ "format" ];
|
|
|
|
|
2022-10-06 18:32:54 +00:00
|
|
|
buildInputs = [
|
|
|
|
openssl
|
|
|
|
(if stdenv.isDarwin then libkrb5 else pam) # Matches the make target.
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://salsa.debian.org/holmgren/uw-imap/raw/dcb42981201ea14c2d71c01ebb4a61691b6f68b3/debian/patches/1006_openssl1.1_autoverify.patch";
|
|
|
|
sha256 = "09xb58awvkhzmmjhrkqgijzgv7ia381ablf0y7i1rvhcqkb5wga7";
|
|
|
|
})
|
|
|
|
# Required to build with newer versions of clang. Fixes call to undeclared functions errors
|
|
|
|
# and incompatible function pointer conversions.
|
|
|
|
./clang-fix.patch
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
sed -i src/osdep/unix/Makefile -e 's,/usr/local/ssl,${openssl.dev},'
|
|
|
|
sed -i src/osdep/unix/Makefile -e 's,^SSLCERTS=.*,SSLCERTS=/etc/ssl/certs,'
|
2022-04-03 18:54:34 +00:00
|
|
|
sed -i src/osdep/unix/Makefile -e 's,^SSLLIB=.*,SSLLIB=${lib.getLib openssl}/lib,'
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
preConfigure = ''
|
|
|
|
makeFlagsArray+=("ARRC=${stdenv.cc.targetPrefix}ar rc")
|
|
|
|
'';
|
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin
|
2020-04-24 23:36:52 +00:00
|
|
|
"-I${openssl.dev}/include/openssl";
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin $out/lib $out/include/c-client
|
|
|
|
cp c-client/*.h osdep/unix/*.h c-client/linkage.c c-client/auths.c $out/include/c-client/
|
|
|
|
cp c-client/c-client.a $out/lib/libc-client.a
|
|
|
|
cp mailutil/mailutil imapd/imapd dmail/dmail mlock/mlock mtest/mtest tmail/tmail \
|
|
|
|
tools/{an,ua} $out/bin
|
|
|
|
'';
|
|
|
|
|
2022-10-06 18:32:54 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://www.washington.edu/imap/";
|
|
|
|
description = "UW IMAP toolkit - IMAP-supporting software developed by the UW";
|
2022-10-06 18:32:54 +00:00
|
|
|
license = licenses.asl20;
|
|
|
|
platforms = platforms.unix;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
withSSL = true;
|
|
|
|
};
|
2021-08-05 21:33:18 +00:00
|
|
|
}
|