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

Previous Next

Package: guix-patches;

Reported by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Date: Wed, 16 Nov 2022 16:57:01 UTC

Severity: normal

Tags: patch

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 59313 in the body.
You can then email your comments to 59313 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#59313; Package guix-patches. (Wed, 16 Nov 2022 16:57:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Wed, 16 Nov 2022 16:57:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH] gnu: linux-libre: Enable building html and info doc.
Date: Wed, 16 Nov 2022 11:55:51 -0500
* 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)
(linux-libre-5.4-source, linux-libre-4.19-source)
(linux-libre-4.9-source): Apply above patch.
* gnu/packages/linux.scm (make-linux-libre): Add new patch in the default
patches used.  Add a BUILD-DOC? argument.
(make-linux-libre*): Add a BUILD-DOC? argument.
[outputs]: New field.
[phases]: Conditionally add the build-doc and install-doc phases.
[native-inputs]: Conditionally add graphviz, python, python-sphinx,
python-sphinx-rtd-theme, texinfo and which.
---
 gnu/local.mk                                  |   3 +-
 gnu/packages/linux.scm                        | 280 ++++++++++--------
 .../patches/linux-libre-infodocs-target.patch |  88 ++++++
 3 files changed, 253 insertions(+), 118 deletions(-)
 create mode 100644 gnu/packages/patches/linux-libre-infodocs-target.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 71472f8410..83cd160864 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1481,7 +1481,8 @@ dist_patch_DATA =						\
   %D%/packages/patches/lierolibre-remove-arch-warning.patch	\
   %D%/packages/patches/lierolibre-try-building-other-arch.patch	\
   %D%/packages/patches/linbox-fix-pkgconfig.patch		\
-  %D%/packages/patches/linphone-desktop-without-sdk.patch           \
+  %D%/packages/patches/linphone-desktop-without-sdk.patch	\
+  %D%/packages/patches/linux-libre-infodocs-target.patch	\
   %D%/packages/patches/linux-libre-support-for-Pinebook-Pro.patch \
   %D%/packages/patches/linux-pam-no-setfsuid.patch		\
   %D%/packages/patches/linuxdcpp-openssl-1.1.patch		\
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index a879dcba8d..c45a54233c 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -33,7 +33,7 @@
 ;;; Copyright © 2018, 2019 Pierre Langlois <pierre.langlois <at> gmx.com>
 ;;; Copyright © 2018 Vasile Dumitrascu <va511e <at> yahoo.com>
 ;;; Copyright © 2019 Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>
-;;; Copyright © 2019, 2020, 2021 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
+;;; Copyright © 2019, 2020, 2021, 2022 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
 ;;; Copyright © 2019 Stefan Stefanović <stefanx2ovic <at> gmail.com>
 ;;; Copyright © 2019-2022 Brice Waegeneire <brice <at> waegenei.re>
 ;;; Copyright © 2019 Kei Kebreau <kkebreau <at> posteo.net>
@@ -119,6 +119,7 @@ (define-module (gnu packages linux)
   #:use-module (gnu packages gnupg)
   #:use-module (gnu packages golang)
   #:use-module (gnu packages gperf)
+  #:use-module (gnu packages graphviz)
   #:use-module (gnu packages gstreamer)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages haskell-apps)
@@ -494,17 +495,20 @@ (define (source-with-patches source patches)
 (define-public linux-libre-6.0-source
   (source-with-patches linux-libre-6.0-pristine-source
                        (list %boot-logo-patch
-                             %linux-libre-arm-export-__sync_icache_dcache-patch)))
+                             %linux-libre-arm-export-__sync_icache_dcache-patch
+                             (search-patch "linux-libre-infodocs-target.patch"))))
 
 (define-public linux-libre-5.15-source
   (source-with-patches linux-libre-5.15-pristine-source
                        (list %boot-logo-patch
-                             %linux-libre-arm-export-__sync_icache_dcache-patch)))
+                             %linux-libre-arm-export-__sync_icache_dcache-patch
+                             (search-patch "linux-libre-infodocs-target.patch"))))
 
 (define-public linux-libre-5.10-source
   (source-with-patches linux-libre-5.10-pristine-source
                        (list %boot-logo-patch
-                             %linux-libre-arm-export-__sync_icache_dcache-patch)))
+                             %linux-libre-arm-export-__sync_icache_dcache-patch
+                             (search-patch "linux-libre-infodocs-target.patch"))))
 
 (define-public linux-libre-5.4-source
   (source-with-patches linux-libre-5.4-pristine-source
@@ -512,21 +516,25 @@ (define-public linux-libre-5.4-source
                              %linux-libre-arm-export-__sync_icache_dcache-patch
                              ;; Pinebook Pro patch from linux-next,
                              ;; can be dropped for linux-libre 5.7
-                             (search-patch
-                              "linux-libre-support-for-Pinebook-Pro.patch"))))
+                             (search-patches
+                              "linux-libre-support-for-Pinebook-Pro.patch"
+                              "linux-libre-infodocs-target.patch"))))
 
 (define-public linux-libre-4.19-source
   (source-with-patches linux-libre-4.19-pristine-source
                        (list %boot-logo-patch
-                             %linux-libre-arm-export-__sync_icache_dcache-patch)))
+                             %linux-libre-arm-export-__sync_icache_dcache-patch
+                             (search-patch "linux-libre-infodocs-target.patch"))))
 
 (define-public linux-libre-4.14-source
   (source-with-patches linux-libre-4.14-pristine-source
-                       (list %boot-logo-patch)))
+                       (list %boot-logo-patch
+                             (search-patch "linux-libre-infodocs-target.patch"))))
 
 (define-public linux-libre-4.9-source
   (source-with-patches linux-libre-4.9-pristine-source
-                       (list %boot-logo-patch)))
+                       (list %boot-logo-patch
+                             (search-patch "linux-libre-infodocs-target.patch"))))
 
 
 ;;;
@@ -767,7 +775,11 @@ (define* (make-linux-libre version gnu-revision hash-string supported-systems
                            (configuration-file #f)
                            (defconfig "defconfig")
                            (extra-options %default-extra-linux-options)
-                           (patches (list %boot-logo-patch)))
+                           (patches
+                            (list %boot-logo-patch
+                                  (search-patch
+                                   "linux-libre-infodocs-target.patch")))
+                           (build-doc? #t))
   (make-linux-libre* version gnu-revision
                      (origin
                        (method url-fetch)
@@ -778,7 +790,8 @@ (define* (make-linux-libre version gnu-revision hash-string supported-systems
                      #:extra-version extra-version
                      #:configuration-file configuration-file
                      #:defconfig defconfig
-                     #:extra-options extra-options))
+                     #:extra-options extra-options
+                     #:build-doc? build-doc?))
 
 (define* (make-linux-libre* version gnu-revision source supported-systems
                             #:key
@@ -787,7 +800,8 @@ (define* (make-linux-libre* version gnu-revision source supported-systems
                             ;; See kernel-config for an example.
                             (configuration-file #f)
                             (defconfig "defconfig")
-                            (extra-options %default-extra-linux-options))
+                            (extra-options %default-extra-linux-options)
+                            (build-doc? #t))
   (package
     (name (if extra-version
               (string-append "linux-libre-" extra-version)
@@ -795,12 +809,135 @@ (define* (make-linux-libre* version gnu-revision source supported-systems
     (version version)
     (source source)
     (supported-systems supported-systems)
+    (outputs `("out"
+               ,@(if build-doc? '("doc") '())))
     (build-system gnu-build-system)
+    (arguments
+     (list
+      #:modules '((guix build gnu-build-system)
+                  (guix build utils)
+                  (srfi srfi-1)
+                  (srfi srfi-26)
+                  (ice-9 ftw)
+                  (ice-9 match))
+      #:tests? #f
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'patch-/bin/pwd
+            (lambda _
+              (substitute* (find-files
+                            "." "^Makefile(\\.include)?$")
+                (("/bin/pwd") "pwd"))))
+          #$@(if build-doc?
+                 #~((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"))))))
+                 #~())
+          (replace 'configure
+            (lambda* (#:key inputs target #:allow-other-keys)
+              ;; Avoid introducing timestamps.
+              (setenv "KCONFIG_NOTIMESTAMP" "1")
+              (setenv "KBUILD_BUILD_TIMESTAMP" (getenv "SOURCE_DATE_EPOCH"))
+
+              ;; Other variables useful for reproducibility.
+              (setenv "KBUILD_BUILD_USER" "guix")
+              (setenv "KBUILD_BUILD_HOST" "guix")
+
+              ;; Set ARCH and CROSS_COMPILE.
+              (let ((arch #$(platform-linux-architecture
+                             (lookup-platform-by-target-or-system
+                              (or (%current-target-system)
+                                  (%current-system))))))
+                (setenv "ARCH" arch)
+                (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
+
+                (when target
+                  (setenv "CROSS_COMPILE" (string-append target "-"))
+                  (format #t "`CROSS_COMPILE' set to `~a'~%"
+                          (getenv "CROSS_COMPILE"))))
+
+              (setenv "EXTRAVERSION"
+                      #$(and extra-version
+                             (string-append "-" extra-version)))
+
+              (let ((config (assoc-ref inputs "kconfig")))
+
+                ;; Use a custom kernel configuration file or a default
+                ;; configuration file.
+                (if config
+                    (begin
+                      (copy-file config ".config")
+                      (chmod ".config" #o666))
+                    (invoke "make" #$defconfig))
+
+                ;; Appending works even when the option wasn't in the
+                ;; file.  The last one prevails if duplicated.
+                (let ((port (open-file ".config" "a"))
+                      (extra-configuration #$(config->string extra-options)))
+                  (display extra-configuration port)
+                  (close-port port))
+
+                (invoke "make" "oldconfig"))))
+          (replace 'install
+            (lambda* (#:key inputs native-inputs #:allow-other-keys)
+              (let ((moddir (string-append #$output "/lib/modules"))
+                    (dtbdir (string-append #$output "/lib/dtbs")))
+                ;; Install kernel image, kernel configuration and link map.
+                (for-each (lambda (file) (install-file file #$output))
+                          (find-files "." "^(\\.config|bzImage|zImage|Image\
+|vmlinuz|System\\.map|Module\\.symvers)$"))
+                ;; Install device tree files
+                (unless (null? (find-files "." "\\.dtb$"))
+                  (mkdir-p dtbdir)
+                  (invoke "make" (string-append "INSTALL_DTBS_PATH=" dtbdir)
+                          "dtbs_install"))
+                ;; Install kernel modules
+                (mkdir-p moddir)
+                (invoke "make"
+                        ;; Disable depmod because the Guix system's
+                        ;; module directory is an union of potentially
+                        ;; multiple packages.  It is not possible to use
+                        ;; depmod to usefully calculate a dependency
+                        ;; graph while building only one of them.
+                        "DEPMOD=true"
+                        (string-append "MODULE_DIR=" moddir)
+                        (string-append "INSTALL_PATH=" #$output)
+                        (string-append "INSTALL_MOD_PATH=" #$output)
+                        "INSTALL_MOD_STRIP=1"
+                        "modules_install")
+                (let* ((versions (filter (lambda (name)
+                                           (not (string-prefix? "." name)))
+                                         (scandir moddir)))
+                       (version (match versions
+                                  ((x) x))))
+                  ;; There are symlinks to the build and source directory.
+                  ;; Both will point to target /tmp/guix-build* and thus
+                  ;; not be useful in a profile.  Delete the symlinks.
+                  (false-if-file-not-found
+                   (delete-file
+                    (string-append moddir "/" version "/build")))
+                  (false-if-file-not-found
+                   (delete-file
+                    (string-append moddir "/" version "/source"))))))))))
     (native-inputs
      `(("perl" ,perl)
        ("bc" ,bc)
        ("openssl" ,openssl)
-       ("elfutils" ,elfutils)  ; Needed to enable CONFIG_STACK_VALIDATION
+       ("elfutils" ,elfutils)        ;needed to enable CONFIG_STACK_VALIDATION
        ("flex" ,flex)
        ("bison" ,bison)
 
@@ -809,6 +946,16 @@ (define* (make-linux-libre* version gnu-revision source supported-systems
        ("mpfr" ,mpfr)
        ("mpc" ,mpc)
 
+       ;; For generating the documentation.
+       ,@(if build-doc?
+             `(("graphviz" ,graphviz)
+               ("python" ,python)
+               ("python-sphinx" ,python-sphinx)
+               ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
+               ("texinfo" ,texinfo)
+               ("which" ,which))
+             '())
+
        ,@(match (let ((arch (platform-linux-architecture
                              (lookup-platform-by-target-or-system
                               (or (%current-target-system)
@@ -817,115 +964,14 @@ (define* (make-linux-libre* version gnu-revision source supported-systems
                        (configuration-file
                         arch
                         #:variant (version-major+minor version))))
-           (#f                                    ;no config for this platform
+           (#f                          ;no config for this platform
             '())
            ((? string? config)
             `(("kconfig" ,config))))))
-    (arguments
-     (list #:modules '((guix build gnu-build-system)
-                       (guix build utils)
-                       (srfi srfi-1)
-                       (srfi srfi-26)
-                       (ice-9 ftw)
-                       (ice-9 match))
-           #:phases
-           #~(modify-phases %standard-phases
-               (add-after 'unpack 'patch-/bin/pwd
-                 (lambda _
-                   (substitute* (find-files "." "^Makefile(\\.include)?$")
-                     (("/bin/pwd") "pwd"))))
-               (replace 'configure
-                 (lambda* (#:key inputs target #:allow-other-keys)
-                   ;; Avoid introducing timestamps.
-                   (setenv "KCONFIG_NOTIMESTAMP" "1")
-                   (setenv "KBUILD_BUILD_TIMESTAMP"
-                           (getenv "SOURCE_DATE_EPOCH"))
-
-                   ;; Other variables useful for reproducibility.
-                   (setenv "KBUILD_BUILD_USER" "guix")
-                   (setenv "KBUILD_BUILD_HOST" "guix")
-
-                   ;; Set ARCH and CROSS_COMPILE.
-                   (let ((arch #$(platform-linux-architecture
-                                  (lookup-platform-by-target-or-system
-                                   (or (%current-target-system)
-                                       (%current-system))))))
-                     (setenv "ARCH" arch)
-                     (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
-
-                     (when target
-                       (setenv "CROSS_COMPILE" (string-append target "-"))
-                       (format #t "`CROSS_COMPILE' set to `~a'~%"
-                               (getenv "CROSS_COMPILE"))))
-
-                   (setenv "EXTRAVERSION"
-                           #$(and extra-version
-                                  (string-append "-" extra-version)))
-
-                   (let ((config (assoc-ref inputs "kconfig")))
-
-                     ;; Use a custom kernel configuration file or a default
-                     ;; configuration file.
-                     (if config
-                         (begin
-                           (copy-file config ".config")
-                           (chmod ".config" #o666))
-                         (invoke "make" #$defconfig))
-
-                     ;; Appending works even when the option wasn't in the
-                     ;; file.  The last one prevails if duplicated.
-                     (let ((port (open-file ".config" "a"))
-                           (extra-configuration #$(config->string extra-options)))
-                       (display extra-configuration port)
-                       (close-port port))
-
-                     (invoke "make" "oldconfig"))))
-               (replace 'install
-                 (lambda* (#:key inputs native-inputs #:allow-other-keys)
-                   (let ((moddir (string-append #$output "/lib/modules"))
-                         (dtbdir (string-append #$output "/lib/dtbs")))
-                     ;; Install kernel image, kernel configuration and link map.
-                     (for-each (lambda (file) (install-file file #$output))
-                               (find-files "." "^(\\.config|bzImage|zImage|Image|vmlinuz|System\\.map|Module\\.symvers)$"))
-                     ;; Install device tree files
-                     (unless (null? (find-files "." "\\.dtb$"))
-                       (mkdir-p dtbdir)
-                       (invoke "make" (string-append "INSTALL_DTBS_PATH=" dtbdir)
-                               "dtbs_install"))
-                     ;; Install kernel modules
-                     (mkdir-p moddir)
-                     (invoke "make"
-                             ;; Disable depmod because the Guix system's
-                             ;; module directory is an union of potentially
-                             ;; multiple packages.  It is not possible to use
-                             ;; depmod to usefully calculate a dependency
-                             ;; graph while building only one of them.
-                             "DEPMOD=true"
-                             (string-append "MODULE_DIR=" moddir)
-                             (string-append "INSTALL_PATH=" #$output)
-                             (string-append "INSTALL_MOD_PATH=" #$output)
-                             "INSTALL_MOD_STRIP=1"
-                             "modules_install")
-                     (let* ((versions (filter (lambda (name)
-                                                (not (string-prefix? "." name)))
-                                              (scandir moddir)))
-                            (version (match versions
-                                       ((x) x))))
-                       ;; There are symlinks to the build and source directory.
-                       ;; Both will point to target /tmp/guix-build* and thus
-                       ;; not be useful in a profile.  Delete the symlinks.
-                       (false-if-file-not-found
-                        (delete-file
-                         (string-append moddir "/" version "/build")))
-                       (false-if-file-not-found
-                        (delete-file
-                         (string-append moddir "/" version "/source"))))))))
-           #:tests? #f))
     (home-page "https://www.gnu.org/software/linux-libre/")
     (synopsis "100% free redistribution of a cleaned Linux kernel")
-    (description
-     "GNU Linux-Libre is a free (as in freedom) variant of the Linux kernel.
-It has been modified to remove all non-free binary blobs.")
+    (description "GNU Linux-Libre is a free (as in freedom) variant of the
+Linux kernel.  It has been modified to remove all non-free binary blobs.")
     (license license:gpl2)
     (properties '((max-silent-time . 3600))))) ;don't timeout on blob scan.
 
diff --git a/gnu/packages/patches/linux-libre-infodocs-target.patch b/gnu/packages/patches/linux-libre-infodocs-target.patch
new file mode 100644
index 0000000000..e9e6495c26
--- /dev/null
+++ b/gnu/packages/patches/linux-libre-infodocs-target.patch
@@ -0,0 +1,88 @@
+Upstream status: https://marc.info/?l=linux-doc&m=166861669723994&w=2
+
+From 7edb5b278ee383ff9bed525329b2cdbe22317bf2 Mon Sep 17 00:00:00 2001
+From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
+Date: Mon, 14 Nov 2022 22:51:11 -0500
+Subject: [PATCH] doc: add texinfodocs and infodocs targets
+
+Sphinx supports generating Texinfo sources and Info documentation,
+which can be navigated easily and is convenient to search (via the
+indexed nodes or anchors, for example).
+
+This change also causes the html output to appear under its own output
+sub-directory, which makes it easier to install, since it's clean from
+.doctrees or other output formats.
+
+Signed-off-by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
+---
+ Documentation/Makefile                     | 13 ++++++++++++-
+ Documentation/userspace-api/media/Makefile |  3 ++-
+ Makefile                                   |  2 +-
+ 3 files changed, 15 insertions(+), 3 deletions(-)
+
+diff --git a/Documentation/Makefile b/Documentation/Makefile
+index 64d44c1ecad3..bd8dac560633 100644
+--- a/Documentation/Makefile
++++ b/Documentation/Makefile
+@@ -93,7 +93,16 @@ quiet_cmd_sphinx = SPHINX  $@ --> file://$(abspath $(BUILDDIR)/$3/$4)
+ 
+ htmldocs:
+ 	@$(srctree)/scripts/sphinx-pre-install --version-check
+-	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
++	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),html,$(var)))
++
++texinfodocs:
++	@$(srctree)/scripts/sphinx-pre-install --version-check
++	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,texinfo,$(var),texinfo,$(var)))
++
++# Note: the 'info' Make target is generated by sphinx itself when
++# running the texinfodocs target define above.
++infodocs: texinfodocs
++	$(MAKE) -C $(BUILDDIR)/texinfo info
+ 
+ linkcheckdocs:
+ 	@$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,linkcheck,$(var),,$(var)))
+@@ -143,6 +152,8 @@ cleandocs:
+ dochelp:
+ 	@echo  ' Linux kernel internal documentation in different formats from ReST:'
+ 	@echo  '  htmldocs        - HTML'
++	@echo  '  texinfodocs     - Texinfo'
++	@echo  '  infodocs        - Info'
+ 	@echo  '  latexdocs       - LaTeX'
+ 	@echo  '  pdfdocs         - PDF'
+ 	@echo  '  epubdocs        - EPUB'
+diff --git a/Documentation/userspace-api/media/Makefile b/Documentation/userspace-api/media/Makefile
+index 00922aa7efde..3d8aaf5c253b 100644
+--- a/Documentation/userspace-api/media/Makefile
++++ b/Documentation/userspace-api/media/Makefile
+@@ -47,10 +47,11 @@ $(BUILDDIR)/lirc.h.rst: ${UAPI}/lirc.h ${PARSER} $(SRC_DIR)/lirc.h.rst.exception
+ 
+ # Media build rules
+ 
+-.PHONY: all html epub xml latex
++.PHONY: all html texinfo epub xml latex
+ 
+ all: $(IMGDOT) $(BUILDDIR) ${TARGETS}
+ html: all
++texinfo: all
+ epub: all
+ xml: all
+ latex: $(IMGPDF) all
+diff --git a/Makefile b/Makefile
+index 58cd4f5e1c3a..b3266c408b6c 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1785,7 +1785,7 @@ $(help-board-dirs): help-%:
+ # Documentation targets
+ # ---------------------------------------------------------------------------
+ DOC_TARGETS := xmldocs latexdocs pdfdocs htmldocs epubdocs cleandocs \
+-	       linkcheckdocs dochelp refcheckdocs
++	       linkcheckdocs dochelp refcheckdocs texinfodocs infodocs
+ PHONY += $(DOC_TARGETS)
+ $(DOC_TARGETS):
+ 	$(Q)$(MAKE) $(build)=Documentation $@
+
+base-commit: 81e7cfa3a9eb4ba6993a9c71772fdab21bc5d870
+-- 
+2.38.1
+

base-commit: 4073f43cbc2a9e0a5156ff5f950973871bff49e3
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#59313; Package guix-patches. (Sun, 20 Nov 2022 11:34:01 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: 59313 <at> debbugs.gnu.org, guix-patches <at> gnu.org
Subject: Re: [bug#59313] [PATCH] gnu: linux-libre: Enable building html and
 info doc.
Date: Sun, 20 Nov 2022 11:31:54 +0000
[Message part 1 (text/plain, inline)]
Maxim Cournoyer <maxim.cournoyer <at> gmail.com> writes:

> * 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)
> (linux-libre-5.4-source, linux-libre-4.19-source)
> (linux-libre-4.9-source): Apply above patch.
> * gnu/packages/linux.scm (make-linux-libre): Add new patch in the default
> patches used.  Add a BUILD-DOC? argument.
> (make-linux-libre*): Add a BUILD-DOC? argument.
> [outputs]: New field.
> [phases]: Conditionally add the build-doc and install-doc phases.
> [native-inputs]: Conditionally add graphviz, python, python-sphinx,
> python-sphinx-rtd-theme, texinfo and which.
> ---
>  gnu/local.mk                                  |   3 +-
>  gnu/packages/linux.scm                        | 280 ++++++++++--------
>  .../patches/linux-libre-infodocs-target.patch |  88 ++++++
>  3 files changed, 253 insertions(+), 118 deletions(-)
>  create mode 100644 gnu/packages/patches/linux-libre-infodocs-target.patch

Hi,

Looking at https://qa.guix.gnu.org/issue/59313 this seems to break the
build of linux-libre <at> 5.10.154 on x86_64-linux and
linux-libre-arm64-generic <at> 5.10.154 on aarch64-linux, plus maybe some
other things.

Chris
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#59313; Package guix-patches. (Sun, 20 Nov 2022 11:34:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#59313; Package guix-patches. (Mon, 21 Nov 2022 00:58:01 GMT) Full text and rfc822 format available.

Message #14 received at 59313 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Christopher Baines <mail <at> cbaines.net>
Cc: 59313 <at> debbugs.gnu.org
Subject: Re: [bug#59313] [PATCH] gnu: linux-libre: Enable building html and
 info doc.
Date: Sun, 20 Nov 2022 19:57:18 -0500
Hi,

Christopher Baines <mail <at> cbaines.net> writes:

> Maxim Cournoyer <maxim.cournoyer <at> gmail.com> writes:
>
>> * 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)
>> (linux-libre-5.4-source, linux-libre-4.19-source)
>> (linux-libre-4.9-source): Apply above patch.
>> * gnu/packages/linux.scm (make-linux-libre): Add new patch in the default
>> patches used.  Add a BUILD-DOC? argument.
>> (make-linux-libre*): Add a BUILD-DOC? argument.
>> [outputs]: New field.
>> [phases]: Conditionally add the build-doc and install-doc phases.
>> [native-inputs]: Conditionally add graphviz, python, python-sphinx,
>> python-sphinx-rtd-theme, texinfo and which.
>> ---
>>  gnu/local.mk                                  |   3 +-
>>  gnu/packages/linux.scm                        | 280 ++++++++++--------
>>  .../patches/linux-libre-infodocs-target.patch |  88 ++++++
>>  3 files changed, 253 insertions(+), 118 deletions(-)
>>  create mode 100644 gnu/packages/patches/linux-libre-infodocs-target.patch
>
> Hi,
>
> Looking at https://qa.guix.gnu.org/issue/59313 this seems to break the
> build of linux-libre <at> 5.10.154 on x86_64-linux and
> linux-libre-arm64-generic <at> 5.10.154 on aarch64-linux, plus maybe some
> other things.

Thanks for pointing that!  The data service is proving useful again!
:-).

I've made the following changes, which I'll send as v2 shortly:

--8<---------------cut here---------------start------------->8---
1 file changed, 26 insertions(+), 17 deletions(-)
gnu/packages/linux.scm | 43 ++++++++++++++++++++++++++-----------------

modified   gnu/packages/linux.scm
@@ -108,8 +108,9 @@ (define-module (gnu packages linux)
   #:use-module (gnu packages docbook)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages elf)
-  #:use-module (gnu packages flex)
   #:use-module (gnu packages file)
+  #:use-module (gnu packages flex)
+  #:use-module (gnu packages fontutils)
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages gawk)
   #:use-module (gnu packages gcc)
@@ -516,25 +517,21 @@ (define-public linux-libre-5.4-source
                              %linux-libre-arm-export-__sync_icache_dcache-patch
                              ;; Pinebook Pro patch from linux-next,
                              ;; can be dropped for linux-libre 5.7
-                             (search-patches
-                              "linux-libre-support-for-Pinebook-Pro.patch"
-                              "linux-libre-infodocs-target.patch"))))
+                             (search-patch
+                              "linux-libre-support-for-Pinebook-Pro.patch"))))
 
 (define-public linux-libre-4.19-source
   (source-with-patches linux-libre-4.19-pristine-source
                        (list %boot-logo-patch
-                             %linux-libre-arm-export-__sync_icache_dcache-patch
-                             (search-patch "linux-libre-infodocs-target.patch"))))
+                             %linux-libre-arm-export-__sync_icache_dcache-patch)))
 
 (define-public linux-libre-4.14-source
   (source-with-patches linux-libre-4.14-pristine-source
-                       (list %boot-logo-patch
-                             (search-patch "linux-libre-infodocs-target.patch"))))
+                       (list %boot-logo-patch)))
 
 (define-public linux-libre-4.9-source
   (source-with-patches linux-libre-4.9-pristine-source
-                       (list %boot-logo-patch
-                             (search-patch "linux-libre-infodocs-target.patch"))))
+                       (list %boot-logo-patch)))
 
 
 ;;;
@@ -767,6 +764,11 @@ (define (config->string options)
 ;;; Kernel package utilities.
 ;;;
 
+(define (doc-supported? version)
+  ;; Versions older than 5.10 have different enough build scripts that the
+  ;; infodocs patch doesn't apply.
+  (version>=? version "5.10"))
+
 (define* (make-linux-libre version gnu-revision hash-string supported-systems
                            #:key
                            (extra-version #f)
@@ -775,11 +777,13 @@ (define* (make-linux-libre version gnu-revision hash-string supported-systems
                            (configuration-file #f)
                            (defconfig "defconfig")
                            (extra-options %default-extra-linux-options)
+                           (build-doc? (doc-supported? version))
                            (patches
-                            (list %boot-logo-patch
-                                  (search-patch
-                                   "linux-libre-infodocs-target.patch")))
-                           (build-doc? #t))
+                            `(,%boot-logo-patch
+                              ,@(if build-doc?
+                                    (list (search-patch
+                                           "linux-libre-infodocs-target.patch"))
+                                    '()))))
   (make-linux-libre* version gnu-revision
                      (origin
                        (method url-fetch)
@@ -801,7 +805,9 @@ (define* (make-linux-libre* version gnu-revision source supported-systems
                             (configuration-file #f)
                             (defconfig "defconfig")
                             (extra-options %default-extra-linux-options)
-                            (build-doc? #t))
+                            (build-doc? (doc-supported? version)))
+  (when (and build-doc? (not (doc-supported? version)))
+    (error "unsupported 'build-doc?' for kernels <5.10"))
   (package
     (name (if extra-version
               (string-append "linux-libre-" extra-version)
@@ -948,8 +954,11 @@ (define* (make-linux-libre* version gnu-revision source supported-systems
 
        ;; For generating the documentation.
        ,@(if build-doc?
-             `(("graphviz" ,graphviz)
-               ("python" ,python)
+             ;; TODO: remove fontconfig after the 5.10 kernel is dropped.
+             ;; Also replace python-wrapper by python at that time.
+             `(("fontconfig" ,fontconfig)
+               ("graphviz" ,graphviz)
+               ("python" ,python-wrapper)
                ("python-sphinx" ,python-sphinx)
                ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
                ("texinfo" ,texinfo)
--8<---------------cut here---------------end--------------->8---

Any kernel older than 5.10 is now untouched.

-- 
Thanks,
Maxim




Information forwarded to guix-patches <at> gnu.org:
bug#59313; Package guix-patches. (Mon, 21 Nov 2022 01:04:02 GMT) Full text and rfc822 format available.

Message #17 received at 59313 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 59313 <at> debbugs.gnu.org
Cc: mail <at> cbaines.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH v2] gnu: linux-libre: Enable building html and info doc.
Date: Sun, 20 Nov 2022 20:03:24 -0500
* 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?):
* 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.
[native-inputs]: Conditionally add fontconfig, graphviz, python-wrapper,
python-sphinx, python-sphinx-rtd-theme, texinfo and which.
---
 gnu/local.mk                                  |   3 +-
 gnu/packages/linux.scm                        | 281 +++++++++++-------
 .../patches/linux-libre-infodocs-target.patch |  88 ++++++
 3 files changed, 258 insertions(+), 114 deletions(-)
 create mode 100644 gnu/packages/patches/linux-libre-infodocs-target.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 02cd182f06..5c3908a02a 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1482,7 +1482,8 @@ dist_patch_DATA =						\
   %D%/packages/patches/lierolibre-remove-arch-warning.patch	\
   %D%/packages/patches/lierolibre-try-building-other-arch.patch	\
   %D%/packages/patches/linbox-fix-pkgconfig.patch		\
-  %D%/packages/patches/linphone-desktop-without-sdk.patch           \
+  %D%/packages/patches/linphone-desktop-without-sdk.patch	\
+  %D%/packages/patches/linux-libre-infodocs-target.patch	\
   %D%/packages/patches/linux-libre-support-for-Pinebook-Pro.patch \
   %D%/packages/patches/linux-pam-no-setfsuid.patch		\
   %D%/packages/patches/linuxdcpp-openssl-1.1.patch		\
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 601162b465..288a421fbc 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -33,7 +33,7 @@
 ;;; Copyright © 2018, 2019 Pierre Langlois <pierre.langlois <at> gmx.com>
 ;;; Copyright © 2018 Vasile Dumitrascu <va511e <at> yahoo.com>
 ;;; Copyright © 2019 Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>
-;;; Copyright © 2019, 2020, 2021 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
+;;; Copyright © 2019, 2020, 2021, 2022 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
 ;;; Copyright © 2019 Stefan Stefanović <stefanx2ovic <at> gmail.com>
 ;;; Copyright © 2019-2022 Brice Waegeneire <brice <at> waegenei.re>
 ;;; Copyright © 2019 Kei Kebreau <kkebreau <at> posteo.net>
@@ -108,8 +108,9 @@ (define-module (gnu packages linux)
   #:use-module (gnu packages docbook)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages elf)
-  #:use-module (gnu packages flex)
   #:use-module (gnu packages file)
+  #:use-module (gnu packages flex)
+  #:use-module (gnu packages fontutils)
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages gawk)
   #:use-module (gnu packages gcc)
@@ -119,6 +120,7 @@ (define-module (gnu packages linux)
   #:use-module (gnu packages gnupg)
   #:use-module (gnu packages golang)
   #:use-module (gnu packages gperf)
+  #:use-module (gnu packages graphviz)
   #:use-module (gnu packages gstreamer)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages haskell-apps)
@@ -494,17 +496,20 @@ (define (source-with-patches source patches)
 (define-public linux-libre-6.0-source
   (source-with-patches linux-libre-6.0-pristine-source
                        (list %boot-logo-patch
-                             %linux-libre-arm-export-__sync_icache_dcache-patch)))
+                             %linux-libre-arm-export-__sync_icache_dcache-patch
+                             (search-patch "linux-libre-infodocs-target.patch"))))
 
 (define-public linux-libre-5.15-source
   (source-with-patches linux-libre-5.15-pristine-source
                        (list %boot-logo-patch
-                             %linux-libre-arm-export-__sync_icache_dcache-patch)))
+                             %linux-libre-arm-export-__sync_icache_dcache-patch
+                             (search-patch "linux-libre-infodocs-target.patch"))))
 
 (define-public linux-libre-5.10-source
   (source-with-patches linux-libre-5.10-pristine-source
                        (list %boot-logo-patch
-                             %linux-libre-arm-export-__sync_icache_dcache-patch)))
+                             %linux-libre-arm-export-__sync_icache_dcache-patch
+                             (search-patch "linux-libre-infodocs-target.patch"))))
 
 (define-public linux-libre-5.4-source
   (source-with-patches linux-libre-5.4-pristine-source
@@ -759,6 +764,11 @@ (define (config->string options)
 ;;; Kernel package utilities.
 ;;;
 
+(define (doc-supported? version)
+  ;; Versions older than 5.10 have different enough build scripts that the
+  ;; infodocs patch doesn't apply.
+  (version>=? version "5.10"))
+
 (define* (make-linux-libre version gnu-revision hash-string supported-systems
                            #:key
                            (extra-version #f)
@@ -767,7 +777,13 @@ (define* (make-linux-libre version gnu-revision hash-string supported-systems
                            (configuration-file #f)
                            (defconfig "defconfig")
                            (extra-options %default-extra-linux-options)
-                           (patches (list %boot-logo-patch)))
+                           (build-doc? (doc-supported? version))
+                           (patches
+                            `(,%boot-logo-patch
+                              ,@(if build-doc?
+                                    (list (search-patch
+                                           "linux-libre-infodocs-target.patch"))
+                                    '()))))
   (make-linux-libre* version gnu-revision
                      (origin
                        (method url-fetch)
@@ -778,7 +794,8 @@ (define* (make-linux-libre version gnu-revision hash-string supported-systems
                      #:extra-version extra-version
                      #:configuration-file configuration-file
                      #:defconfig defconfig
-                     #:extra-options extra-options))
+                     #:extra-options extra-options
+                     #:build-doc? build-doc?))
 
 (define* (make-linux-libre* version gnu-revision source supported-systems
                             #:key
@@ -787,7 +804,10 @@ (define* (make-linux-libre* version gnu-revision source supported-systems
                             ;; See kernel-config for an example.
                             (configuration-file #f)
                             (defconfig "defconfig")
-                            (extra-options %default-extra-linux-options))
+                            (extra-options %default-extra-linux-options)
+                            (build-doc? (doc-supported? version)))
+  (when (and build-doc? (not (doc-supported? version)))
+    (error "unsupported 'build-doc?' for kernels <5.10"))
   (package
     (name (if extra-version
               (string-append "linux-libre-" extra-version)
@@ -795,12 +815,135 @@ (define* (make-linux-libre* version gnu-revision source supported-systems
     (version version)
     (source source)
     (supported-systems supported-systems)
+    (outputs `("out"
+               ,@(if build-doc? '("doc") '())))
     (build-system gnu-build-system)
+    (arguments
+     (list
+      #:modules '((guix build gnu-build-system)
+                  (guix build utils)
+                  (srfi srfi-1)
+                  (srfi srfi-26)
+                  (ice-9 ftw)
+                  (ice-9 match))
+      #:tests? #f
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'patch-/bin/pwd
+            (lambda _
+              (substitute* (find-files
+                            "." "^Makefile(\\.include)?$")
+                (("/bin/pwd") "pwd"))))
+          #$@(if build-doc?
+                 #~((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"))))))
+                 #~())
+          (replace 'configure
+            (lambda* (#:key inputs target #:allow-other-keys)
+              ;; Avoid introducing timestamps.
+              (setenv "KCONFIG_NOTIMESTAMP" "1")
+              (setenv "KBUILD_BUILD_TIMESTAMP" (getenv "SOURCE_DATE_EPOCH"))
+
+              ;; Other variables useful for reproducibility.
+              (setenv "KBUILD_BUILD_USER" "guix")
+              (setenv "KBUILD_BUILD_HOST" "guix")
+
+              ;; Set ARCH and CROSS_COMPILE.
+              (let ((arch #$(platform-linux-architecture
+                             (lookup-platform-by-target-or-system
+                              (or (%current-target-system)
+                                  (%current-system))))))
+                (setenv "ARCH" arch)
+                (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
+
+                (when target
+                  (setenv "CROSS_COMPILE" (string-append target "-"))
+                  (format #t "`CROSS_COMPILE' set to `~a'~%"
+                          (getenv "CROSS_COMPILE"))))
+
+              (setenv "EXTRAVERSION"
+                      #$(and extra-version
+                             (string-append "-" extra-version)))
+
+              (let ((config (assoc-ref inputs "kconfig")))
+
+                ;; Use a custom kernel configuration file or a default
+                ;; configuration file.
+                (if config
+                    (begin
+                      (copy-file config ".config")
+                      (chmod ".config" #o666))
+                    (invoke "make" #$defconfig))
+
+                ;; Appending works even when the option wasn't in the
+                ;; file.  The last one prevails if duplicated.
+                (let ((port (open-file ".config" "a"))
+                      (extra-configuration #$(config->string extra-options)))
+                  (display extra-configuration port)
+                  (close-port port))
+
+                (invoke "make" "oldconfig"))))
+          (replace 'install
+            (lambda* (#:key inputs native-inputs #:allow-other-keys)
+              (let ((moddir (string-append #$output "/lib/modules"))
+                    (dtbdir (string-append #$output "/lib/dtbs")))
+                ;; Install kernel image, kernel configuration and link map.
+                (for-each (lambda (file) (install-file file #$output))
+                          (find-files "." "^(\\.config|bzImage|zImage|Image\
+|vmlinuz|System\\.map|Module\\.symvers)$"))
+                ;; Install device tree files
+                (unless (null? (find-files "." "\\.dtb$"))
+                  (mkdir-p dtbdir)
+                  (invoke "make" (string-append "INSTALL_DTBS_PATH=" dtbdir)
+                          "dtbs_install"))
+                ;; Install kernel modules
+                (mkdir-p moddir)
+                (invoke "make"
+                        ;; Disable depmod because the Guix system's
+                        ;; module directory is an union of potentially
+                        ;; multiple packages.  It is not possible to use
+                        ;; depmod to usefully calculate a dependency
+                        ;; graph while building only one of them.
+                        "DEPMOD=true"
+                        (string-append "MODULE_DIR=" moddir)
+                        (string-append "INSTALL_PATH=" #$output)
+                        (string-append "INSTALL_MOD_PATH=" #$output)
+                        "INSTALL_MOD_STRIP=1"
+                        "modules_install")
+                (let* ((versions (filter (lambda (name)
+                                           (not (string-prefix? "." name)))
+                                         (scandir moddir)))
+                       (version (match versions
+                                  ((x) x))))
+                  ;; There are symlinks to the build and source directory.
+                  ;; Both will point to target /tmp/guix-build* and thus
+                  ;; not be useful in a profile.  Delete the symlinks.
+                  (false-if-file-not-found
+                   (delete-file
+                    (string-append moddir "/" version "/build")))
+                  (false-if-file-not-found
+                   (delete-file
+                    (string-append moddir "/" version "/source"))))))))))
     (native-inputs
      `(("perl" ,perl)
        ("bc" ,bc)
        ("openssl" ,openssl)
-       ("elfutils" ,elfutils)  ; Needed to enable CONFIG_STACK_VALIDATION
+       ("elfutils" ,elfutils)        ;needed to enable CONFIG_STACK_VALIDATION
        ("flex" ,flex)
        ("bison" ,bison)
 
@@ -809,6 +952,19 @@ (define* (make-linux-libre* version gnu-revision source supported-systems
        ("mpfr" ,mpfr)
        ("mpc" ,mpc)
 
+       ;; For generating the documentation.
+       ,@(if build-doc?
+             ;; TODO: remove fontconfig after the 5.10 kernel is dropped.
+             ;; Also replace python-wrapper by python at that time.
+             `(("fontconfig" ,fontconfig)
+               ("graphviz" ,graphviz)
+               ("python" ,python-wrapper)
+               ("python-sphinx" ,python-sphinx)
+               ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
+               ("texinfo" ,texinfo)
+               ("which" ,which))
+             '())
+
        ,@(match (let ((arch (platform-linux-architecture
                              (lookup-platform-by-target-or-system
                               (or (%current-target-system)
@@ -817,115 +973,14 @@ (define* (make-linux-libre* version gnu-revision source supported-systems
                        (configuration-file
                         arch
                         #:variant (version-major+minor version))))
-           (#f                                    ;no config for this platform
+           (#f                          ;no config for this platform
             '())
            ((? string? config)
             `(("kconfig" ,config))))))
-    (arguments
-     (list #:modules '((guix build gnu-build-system)
-                       (guix build utils)
-                       (srfi srfi-1)
-                       (srfi srfi-26)
-                       (ice-9 ftw)
-                       (ice-9 match))
-           #:phases
-           #~(modify-phases %standard-phases
-               (add-after 'unpack 'patch-/bin/pwd
-                 (lambda _
-                   (substitute* (find-files "." "^Makefile(\\.include)?$")
-                     (("/bin/pwd") "pwd"))))
-               (replace 'configure
-                 (lambda* (#:key inputs target #:allow-other-keys)
-                   ;; Avoid introducing timestamps.
-                   (setenv "KCONFIG_NOTIMESTAMP" "1")
-                   (setenv "KBUILD_BUILD_TIMESTAMP"
-                           (getenv "SOURCE_DATE_EPOCH"))
-
-                   ;; Other variables useful for reproducibility.
-                   (setenv "KBUILD_BUILD_USER" "guix")
-                   (setenv "KBUILD_BUILD_HOST" "guix")
-
-                   ;; Set ARCH and CROSS_COMPILE.
-                   (let ((arch #$(platform-linux-architecture
-                                  (lookup-platform-by-target-or-system
-                                   (or (%current-target-system)
-                                       (%current-system))))))
-                     (setenv "ARCH" arch)
-                     (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
-
-                     (when target
-                       (setenv "CROSS_COMPILE" (string-append target "-"))
-                       (format #t "`CROSS_COMPILE' set to `~a'~%"
-                               (getenv "CROSS_COMPILE"))))
-
-                   (setenv "EXTRAVERSION"
-                           #$(and extra-version
-                                  (string-append "-" extra-version)))
-
-                   (let ((config (assoc-ref inputs "kconfig")))
-
-                     ;; Use a custom kernel configuration file or a default
-                     ;; configuration file.
-                     (if config
-                         (begin
-                           (copy-file config ".config")
-                           (chmod ".config" #o666))
-                         (invoke "make" #$defconfig))
-
-                     ;; Appending works even when the option wasn't in the
-                     ;; file.  The last one prevails if duplicated.
-                     (let ((port (open-file ".config" "a"))
-                           (extra-configuration #$(config->string extra-options)))
-                       (display extra-configuration port)
-                       (close-port port))
-
-                     (invoke "make" "oldconfig"))))
-               (replace 'install
-                 (lambda* (#:key inputs native-inputs #:allow-other-keys)
-                   (let ((moddir (string-append #$output "/lib/modules"))
-                         (dtbdir (string-append #$output "/lib/dtbs")))
-                     ;; Install kernel image, kernel configuration and link map.
-                     (for-each (lambda (file) (install-file file #$output))
-                               (find-files "." "^(\\.config|bzImage|zImage|Image|vmlinuz|System\\.map|Module\\.symvers)$"))
-                     ;; Install device tree files
-                     (unless (null? (find-files "." "\\.dtb$"))
-                       (mkdir-p dtbdir)
-                       (invoke "make" (string-append "INSTALL_DTBS_PATH=" dtbdir)
-                               "dtbs_install"))
-                     ;; Install kernel modules
-                     (mkdir-p moddir)
-                     (invoke "make"
-                             ;; Disable depmod because the Guix system's
-                             ;; module directory is an union of potentially
-                             ;; multiple packages.  It is not possible to use
-                             ;; depmod to usefully calculate a dependency
-                             ;; graph while building only one of them.
-                             "DEPMOD=true"
-                             (string-append "MODULE_DIR=" moddir)
-                             (string-append "INSTALL_PATH=" #$output)
-                             (string-append "INSTALL_MOD_PATH=" #$output)
-                             "INSTALL_MOD_STRIP=1"
-                             "modules_install")
-                     (let* ((versions (filter (lambda (name)
-                                                (not (string-prefix? "." name)))
-                                              (scandir moddir)))
-                            (version (match versions
-                                       ((x) x))))
-                       ;; There are symlinks to the build and source directory.
-                       ;; Both will point to target /tmp/guix-build* and thus
-                       ;; not be useful in a profile.  Delete the symlinks.
-                       (false-if-file-not-found
-                        (delete-file
-                         (string-append moddir "/" version "/build")))
-                       (false-if-file-not-found
-                        (delete-file
-                         (string-append moddir "/" version "/source"))))))))
-           #:tests? #f))
     (home-page "https://www.gnu.org/software/linux-libre/")
     (synopsis "100% free redistribution of a cleaned Linux kernel")
-    (description
-     "GNU Linux-Libre is a free (as in freedom) variant of the Linux kernel.
-It has been modified to remove all non-free binary blobs.")
+    (description "GNU Linux-Libre is a free (as in freedom) variant of the
+Linux kernel.  It has been modified to remove all non-free binary blobs.")
     (license license:gpl2)
     (properties '((max-silent-time . 3600))))) ;don't timeout on blob scan.
 
diff --git a/gnu/packages/patches/linux-libre-infodocs-target.patch b/gnu/packages/patches/linux-libre-infodocs-target.patch
new file mode 100644
index 0000000000..e9e6495c26
--- /dev/null
+++ b/gnu/packages/patches/linux-libre-infodocs-target.patch
@@ -0,0 +1,88 @@
+Upstream status: https://marc.info/?l=linux-doc&m=166861669723994&w=2
+
+From 7edb5b278ee383ff9bed525329b2cdbe22317bf2 Mon Sep 17 00:00:00 2001
+From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
+Date: Mon, 14 Nov 2022 22:51:11 -0500
+Subject: [PATCH] doc: add texinfodocs and infodocs targets
+
+Sphinx supports generating Texinfo sources and Info documentation,
+which can be navigated easily and is convenient to search (via the
+indexed nodes or anchors, for example).
+
+This change also causes the html output to appear under its own output
+sub-directory, which makes it easier to install, since it's clean from
+.doctrees or other output formats.
+
+Signed-off-by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
+---
+ Documentation/Makefile                     | 13 ++++++++++++-
+ Documentation/userspace-api/media/Makefile |  3 ++-
+ Makefile                                   |  2 +-
+ 3 files changed, 15 insertions(+), 3 deletions(-)
+
+diff --git a/Documentation/Makefile b/Documentation/Makefile
+index 64d44c1ecad3..bd8dac560633 100644
+--- a/Documentation/Makefile
++++ b/Documentation/Makefile
+@@ -93,7 +93,16 @@ quiet_cmd_sphinx = SPHINX  $@ --> file://$(abspath $(BUILDDIR)/$3/$4)
+ 
+ htmldocs:
+ 	@$(srctree)/scripts/sphinx-pre-install --version-check
+-	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
++	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),html,$(var)))
++
++texinfodocs:
++	@$(srctree)/scripts/sphinx-pre-install --version-check
++	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,texinfo,$(var),texinfo,$(var)))
++
++# Note: the 'info' Make target is generated by sphinx itself when
++# running the texinfodocs target define above.
++infodocs: texinfodocs
++	$(MAKE) -C $(BUILDDIR)/texinfo info
+ 
+ linkcheckdocs:
+ 	@$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,linkcheck,$(var),,$(var)))
+@@ -143,6 +152,8 @@ cleandocs:
+ dochelp:
+ 	@echo  ' Linux kernel internal documentation in different formats from ReST:'
+ 	@echo  '  htmldocs        - HTML'
++	@echo  '  texinfodocs     - Texinfo'
++	@echo  '  infodocs        - Info'
+ 	@echo  '  latexdocs       - LaTeX'
+ 	@echo  '  pdfdocs         - PDF'
+ 	@echo  '  epubdocs        - EPUB'
+diff --git a/Documentation/userspace-api/media/Makefile b/Documentation/userspace-api/media/Makefile
+index 00922aa7efde..3d8aaf5c253b 100644
+--- a/Documentation/userspace-api/media/Makefile
++++ b/Documentation/userspace-api/media/Makefile
+@@ -47,10 +47,11 @@ $(BUILDDIR)/lirc.h.rst: ${UAPI}/lirc.h ${PARSER} $(SRC_DIR)/lirc.h.rst.exception
+ 
+ # Media build rules
+ 
+-.PHONY: all html epub xml latex
++.PHONY: all html texinfo epub xml latex
+ 
+ all: $(IMGDOT) $(BUILDDIR) ${TARGETS}
+ html: all
++texinfo: all
+ epub: all
+ xml: all
+ latex: $(IMGPDF) all
+diff --git a/Makefile b/Makefile
+index 58cd4f5e1c3a..b3266c408b6c 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1785,7 +1785,7 @@ $(help-board-dirs): help-%:
+ # Documentation targets
+ # ---------------------------------------------------------------------------
+ DOC_TARGETS := xmldocs latexdocs pdfdocs htmldocs epubdocs cleandocs \
+-	       linkcheckdocs dochelp refcheckdocs
++	       linkcheckdocs dochelp refcheckdocs texinfodocs infodocs
+ PHONY += $(DOC_TARGETS)
+ $(DOC_TARGETS):
+ 	$(Q)$(MAKE) $(build)=Documentation $@
+
+base-commit: 81e7cfa3a9eb4ba6993a9c71772fdab21bc5d870
+-- 
+2.38.1
+

base-commit: 351bada95049f0023aaf2fc7c91ee4b33e94486c
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#59313; Package guix-patches. (Tue, 22 Nov 2022 06:47:01 GMT) Full text and rfc822 format available.

Message #20 received at 59313 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: 59313 <at> debbugs.gnu.org, mail <at> cbaines.net
Subject: Re: bug#59313: [PATCH] gnu: linux-libre: Enable building html and
 info doc.
Date: Tue, 22 Nov 2022 07:46:14 +0100
Hi Maxim,

Maxim Cournoyer <maxim.cournoyer <at> gmail.com> 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’.




Information forwarded to guix-patches <at> gnu.org:
bug#59313; Package guix-patches. (Tue, 22 Nov 2022 06:50:01 GMT) Full text and rfc822 format available.

Message #23 received at 59313 <at> debbugs.gnu.org (full text, mbox):

From: "(" <paren <at> disroot.org>
To: Ludovic Courtès <ludo <at> gnu.org>, "Maxim Cournoyer"
 <maxim.cournoyer <at> gmail.com>
Cc: 59313 <at> debbugs.gnu.org, mail <at> cbaines.net
Subject: Re: [bug#59313] [PATCH] gnu: linux-libre: Enable building html and
 info doc.
Date: Tue, 22 Nov 2022 06:49:22 +0000
On Tue Nov 22, 2022 at 6:46 AM GMT, Ludovic Courtès wrote:
> Nitpick: I’d write “[arguments]” rather than “[phases]”.

``[arguments]<#:phases>'' would be better, no?

    -- (




Information forwarded to guix-patches <at> gnu.org:
bug#59313; Package guix-patches. (Tue, 22 Nov 2022 10:33:01 GMT) Full text and rfc822 format available.

Message #26 received at 59313 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: "(" <paren <at> disroot.org>
Cc: Ludovic Courtès <ludo <at> gnu.org>, mail <at> cbaines.net,
 59313 <at> debbugs.gnu.org
Subject: Re: [bug#59313] [PATCH] gnu: linux-libre: Enable building html and
 info doc.
Date: Tue, 22 Nov 2022 05:32:26 -0500
Hi,

"(" <paren <at> disroot.org> writes:

> On Tue Nov 22, 2022 at 6:46 AM GMT, Ludovic Courtès wrote:
>> Nitpick: I’d write “[arguments]” rather than “[phases]”.
>
> ``[arguments]<#:phases>'' would be better, no?

To nitpick myself, if we want to stick to the canonical GNU ChangeLog
style (in its most modern revision), we wouldn't use square brackets as
that is meant for conditional changes [0, 1]; we'd only use ( ) for the
variable name then < > to denote where the change occurred.

Unfortunately < > are a pain to use (breaks auto-completion for some
reason).

[0] info '(standards) Conditional Changes'
[1] info '(standards) Indicating the Part Changed'

-- 
Thanks,
Maxim




Reply sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
You have taken responsibility. (Thu, 24 Nov 2022 21:38:01 GMT) Full text and rfc822 format available.

Notification sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
bug acknowledged by developer. (Thu, 24 Nov 2022 21:38:01 GMT) Full text and rfc822 format available.

Message #31 received at 59313-done <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 59313-done <at> debbugs.gnu.org, mail <at> cbaines.net
Subject: Re: bug#59313: [PATCH] gnu: linux-libre: Enable building html and
 info doc.
Date: Thu, 24 Nov 2022 16:37:30 -0500
Hi Ludo,

Ludovic Courtès <ludo <at> gnu.org> writes:

> Hi Maxim,
>
> Maxim Cournoyer <maxim.cournoyer <at> gmail.com> 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.

Fixed.

>
>> * 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]”.

Adjusted.

>> [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.

Done, like this:

--8<---------------cut here---------------start------------->8---
modified   gnu/packages/linux.scm
@@ -815,8 +815,6 @@ (define* (make-linux-libre* version gnu-revision source supported-systems
     (version version)
     (source source)
     (supported-systems supported-systems)
-    (outputs `("out"
-               ,@(if build-doc? '("doc") '())))
     (build-system gnu-build-system)
     (arguments
      (list
@@ -840,15 +838,10 @@ (define* (make-linux-libre* version gnu-revision source supported-systems
                         (substitute* "Documentation/Makefile"
                           ;; Remove problematic environment check script.
                           ((".*scripts/sphinx-pre-install.*") ""))
-                        (invoke "make" "infodocs" "htmldocs")))
+                        (invoke "make" "infodocs")))
                     (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"))))))
--8<---------------cut here---------------end--------------->8---

(as well as python-sphinx-rtd, not shown above) and pushed.

Thanks for the review!

-- 
Thanks,
Maxim




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 23 Dec 2022 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 237 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.