Skip to content

Commit 10a1df3

Browse files
xyprontrini
authored andcommitted
doc: update Kernel documentation build system
Update the docomentation build system according to Linux v5.11-rc1. With this patch we can build the HTML documentation using either of Sphinx 2 and Sphinx 3. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> [Fix warning in b4860qds.rst about "Switch Settings"] Signed-off-by: Tom Rini <trini@konsulko.com>
1 parent 4afc4f3 commit 10a1df3

File tree

15 files changed

+1480
-160
lines changed

15 files changed

+1480
-160
lines changed

doc/board/freescale/b4860qds.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ B4420 has:
133133
B4860QDS Default Settings
134134
-------------------------
135135

136-
Switch Settings
137-
^^^^^^^^^^^^^^^
136+
B4860QDS Switch Settings
137+
^^^^^^^^^^^^^^^^^^^^^^^^
138138

139139
.. code-block:: none
140140
@@ -166,8 +166,8 @@ NOR boot::
166166
B4420QDS Default Settings
167167
-------------------------
168168

169-
Switch Settings
170-
^^^^^^^^^^^^^^^
169+
B4420QDS Switch Settings
170+
^^^^^^^^^^^^^^^^^^^^^^^^
171171

172172
.. code-block:: none
173173

doc/conf.py

Lines changed: 113 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
import os
1717
import sphinx
1818

19+
from subprocess import check_output
20+
1921
# Get Sphinx version
2022
major, minor, patch = sphinx.version_info[:3]
2123

@@ -31,39 +33,98 @@
3133
# If your documentation needs a minimal Sphinx version, state it here.
3234
needs_sphinx = '1.3'
3335

34-
latex_engine = 'xelatex'
35-
3636
# Add any Sphinx extension module names here, as strings. They can be
3737
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3838
# ones.
39-
extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include', 'kfigure']
39+
extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include',
40+
'kfigure', 'sphinx.ext.ifconfig', 'automarkup',
41+
'maintainers_include', 'sphinx.ext.autosectionlabel',
42+
'kernel_abi', 'kernel_feat']
4043

4144
#
42-
# cdomain is badly broken in Sphinx 3+. Leaving it out generates *most*
43-
# of the docs correctly, but not all.
45+
# cdomain is badly broken in Sphinx 3+. Leaving it out generates *most*
46+
# of the docs correctly, but not all. Scream bloody murder but allow
47+
# the process to proceed; hopefully somebody will fix this properly soon.
4448
#
4549
if major >= 3:
50+
sys.stderr.write('''WARNING: The kernel documentation build process
51+
support for Sphinx v3.0 and above is brand new. Be prepared for
52+
possible issues in the generated output.
53+
''')
4654
if (major > 3) or (minor > 0 or patch >= 2):
47-
sys.stderr.write('''The build process with Sphinx 3+ is broken.
48-
You will have to remove -W in doc/Makefile.
49-
''')
5055
# Sphinx c function parser is more pedantic with regards to type
5156
# checking. Due to that, having macros at c:function cause problems.
52-
# Those needed to be escaped by using c_id_attributes[] array
57+
# Those needed to be scaped by using c_id_attributes[] array
5358
c_id_attributes = [
54-
55-
# include/linux/compiler.h
59+
# GCC Compiler types not parsed by Sphinx:
60+
"__restrict__",
61+
62+
# include/linux/compiler_types.h:
63+
"__iomem",
64+
"__kernel",
65+
"noinstr",
66+
"notrace",
67+
"__percpu",
68+
"__rcu",
69+
"__user",
70+
71+
# include/linux/compiler_attributes.h:
72+
"__alias",
73+
"__aligned",
74+
"__aligned_largest",
75+
"__always_inline",
76+
"__assume_aligned",
77+
"__cold",
78+
"__attribute_const__",
79+
"__copy",
80+
"__pure",
81+
"__designated_init",
82+
"__visible",
83+
"__printf",
84+
"__scanf",
85+
"__gnu_inline",
86+
"__malloc",
87+
"__mode",
88+
"__no_caller_saved_registers",
89+
"__noclone",
90+
"__nonstring",
91+
"__noreturn",
92+
"__packed",
93+
"__pure",
94+
"__section",
95+
"__always_unused",
5696
"__maybe_unused",
97+
"__used",
98+
"__weak",
99+
"noinline",
57100

58101
# include/efi.h
59102
"EFIAPI",
60103

61104
# include/efi_loader.h
62105
"__efi_runtime",
106+
107+
# include/linux/memblock.h:
108+
"__init_memblock",
109+
"__meminit",
110+
111+
# include/linux/init.h:
112+
"__init",
113+
"__ref",
114+
115+
# include/linux/linkage.h:
116+
"asmlinkage",
63117
]
64118

65119
else:
66120
extensions.append('cdomain')
121+
if major == 1 and minor < 7:
122+
sys.stderr.write('WARNING: Sphinx 1.7 or greater will be required as of '
123+
'the v2021.04 release\n')
124+
125+
# Ensure that autosectionlabel will produce unique names
126+
autosectionlabel_prefix_document = True
127+
autosectionlabel_maxdepth = 2
67128

68129
# The name of the math extension changed on Sphinx 1.4
69130
if (major == 1 and minor > 3) or (major > 1):
@@ -86,9 +147,9 @@
86147
master_doc = 'index'
87148

88149
# General information about the project.
89-
project = 'Das U-Boot'
90-
copyright = 'The U-Boot development community'
91-
author = 'The U-Boot development community'
150+
project = 'The Linux Kernel'
151+
copyright = 'The kernel development community'
152+
author = 'The kernel development community'
92153

93154
# The version info for the project you're documenting, acts as replacement for
94155
# |version| and |release|, also used in various other places throughout the
@@ -199,7 +260,7 @@
199260

200261
# The name of an image file (relative to this directory) to place at the top
201262
# of the sidebar.
202-
html_logo = '../tools/logos/u-boot_logo.svg'
263+
#html_logo = None
203264

204265
# The name of an image file (within the static path) to use as favicon of the
205266
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
@@ -229,7 +290,7 @@
229290

230291
# If true, SmartyPants will be used to convert quotes and dashes to
231292
# typographically correct entities.
232-
#html_use_smartypants = True
293+
html_use_smartypants = False
233294

234295
# Custom sidebar templates, maps document names to template names.
235296
#html_sidebars = {}
@@ -279,7 +340,7 @@
279340
#html_search_scorer = 'scorer.js'
280341

281342
# Output file base name for HTML help builder.
282-
htmlhelp_basename = 'TheUBootdoc'
343+
htmlhelp_basename = 'TheLinuxKerneldoc'
283344

284345
# -- Options for LaTeX output ---------------------------------------------
285346

@@ -288,7 +349,7 @@
288349
'papersize': 'a4paper',
289350

290351
# The font size ('10pt', '11pt' or '12pt').
291-
'pointsize': '8pt',
352+
'pointsize': '11pt',
292353

293354
# Latex figure (float) alignment
294355
#'figure_align': 'htbp',
@@ -301,13 +362,24 @@
301362
'preamble': '''
302363
% Use some font with UTF-8 support with XeLaTeX
303364
\\usepackage{fontspec}
304-
\\setsansfont{DejaVu Serif}
305-
\\setromanfont{DejaVu Sans}
365+
\\setsansfont{DejaVu Sans}
366+
\\setromanfont{DejaVu Serif}
306367
\\setmonofont{DejaVu Sans Mono}
307-
308368
'''
309369
}
310370

371+
# At least one book (translations) may have Asian characters
372+
# with are only displayed if xeCJK is used
373+
374+
cjk_cmd = check_output(['fc-list', '--format="%{family[0]}\n"']).decode('utf-8', 'ignore')
375+
if cjk_cmd.find("Noto Sans CJK SC") >= 0:
376+
print ("enabling CJK for LaTeX builder")
377+
latex_elements['preamble'] += '''
378+
% This is needed for translations
379+
\\usepackage{xeCJK}
380+
\\setCJKmainfont{Noto Sans CJK SC}
381+
'''
382+
311383
# Fix reference escape troubles with Sphinx 1.4.x
312384
if major == 1 and minor > 3:
313385
latex_elements['preamble'] += '\\renewcommand*{\\DUrole}[2]{ #2 }\n'
@@ -398,10 +470,23 @@
398470
# author, documentclass [howto, manual, or own class]).
399471
# Sorted in alphabetical order
400472
latex_documents = [
401-
('index', 'u-boot-hacker-manual.tex', 'U-Boot Hacker Manual',
402-
'The U-Boot development community', 'manual'),
403473
]
404474

475+
# Add all other index files from Documentation/ subdirectories
476+
for fn in os.listdir('.'):
477+
doc = os.path.join(fn, "index")
478+
if os.path.exists(doc + ".rst"):
479+
has = False
480+
for l in latex_documents:
481+
if l[0] == doc:
482+
has = True
483+
break
484+
if not has:
485+
latex_documents.append((doc, fn + '.tex',
486+
'Linux %s Documentation' % fn.capitalize(),
487+
'The kernel development community',
488+
'manual'))
489+
405490
# The name of an image file (relative to this directory) to place at the top of
406491
# the title page.
407492
#latex_logo = None
@@ -428,7 +513,7 @@
428513
# One entry per manual page. List of tuples
429514
# (source start file, name, description, authors, manual section).
430515
man_pages = [
431-
(master_doc, 'dasuboot', 'The U-Boot Documentation',
516+
(master_doc, 'thelinuxkernel', 'The Linux Kernel Documentation',
432517
[author], 1)
433518
]
434519

@@ -442,8 +527,8 @@
442527
# (source start file, target name, title, author,
443528
# dir menu entry, description, category)
444529
texinfo_documents = [
445-
(master_doc, 'DasUBoot', 'The U-Boot Documentation',
446-
author, 'DasUBoot', 'One line description of project.',
530+
(master_doc, 'TheLinuxKernel', 'The Linux Kernel Documentation',
531+
author, 'TheLinuxKernel', 'One line description of project.',
447532
'Miscellaneous'),
448533
]
449534

@@ -535,13 +620,13 @@
535620
# Grouping the document tree into PDF files. List of tuples
536621
# (source start file, target name, title, author, options).
537622
#
538-
# See the Sphinx chapter of http://ralsina.me/static/manual.pdf
623+
# See the Sphinx chapter of https://ralsina.me/static/manual.pdf
539624
#
540625
# FIXME: Do not add the index file here; the result will be too big. Adding
541626
# multiple PDF files here actually tries to get the cross-referencing right
542627
# *between* PDF files.
543628
pdf_documents = [
544-
('uboot-documentation', u'U-Boot', u'U-Boot', u'J. Random Bozo'),
629+
('kernel-documentation', u'Kernel', u'Kernel', u'J. Random Bozo'),
545630
]
546631

547632
# kernel-doc extension configuration for running Sphinx directly (e.g. by Read

0 commit comments

Comments
 (0)