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