summary refs log tree commit diff
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2022-12-16 13:39:48 -0500
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2022-12-28 16:03:20 -0500
commit0d4587d65fe1ad0d9357a6d9f776bc7d17391b8e (patch)
tree099d88ae35177f85a0a544ee40730b7180db1f83
parentfde5af3962c8fafc5d20e5d742cc7aea907f3563 (diff)
downloadguix-0d4587d65fe1ad0d9357a6d9f776bc7d17391b8e.tar.gz
gnu: Add u-boot-documentation.
* gnu/packages/patches/u-boot-infodocs-target.patch: New patch.
* gnu/local.mk: (dist_patch_DATA): Register it.
* gnu/packages/bootloaders.scm (u-boot): Apply it.
(u-boot-documentation): New variable.
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/bootloaders.scm41
-rw-r--r--gnu/packages/patches/u-boot-infodocs-target.patch84
3 files changed, 125 insertions, 1 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 0d4028a161..71b8ba506b 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1916,6 +1916,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/tuxpaint-stamps-path.patch		\
   %D%/packages/patches/twinkle-bcg729.patch			\
   %D%/packages/patches/u-boot-allow-disabling-openssl.patch	\
+  %D%/packages/patches/u-boot-infodocs-target.patch		\
   %D%/packages/patches/u-boot-nintendo-nes-serial.patch		\
   %D%/packages/patches/u-boot-rockchip-inno-usb.patch		\
   %D%/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch	\
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 89f051f337..a0d1bb279e 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -17,6 +17,7 @@
 ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
 ;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
 ;;; Copyright © 2021 Stefan <stefan-guix@vodafonemail.de>
+;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -62,6 +63,7 @@
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages sdl)
+  #:use-module (gnu packages sphinx)
   #:use-module (gnu packages serialization)
   #:use-module (gnu packages swig)
   #:use-module (gnu packages valgrind)
@@ -638,7 +640,8 @@ tree binary files.  These are board description files used by Linux and BSD.")
                (list %u-boot-rockchip-inno-usb-patch
                      %u-boot-allow-disabling-openssl-patch
                      %u-boot-sifive-prevent-relocating-initrd-fdt
-                     %u-boot-rk3399-enable-emmc-phy-patch))
+                     %u-boot-rk3399-enable-emmc-phy-patch
+                     (search-patch "u-boot-infodocs-target.patch")))
               (method url-fetch)
               (uri (string-append
                     "https://ftp.denx.de/pub/u-boot/"
@@ -669,6 +672,42 @@ tree binary files.  These are board description files used by Linux and BSD.")
 also initializes the boards (RAM etc).")
     (license license:gpl2+)))
 
+;;; This is very similar to the linux-libre-documentation package, since it
+;;; reuses the same Makefile-based build system.
+(define-public u-boot-documentation
+  (package
+    (inherit u-boot)
+    (name "u-boot-documentation")
+    (arguments
+     (list
+      #:make-flags #~(list "HOSTCC=gcc"
+                           ;; Avoid treating Sphinx warnings as errors.
+                           "SPHINXOPTS=")
+      #:tests? #f
+      #:phases #~(modify-phases %standard-phases
+                   (delete 'configure)
+                   (replace 'build
+                     (lambda* (#:key make-flags #:allow-other-keys)
+                       (apply invoke "make" "infodocs" make-flags)))
+                   (replace 'install
+                     (lambda* (#:key make-flags #:allow-other-keys)
+                       (let* ((info-dir (string-append #$output "/share/info"))
+                              (info (string-append info-dir
+                                                   "/DasUBoot.info.gz")))
+                         (with-directory-excursion "doc/output"
+                           (apply invoke "make" "-C" "texinfo" "install-info"
+                                  (string-append "infodir=" info-dir)
+                                  make-flags))))))))
+    (native-inputs
+     (modify-inputs (package-native-inputs u-boot)
+       (append fontconfig
+               python-sphinx
+               texinfo
+               which)))
+    (synopsis "U-Boot documentation")
+    (description "This package provides the documentation for U-Boot, as an
+Info manual.")))
+
 (define-public u-boot-tools
   (package
     (inherit u-boot)
diff --git a/gnu/packages/patches/u-boot-infodocs-target.patch b/gnu/packages/patches/u-boot-infodocs-target.patch
new file mode 100644
index 0000000000..5b21a99de3
--- /dev/null
+++ b/gnu/packages/patches/u-boot-infodocs-target.patch
@@ -0,0 +1,84 @@
+Upstream status: https://patchwork.ozlabs.org/project/uboot/list/?series=333259
+
+diff --git a/Makefile b/Makefile
+index de5746399a..597a8886c3 100644
+--- a/Makefile
++++ b/Makefile
+@@ -2372,7 +2372,7 @@ tcheck:
+ # Documentation targets
+ # ---------------------------------------------------------------------------
+ DOC_TARGETS := xmldocs latexdocs pdfdocs htmldocs epubdocs cleandocs \
+-	       linkcheckdocs dochelp refcheckdocs
++	       linkcheckdocs dochelp refcheckdocs texinfodocs infodocs
+ PHONY += $(DOC_TARGETS)
+ $(DOC_TARGETS): scripts_basic FORCE
+ 	$(Q)$(MAKE) $(build)=doc $@
+diff --git a/doc/Makefile b/doc/Makefile
+index f5de65e927..d0904a9f99 100644
+--- a/doc/Makefile
++++ b/doc/Makefile
+@@ -69,6 +69,14 @@ quiet_cmd_sphinx = SPHINX  $@ --> file://$(abspath $(BUILDDIR)/$3/$4)
+ htmldocs:
+ 	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
+ 
++texinfodocs:
++	@+$(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 defined above.
++infodocs: texinfodocs
++	$(MAKE) -C $(BUILDDIR)/texinfo info
++
+ linkcheckdocs:
+ 	@$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,linkcheck,$(var),,$(var)))
+ 
+@@ -109,6 +117,8 @@ cleandocs:
+ dochelp:
+ 	@echo  ' U-Boot 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/doc/conf.py b/doc/conf.py
+index 62c8d31270..3db70f80c1 100644
+--- a/doc/conf.py
++++ b/doc/conf.py
+@@ -449,7 +449,7 @@ for fn in os.listdir('.'):
+ # One entry per manual page. List of tuples
+ # (source start file, name, description, authors, manual section).
+ man_pages = [
+-    (master_doc, 'dasuboot', 'The U-Boot Documentation',
++    (master_doc, 'u-boot', 'The U-Boot Documentation',
+      [author], 1)
+ ]
+ 
+@@ -463,8 +463,8 @@ man_pages = [
+ # (source start file, target name, title, author,
+ #  dir menu entry, description, category)
+ texinfo_documents = [
+-    (master_doc, 'DasUBoot', 'The U-Boot Documentation',
+-     author, 'DasUBoot', 'One line description of project.',
++    (master_doc, 'u-boot', 'The U-Boot Documentation',
++     author, 'U-Boot', 'Boot loader for embedded systems',
+      'Miscellaneous'),
+ ]
+ 
+diff --git a/doc/media/Makefile b/doc/media/Makefile
+index b9b43a34c3..9b32258696 100644
+--- a/doc/media/Makefile
++++ b/doc/media/Makefile
+@@ -22,10 +22,11 @@ $(BUILDDIR)/linker_lists.h.rst: ${API}/linker_lists.h ${PARSER} $(SRC_DIR)/linke
+ 
+ # 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