Skip to content

Commit 16fc9ce

Browse files
authored
linux-manual: clean up and improve (#380978)
2 parents 23e610d + 884b411 commit 16fc9ce

File tree

1 file changed

+27
-12
lines changed

1 file changed

+27
-12
lines changed
Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
{
22
lib,
33
stdenv,
4-
perl,
54
linuxPackages_latest,
5+
perl,
6+
man,
67
}:
78

8-
stdenv.mkDerivation rec {
9+
stdenv.mkDerivation {
910
pname = "linux-manual";
1011
inherit (linuxPackages_latest.kernel) version src;
1112

1213
nativeBuildInputs = [ perl ];
14+
nativeInstallCheckInputs = [ man ];
1315

1416
dontConfigure = true;
1517
dontBuild = true;
18+
doInstallCheck = true;
1619

1720
postPatch = ''
1821
patchShebangs --build \
@@ -21,25 +24,37 @@ stdenv.mkDerivation rec {
2124
'';
2225

2326
installPhase = ''
24-
mandir=$out/share/man/man9
25-
mkdir -p $mandir
27+
runHook preInstall
2628
27-
KBUILD_BUILD_TIMESTAMP=$(stat -c %Y Makefile) \
29+
export mandir="$out/share/man/man9"
30+
mkdir -p "$mandir"
31+
32+
KBUILD_BUILD_TIMESTAMP="$(date -u -d "@$SOURCE_DATE_EPOCH")" \
2833
grep -F -l -Z \
2934
--exclude-dir Documentation \
3035
--exclude-dir tools \
3136
-R '/**' \
32-
| xargs -0 -n 256 -P $NIX_BUILD_CORES \
33-
$SHELL -c '{ scripts/kernel-doc -man "$@" || :; } \
34-
| scripts/split-man.pl '$mandir kernel-doc
37+
| xargs -0 -n 256 -P "$NIX_BUILD_CORES" \
38+
"$SHELL" -c '{ scripts/kernel-doc -man "$@" || :; } \
39+
| scripts/split-man.pl "$mandir"' kernel-doc
40+
41+
runHook postInstall
42+
'';
43+
44+
installCheckPhase = ''
45+
runHook preInstallCheck
46+
47+
# Check for well‐known man page
48+
man -M "$out/share/man" -P cat 9 kmalloc >/dev/null
3549
36-
test -f $mandir/kmalloc.9
50+
runHook postInstallCheck
3751
'';
3852

39-
meta = with lib; {
53+
meta = {
4054
homepage = "https://kernel.org/";
4155
description = "Linux kernel API manual pages";
42-
license = licenses.gpl2Only;
43-
maintainers = with maintainers; [ mvs ];
56+
license = lib.licenses.gpl2Only;
57+
maintainers = with lib.maintainers; [ mvs ];
58+
platforms = lib.platforms.linux;
4459
};
4560
}

0 commit comments

Comments
 (0)