1{ stdenv, fetchurl, makeWrapper, apr, expat, gnused
2, sslSupport ? true, openssl
3, bdbSupport ? false, db
4, ldapSupport ? !stdenv.isCygwin, openldap
5, libiconv
6, cyrus_sasl, autoreconfHook
7}:
8
9assert sslSupport -> openssl != null;
10assert bdbSupport -> db != null;
11assert ldapSupport -> openldap != null;
12
13with stdenv.lib;
14
15stdenv.mkDerivation rec {
16 name = "apr-util-1.5.4";
17
18 src = fetchurl {
19 url = "mirror://apache/apr/${name}.tar.bz2";
20 sha256 = "0bn81pfscy9yjvbmyx442svf43s6dhrdfcsnkpxz43fai5qk5kx6";
21 };
22
23 patches = optional stdenv.isFreeBSD ./include-static-dependencies.patch;
24
25 outputs = [ "out" "dev" ];
26 outputBin = "dev";
27
28 buildInputs = optional stdenv.isFreeBSD autoreconfHook;
29
30 configureFlags = [ "--with-apr=${apr.dev}" "--with-expat=${expat.dev}" ]
31 ++ optional (!stdenv.isCygwin) "--with-crypto"
32 ++ optional sslSupport "--with-openssl=${openssl.dev}"
33 ++ optional bdbSupport "--with-berkeley-db=${db}"
34 ++ optional ldapSupport "--with-ldap=ldap"
35 ++ optionals stdenv.isCygwin
36 [ "--without-pgsql" "--without-sqlite2" "--without-sqlite3"
37 "--without-freetds" "--without-berkeley-db" "--without-crypto" ]
38 ;
39
40 propagatedBuildInputs = [ makeWrapper apr expat libiconv ]
41 ++ optional sslSupport openssl
42 ++ optional bdbSupport db
43 ++ optional ldapSupport openldap
44 ++ optional stdenv.isFreeBSD cyrus_sasl;
45
46 # Give apr1 access to sed for runtime invocations
47 postInstall = ''
48 for f in $out/lib/*.la $out/lib/apr-util-1/*.la; do
49 substituteInPlace $f --replace "${expat.dev}/lib" "${expat.out}/lib"
50 done
51 wrapProgram $dev/bin/apu-1-config --prefix PATH : "${gnused}/bin"
52 '';
53
54 enableParallelBuilding = true;
55
56 passthru = {
57 inherit sslSupport bdbSupport ldapSupport;
58 };
59
60 meta = {
61 homepage = http://apr.apache.org/;
62 description = "A companion library to APR, the Apache Portable Runtime";
63 maintainers = [ stdenv.lib.maintainers.eelco ];
64 platforms = stdenv.lib.platforms.unix;
65 };
66}