xref: /OK3568_Linux_fs/yocto/poky/meta/classes/allarch.bbclass (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1#
2# This class is used for architecture independent recipes/data files (usually scripts)
3#
4
5python allarch_package_arch_handler () {
6    if bb.data.inherits_class("native", d) or bb.data.inherits_class("nativesdk", d) \
7        or bb.data.inherits_class("crosssdk", d):
8        return
9
10    variants = d.getVar("MULTILIB_VARIANTS")
11    if not variants:
12        d.setVar("PACKAGE_ARCH", "all" )
13}
14
15addhandler allarch_package_arch_handler
16allarch_package_arch_handler[eventmask] = "bb.event.RecipePreFinalise"
17
18python () {
19    # Allow this class to be included but overridden - only set
20    # the values if we're still "all" package arch.
21    if d.getVar("PACKAGE_ARCH") == "all":
22        # No need for virtual/libc or a cross compiler
23        d.setVar("INHIBIT_DEFAULT_DEPS","1")
24
25        # Set these to a common set of values, we shouldn't be using them other that for WORKDIR directory
26        # naming anyway
27        d.setVar("baselib", "lib")
28        d.setVar("TARGET_ARCH", "allarch")
29        d.setVar("TARGET_OS", "linux")
30        d.setVar("TARGET_CC_ARCH", "none")
31        d.setVar("TARGET_LD_ARCH", "none")
32        d.setVar("TARGET_AS_ARCH", "none")
33        d.setVar("TARGET_FPU", "")
34        d.setVar("TARGET_PREFIX", "")
35        # Expand PACKAGE_EXTRA_ARCHS since the staging code needs this
36        # (this removes any dependencies from the hash perspective)
37        d.setVar("PACKAGE_EXTRA_ARCHS", d.getVar("PACKAGE_EXTRA_ARCHS"))
38        d.setVar("SDK_ARCH", "none")
39        d.setVar("SDK_CC_ARCH", "none")
40        d.setVar("TARGET_CPPFLAGS", "none")
41        d.setVar("TARGET_CFLAGS", "none")
42        d.setVar("TARGET_CXXFLAGS", "none")
43        d.setVar("TARGET_LDFLAGS", "none")
44        d.setVar("POPULATESYSROOTDEPS", "")
45
46        # Avoid this being unnecessarily different due to nuances of
47        # the target machine that aren't important for "all" arch
48        # packages.
49        d.setVar("LDFLAGS", "")
50
51        # No need to do shared library processing or debug symbol handling
52        d.setVar("EXCLUDE_FROM_SHLIBS", "1")
53        d.setVar("INHIBIT_PACKAGE_DEBUG_SPLIT", "1")
54        d.setVar("INHIBIT_PACKAGE_STRIP", "1")
55
56        # These multilib values shouldn't change allarch packages so exclude them
57        d.appendVarFlag("emit_pkgdata", "vardepsexclude", " MULTILIB_VARIANTS")
58        d.appendVarFlag("write_specfile", "vardepsexclude", " MULTILIBS")
59        d.appendVarFlag("do_package", "vardepsexclude", " package_do_shlibs")
60    elif bb.data.inherits_class('packagegroup', d) and not bb.data.inherits_class('nativesdk', d):
61        bb.error("Please ensure recipe %s sets PACKAGE_ARCH before inherit packagegroup" % d.getVar("FILE"))
62}
63
64def qemu_wrapper_cmdline(data, rootfs_path, library_paths):
65    return 'false'
66