1{
2 stdenv, buildPackages, fetchurl, fetchpatch,
3 enablePython ? false, python ? null,
4}:
5
6assert enablePython -> python != null;
7
8stdenv.mkDerivation rec {
9 name = "audit-2.8.2";
10
11 src = fetchurl {
12 url = "http://people.redhat.com/sgrubb/audit/${name}.tar.gz";
13 sha256 = "1fmw8whraz1q3y3z5mgdpgsa3wz6r3zq0kgsgbc9xvmgfwmrpdb7";
14 };
15
16 outputs = [ "bin" "dev" "out" "man" ];
17
18 depsBuildBuild = [ buildPackages.stdenv.cc ];
19 buildInputs = stdenv.lib.optional enablePython python;
20
21 configureFlags = [
22 # z/OS plugin is not useful on Linux,
23 # and pulls in an extra openldap dependency otherwise
24 "--disable-zos-remote"
25 (if enablePython then "--with-python" else "--without-python")
26 ];
27
28 enableParallelBuilding = true;
29
30 patches = stdenv.lib.optional stdenv.hostPlatform.isMusl [
31 (fetchpatch {
32 url = "https://git.alpinelinux.org/cgit/aports/plain/main/audit/0002-auparse-remove-use-of-rawmemchr.patch?id=3e57180fdf3f90c30a25aea44f57846efc93a696";
33 name = "0002-auparse-remove-use-of-rawmemchr.patch";
34 sha256 = "1caaqbfgb2rq3ria5bz4n8x30ihgihln6w9w9a46k62ba0wh9rkz";
35 })
36 (fetchpatch {
37 url = "https://git.alpinelinux.org/cgit/aports/plain/main/audit/0003-all-get-rid-of-strndupa.patch?id=3e57180fdf3f90c30a25aea44f57846efc93a696";
38 name = "0003-all-get-rid-of-strndupa.patch";
39 sha256 = "1ddrm6a0ijrf7caw1wpw2kkbjp2lkxkmc16v51j5j7dvdalc6591";
40 })
41 ];
42
43 prePatch = ''
44 sed -i 's,#include <sys/poll.h>,#include <poll.h>\n#include <limits.h>,' audisp/audispd.c
45 '';
46 meta = {
47 description = "Audit Library";
48 homepage = http://people.redhat.com/sgrubb/audit/;
49 license = stdenv.lib.licenses.gpl2;
50 platforms = stdenv.lib.platforms.linux;
51 maintainers = with stdenv.lib.maintainers; [ fuuzetsu ];
52 };
53}