2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchurl, makeWrapper, apr, expat, gnused
|
2020-04-24 23:36:52 +00:00
|
|
|
, sslSupport ? true, openssl
|
|
|
|
, bdbSupport ? true, db
|
|
|
|
, ldapSupport ? !stdenv.isCygwin, openldap
|
2022-10-30 15:09:59 +00:00
|
|
|
, libiconv, libxcrypt
|
2020-04-24 23:36:52 +00:00
|
|
|
, cyrus_sasl, autoreconfHook
|
|
|
|
}:
|
|
|
|
|
|
|
|
assert sslSupport -> openssl != null;
|
|
|
|
assert bdbSupport -> db != null;
|
|
|
|
assert ldapSupport -> openldap != null;
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2021-07-21 07:28:18 +00:00
|
|
|
pname = "apr-util";
|
2023-07-15 17:15:38 +00:00
|
|
|
version = "1.6.3";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2021-07-21 07:28:18 +00:00
|
|
|
url = "mirror://apache/apr/${pname}-${version}.tar.bz2";
|
2023-07-15 17:15:38 +00:00
|
|
|
sha256 = "sha256-pBB243EHRjJsOUUEKZStmk/KwM4Cd92P6gdv7DyXcrU=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
patches = [
|
|
|
|
./fix-libxcrypt-build.patch
|
|
|
|
# Fix incorrect Berkeley DB detection with newer versions of clang due to implicit `int` on main errors.
|
|
|
|
./clang-bdb.patch
|
|
|
|
] ++ lib.optional stdenv.isFreeBSD ./include-static-dependencies.patch;
|
2022-10-30 15:09:59 +00:00
|
|
|
|
|
|
|
NIX_CFLAGS_LINK = [ "-lcrypt" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
outputBin = "dev";
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper autoreconfHook ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
configureFlags = [ "--with-apr=${apr.dev}" "--with-expat=${expat.dev}" ]
|
2023-02-02 18:25:31 +00:00
|
|
|
++ lib.optional (!stdenv.isCygwin) "--with-crypto"
|
|
|
|
++ lib.optional sslSupport "--with-openssl=${openssl.dev}"
|
|
|
|
++ lib.optional bdbSupport "--with-berkeley-db=${db.dev}"
|
|
|
|
++ lib.optional ldapSupport "--with-ldap=ldap"
|
|
|
|
++ lib.optionals stdenv.isCygwin
|
2020-04-24 23:36:52 +00:00
|
|
|
[ "--without-pgsql" "--without-sqlite2" "--without-sqlite3"
|
|
|
|
"--without-freetds" "--without-berkeley-db" "--without-crypto" ]
|
|
|
|
;
|
|
|
|
|
2022-10-30 15:09:59 +00:00
|
|
|
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"
|
2023-04-29 16:46:19 +00:00
|
|
|
substituteInPlace apu-1-config \
|
|
|
|
--replace "-ldb-6.9" "-ldb"
|
2022-02-20 05:27:41 +00:00
|
|
|
'';
|
|
|
|
|
2022-10-30 15:09:59 +00:00
|
|
|
propagatedBuildInputs = [ apr expat libiconv libxcrypt ]
|
2023-02-02 18:25:31 +00:00
|
|
|
++ lib.optional sslSupport openssl
|
|
|
|
++ lib.optional bdbSupport db
|
|
|
|
++ lib.optional ldapSupport openldap
|
|
|
|
++ lib.optional stdenv.isFreeBSD cyrus_sasl;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
for f in $out/lib/*.la $out/lib/apr-util-1/*.la $dev/bin/apu-1-config; do
|
|
|
|
substituteInPlace $f \
|
|
|
|
--replace "${expat.dev}/lib" "${expat.out}/lib" \
|
|
|
|
--replace "${db.dev}/lib" "${db.out}/lib" \
|
2022-04-03 18:54:34 +00:00
|
|
|
--replace "${openssl.dev}/lib" "${lib.getLib openssl}/lib"
|
2020-04-24 23:36:52 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
# Give apr1 access to sed for runtime invocations.
|
|
|
|
wrapProgram $dev/bin/apu-1-config --prefix PATH : "${gnused}/bin"
|
|
|
|
'';
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
inherit sslSupport bdbSupport ldapSupport;
|
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2022-01-03 16:56:52 +00:00
|
|
|
homepage = "https://apr.apache.org/";
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Companion library to APR, the Apache Portable Runtime";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "apu-1-config";
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = [ maintainers.eelco ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
license = licenses.asl20;
|
|
|
|
};
|
|
|
|
}
|