bandwhich: 0.23.0 -> 0.23.1; move to by-name; nixfmt; useFetchCargoVendor (#356934)
[NixPkgs.git] / pkgs / by-name / au / audit / package.nix
blob62115bfc2b4d3ed49e9e52bbfebdcef4d50a5b28
2   lib,
3   stdenv,
4   fetchurl,
5   fetchpatch,
6   autoreconfHook,
7   bash,
8   buildPackages,
9   linuxHeaders,
10   python3,
11   swig,
12   pkgsCross,
14   # Enabling python support while cross compiling would be possible, but the
15   # configure script tries executing python to gather info instead of relying on
16   # python3-config exclusively
17   enablePython ? stdenv.hostPlatform == stdenv.buildPlatform,
20 stdenv.mkDerivation (finalAttrs: {
21   pname = "audit";
22   version = "4.0";
24   src = fetchurl {
25     url = "https://people.redhat.com/sgrubb/audit/audit-${finalAttrs.version}.tar.gz";
26     hash = "sha256-v0ItQSard6kqTDrDneVHPyeNw941ck0lGKSMe+FdVNg=";
27   };
29   patches = [
30     (fetchpatch {
31       name = "musl.patch";
32       url = "https://github.com/linux-audit/audit-userspace/commit/64cb48e1e5137b8a389c7528e611617a98389bc7.patch";
33       hash = "sha256-DN2F5w+2Llm80FZntH9dvdyT00pVBSgRu8DDFILyrlU=";
34     })
35     (fetchpatch {
36       name = "musl.patch";
37       url = "https://github.com/linux-audit/audit-userspace/commit/4192eb960388458c85d76e5e385cfeef48f02c79.patch";
38       hash = "sha256-G6CJ9nBJSsTyJ0qq14PVo+YdInAvLLQtXcR25Q8V5/4=";
39     })
40   ];
42   postPatch = ''
43     substituteInPlace bindings/swig/src/auditswig.i \
44       --replace "/usr/include/linux/audit.h" \
45                 "${linuxHeaders}/include/linux/audit.h"
46   '';
48   outputs = [
49     "bin"
50     "dev"
51     "out"
52     "man"
53   ];
55   strictDeps = true;
57   depsBuildBuild = [
58     buildPackages.stdenv.cc
59   ];
61   nativeBuildInputs =
62     [
63       autoreconfHook
64     ]
65     ++ lib.optionals enablePython [
66       python3
67       swig
68     ];
70   buildInputs = [
71     bash
72   ];
74   configureFlags = [
75     # z/OS plugin is not useful on Linux, and pulls in an extra openldap
76     # dependency otherwise
77     "--disable-zos-remote"
78     "--with-arm"
79     "--with-aarch64"
80     (if enablePython then "--with-python" else "--without-python")
81   ];
83   enableParallelBuilding = true;
85   passthru.tests = {
86     musl = pkgsCross.musl64.audit;
87   };
89   meta = {
90     homepage = "https://people.redhat.com/sgrubb/audit/";
91     description = "Audit Library";
92     changelog = "https://github.com/linux-audit/audit-userspace/releases/tag/v${finalAttrs.version}";
93     license = lib.licenses.gpl2Plus;
94     maintainers = with lib.maintainers; [ ];
95     platforms = lib.platforms.linux;
96   };