dramforever 40d78d58e3 linux-manual: Handle scripts/kernel-doc.py
Upstream switched the script to Python in 6.16, so handle that.
2025-07-30 05:07:37 +08:00

68 lines
1.4 KiB
Nix
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
lib,
stdenv,
linuxPackages_latest,
perl,
python3,
man,
}:
stdenv.mkDerivation {
pname = "linux-manual";
inherit (linuxPackages_latest.kernel) version src;
nativeBuildInputs = [
perl
python3
];
nativeInstallCheckInputs = [ man ];
dontConfigure = true;
dontBuild = true;
doInstallCheck = true;
postPatch = ''
# Use scripts/kernel-doc.py here, not scripts/kernel-doc because
# patchShebangs skips symlinks
patchShebangs --build \
scripts/kernel-doc.py \
scripts/split-man.pl
'';
installPhase = ''
runHook preInstall
export mandir="$out/share/man/man9"
mkdir -p "$mandir"
KBUILD_BUILD_TIMESTAMP="$(date -u -d "@$SOURCE_DATE_EPOCH")" \
grep -F -l -Z \
--exclude-dir Documentation \
--exclude-dir tools \
-R '/**' \
| xargs -0 -n 256 -P "$NIX_BUILD_CORES" \
"$SHELL" -c '{ scripts/kernel-doc -man "$@" || :; } \
| scripts/split-man.pl "$mandir"' kernel-doc
runHook postInstall
'';
installCheckPhase = ''
runHook preInstallCheck
# Check for wellknown man page
man -M "$out/share/man" -P cat 9 kmalloc >/dev/null
runHook postInstallCheck
'';
meta = {
homepage = "https://kernel.org/";
description = "Linux kernel API manual pages";
license = lib.licenses.gpl2Only;
maintainers = with lib.maintainers; [ mvs ];
platforms = lib.platforms.linux;
};
}