aprutil: fix build with libxcrypt

This commit is contained in:
Franz Pletz 2022-09-27 04:07:33 +02:00 committed by Martin Weinelt
parent ae4e703c17
commit 77a7b43e62
No known key found for this signature in database
GPG Key ID: 87C1E9888F856759
2 changed files with 29 additions and 9 deletions

View File

@ -2,7 +2,7 @@
, sslSupport ? true, openssl
, bdbSupport ? true, db
, ldapSupport ? !stdenv.isCygwin, openldap
, libiconv
, libiconv, libxcrypt
, cyrus_sasl, autoreconfHook
}:
@ -21,7 +21,10 @@ stdenv.mkDerivation rec {
sha256 = "0nq3s1yn13vplgl6qfm09f7n0wm08malff9s59bqf9nid9xjzqfk";
};
patches = optional stdenv.isFreeBSD ./include-static-dependencies.patch;
patches = [ ./fix-libxcrypt-build.patch ]
++ optional stdenv.isFreeBSD ./include-static-dependencies.patch;
NIX_CFLAGS_LINK = [ "-lcrypt" ];
outputs = [ "out" "dev" ];
outputBin = "dev";
@ -38,15 +41,18 @@ stdenv.mkDerivation rec {
"--without-freetds" "--without-berkeley-db" "--without-crypto" ]
;
# For some reason, db version 6.9 is selected when cross-compiling.
# It's unclear as to why, it requires someone with more autotools / configure knowledge to go deeper into that.
# Always replacing the link flag with a generic link flag seems to help though, so let's do that for now.
postConfigure = lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
substituteInPlace Makefile \
--replace "-ldb-6.9" "-ldb"
postConfigure = ''
echo '#define APR_HAVE_CRYPT_H 1' >> confdefs.h
'' +
# For some reason, db version 6.9 is selected when cross-compiling.
# It's unclear as to why, it requires someone with more autotools / configure knowledge to go deeper into that.
# Always replacing the link flag with a generic link flag seems to help though, so let's do that for now.
lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
substituteInPlace Makefile \
--replace "-ldb-6.9" "-ldb"
'';
propagatedBuildInputs = [ apr expat libiconv ]
propagatedBuildInputs = [ apr expat libiconv libxcrypt ]
++ optional sslSupport openssl
++ optional bdbSupport db
++ optional ldapSupport openldap

View File

@ -0,0 +1,14 @@
diff --git a/crypto/apr_passwd.c b/crypto/apr_passwd.c
index c961de2..a397f27 100644
--- a/crypto/apr_passwd.c
+++ b/crypto/apr_passwd.c
@@ -24,9 +24,7 @@
#if APR_HAVE_STRING_H
#include <string.h>
#endif
-#if APR_HAVE_CRYPT_H
#include <crypt.h>
-#endif
#if APR_HAVE_UNISTD_H
#include <unistd.h>
#endif