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
|
|
|
|
, libiconv
|
|
|
|
, cyrus_sasl, autoreconfHook
|
|
|
|
}:
|
|
|
|
|
|
|
|
assert sslSupport -> openssl != null;
|
|
|
|
assert bdbSupport -> db != null;
|
|
|
|
assert ldapSupport -> openldap != null;
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
with lib;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2021-07-21 07:28:18 +00:00
|
|
|
pname = "apr-util";
|
|
|
|
version = "1.6.1";
|
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";
|
2020-04-24 23:36:52 +00:00
|
|
|
sha256 = "0nq3s1yn13vplgl6qfm09f7n0wm08malff9s59bqf9nid9xjzqfk";
|
|
|
|
};
|
|
|
|
|
|
|
|
patches = optional stdenv.isFreeBSD ./include-static-dependencies.patch;
|
|
|
|
|
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
outputBin = "dev";
|
|
|
|
|
2022-02-20 05:27:41 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = optional stdenv.isFreeBSD autoreconfHook;
|
|
|
|
|
|
|
|
configureFlags = [ "--with-apr=${apr.dev}" "--with-expat=${expat.dev}" ]
|
|
|
|
++ optional (!stdenv.isCygwin) "--with-crypto"
|
|
|
|
++ optional sslSupport "--with-openssl=${openssl.dev}"
|
|
|
|
++ optional bdbSupport "--with-berkeley-db=${db.dev}"
|
|
|
|
++ optional ldapSupport "--with-ldap=ldap"
|
|
|
|
++ optionals stdenv.isCygwin
|
|
|
|
[ "--without-pgsql" "--without-sqlite2" "--without-sqlite3"
|
|
|
|
"--without-freetds" "--without-berkeley-db" "--without-crypto" ]
|
|
|
|
;
|
|
|
|
|
2022-02-20 05:27:41 +00:00
|
|
|
# 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"
|
|
|
|
'';
|
|
|
|
|
|
|
|
propagatedBuildInputs = [ apr expat libiconv ]
|
2020-04-24 23:36:52 +00:00
|
|
|
++ optional sslSupport openssl
|
|
|
|
++ optional bdbSupport db
|
|
|
|
++ optional ldapSupport openldap
|
|
|
|
++ optional stdenv.isFreeBSD cyrus_sasl;
|
|
|
|
|
|
|
|
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/";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A companion library to APR, the Apache Portable Runtime";
|
|
|
|
maintainers = [ maintainers.eelco ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
license = licenses.asl20;
|
|
|
|
};
|
|
|
|
}
|