bandwhich: 0.23.0 -> 0.23.1; move to by-name; nixfmt; useFetchCargoVendor (#356934)
[NixPkgs.git] / pkgs / servers / http / apache-httpd / 2.4.nix
blob304ff008348b3e03bb885826adfe1ffe74c64d58
1 { lib, stdenv, fetchurl, fetchpatch2, perl, zlib, apr, aprutil, pcre2, libiconv, lynx, which, libxcrypt, buildPackages
2 , nixosTests
3 , proxySupport ? true
4 , sslSupport ? true, openssl
5 , http2Support ? true, nghttp2
6 , ldapSupport ? true, openldap
7 , libxml2Support ? true, libxml2
8 , brotliSupport ? true, brotli
9 , luaSupport ? false, lua5
12 stdenv.mkDerivation rec {
13   pname = "apache-httpd";
14   version = "2.4.62";
16   src = fetchurl {
17     url = "mirror://apache/httpd/httpd-${version}.tar.bz2";
18     hash = "sha256-Z0GI579EztgtqNtSLalGhJ4iCA1z0WyT9/TfieJXKew=";
19   };
21   patches = [
22     # Fix cross-compilation by using CC_FOR_BUILD for generator program
23     # https://issues.apache.org/bugzilla/show_bug.cgi?id=51257#c6
24     (fetchpatch2 {
25       name = "apache-httpd-cross-compile.patch";
26       url = "https://gitlab.com/buildroot.org/buildroot/-/raw/5dae8cddeecf16c791f3c138542ec51c4e627d75/package/apache/0001-cross-compile.patch";
27       hash = "sha256-KGnAa6euOt6dkZQwURyVITcfqTkDkSR8zpE97DywUUw=";
28     })
29   ];
31   # FIXME: -dev depends on -doc
32   outputs = [ "out" "dev" "man" "doc" ];
33   setOutputFlags = false; # it would move $out/modules, etc.
35   depsBuildBuild = [ buildPackages.stdenv.cc ];
37   nativeBuildInputs = [ which ];
39   buildInputs = [ perl libxcrypt zlib ] ++
40     lib.optional brotliSupport brotli ++
41     lib.optional sslSupport openssl ++
42     lib.optional ldapSupport openldap ++    # there is no --with-ldap flag
43     lib.optional libxml2Support libxml2 ++
44     lib.optional http2Support nghttp2 ++
45     lib.optional stdenv.hostPlatform.isDarwin libiconv;
47   postPatch = ''
48     sed -i config.layout -e "s|installbuilddir:.*|installbuilddir: $dev/share/build|"
49     sed -i support/apachectl.in -e 's|@LYNX_PATH@|${lynx}/bin/lynx|'
50   '';
52   # Required for â€˜pthread_cancel’.
53   NIX_LDFLAGS = lib.optionalString (!stdenv.hostPlatform.isDarwin) "-lgcc_s";
55   configureFlags = [
56     "--with-apr=${apr.dev}"
57     "--with-apr-util=${aprutil.dev}"
58     "--with-z=${zlib.dev}"
59     "--with-pcre=${pcre2.dev}/bin/pcre2-config"
60     "--disable-maintainer-mode"
61     "--disable-debugger-mode"
62     "--enable-mods-shared=all"
63     "--enable-mpms-shared=all"
64     "--enable-cern-meta"
65     "--enable-imagemap"
66     "--enable-cgi"
67     "--includedir=${placeholder "dev"}/include"
68     (lib.enableFeature proxySupport "proxy")
69     (lib.enableFeature sslSupport "ssl")
70     (lib.withFeatureAs libxml2Support "libxml2" "${libxml2.dev}/include/libxml2")
71     "--docdir=$(doc)/share/doc"
73     (lib.enableFeature brotliSupport "brotli")
74     (lib.withFeatureAs brotliSupport "brotli" brotli)
76     (lib.enableFeature http2Support "http2")
77     (lib.withFeature http2Support "nghttp2")
79     (lib.enableFeature luaSupport "lua")
80     (lib.withFeatureAs luaSupport "lua" lua5)
81   ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
82     # skip bad config check when cross compiling
83     # https://gitlab.com/buildroot.org/buildroot/-/blob/5dae8cddeecf16c791f3c138542ec51c4e627d75/package/apache/apache.mk#L23
84     "ap_cv_void_ptr_lt_long=no"
85   ];
87   enableParallelBuilding = true;
89   stripDebugList = [ "lib" "modules" "bin" ];
91   postInstall = ''
92     mkdir -p $doc/share/doc/httpd
93     mv $out/manual $doc/share/doc/httpd
94     mkdir -p $dev/bin
95     mv $out/bin/apxs $dev/bin/apxs
96   '';
98   passthru = {
99     inherit apr aprutil sslSupport proxySupport ldapSupport luaSupport lua5;
100     tests = {
101       acme-integration = nixosTests.acme;
102       proxy = nixosTests.proxy;
103       php = nixosTests.php.httpd;
104     };
105   };
107   meta = with lib; {
108     description = "Apache HTTPD, the world's most popular web server";
109     homepage    = "https://httpd.apache.org/";
110     license     = licenses.asl20;
111     platforms   = platforms.linux ++ platforms.darwin;
112     maintainers = with maintainers; [ lovek323 ];
113   };