summaryrefslogtreecommitdiffstats
path: root/documentation/ref-manual
diff options
context:
space:
mode:
authorBELHADJ SALEM Talel <bhstalel@gmail.com>2023-10-16 18:11:53 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-10-20 14:40:29 +0100
commitf70a86b27e7b2a01d84596ec54abf92f6c86f22b (patch)
tree939655121e74284528ef2a5d2db769430d224a34 /documentation/ref-manual
parentcd9114c412bf2cce5b83d9c60266b705f0b7b268 (diff)
downloadpoky-f70a86b27e7b2a01d84596ec54abf92f6c86f22b.tar.gz
ref-manual: Fix PACKAGECONFIG term and add an example
PACKAGECONFIG's first and second flag value will be added to PACKAGECONFIG_CONFARGS and then it will be added to the appropriate variable (EXTRA_OECMAKE, or ...) So we need to only mention PACKAGECONFIG_CONFARGS and it will lead to other variables. I added a custom example that can help understanding very well PACKAGECONFIG. (From yocto-docs rev: 7f26b0c0a08d6be9810128369265b0c494e7191b) Signed-off-by: Talel BELHAJSALEM <bhstalel@gmail.com> Reviewed-by: Michael Opdenacker <michael.opdenacker@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'documentation/ref-manual')
-rw-r--r--documentation/ref-manual/variables.rst42
1 files changed, 36 insertions, 6 deletions
diff --git a/documentation/ref-manual/variables.rst b/documentation/ref-manual/variables.rst
index dbd21826a3..cf69d5a86c 100644
--- a/documentation/ref-manual/variables.rst
+++ b/documentation/ref-manual/variables.rst
@@ -6064,13 +6064,11 @@ system and gives an overview of their function and contents.
6064 omit any argument you like but must retain the separating commas. The 6064 omit any argument you like but must retain the separating commas. The
6065 order is important and specifies the following: 6065 order is important and specifies the following:
6066 6066
6067 #. Extra arguments that should be added to the configure script 6067 #. Extra arguments that should be added to :term:`PACKAGECONFIG_CONFARGS`
6068 argument list (:term:`EXTRA_OECONF` or 6068 if the feature is enabled.
6069 :term:`PACKAGECONFIG_CONFARGS`) if
6070 the feature is enabled.
6071 6069
6072 #. Extra arguments that should be added to :term:`EXTRA_OECONF` or 6070 #. Extra arguments that should be added to :term:`PACKAGECONFIG_CONFARGS`
6073 :term:`PACKAGECONFIG_CONFARGS` if the feature is disabled. 6071 if the feature is disabled.
6074 6072
6075 #. Additional build dependencies (:term:`DEPENDS`) 6073 #. Additional build dependencies (:term:`DEPENDS`)
6076 that should be added if the feature is enabled. 6074 that should be added if the feature is enabled.
@@ -6128,6 +6126,38 @@ system and gives an overview of their function and contents.
6128 6126
6129 PACKAGECONFIG:append:pn-recipename = " f4" 6127 PACKAGECONFIG:append:pn-recipename = " f4"
6130 6128
6129 Consider the following example of a :ref:`ref-classes-cmake` recipe with a systemd service
6130 in which :term:`PACKAGECONFIG` is used to transform the systemd service
6131 into a feature that can be easily enabled or disabled via :term:`PACKAGECONFIG`::
6132
6133 example.c
6134 example.service
6135 CMakeLists.txt
6136
6137 The ``CMakeLists.txt`` file contains::
6138
6139 if(WITH_SYSTEMD)
6140 install(FILES ${PROJECT_SOURCE_DIR}/example.service DESTINATION /etc/systemd/systemd)
6141 endif(WITH_SYSTEMD)
6142
6143 In order to enable the installation of ``example.service`` we need to
6144 ensure that ``-DWITH_SYSTEMD=ON`` is passed to the ``cmake`` command
6145 execution. Recipes that have ``CMakeLists.txt`` generally inherit the
6146 :ref:`ref-classes-cmake` class, that runs ``cmake`` with
6147 :term:`EXTRA_OECMAKE`, which :term:`PACKAGECONFIG_CONFARGS` will be
6148 appended to. Now, knowing that :term:`PACKAGECONFIG_CONFARGS` is
6149 automatically filled with either the first or second element of
6150 :term:`PACKAGECONFIG` flag value, the recipe would be like::
6151
6152 inherit cmake
6153 PACKAGECONFIG = "systemd"
6154 PACKAGECONFIG[systemd] = "-DWITH_SYSTEMD=ON,-DWITH_SYSTEMD=OFF"
6155
6156 A side note to this recipe is to check if ``systemd`` is in fact the used :term:`INIT_MANAGER`
6157 or not::
6158
6159 PACKAGECONFIG = "${@'systemd' if d.getVar('INIT_MANAGER') == 'systemd' else ''}"
6160
6131 :term:`PACKAGECONFIG_CONFARGS` 6161 :term:`PACKAGECONFIG_CONFARGS`
6132 A space-separated list of configuration options generated from the 6162 A space-separated list of configuration options generated from the
6133 :term:`PACKAGECONFIG` setting. 6163 :term:`PACKAGECONFIG` setting.