1 { lib, stdenv, fetchurl, fetchpatch, buildPackages, autoreconfHook }:
3 stdenv.mkDerivation rec {
8 url = "mirror://apache/apr/${pname}-${version}.tar.bz2";
9 sha256 = "1spp6r2a3xcl5yajm9safhzyilsdzgagc2dadif8x6z9nbq4iqg2";
14 name = "CVE-2021-35940.patch";
15 url = "https://dist.apache.org/repos/dist/release/apr/patches/apr-1.7.0-CVE-2021-35940.patch";
16 sha256 = "1qd511dyqa1b7bj89iihrlbaavbzl6yyblqginghmcnhw8adymbs";
17 # convince fetchpatch to restore missing `a/`, `b/` to paths
23 url = "https://github.com/apache/apr/commit/374210c50ee9f4dbf265f0172dcf2d45b97d0550.patch";
24 sha256 = "04k62c5dh043jhkgs5qma6yqkq4q7nh0zswr81il4l7q1zil581y";
27 url = "https://github.com/apache/apr/commit/866e1df66be6704a584feaf5c3d241e3d631d03a.patch";
28 sha256 = "0hhm5v5wx985c28dq6d9ngnyqihpsphq4mw7rwylk39k2p90ppcm";
31 # Cross fix. Patch the /dev/zero mmapable detection logic. https://bugs.gentoo.org/show_bug.cgi?id=830833
33 url = "https://830833.bugs.gentoo.org/attachment.cgi?id=761676";
34 name = "cross-assume-dev-zero-mmappable.patch";
35 sha256 = "sha256-rsouJp1o7p0d+AJ5KvyhUU79vAJOcVHEuwSEKaCEGa8=";
39 # This test needs the net
44 outputs = [ "out" "dev" ];
49 configureFlagsArray+=("--with-installbuilddir=$dev/share/build")
52 configureFlags = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
53 # For cross builds, provide answers to the configure time tests.
54 # These answers are valid on x86_64-linux and aarch64-linux.
55 "ac_cv_file__dev_zero=yes"
56 "ac_cv_func_setpgrp_void=yes"
57 "apr_cv_tcp_nodelay_with_cork=yes"
58 "ac_cv_define_PTHREAD_PROCESS_SHARED=yes"
59 "apr_cv_process_shared_works=yes"
60 "apr_cv_mutex_robust_shared=yes"
61 "ap_cv_atomic_builtins=yes"
62 "apr_cv_mutex_recursive=yes"
64 "apr_cv_epoll_create1=yes"
67 "apr_cv_sock_cloexec=yes"
68 "ac_cv_struct_rlimit=yes"
69 "ac_cv_func_sem_open=yes"
70 "ac_cv_negative_eai=yes"
71 "apr_cv_gai_addrconfig=yes"
72 "ac_cv_o_nonblock_inherited=no"
73 "apr_cv_pthreads_lib=-lpthread"
74 "CC_FOR_BUILD=${buildPackages.stdenv.cc}/bin/cc"
75 ] ++ lib.optionals (stdenv.hostPlatform.system == "i686-cygwin") [
76 # Including the Windows headers breaks unistd.h.
77 # Based on ftp://sourceware.org/pub/cygwin/release/libapr1/libapr1-1.3.8-2-src.tar.bz2
78 "ac_cv_header_windows_h=no"
81 # - Update libtool for macOS 11 support
82 # - Regenerate for cross fix patch
83 nativeBuildInputs = [ autoreconfHook ];
87 enableParallelBuilding = true;
90 homepage = "https://apr.apache.org/";
91 description = "The Apache Portable Runtime library";
92 platforms = platforms.all;
93 license = licenses.asl20;
94 maintainers = [ maintainers.eelco ];