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