1{ lib
2, stdenv
3, fetchurl
4, fetchpatch
5, autoreconfHook
6, bash
7, buildPackages
8, libtool
9, linuxHeaders
10, python3
11, swig
12
13# Enabling python support while cross compiling would be possible, but the
14# configure script tries executing python to gather info instead of relying on
15# python3-config exclusively
16, enablePython ? stdenv.hostPlatform == stdenv.buildPlatform,
17}:
18
19stdenv.mkDerivation (finalAttrs: {
20 pname = "audit";
21 version = "3.1.2";
22
23 src = fetchurl {
24 url = "https://people.redhat.com/sgrubb/audit/audit-${finalAttrs.version}.tar.gz";
25 hash = "sha256-wLF5LR8KiMbxgocQUJy7mHBZ/GhxLJdmnKkOrhA9KH0=";
26 };
27
28 postPatch = ''
29 substituteInPlace bindings/swig/src/auditswig.i \
30 --replace "/usr/include/linux/audit.h" \
31 "${linuxHeaders}/include/linux/audit.h"
32 '';
33
34 outputs = [ "bin" "dev" "out" "man" ];
35
36 strictDeps = true;
37
38 depsBuildBuild = [
39 buildPackages.stdenv.cc
40 ];
41
42 nativeBuildInputs = [
43 autoreconfHook
44 ]
45 ++ lib.optionals enablePython [
46 python3
47 swig
48 ];
49
50 buildInputs = [
51 bash
52 ];
53
54 configureFlags = [
55 # z/OS plugin is not useful on Linux, and pulls in an extra openldap
56 # dependency otherwise
57 "--disable-zos-remote"
58 "--with-arm"
59 "--with-aarch64"
60 (if enablePython then "--with-python" else "--without-python")
61 ];
62
63 enableParallelBuilding = true;
64
65 meta = {
66 homepage = "https://people.redhat.com/sgrubb/audit/";
67 description = "Audit Library";
68 changelog = "https://github.com/linux-audit/audit-userspace/releases/tag/v${finalAttrs.version}";
69 license = lib.licenses.gpl2Plus;
70 maintainers = with lib.maintainers; [ AndersonTorres ];
71 platforms = lib.platforms.linux;
72 };
73})