blob: 1b8c1ebe4a33565a6718ddb4536548ea5e64b9cf [file] [log] [blame]
Sandrine Bailleux35318342020-04-22 11:05:19 +02001Building Documentation
2======================
3
4To create a rendered copy of this documentation locally you can use the
5`Sphinx`_ tool to build and package the plain-text documents into HTML-formatted
6pages.
7
8If you are building the documentation for the first time then you will need to
9check that you have the required software packages, as described in the
10*Prerequisites* section that follows.
11
12.. note::
13 An online copy of the documentation is available at
14 https://trustedfirmware-a-tests.readthedocs.io, if you want to view a
15 rendered copy without doing a local build.
16
17Prerequisites
18-------------
19
20For building a local copy of the documentation you will need, at minimum:
21
22- Python 3 (3.5 or later)
23- PlantUML (1.2017.15 or later)
24
25You must also install the Python modules that are specified in the
26``requirements.txt`` file in the root of the ``docs`` directory. These modules
27can be installed using ``pip3`` (the Python Package Installer). Passing this
28requirements file as an argument to ``pip3`` automatically installs the specific
29module versions required by TF-A Tests.
30
31An example set of installation commands for Ubuntu 18.04 LTS follows, assuming
32that the working directory is ``docs``:
33
34.. code:: shell
35
36 sudo apt install python3 python3-pip plantuml
37 pip3 install [--user] -r requirements.txt
38
39.. note::
40 Several other modules will be installed as dependencies. Please review
41 the list to ensure that there will be no conflicts with other modules already
42 installed in your environment.
43
44Passing the optional ``--user`` argument to ``pip3`` will install the Python
45packages only for the current user. Omitting this argument will attempt to
46install the packages globally and this will likely require the command to be run
47as root or using ``sudo``.
48
49.. note::
50 More advanced usage instructions for *pip* are beyond the scope of this
51 document but you can refer to the `pip homepage`_ for detailed guides.
52
53Building rendered documentation
54-------------------------------
55
56The documentation can be built into HTML-formatted pages from the project's root
57directory by running the following command.
58
59.. code:: shell
60
61 make doc
62
63Output from the build process will be placed in:
64
65::
66
Leonardo Sandoval5b5bc202020-07-14 10:05:23 -050067 docs/build/html
Sandrine Bailleux35318342020-04-22 11:05:19 +020068
69We also support building documentation in other formats. From the ``docs``
70directory of the project, run the following command to see the supported
71formats. It is important to note that you will not get the correct result if the
72command is run from the project's root directory, as that would invoke the
73top-level Makefile for TF-A Tests themselves.
74
75.. code:: shell
76
77 make help
78
Leonardo Sandoval5b5bc202020-07-14 10:05:23 -050079Building rendered documentation from a container
80------------------------------------------------
81
82There may be cases where you can not either install or upgrade required
83dependencies to generate the documents, so in this case, one way to
84create the documentation is through a docker container. The first step is
85to check if `docker`_ is installed in your host, otherwise check main docker
86page for installation instructions. Once installed, run the following script
87from project root directory
88
89.. code:: shell
90
91 docker run --rm -v $PWD:/TF sphinxdoc/sphinx \
92 bash -c 'cd /TF && \
93 pip3 install plantuml -r ./docs/requirements.txt && make doc'
94
95The above command fetches the ``sphinxdoc/sphinx`` container from `docker
96hub`_, launches the container, installs documentation requirements and finally
97creates the documentation. Once done, exit the container and output from the
98build process will be placed in:
99
100::
101
102 docs/build/html
103
Sandrine Bailleux35318342020-04-22 11:05:19 +0200104--------------
105
106*Copyright (c) 2020, Arm Limited. All rights reserved.*
107
108.. _Sphinx: http://www.sphinx-doc.org/en/master/
109.. _pip homepage: https://pip.pypa.io/en/stable/
Leonardo Sandoval5b5bc202020-07-14 10:05:23 -0500110.. _docker: https://www.docker.com/
111.. _docker hub: https://hub.docker.com/repository/docker/sphinxdoc/sphinx