2024-08-17 16:38:33 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
fetchurl,
|
|
|
|
fetchpatch,
|
|
|
|
autoreconfHook,
|
|
|
|
bash,
|
|
|
|
buildPackages,
|
|
|
|
linuxHeaders,
|
|
|
|
python3,
|
|
|
|
swig,
|
|
|
|
pkgsCross,
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-08-17 16:38:33 +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,
|
2024-05-02 00:46:19 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
|
|
pname = "audit";
|
2024-08-17 16:38:33 +00:00
|
|
|
version = "4.0";
|
2024-05-02 00:46:19 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://people.redhat.com/sgrubb/audit/audit-${finalAttrs.version}.tar.gz";
|
2024-08-17 16:38:33 +00:00
|
|
|
hash = "sha256-v0ItQSard6kqTDrDneVHPyeNw941ck0lGKSMe+FdVNg=";
|
2024-05-02 00:46:19 +00:00
|
|
|
};
|
|
|
|
|
2024-08-17 16:38:33 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
name = "musl.patch";
|
|
|
|
url = "https://github.com/linux-audit/audit-userspace/commit/64cb48e1e5137b8a389c7528e611617a98389bc7.patch";
|
|
|
|
hash = "sha256-DN2F5w+2Llm80FZntH9dvdyT00pVBSgRu8DDFILyrlU=";
|
|
|
|
})
|
|
|
|
(fetchpatch {
|
|
|
|
name = "musl.patch";
|
|
|
|
url = "https://github.com/linux-audit/audit-userspace/commit/4192eb960388458c85d76e5e385cfeef48f02c79.patch";
|
|
|
|
hash = "sha256-G6CJ9nBJSsTyJ0qq14PVo+YdInAvLLQtXcR25Q8V5/4=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2024-05-02 00:46:19 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace bindings/swig/src/auditswig.i \
|
2024-08-17 16:38:33 +00:00
|
|
|
--replace-fail "/usr/include/linux/audit.h" \
|
|
|
|
"${linuxHeaders}/include/linux/audit.h"
|
2024-05-02 00:46:19 +00:00
|
|
|
'';
|
|
|
|
|
2024-08-17 16:38:33 +00:00
|
|
|
outputs = [
|
|
|
|
"bin"
|
|
|
|
"dev"
|
|
|
|
"out"
|
|
|
|
"man"
|
|
|
|
];
|
2024-05-02 00:46:19 +00:00
|
|
|
|
|
|
|
strictDeps = true;
|
|
|
|
|
2024-08-17 16:38:33 +00:00
|
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-08-17 16:38:33 +00:00
|
|
|
nativeBuildInputs =
|
|
|
|
[ autoreconfHook ]
|
|
|
|
++ lib.optionals enablePython [
|
|
|
|
python3
|
|
|
|
swig
|
|
|
|
];
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-08-17 16:38:33 +00:00
|
|
|
buildInputs = [ bash ];
|
2024-05-02 00:46:19 +00:00
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
# z/OS plugin is not useful on Linux, and pulls in an extra openldap
|
|
|
|
# dependency otherwise
|
|
|
|
"--disable-zos-remote"
|
|
|
|
"--with-arm"
|
|
|
|
"--with-aarch64"
|
|
|
|
(if enablePython then "--with-python" else "--without-python")
|
|
|
|
];
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2024-08-17 16:38:33 +00:00
|
|
|
passthru.tests = {
|
|
|
|
musl = pkgsCross.musl64.audit;
|
|
|
|
};
|
|
|
|
|
2024-05-02 00:46:19 +00:00
|
|
|
meta = {
|
|
|
|
homepage = "https://people.redhat.com/sgrubb/audit/";
|
|
|
|
description = "Audit Library";
|
|
|
|
changelog = "https://github.com/linux-audit/audit-userspace/releases/tag/v${finalAttrs.version}";
|
|
|
|
license = lib.licenses.gpl2Plus;
|
|
|
|
maintainers = with lib.maintainers; [ AndersonTorres ];
|
|
|
|
platforms = lib.platforms.linux;
|
|
|
|
};
|
|
|
|
})
|