summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBELHADJ SALEM Talel <bhstalel@gmail.com>2023-10-16 18:11:53 +0100
committerSteve Sakoman <steve@sakoman.com>2023-10-25 04:45:51 -1000
commit0f23056836b8bef7e0a10253496d561d9769c2ce (patch)
tree3c13772f959824d4e0ad31099f7d2afd35d8f7c4
parent6fd2902f0567fa231581e88e40192cdbeb8e3f6c (diff)
downloadpoky-0f23056836b8bef7e0a10253496d561d9769c2ce.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: 94eb37ef56cbb19b5b6e28bef522a7288a1a61f9) Signed-off-by: Talel BELHAJSALEM <bhstalel@gmail.com> Reviewed-by: Michael Opdenacker <michael.opdenacker@bootlin.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--documentation/ref-manual/variables.rst50
1 files changed, 40 insertions, 10 deletions
diff --git a/documentation/ref-manual/variables.rst b/documentation/ref-manual/variables.rst
index 0c573194e9..5d45f4a9f9 100644
--- a/documentation/ref-manual/variables.rst
+++ b/documentation/ref-manual/variables.rst
@@ -5548,25 +5548,23 @@ system and gives an overview of their function and contents.
5548 omit any argument you like but must retain the separating commas. The 5548 omit any argument you like but must retain the separating commas. The
5549 order is important and specifies the following: 5549 order is important and specifies the following:
5550 5550
5551 1. Extra arguments that should be added to the configure script 5551 #. Extra arguments that should be added to :term:`PACKAGECONFIG_CONFARGS`
5552 argument list (:term:`EXTRA_OECONF` or 5552 if the feature is enabled.
5553 :term:`PACKAGECONFIG_CONFARGS`) if
5554 the feature is enabled.
5555 5553
5556 2. Extra arguments that should be added to :term:`EXTRA_OECONF` or 5554 #. Extra arguments that should be added to :term:`PACKAGECONFIG_CONFARGS`
5557 :term:`PACKAGECONFIG_CONFARGS` if the feature is disabled. 5555 if the feature is disabled.
5558 5556
5559 3. Additional build dependencies (:term:`DEPENDS`) 5557 #. Additional build dependencies (:term:`DEPENDS`)
5560 that should be added if the feature is enabled. 5558 that should be added if the feature is enabled.
5561 5559
5562 4. Additional runtime dependencies (:term:`RDEPENDS`) 5560 #. Additional runtime dependencies (:term:`RDEPENDS`)
5563 that should be added if the feature is enabled. 5561 that should be added if the feature is enabled.
5564 5562
5565 5. Additional runtime recommendations 5563 #. Additional runtime recommendations
5566 (:term:`RRECOMMENDS`) that should be added if 5564 (:term:`RRECOMMENDS`) that should be added if
5567 the feature is enabled. 5565 the feature is enabled.
5568 5566
5569 6. Any conflicting (that is, mutually exclusive) :term:`PACKAGECONFIG` 5567 #. Any conflicting (that is, mutually exclusive) :term:`PACKAGECONFIG`
5570 settings for this feature. 5568 settings for this feature.
5571 5569
5572 Consider the following :term:`PACKAGECONFIG` block taken from the 5570 Consider the following :term:`PACKAGECONFIG` block taken from the
@@ -5613,6 +5611,38 @@ system and gives an overview of their function and contents.
5613 5611
5614 PACKAGECONFIG:append:pn-recipename = " f4" 5612 PACKAGECONFIG:append:pn-recipename = " f4"
5615 5613
5614 Consider the following example of a :ref:`ref-classes-cmake` recipe with a systemd service
5615 in which :term:`PACKAGECONFIG` is used to transform the systemd service
5616 into a feature that can be easily enabled or disabled via :term:`PACKAGECONFIG`::
5617
5618 example.c
5619 example.service
5620 CMakeLists.txt
5621
5622 The ``CMakeLists.txt`` file contains::
5623
5624 if(WITH_SYSTEMD)
5625 install(FILES ${PROJECT_SOURCE_DIR}/example.service DESTINATION /etc/systemd/systemd)
5626 endif(WITH_SYSTEMD)
5627
5628 In order to enable the installation of ``example.service`` we need to
5629 ensure that ``-DWITH_SYSTEMD=ON`` is passed to the ``cmake`` command
5630 execution. Recipes that have ``CMakeLists.txt`` generally inherit the
5631 :ref:`ref-classes-cmake` class, that runs ``cmake`` with
5632 :term:`EXTRA_OECMAKE`, which :term:`PACKAGECONFIG_CONFARGS` will be
5633 appended to. Now, knowing that :term:`PACKAGECONFIG_CONFARGS` is
5634 automatically filled with either the first or second element of
5635 :term:`PACKAGECONFIG` flag value, the recipe would be like::
5636
5637 inherit cmake
5638 PACKAGECONFIG = "systemd"
5639 PACKAGECONFIG[systemd] = "-DWITH_SYSTEMD=ON,-DWITH_SYSTEMD=OFF"
5640
5641 A side note to this recipe is to check if ``systemd`` is in fact the used :term:`INIT_MANAGER`
5642 or not::
5643
5644 PACKAGECONFIG = "${@'systemd' if d.getVar('INIT_MANAGER') == 'systemd' else ''}"
5645
5616 :term:`PACKAGECONFIG_CONFARGS` 5646 :term:`PACKAGECONFIG_CONFARGS`
5617 A space-separated list of configuration options generated from the 5647 A space-separated list of configuration options generated from the
5618 :term:`PACKAGECONFIG` setting. 5648 :term:`PACKAGECONFIG` setting.