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:51:01 -1000
commit8de77fdcbb6e80f6722cb01efe53da0724f148ec (patch)
tree6266a47e5646f8c78e853e4a400201ce96804d40
parent0041bad3a52ef9d888a0c6b2e52e7de5d28844bf (diff)
downloadpoky-8de77fdcbb6e80f6722cb01efe53da0724f148ec.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: 1bf0ac5c208d2d9609649bae681f37e3b4281c63) 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.rst42
1 files changed, 36 insertions, 6 deletions
diff --git a/documentation/ref-manual/variables.rst b/documentation/ref-manual/variables.rst
index 59fd1b70ae..0e11ab2f68 100644
--- a/documentation/ref-manual/variables.rst
+++ b/documentation/ref-manual/variables.rst
@@ -5925,13 +5925,11 @@ system and gives an overview of their function and contents.
5925 omit any argument you like but must retain the separating commas. The 5925 omit any argument you like but must retain the separating commas. The
5926 order is important and specifies the following: 5926 order is important and specifies the following:
5927 5927
5928 #. Extra arguments that should be added to the configure script 5928 #. Extra arguments that should be added to :term:`PACKAGECONFIG_CONFARGS`
5929 argument list (:term:`EXTRA_OECONF` or 5929 if the feature is enabled.
5930 :term:`PACKAGECONFIG_CONFARGS`) if
5931 the feature is enabled.
5932 5930
5933 #. Extra arguments that should be added to :term:`EXTRA_OECONF` or 5931 #. Extra arguments that should be added to :term:`PACKAGECONFIG_CONFARGS`
5934 :term:`PACKAGECONFIG_CONFARGS` if the feature is disabled. 5932 if the feature is disabled.
5935 5933
5936 #. Additional build dependencies (:term:`DEPENDS`) 5934 #. Additional build dependencies (:term:`DEPENDS`)
5937 that should be added if the feature is enabled. 5935 that should be added if the feature is enabled.
@@ -5989,6 +5987,38 @@ system and gives an overview of their function and contents.
5989 5987
5990 PACKAGECONFIG:append:pn-recipename = " f4" 5988 PACKAGECONFIG:append:pn-recipename = " f4"
5991 5989
5990 Consider the following example of a :ref:`ref-classes-cmake` recipe with a systemd service
5991 in which :term:`PACKAGECONFIG` is used to transform the systemd service
5992 into a feature that can be easily enabled or disabled via :term:`PACKAGECONFIG`::
5993
5994 example.c
5995 example.service
5996 CMakeLists.txt
5997
5998 The ``CMakeLists.txt`` file contains::
5999
6000 if(WITH_SYSTEMD)
6001 install(FILES ${PROJECT_SOURCE_DIR}/example.service DESTINATION /etc/systemd/systemd)
6002 endif(WITH_SYSTEMD)
6003
6004 In order to enable the installation of ``example.service`` we need to
6005 ensure that ``-DWITH_SYSTEMD=ON`` is passed to the ``cmake`` command
6006 execution. Recipes that have ``CMakeLists.txt`` generally inherit the
6007 :ref:`ref-classes-cmake` class, that runs ``cmake`` with
6008 :term:`EXTRA_OECMAKE`, which :term:`PACKAGECONFIG_CONFARGS` will be
6009 appended to. Now, knowing that :term:`PACKAGECONFIG_CONFARGS` is
6010 automatically filled with either the first or second element of
6011 :term:`PACKAGECONFIG` flag value, the recipe would be like::
6012
6013 inherit cmake
6014 PACKAGECONFIG = "systemd"
6015 PACKAGECONFIG[systemd] = "-DWITH_SYSTEMD=ON,-DWITH_SYSTEMD=OFF"
6016
6017 A side note to this recipe is to check if ``systemd`` is in fact the used :term:`INIT_MANAGER`
6018 or not::
6019
6020 PACKAGECONFIG = "${@'systemd' if d.getVar('INIT_MANAGER') == 'systemd' else ''}"
6021
5992 :term:`PACKAGECONFIG_CONFARGS` 6022 :term:`PACKAGECONFIG_CONFARGS`
5993 A space-separated list of configuration options generated from the 6023 A space-separated list of configuration options generated from the
5994 :term:`PACKAGECONFIG` setting. 6024 :term:`PACKAGECONFIG` setting.