Unverified Commit a23447be authored by dram's avatar dram Committed by GitHub
Browse files

linux-manual: fix for Linux 6.19 (#490939)

parents 9884749f 5e4242be
Loading
Loading
Loading
Loading
+17 −22
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@
  lib,
  stdenv,
  linuxPackages_latest,
  perl,
  python3,
  man,
}:
@@ -11,39 +10,35 @@ stdenv.mkDerivation {
  pname = "linux-manual";
  inherit (linuxPackages_latest.kernel) version src;

  nativeBuildInputs = [
    perl
    python3
  ];
  nativeBuildInputs = [ python3 ];
  nativeInstallCheckInputs = [ man ];

  dontConfigure = true;
  dontBuild = true;
  doInstallCheck = true;

  postPatch = ''
    # Use scripts/kernel-doc.py here, not scripts/kernel-doc because
    # patchShebangs skips symlinks

    # Releases up to including 6.19.3 still use scripts/kernel-doc.py, but it
    # has been moved to tools/docs with 7.0-rc1.
    patchShebangs --build \
      scripts/kernel-doc.py \
      scripts/split-man.pl
      tools/docs \
      scripts/kernel-doc.py
  '';

  buildPhase = ''
    runHook preBuild

    # avoid Makefile because it checks for unnecessary Python dependencies
    KBUILD_BUILD_TIMESTAMP="$(date -u -d "@$SOURCE_DATE_EPOCH")" \
    tools/docs/sphinx-build-wrapper mandocs

    runHook postBuild
  '';

  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
    mkdir -p "$out/share/man"
    cp -r output/man "$out/share/man/man9"

    runHook postInstall
  '';