diff options
Diffstat (limited to 'documentation/ref-manual/classes.rst')
| -rw-r--r-- | documentation/ref-manual/classes.rst | 191 |
1 files changed, 167 insertions, 24 deletions
diff --git a/documentation/ref-manual/classes.rst b/documentation/ref-manual/classes.rst index 662121ed9c..a56a2f7198 100644 --- a/documentation/ref-manual/classes.rst +++ b/documentation/ref-manual/classes.rst | |||
| @@ -392,8 +392,19 @@ file for details about how to enable this mechanism in your configuration | |||
| 392 | file, how to disable it for specific recipes, and how to share ``ccache`` | 392 | file, how to disable it for specific recipes, and how to share ``ccache`` |
| 393 | files between builds. | 393 | files between builds. |
| 394 | 394 | ||
| 395 | However, using the class can lead to unexpected side-effects. Thus, using | 395 | Recipes (including :ref:`ref-classes-native` ones) can make use of the host's |
| 396 | this class is not recommended. | 396 | ``ccache`` binary (via :term:`HOSTTOOLS`) if the following configuration |
| 397 | statements are provided in a :term:`configuration file`:: | ||
| 398 | |||
| 399 | ASSUME_PROVIDED += "ccache-native" | ||
| 400 | HOSTTOOLS += "ccache" | ||
| 401 | |||
| 402 | Recipes can also explicitly disable `Ccache` support even when the | ||
| 403 | :ref:`ref-classes-ccache` class is enabled, by setting the | ||
| 404 | :term:`CCACHE_DISABLE` variable to "1". | ||
| 405 | |||
| 406 | Using the :ref:`ref-classes-ccache` class can lead to unexpected side-effects. | ||
| 407 | Using this class is not recommended. | ||
| 397 | 408 | ||
| 398 | .. _ref-classes-chrpath: | 409 | .. _ref-classes-chrpath: |
| 399 | 410 | ||
| @@ -955,6 +966,14 @@ software that uses the GNU ``gettext`` internationalization and localization | |||
| 955 | system. All recipes building software that use ``gettext`` should inherit this | 966 | system. All recipes building software that use ``gettext`` should inherit this |
| 956 | class. | 967 | class. |
| 957 | 968 | ||
| 969 | This class will configure recipes to build translations *unless*: | ||
| 970 | |||
| 971 | - the :term:`USE_NLS` variable is set to ``no``, or | ||
| 972 | |||
| 973 | - the :term:`INHIBIT_DEFAULT_DEPS` variable is set and the recipe inheriting | ||
| 974 | the :ref:`ref-classes-gettext` class does not also inherit the | ||
| 975 | :ref:`ref-classes-cross-canadian` class. | ||
| 976 | |||
| 958 | .. _ref-classes-github-releases: | 977 | .. _ref-classes-github-releases: |
| 959 | 978 | ||
| 960 | ``github-releases`` | 979 | ``github-releases`` |
| @@ -2174,6 +2193,19 @@ meson-python build system. | |||
| 2174 | 2193 | ||
| 2175 | Internally this uses the :ref:`ref-classes-python_pep517` class. | 2194 | Internally this uses the :ref:`ref-classes-python_pep517` class. |
| 2176 | 2195 | ||
| 2196 | .. _ref-classes-python_pdm: | ||
| 2197 | |||
| 2198 | ``python_pdm`` | ||
| 2199 | ================= | ||
| 2200 | |||
| 2201 | The :ref:`ref-classes-python_pdm` class adds support for building Python | ||
| 2202 | packages with the `PDM <https://pdm-project.org/>`__ package and dependency manager. | ||
| 2203 | |||
| 2204 | This class adds ``python3-pdm-backend-native`` to the recipe's build-time | ||
| 2205 | dependencies. | ||
| 2206 | |||
| 2207 | Internally this uses the :ref:`ref-classes-python_pep517` class. | ||
| 2208 | |||
| 2177 | .. _ref-classes-python_pep517: | 2209 | .. _ref-classes-python_pep517: |
| 2178 | 2210 | ||
| 2179 | ``python_pep517`` | 2211 | ``python_pep517`` |
| @@ -2466,6 +2498,25 @@ The :ref:`ref-classes-recipe_sanity` class checks for the presence of any host s | |||
| 2466 | recipe prerequisites that might affect the build (e.g. variables that | 2498 | recipe prerequisites that might affect the build (e.g. variables that |
| 2467 | are set or software that is present). | 2499 | are set or software that is present). |
| 2468 | 2500 | ||
| 2501 | .. _ref-classes-relative_symlinks: | ||
| 2502 | |||
| 2503 | ``relative_symlinks`` | ||
| 2504 | ===================== | ||
| 2505 | |||
| 2506 | The :ref:`ref-classes-relative_symlinks` class walks the symbolic links in the | ||
| 2507 | :term:`D` directory and replaces links pointing to absolute paths to relative | ||
| 2508 | paths. This is occasionally used in some recipes that create wrong symbolic | ||
| 2509 | links when their :ref:`ref-classes-native` version is built, and/or would cause | ||
| 2510 | breakage in the :ref:`overview-manual/concepts:shared state cache`. | ||
| 2511 | |||
| 2512 | For example, if the following symbolic link is found in :term:`D`:: | ||
| 2513 | |||
| 2514 | /usr/bin/foo -> /sbin/bar | ||
| 2515 | |||
| 2516 | It is replaced by:: | ||
| 2517 | |||
| 2518 | /usr/bin/foo -> ../../sbin/bar | ||
| 2519 | |||
| 2469 | .. _ref-classes-relocatable: | 2520 | .. _ref-classes-relocatable: |
| 2470 | 2521 | ||
| 2471 | ``relocatable`` | 2522 | ``relocatable`` |
| @@ -2606,6 +2657,19 @@ The :ref:`ref-classes-rust-common` class is an internal class to the | |||
| 2606 | :ref:`ref-classes-cargo_common` and :ref:`ref-classes-rust` classes and is not | 2657 | :ref:`ref-classes-cargo_common` and :ref:`ref-classes-rust` classes and is not |
| 2607 | intended to be used directly. | 2658 | intended to be used directly. |
| 2608 | 2659 | ||
| 2660 | .. _ref-classes-rust-target-config: | ||
| 2661 | |||
| 2662 | ``rust-target-config`` | ||
| 2663 | ====================== | ||
| 2664 | |||
| 2665 | The :ref:`ref-classes-rust-target-config` class is an internal class to the | ||
| 2666 | :ref:`ref-classes-cargo_common` and :ref:`ref-classes-rust` classes and is not | ||
| 2667 | intended to be used directly. | ||
| 2668 | |||
| 2669 | It is used to generate a JSON specification file from the features listed in | ||
| 2670 | :term:`TUNE_FEATURES`, which is used for cross-compiling. The logic is done in a | ||
| 2671 | ``do_rust_gen_targets`` task. | ||
| 2672 | |||
| 2609 | .. _ref-classes-sanity: | 2673 | .. _ref-classes-sanity: |
| 2610 | 2674 | ||
| 2611 | ``sanity`` | 2675 | ``sanity`` |
| @@ -3169,15 +3233,65 @@ variable using the "type" varflag. Here is an example:: | |||
| 3169 | ``uboot-config`` | 3233 | ``uboot-config`` |
| 3170 | ================ | 3234 | ================ |
| 3171 | 3235 | ||
| 3172 | The :ref:`ref-classes-uboot-config` class provides support for U-Boot configuration for | 3236 | The :ref:`ref-classes-uboot-config` class provides support for configuring one |
| 3173 | a machine. Specify the machine in your recipe as follows:: | 3237 | or more U-Boot build configurations. |
| 3238 | |||
| 3239 | There are two ways to configure the recipe for your machine: | ||
| 3240 | |||
| 3241 | - Using :term:`UBOOT_CONFIG` variable. For example:: | ||
| 3242 | |||
| 3243 | UBOOT_CONFIG ??= "foo bar" | ||
| 3244 | UBOOT_CONFIG[foo] = "config,images,binary,makeopts" | ||
| 3245 | UBOOT_CONFIG[bar] = "config2,images2,binary2,makeopts2" | ||
| 3246 | |||
| 3247 | In this example, all possible configurations are selected (``foo`` and | ||
| 3248 | ``bar``), but it is also possible to build only ``foo`` or ``bar`` by | ||
| 3249 | changing the value of :term:`UBOOT_CONFIG` to include either one or the | ||
| 3250 | other. | ||
| 3251 | |||
| 3252 | Each build configuration is associated to a variable flag definition of | ||
| 3253 | :term:`UBOOT_CONFIG`, that can take up to three comma-separated options | ||
| 3254 | (``config,images,binary``): | ||
| 3255 | |||
| 3256 | - ``config``: defconfig file selected for this build configuration. | ||
| 3257 | These files are found in the source tree's ``configs`` folder of U-Boot. | ||
| 3258 | |||
| 3259 | *This option is mandatory.* | ||
| 3260 | |||
| 3261 | - ``images``: image types to append to the :term:`IMAGE_FSTYPES` variable | ||
| 3262 | for image generation for this build configuration. | ||
| 3263 | |||
| 3264 | This can allow building an extra image format that uses the binary | ||
| 3265 | generated by this build configuration. | ||
| 3266 | |||
| 3267 | This option is not mandatory and can be left empty. | ||
| 3268 | |||
| 3269 | - ``binary``: binary to select as the one to deploy in | ||
| 3270 | :term:`DEPLOY_DIR_IMAGE`. The output of a U-Boot build may be more than | ||
| 3271 | one binary, for example:: | ||
| 3272 | |||
| 3273 | u-boot.bin | ||
| 3274 | u-boot-with-spl.bin | ||
| 3275 | |||
| 3276 | Setting the ``binary`` value to ``u-boot-with-spl.bin`` will make this | ||
| 3277 | binary the one deployed in :term:`DEPLOY_DIR_IMAGE`. It is renamed to | ||
| 3278 | include the build configuration name in the process (``foo`` or ``bar`` in | ||
| 3279 | the above example). | ||
| 3280 | |||
| 3281 | This option defaults to :term:`UBOOT_BINARY` if unset. | ||
| 3282 | |||
| 3283 | - ``makeopts``: the additional options passed to ``make`` when configuring | ||
| 3284 | and compiling U-Boot for this configuration entry. The options in this | ||
| 3285 | entry are added before the options in :term:`UBOOT_MAKE_OPTS`. | ||
| 3174 | 3286 | ||
| 3175 | UBOOT_CONFIG ??= <default> | 3287 | - Or, using the :term:`UBOOT_MACHINE` variable (and its companion variable |
| 3176 | UBOOT_CONFIG[foo] = "config,images,binary" | 3288 | :term:`UBOOT_BINARY`). For example:: |
| 3177 | 3289 | ||
| 3178 | You can also specify the machine using this method:: | 3290 | UBOOT_MACHINE = "config" |
| 3291 | UBOOT_BINARY = "u-boot.bin" | ||
| 3179 | 3292 | ||
| 3180 | UBOOT_MACHINE = "config" | 3293 | Using :term:`UBOOT_MACHINE` and :term:`UBOOT_CONFIG` at the same time is not |
| 3294 | possible. | ||
| 3181 | 3295 | ||
| 3182 | See the :term:`UBOOT_CONFIG` and :term:`UBOOT_MACHINE` variables for additional | 3296 | See the :term:`UBOOT_CONFIG` and :term:`UBOOT_MACHINE` variables for additional |
| 3183 | information. | 3297 | information. |
| @@ -3293,22 +3407,51 @@ buildtime via :term:`UKI_FILENAME`. | |||
| 3293 | ``uninative`` | 3407 | ``uninative`` |
| 3294 | ============= | 3408 | ============= |
| 3295 | 3409 | ||
| 3296 | Attempts to isolate the build system from the host distribution's C | 3410 | The :ref:`ref-classes-uninative` class allows binaries to run on systems with |
| 3297 | library in order to make re-use of native shared state artifacts across | 3411 | older or newer :wikipedia:`Glibc <Glibc>` versions. This means |
| 3298 | different host distributions practical. With this class enabled, a | 3412 | :ref:`ref-classes-native` recipe :ref:`overview-manual/concepts:shared state |
| 3299 | tarball containing a pre-built C library is downloaded at the start of | 3413 | cache` can be shared among different host distributions of different versions, |
| 3300 | the build. In the Poky reference distribution this is enabled by default | 3414 | i.e. the :ref:`overview-manual/concepts:shared state cache` is "universal". |
| 3301 | through ``meta/conf/distro/include/yocto-uninative.inc``. Other | 3415 | |
| 3302 | distributions that do not derive from poky can also | 3416 | To allow this to work, the dynamic loader is changed to our own :manpage:`ld.so |
| 3303 | "``require conf/distro/include/yocto-uninative.inc``" to use this. | 3417 | <ld.so.8>` when binaries are compiled using the |
| 3304 | Alternatively if you prefer, you can build the uninative-tarball recipe | 3418 | ``--dynamic-linker`` option. This means when the binary is executed, it finds |
| 3305 | yourself, publish the resulting tarball (e.g. via HTTP) and set | 3419 | our own :manpage:`ld.so <ld.so.8>` and that loader has a modified search path |
| 3306 | ``UNINATIVE_URL`` and ``UNINATIVE_CHECKSUM`` appropriately. For an | 3420 | which finds a newer Glibc version. |
| 3307 | example, see the ``meta/conf/distro/include/yocto-uninative.inc``. | 3421 | |
| 3308 | 3422 | The linking of the binaries is not changed at link time since the | |
| 3309 | The :ref:`ref-classes-uninative` class is also used unconditionally by the extensible | 3423 | headers on the system wouldn't match the newer Glibc and this causes |
| 3310 | SDK. When building the extensible SDK, ``uninative-tarball`` is built | 3424 | obtuse failures. Changing the loader is effectively the same as if the |
| 3311 | and the resulting tarball is included within the SDK. | 3425 | system had a Glibc upgrade after the binary was compiled, so it is a |
| 3426 | mechanism supported by upstream. | ||
| 3427 | |||
| 3428 | One caveat to this approach is that the uninative Glibc binary must be | ||
| 3429 | equal to or newer in version to the versions on all the systems using | ||
| 3430 | the common :ref:`overview-manual/concepts:shared state cache`. This is why | ||
| 3431 | :ref:`ref-classes-uninative` is regularly changed on the development and stable | ||
| 3432 | branches. | ||
| 3433 | |||
| 3434 | Another potential issue is static linking: static libraries created on | ||
| 3435 | a system with a new Glibc version may have symbols not present in older | ||
| 3436 | versions, which would then fail during linking on older systems. This | ||
| 3437 | is one reason we don't use static linking for our :ref:`ref-classes-native` | ||
| 3438 | binaries. | ||
| 3439 | |||
| 3440 | With this class enabled, a tarball containing a pre-built C library is | ||
| 3441 | downloaded at the start of the build. In the Poky reference distribution this is | ||
| 3442 | enabled by default through :oe_git:`meta/conf/distro/include/yocto-uninative.inc | ||
| 3443 | </openembedded-core/tree/meta/conf/distro/include/yocto-uninative.inc>`. Other distributions that do | ||
| 3444 | not derive from Poky can also "``require conf/distro/include/yocto-uninative.inc``" | ||
| 3445 | to use this. Alternatively if you prefer, you can build the uninative-tarball | ||
| 3446 | recipe yourself, publish the resulting tarball (e.g. via HTTP) and set | ||
| 3447 | :term:`UNINATIVE_URL` and :term:`UNINATIVE_CHECKSUM` appropriately. For an | ||
| 3448 | example, see :oe_git:`meta/conf/distro/include/yocto-uninative.inc | ||
| 3449 | </openembedded-core/tree/meta/conf/distro/include/yocto-uninative.inc>`. | ||
| 3450 | |||
| 3451 | The :ref:`ref-classes-uninative` class is also used unconditionally by the | ||
| 3452 | :doc:`extensible SDK </sdk-manual/extensible>`. When building the extensible | ||
| 3453 | SDK, ``uninative-tarball`` is built and the resulting tarball is included within | ||
| 3454 | the SDK. | ||
| 3312 | 3455 | ||
| 3313 | .. _ref-classes-update-alternatives: | 3456 | .. _ref-classes-update-alternatives: |
| 3314 | 3457 | ||
