source: rtems-docs/README.txt @ 62efd4c

5
Last change on this file since 62efd4c was 62efd4c, checked in by Chris Johns <chrisj@…>, on 02/19/19 at 23:11:37

waf: Change --sphinx-verbose to --sphinx-options, add --sphinx-nit-pick

Provide options to manage sphinx. Make using the nit-picky mode simpler
to access.

  • Property mode set to 100644
File size: 15.9 KB
Line 
1RTEMS Project Documentation
2===========================
3
4The documents are written in ReST and built using Sphinx. The build system will
5check the version of Sphinx and ensure you have a suitable version
6available. If your host does not provide a packaged version use PIP to fetch a
7recent version. The Sphinx website provides details on doing this.
8
9ReST is the Re-Structured-Text format. It is a simple markup language that allows
10us to create quality documentaion. It is flexible and powerful however does not
11attempt to train it to create a specific format. You need to test any new way
12of presenting something on all output formats. What may look great in one
13format may not translate with the same clarity to another output format.
14
15The RTEMS Documentation output formats are:
16
17 HTML        - Multi-page HTML with files in a single directory per manual.
18 PDF         - Single PDF per manual.
19 Single HTML - Single HTML, one file per manual.
20
21The PDF format is created using Latex and that uses texlive packages. This
22exposes us to the complex world of Latex however the quality of the documents
23created is worth it.
24
25Images can be created from source using PlantUML and Ditaa.
26
27Production Quality Hosts
28------------------------
29
30We allow the building of PDF documentation on hosts that do not have a fully
31suitable texlive environment and this results in quality that is not at the
32production level.
33
34The hosts which produce production quality are:
35
36 FreeBSD
37 CentOS 6 and 7 (if using texlive, not RPMs of texlive)
38
39NOTE: RedHat Enterprise Linux (RHEL) and Fedora should be the same as CentOS.
40
41Images
42------
43
44All images should be placed int he 'images' directory and referenced from the
45ReST with a relative path. This lets us shared and control images.
46
47We prefer being able to build images from source. This is not always possible
48so SVG format is preferred with generated PNG images to make sure the quality
49is consistent when building PDF output.
50
51Building images requires the source with an apporoiate file extension
52is placed in the images directory. The built output image is written
53back to the images directory. All images may be built or rebuilt when
54building images is enabled via the waf configure command line. Please
55only add and commit those images that have changed.
56
57We support building images in:
58
591. PlantUML (.puml), enable with `--plantuml`
60
612. Ditaa (.ditaa), enable with `--ditaa`
62
63We support the PlantUML image language. The PlantUML home page is:
64
65 http://plantuml.com/
66
67The page as a link to an 'online demo server' you can use to create images
68rathre than installing PlantUML. Save you source then View and save the PNG
69format image. The PlantUML language reference guide is:
70
71 http://plantuml.com/PlantUML_Language_Reference_Guide.pdf
72
73And the web site has online documentation. The image source extension is
74'.puml'.
75
76We also support Ditaa image language. The Ditaa home page is:
77
78 http://ditaa.sourceforge.net/
79
80The home page contain the language options. The PlantUML online demo server
81supports Ditaa so use that resource as an online tool. The Ditaa image source
82extension is '.ditaa'.
83
84You do not need PlantUML or Ditaa install to build our documentation. The
85online resources can be used. Save the source and the generated PNG file in the
86same directory under 'images'.
87
88Host Setup
89----------
90
91HTML builds directly with Sphinx, PDF requires a full Latex (texlive) install,
92and building a Single HTML page requires the 'inliner' tool. The
93sphinxcontrib-bibtex extension is mandatory. PlantUML requres the Node.js
94package called 'node-plantuml' which installs the 'puml' command and Ditaa needs
95the 'ditaa' command and package. Ditaa images are built using the 'puml'
96command.
97
98Please add your host as you set it up.
99
100Sphinx Per User Install
101~~~~~~~~~~~~~~~~~~~~~~~
102
103You can use this method to install a personal version of Sphinx if your host
104does not provide a suitable package:
105
106  $ pip install -U --user sphinx
107  $ pip install --user sphinxcontrib-bibtex
108
109On some hosts, this may complain that a newer version of pip is available.
110If so, then upgrade pip into your personal area.
111
112 $ pip install --upgrade --user pip
113
114The personal area for these tools is ${HOME}/.local/bin. It should
115be PREPENDED to your path. On a 32-bit install of CentOS, RHEL, or
116Fedora, these were the PATH modifications to use the local install of
117Texlive and sphinx:
118
119  export PATH=/usr/local/texlive/2016/bin/i386-linux/:${PATH}
120  export PATH=${HOME}/.local/bin:${PATH}
121
122If on a 64-bit install of CentOS, RHEL, or Fedora, these will
123be the PATH modifications to use the local install of Texlive
124and sphinx:
125
126  export PATH=/usr/local/texlive/2016/bin/x86_64-linux/:${PATH}
127  export PATH=${HOME}/.local/bin:${PATH}
128
129Windows
130~~~~~~~
131
132To build the documentation on Windows you need to install an offical Python
133build from https://www.python.org/. We suggest you install a recent 2.7 series
13464bit build. The versions 2.7.9 and after include pip.
135
136Note: you cannot use the MSYS2 versions of Python because the pip libraries
137that contain C or C++ code are built with MSVC libraries and cannot integrate
138with the MSYS2 built python.
139
140The following assumes Python is installed to its default path of C:\Python27.
141
142Open an MSYS2 terminal window and add the needed paths to Python and its
143scripts:
144
145 $ export PATH=/c/Python27/Scripts:/c/Python27:$PATH
146
147Install Sphinx and any needed extensions:
148
149 $ pip install sphinx
150 $ pip install sphinxcontrib-bibtex
151
152FreeBSD
153~~~~~~~
154
155PDF Quality: production
156
157Sphinx:
158
159  # pkg install py27-sphinx
160
161PDF:
162
163  # pkg install texlive-full
164
165Single HTML:
166
167  # pkg install npm
168  # npm install -g inliner
169
170Plant UML:
171
172Install NPM as shown in Single HTML then:
173
174  # npm install -g node-plantuml
175
176Ditaa:
177
178  # pkg install ditaa
179
180CentOS 6 and 7
181~~~~~~~~~~~~~~
182
183PDF Quality: production
184
185Sphinx:
186
187  $ pip install -U sphinx
188
189PDF:
190
191  WARNING: Do NOT use the RPMs for texlive. They are incomplete and, in
192           the best case, result in ugly PDFs.
193
194  As root, install texlive per the instructions at
195  http://tug.org/texlive/acquire-netinstall.html
196
197  # wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
198  # tar xf install-tl-unx.tar.gz
199  # cd install-tl-20161106
200    NOTE: The date in the name of the directory will change.
201  # ./install-tl
202    - Use the command line system. Select "O" for options if you want to
203      change from A4 to US letter paper size by default.
204    - Select "I" to install
205    - The tools will be installed into a directory like the following:
206      /usr/local/texlive/2016/bin/i386-linux/
207
208     NOTE: The year (2016) and host OS (i386-linux) will change to
209           reflect 32 or 64 bit and OS name.
210
211Single HTML:
212
213NOTE: npm appears to be part of the EPEL repository for RHEL and CentOS.
214You may have to add that repository to your configuration.
215
216  # yum install npm
217  # npm install -g inliner
218
219Plant UML:
220
221Install NPM as shown in Single HTML then:
222
223  # npm install -g node-plantuml
224
225Spell check:
226
227  # yum install aspell
228
229PATH:
230
231  Ensure the appropriate directories are PREPENDED to your PATH before
232  building the documentation. Examples are shown below:
233
234  export PATH=/usr/local/texlive/2016/bin/i386-linux/:${PATH}
235  export PATH=${HOME}/.local/bin:${PATH}
236
237Arch Linux
238~~~~~~~~~~
239
240Sphinx:
241
242  # pacman -S python-sphinx
243
244PDF:
245
246  # pacman -S texlive-bin texlive-core texlive-latexextra texlive-fontsextra \
247
248openSUSE
249~~~~~~~~
250
251Packages:
252
253  # zypper in python-pip 'texlive*'
254
255Sphinx:
256
257  # pip install -U Sphinx
258
259Using pip to install Sphinx destroys the python-Sphinx package if installed via
260RPM.
261
262Latex Setup
263~~~~~~~~~~~
264
265Latex is used to create the PDF document.  The setup of Latex varies from host
266to host operating system due to the way each host packages the texlive
267packages. There is no common naming and no real way to figure what texlive
268package is present in a host's packaging. It seems not all of texlive is
269available.
270
271The RTEMS Documentation waf configure phase check for each texlive package used
272in the generated output and the styles. If you complete configure with the
273--pdf option you should be able to build PDF documentation.
274
275The texlive package requirments come from the Latex styles we are using and
276Sphinx.
277
278An example of failures are:
279
280  Checking for Tex package 'Bjarne'        : ok
281  Checking for Tex package 'alltt'         : ok
282  Checking for Tex package 'amsmath'       : ok
283  Checking for Tex package 'amssymb'       : ok
284  Checking for Tex package 'amstext'       : ok
285  Checking for Tex package 'array'         : ok
286  Checking for Tex package 'atbegshi'      : ok
287  Checking for Tex package 'babel'         : ok
288  Checking for Tex package 'calc'          : ok
289  Checking for Tex package 'capt-of'       : not found (please install)
290  Checking for Tex package 'charter'       : ok
291  Checking for Tex package 'cmap'          : ok
292  Checking for Tex package 'color'         : ok
293  Checking for Tex package 'eqparbox'      : not found (please install)
294  Checking for Tex package 'etoolbox'      : ok
295  Checking for Tex package 'fancybox'      : ok
296  Checking for Tex package 'fancyhdr'      : ok
297  Checking for Tex package 'fancyvrb'      : ok
298  Checking for Tex package 'float'         : ok
299  Checking for Tex package 'fncychap'      : ok
300  Checking for Tex package 'fontenc'       : ok
301  Checking for Tex package 'footnote'      : ok
302  Checking for Tex package 'framed'        : ok
303  Checking for Tex package 'graphicx'      : ok
304  Checking for Tex package 'hypcap'        : ok
305  Checking for Tex package 'hyperref'      : ok
306  Checking for Tex package 'ifplatform'    : not found (please install)
307  Checking for Tex package 'ifthen'        : ok
308  Checking for Tex package 'inconsolata'   : not found (please install)
309  Checking for Tex package 'inputenc'      : ok
310  Checking for Tex package 'keyval'        : ok
311  Checking for Tex package 'kvoptions'     : ok
312  Checking for Tex package 'lato'          : not found (please install)
313  Checking for Tex package 'lineno'        : ok
314  Checking for Tex package 'longtable'     : ok
315  Checking for Tex package 'makeidx'       : ok
316  Checking for Tex package 'multirow'      : ok
317  Checking for Tex package 'parskip'       : ok
318  Checking for Tex package 'pdftexcmds'    : ok
319  Checking for Tex package 'textcomp'      : ok
320  Checking for Tex package 'threeparttable' : ok
321  Checking for Tex package 'times'          : ok
322  Checking for Tex package 'titlesec'       : ok
323  Checking for Tex package 'upquote'        : not found (please install)
324  Checking for Tex package 'utf8'           : ok
325  Checking for Tex package 'wrapfig'        : ok
326  Checking for Tex package 'xcolor'         : ok
327  Checking for Tex package 'xstring'        : ok
328  There are 6 Tex package failures. Please fix.
329
330If you find there is an issue please post the developers list.
331
332Building
333--------
334
335Note: waf-1.9.5 is a little noisy when running tex builds and tests. I hope
336      to have this resolved soon.
337
338To build enter in the top directory:
339
340  $ ./waf configure [--pdf] [--singlehtml] [--prefix] \
341                    [--sphinx-options] \
342                    [--sphinx-nit-pick] \
343                    [--plantuml] \
344                    [--ditaa] \
345                    [--disable-extra-fonts]
346
347  $ ./waf
348
349The '--pdf' and '--singlehtml' options can be added to configure to build those
350output formats.
351
352Sphinx options can be added using the `--sphinx-options` option. If you have
353more than option use a quoted argument. This is an advanced feature that can
354be useful when experimenting with the `sphinx-build` command.
355
356Sphinx nit-picky mode adds `-n` to the `sphinx-build` command line to generate
357warnings and extra information about the source to help make sure our
358documentation source is as clean as possible. Please use this when writing
359documentation or making updates.
360
361The '--disable-extra-fonts' allows you to build PDF documents with out the
362fonts we use for a better quality document. Use this option to build without
363needing the extra fonts accepting you will get poor quality documents.
364
365To build and install to a specific location:
366
367  $ ./waf configure --prefix=/foo/my/location
368  $ ./waf build install
369
370To build the PlantUML and Ditaa images:
371
372  $ ./waf configure --plantuml --ditaa
373  $ ./waf clean build
374
375To nit-pick the source use:
376
377  $ ./waf configure --sphinx-nit-pick
378  $ ./waf clean build
379
380If you need to debug what is happening use configure with a suitable Sphinx
381verbose level:
382
383  $ ./waf configure --sphinx-options "-V -V"
384  $ ./waf clean build
385
386You can enter a manual's directory and run the same configure command and build
387just that manual.
388
389Documentation Standard
390----------------------
391
392This following details the documentation standard. If in doubt first search the
393existing documentation for an example and if unsure ask.
394
3951. All text is to be formatted to wrap at 80 columns. Do not manually line feed
396   before 80.
397
3982. Do not insert tab characters, use spaces, no trailing white space.
399
4003. Pasted text such as console output can exceed 80 columns however it is
401   preferred even this text is wrapped at 80 columns. Long lines in code block
402   text causes issues with the PDF output.
403
4044. The headings use the following:
405
406      Heading   Description
407      1  ###### Part
408      2  ****** Section
409      3  ====== Sub-section
410      4  ------ Sub-sub-section
411      5  ^^^^^^ Sub-sub-sub-section
412      6  ~~~~~~ Sub-sub-sub-sub-section
413
4145. For literal output, such as shell commands and code use '::' at the trailing
415   edge of the previous paragraph. Use the '.. code-block::' with
416   'c' for C code and 'shell' for shell code and terminal output. If you need
417   line number use:
418
419    .. code-block:: shell
420       :linenos:
421
4226. Use the directives for 'note', 'warning', and 'topic'. Do not add 'TIP',
423   'Important' or 'Warning' to the text. Let the mark-up language handle
424   this. The supported directives are:
425
426     .. warning::
427     .. note::
428     .. topic::
429
430   These directives reference specific CSS style support.
431
4327. Images are placed in the 'images' directory. Do not place images in the
433   source directories. Using a common 'images' tree of images promotes sharing
434   of images. To add an image use:
435
436    .. figure:: ../images/my-image.png
437       :wdith: 75%
438       :align: center
439       :alt: This is the alt text for some output types.
440
4418. Callouts can be implemented manually using a literal block which can use
442   '::' or a code block and topic block is used for the items. For
443   example:
444
445     .. code-block: c
446
447        #include <stdio.h>  <1>
448        int main(int argc, char** argv)  <2>
449        {
450           printf("Hello world\n");  <3>
451           return 0;   <4>
452        }
453
454     .. topic:: Items:
455
456       1. Include the standard input/output header file.
457
458       2. The program starts here.
459
460       3. Print something to the standard output device.
461
462       4. Exit with an exit code of 0. This value can be checked by the
463          caller of this program.
464
465   Note, the topic items are manually numbered, which makes it easier to see
466   which item matches the text. Use <> for the number and align at a position
467   that works and makes the number as visible as possible. Use hanging indents
468   if an items extends past a single line.
469
4709. Use the RTEMS domain references for URLs and mailing lists. For example to
471   insert the RTEMS developers list use:
472
473     :r:list:`devel`
474     :r:url:`git`
475
476   The valid lists are:
477
478     announce     : Announce Mailing List
479     bugs         : Bugs Mailing List
480     devel        : Developers Mailing List
481     build        : Build Logs
482     users        : Users Mailing List
483     vc           : Version Control Mailing List
484
485  The valid URLs are:
486
487     trac         : https://devel.rtems.org/
488     devel        : https://devel.rtems.org/
489     www          : https://www.rtems.org/
490     buildbot     : https://buildbot.rtems.org/
491     builder      : https://builder.rtems.org/
492     docs         : https://docs.rtems.org/
493     lists        : https://lists.rtems.org/
494     git          : https://git.rtems.org/
495     ftp          : https://ftp.rtems.org/
496     review       : https://review.rtems.org/
497     bugs         : https://devel.rtems.org/wiki/Bugs/
498     gsoc         : https://devel.rtems.org/wiki/GSoC/
499     socis        : https://devel.rtems.org/wiki/SOCIS/
Note: See TracBrowser for help on using the repository browser.