2020-04-24 23:36:52 +00:00
|
|
|
{
|
2021-02-05 17:12:51 +00:00
|
|
|
lib, stdenv, buildPackages, fetchurl, fetchpatch,
|
2020-04-24 23:36:52 +00:00
|
|
|
runCommand,
|
2021-12-26 17:43:05 +00:00
|
|
|
autoreconfHook,
|
2022-05-18 14:49:53 +00:00
|
|
|
autoconf, automake, libtool, bash,
|
2022-03-30 09:31:56 +00:00
|
|
|
# Enabling python support while cross compiling would be possible, but
|
|
|
|
# the configure script tries executing python to gather info instead of
|
|
|
|
# relying on python3-config exclusively
|
|
|
|
enablePython ? stdenv.hostPlatform == stdenv.buildPlatform, python3, swig,
|
|
|
|
linuxHeaders ? stdenv.cc.libc.linuxHeaders
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2021-09-26 12:46:18 +00:00
|
|
|
pname = "audit";
|
2023-04-29 16:46:19 +00:00
|
|
|
version = "3.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2021-09-26 12:46:18 +00:00
|
|
|
url = "https://people.redhat.com/sgrubb/audit/audit-${version}.tar.gz";
|
2023-04-29 16:46:19 +00:00
|
|
|
sha256 = "sha256-tc882rsnhsCLHeNZmjsaVH5V96n5wesgePW0TPROg3g=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = [ "bin" "dev" "out" "man" ];
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
strictDeps = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
2022-05-18 14:49:53 +00:00
|
|
|
nativeBuildInputs = [ autoreconfHook ]
|
|
|
|
++ lib.optionals enablePython [ python3 swig ];
|
|
|
|
buildInputs = [ bash ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
# z/OS plugin is not useful on Linux,
|
|
|
|
# and pulls in an extra openldap dependency otherwise
|
|
|
|
"--disable-zos-remote"
|
|
|
|
(if enablePython then "--with-python" else "--without-python")
|
|
|
|
"--with-arm"
|
|
|
|
"--with-aarch64"
|
|
|
|
];
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
2021-10-06 13:57:05 +00:00
|
|
|
patches = [
|
2023-04-29 16:46:19 +00:00
|
|
|
./fix-static.patch
|
2021-12-26 17:43:05 +00:00
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
# Fix pending upstream inclusion for linux-headers-5.17 support:
|
|
|
|
# https://github.com/linux-audit/audit-userspace/pull/253
|
|
|
|
(fetchpatch {
|
|
|
|
name = "ignore-flexible-array.patch";
|
|
|
|
url = "https://github.com/linux-audit/audit-userspace/commit/beed138222421a2eb4212d83cb889404bd7efc49.patch";
|
|
|
|
sha256 = "1hf02zaxv6x0wmn4ca9fj48y2shks7vfna43i1zz58xw9jq7sza0";
|
|
|
|
})
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
postPatch = ''
|
2020-04-24 23:36:52 +00:00
|
|
|
sed -i 's,#include <sys/poll.h>,#include <poll.h>\n#include <limits.h>,' audisp/audispd.c
|
2022-03-30 09:31:56 +00:00
|
|
|
substituteInPlace bindings/swig/src/auditswig.i \
|
|
|
|
--replace "/usr/include/linux/audit.h" \
|
|
|
|
"${linuxHeaders}/include/linux/audit.h"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
meta = {
|
|
|
|
description = "Audit Library";
|
|
|
|
homepage = "https://people.redhat.com/sgrubb/audit/";
|
2021-02-05 17:12:51 +00:00
|
|
|
license = lib.licenses.gpl2;
|
|
|
|
platforms = lib.platforms.linux;
|
|
|
|
maintainers = with lib.maintainers; [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|