summaryrefslogtreecommitdiff
path: root/upstream-layers/openembedded-core/meta/classes-recipe/allarch.bbclass
blob: aa44e2bc61323613ad5beefb97f5f0cadcf4fb34 (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
#
# Copyright OpenEmbedded Contributors
#
# SPDX-License-Identifier: MIT
#

#
# This class is used for architecture independent recipes/data files (usually scripts)
#

# No need for virtual/libc or a cross compiler
INHIBIT_DEFAULT_DEPS = "1"

python allarch_package_arch_handler () {
    if bb.data.inherits_class("native", d) or bb.data.inherits_class("nativesdk", d) \
        or bb.data.inherits_class("crosssdk", d):
        return

    variants = d.getVar("MULTILIB_VARIANTS")
    if not variants:
        d.setVar("PACKAGE_ARCH", "all" )
}

addhandler allarch_package_arch_handler
allarch_package_arch_handler[eventmask] = "bb.event.RecipePreFinalise"

python () {
    # Allow this class to be included but overridden - only set
    # the values if we're still "all" package arch.
    if d.getVar("PACKAGE_ARCH") == "all":
        oe.utils.make_arch_independent(d)
    elif bb.data.inherits_class('packagegroup', d) and not bb.data.inherits_class('nativesdk', d):
        bb.error("Please ensure recipe %s sets PACKAGE_ARCH before inherit packagegroup" % d.getVar("FILE"))
}