lol
1{ stdenv, fetchurl, openssl, perl, zlib
2, sslSupport, proxySupport ? true
3, apr, aprutil, pcre
4, ldapSupport ? true, openldap
5, # Multi-processing module to use. This is built into the server and
6 # cannot be selected at runtime.
7 mpm ? "prefork"
8}:
9
10assert sslSupport -> openssl != null;
11assert ldapSupport -> aprutil.ldapSupport && openldap != null;
12assert mpm == "prefork" || mpm == "worker" || mpm == "event";
13
14stdenv.mkDerivation rec {
15 version = "2.2.31";
16 name = "apache-httpd-${version}";
17
18 src = fetchurl {
19 url = "mirror://apache/httpd/httpd-${version}.tar.bz2";
20 sha256 = "1b165zi7jrrlz5wmyy3b34lcs3dl4g0dymfb0qxwdnimylcrsbzk";
21 };
22
23 buildInputs = [perl apr aprutil pcre] ++
24 stdenv.lib.optional sslSupport openssl;
25
26 # An apr-util header file includes an apr header file
27 # through #include "" (quotes)
28 # passing simply CFLAGS did not help, then I go by NIX_CFLAGS_COMPILE
29 NIX_CFLAGS_COMPILE = "-iquote ${apr}/include/apr-1";
30
31 # Required for ‘pthread_cancel’.
32 NIX_LDFLAGS = (if stdenv.isDarwin then "" else "-lgcc_s");
33
34 configureFlags = ''
35 --with-z=${zlib}
36 --with-pcre=${pcre}
37 --enable-mods-shared=all
38 --enable-authn-alias
39 ${if proxySupport then "--enable-proxy" else ""}
40 ${if sslSupport then "--enable-ssl --with-ssl=${openssl}" else ""}
41 ${if ldapSupport then "--enable-ldap --enable-authnz-ldap" else ""}
42 --with-mpm=${mpm}
43 --enable-cache
44 --enable-disk-cache
45 --enable-file-cache
46 --enable-mem-cache
47 '';
48
49 enableParallelBuilding = true;
50
51 postInstall = ''
52 echo "removing manual"
53 rm -rf $out/manual
54 '';
55
56 passthru = {
57 inherit apr aprutil sslSupport proxySupport;
58 };
59
60 meta = {
61 description = "Apache HTTPD, the world's most popular web server";
62 branch = "2.2";
63 homepage = http://httpd.apache.org/;
64 license = stdenv.lib.licenses.asl20;
65 platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
66 maintainers = with stdenv.lib.maintainers; [ eelco simons lovek323 ];
67 };
68}