nixpkgs-suyu/pkgs/tools/networking/uwimap/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

66 lines
2.4 KiB
Nix
Raw Normal View History

2022-10-02 20:05:18 +02:00
{ lib, stdenv, fetchurl, fetchpatch, pam, openssl, libkrb5 }:
stdenv.mkDerivation rec {
pname = "uw-imap";
version = "2007f";
src = fetchurl {
url = "ftp://ftp.cac.washington.edu/imap/imap-${version}.tar.gz";
sha256 = "0a2a00hbakh0640r2wdpnwr8789z59wnk7rfsihh3j0vbhmmmqak";
};
2019-10-27 22:48:01 +01:00
makeFlags = [ (if stdenv.isDarwin
then "osx"
2019-10-27 22:48:01 +01:00
else "lnp") ] # Linux with PAM modules;
2013-06-24 14:32:02 +02:00
# -fPIC is required to compile php with imap on x86_64 systems
2021-01-15 10:19:50 +01:00
++ lib.optional stdenv.isx86_64 "EXTRACFLAGS=-fPIC"
++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ "CC=${stdenv.hostPlatform.config}-gcc" "RANLIB=${stdenv.hostPlatform.config}-ranlib" ];
hardeningDisable = [ "format" ];
2016-02-07 23:28:15 +01:00
2022-10-02 20:05:18 +02:00
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";
sha256 = "09xb58awvkhzmmjhrkqgijzgv7ia381ablf0y7i1rvhcqkb5wga7";
}) ];
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,'
treewide: use lib.getLib for OpenSSL libraries At some point, I'd like to make another attempt at 71f1f4884b5 ("openssl: stop static binaries referencing libs"), which was reverted in 195c7da07df. One problem with my previous attempt is that I moved OpenSSL's libraries to a lib output, but many dependent packages were hardcoding the out output as the location of the libraries. This patch fixes every such case I could find in the tree. It won't have any effect immediately, but will mean these packages will automatically use an OpenSSL lib output if it is reintroduced in future. This patch should cause very few rebuilds, because it shouldn't make any change at all to most packages I'm touching. The few rebuilds that are introduced come from when I've changed a package builder not to use variable names like openssl.out in scripts / substitution patterns, which would be confusing since they don't hardcode the output any more. I started by making the following global replacements: ${pkgs.openssl.out}/lib -> ${lib.getLib pkgs.openssl}/lib ${openssl.out}/lib -> ${lib.getLib openssl}/lib Then I removed the ".out" suffix when part of the argument to lib.makeLibraryPath, since that function uses lib.getLib internally. Then I fixed up cases where openssl was part of the -L flag to the compiler/linker, since that unambigously is referring to libraries. Then I manually investigated and fixed the following packages: - pycurl - citrix-workspace - ppp - wraith - unbound - gambit - acl2 I'm reasonably confindent in my fixes for all of them. For acl2, since the openssl library paths are manually provided above anyway, I don't think openssl is required separately as a build input at all. Removing it doesn't make a difference to the output size, the file list, or the closure. I've tested evaluation with the OfBorg meta checks, to protect against introducing evaluation failures.
2022-03-25 16:33:21 +01:00
sed -i src/osdep/unix/Makefile -e 's,^SSLLIB=.*,SSLLIB=${lib.getLib openssl}/lib,'
'';
2021-01-15 10:19:50 +01:00
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin
"-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-02 20:05:18 +02:00
meta = with lib; {
homepage = "https://www.washington.edu/imap/";
description = "UW IMAP toolkit - IMAP-supporting software developed by the UW";
2022-10-02 20:05:18 +02:00
license = licenses.asl20;
platforms = platforms.unix;
};
passthru = {
withSSL = true;
};
2021-01-15 10:19:50 +01:00
} // 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")
'';
}