aboutsummaryrefslogtreecommitdiff
path: root/third_party/boringssl/docs.rst
blob: 7e16e2c0ebbb5f2da05cadf9f2d59cd4992be857 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
.. _module-pw_third_party_boringssl:

=========
BoringSSL
=========

The ``$dir_pw_third_party/boringssl`` module provides the build files to
compile and use BoringSSL. The source code of BoringSSL needs to be provided by
the user. It is recommended to download it via Git submodules.

-------------
Build support
-------------

This module provides support to compile BoringSSL with GN. This is required when
compiling backends modules that use BoringSSL, such as some facades in
:ref:`module-pw_crypto`

Submodule
=========

The recommended way to include BoringSSL source code is to add it as a
submodule:

.. code-block:: sh

  git submodule add https://boringssl.googlesource.com/boringssl/ \
      third_party/boringssl/src

GN
==
The GN build file depends on a generated file called ``BUILD.generated.gni``
with the list of the different types of source files for the selected BoringSSL
version.

.. code-block:: sh

  cd third_party/boringssl
  python src/util/generate_build_files.py gn

The GN variables needed are defined in
``$dir_pw_third_party/boringssl/boringssl.gni``:

#. Set the GN ``dir_pw_third_party_boringssl`` to the path of the BoringSSL
   installation.

   - If using the submodule path from above, add the following to the
     ``default_args`` in the project's ``.gn``:

     .. code-block::

        dir_pw_third_party_boringssl = "//third_party/boringssl/src"

#. Having a non-empty ``dir_pw_third_party_boringssl`` variable causes GN to
   attempt to include the ``BUILD.generated.gni`` file from the sources even
   during the bootstrap process before the source package is installed by the
   bootstrap process. To avoid this problem, set this variable to the empty
   string during bootstrap by adding it to the ``virtualenv.gn_args`` setting in
   the ``env_setup.json`` file:

   .. code-block:: json

     {
       "virtualenv": {
         "gn_args": [
           "dir_pw_third_party_boringssl=\"\""
         ]
       }
     }

#. Alternatively, set the GN ``pw_third_party_boringssl_ALIAS`` to your
   boringssl build target if you would like to use your own build target instead
   of the one provided by Pigweed. This should be used instead of
   ``dir_pw_third_party_boringssl``. This fixes diamond dependency conflicts
   caused by two build targets using the same source files.

After this is done a ``pw_source_set`` for the BoringSSL library is created at
``$dir_pw_third_party/boringssl``.