Subject: [bug#59313] [PATCH] gnu: linux-libre: Enable building html and info doc.

From: Ludovic Courtès <[email-masked]>
Date: Tue, 22 Nov 2022 07:46:14 +0100

Hi Maxim,

Maxim Cournoyer <[email-masked]> skribis:

> * gnu/packages/patches/linux-libre-infodocs-target.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Register it.
> (linux-libre-6.0-source, linux-libre-5.15-source)
> (linux-libre-5.10-source): Apply above patch.
> (doc-supported?):

Looks like these 3 lines are misplaced.

> * gnu/packages/linux.scm (make-linux-libre) [DOC-SUPPORTED?]: Add new patch in
> the default patches used.  Add a BUILD-DOC? argument.
> (make-linux-libre*): Add a BUILD-DOC? argument.  Validate BUILD-DOC? for
> supported VERSION.
> [outputs]: New field.
> [phases]: Conditionally add the build-doc and install-doc phases.

Nitpick: I’d write “[arguments]” rather than “[phases]”.

> [native-inputs]: Conditionally add fontconfig, graphviz, python-wrapper,
> python-sphinx, python-sphinx-rtd-theme, texinfo and which.

[...]

> +                 #~((add-before 'configure 'build-doc
> +                      (lambda _
> +                        (substitute* "Documentation/Makefile"
> +                          ;; Remove problematic environment check script.
> +                          ((".*scripts/sphinx-pre-install.*") ""))
> +                        (invoke "make" "infodocs" "htmldocs")))
> +                    (add-after 'build-doc 'install-doc
> +                      (lambda _
> +                        (with-directory-excursion "Documentation/output"
> +                          (let ((docdir (string-append
> +                                         #$output:doc
> +                                         "/share/doc/linux-libre/html")))
> +                            (mkdir-p docdir)
> +                            (copy-recursively "html" docdir))
> +                          (invoke "make" "-C" "texinfo" "install-info"
> +                                  (string-append "infodir=" #$output
> +                                                 "/share/info"))))))

I would keep only Info documentation, which is much smaller than HTML.
This is what we do for every packages where we have that possibility.

Apart from that it looks great to me, thanks!

Ludo’.