blob: 08288fdb733e8be87b69820373794deb09c66d30 [file] [log] [blame]
Patrick Williams92b42cb2022-09-03 06:53:57 -05001#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: MIT
5#
6
7# SDK packages are built either explicitly by the user,
8# or indirectly via dependency. No need to be in 'world'.
9EXCLUDE_FROM_WORLD = "1"
10
11STAGING_BINDIR_TOOLCHAIN = "${STAGING_DIR_NATIVE}${bindir_native}/${SDK_ARCH}${SDK_VENDOR}-${SDK_OS}"
12
13# libc for the SDK can be different to that of the target
14NATIVESDKLIBC ?= "libc-glibc"
15LIBCOVERRIDE = ":${NATIVESDKLIBC}"
16CLASSOVERRIDE = "class-nativesdk"
17MACHINEOVERRIDES = ""
18MACHINE_FEATURES = ""
19
20MULTILIBS = ""
21
22# we need consistent staging dir whether or not multilib is enabled
23STAGING_DIR_HOST = "${WORKDIR}/recipe-sysroot"
24STAGING_DIR_TARGET = "${WORKDIR}/recipe-sysroot"
25RECIPE_SYSROOT = "${WORKDIR}/recipe-sysroot"
26
27#
28# Update PACKAGE_ARCH and PACKAGE_ARCHS
29#
30PACKAGE_ARCH = "${SDK_ARCH}-${SDKPKGSUFFIX}"
31PACKAGE_ARCHS = "${SDK_PACKAGE_ARCHS}"
32
33#
34# We need chrpath >= 0.14 to ensure we can deal with 32 and 64 bit
35# binaries
36#
37DEPENDS:append = " chrpath-replacement-native"
38EXTRANATIVEPATH += "chrpath-native"
39
40PKGDATA_DIR = "${PKGDATA_DIR_SDK}"
41
42HOST_ARCH = "${SDK_ARCH}"
43HOST_VENDOR = "${SDK_VENDOR}"
44HOST_OS = "${SDK_OS}"
45HOST_PREFIX = "${SDK_PREFIX}"
46HOST_CC_ARCH = "${SDK_CC_ARCH}"
47HOST_LD_ARCH = "${SDK_LD_ARCH}"
48HOST_AS_ARCH = "${SDK_AS_ARCH}"
49#HOST_SYS = "${HOST_ARCH}${TARGET_VENDOR}-${HOST_OS}"
50
51TARGET_ARCH = "${SDK_ARCH}"
52TARGET_VENDOR = "${SDK_VENDOR}"
53TARGET_OS = "${SDK_OS}"
54TARGET_PREFIX = "${SDK_PREFIX}"
55TARGET_CC_ARCH = "${SDK_CC_ARCH}"
56TARGET_LD_ARCH = "${SDK_LD_ARCH}"
57TARGET_AS_ARCH = "${SDK_AS_ARCH}"
58TARGET_CPPFLAGS = "${BUILDSDK_CPPFLAGS}"
59TARGET_CFLAGS = "${BUILDSDK_CFLAGS}"
60TARGET_CXXFLAGS = "${BUILDSDK_CXXFLAGS}"
61TARGET_LDFLAGS = "${BUILDSDK_LDFLAGS}"
62TARGET_FPU = ""
63EXTRA_OECONF_GCC_FLOAT = ""
64TUNE_FEATURES = ""
65
66CPPFLAGS = "${BUILDSDK_CPPFLAGS}"
67CFLAGS = "${BUILDSDK_CFLAGS}"
68CXXFLAGS = "${BUILDSDK_CXXFLAGS}"
69LDFLAGS = "${BUILDSDK_LDFLAGS}"
70
71# Change to place files in SDKPATH
72base_prefix = "${SDKPATHNATIVE}"
73prefix = "${SDKPATHNATIVE}${prefix_nativesdk}"
74exec_prefix = "${SDKPATHNATIVE}${prefix_nativesdk}"
75baselib = "lib"
76sbindir = "${bindir}"
77
78export PKG_CONFIG_DIR = "${STAGING_DIR_HOST}${libdir}/pkgconfig"
79export PKG_CONFIG_SYSROOT_DIR = "${STAGING_DIR_HOST}"
80
81python nativesdk_virtclass_handler () {
82 pn = e.data.getVar("PN")
83 if not (pn.endswith("-nativesdk") or pn.startswith("nativesdk-")):
84 return
85
86 # Set features here to prevent appends and distro features backfill
87 # from modifying nativesdk distro features
88 features = set(d.getVar("DISTRO_FEATURES_NATIVESDK").split())
89 filtered = set(bb.utils.filter("DISTRO_FEATURES", d.getVar("DISTRO_FEATURES_FILTER_NATIVESDK"), d).split())
90 d.setVar("DISTRO_FEATURES", " ".join(sorted(features | filtered)))
91
92 e.data.setVar("MLPREFIX", "nativesdk-")
93 e.data.setVar("PN", "nativesdk-" + e.data.getVar("PN").replace("-nativesdk", "").replace("nativesdk-", ""))
94}
95
96python () {
97 pn = d.getVar("PN")
98 if not pn.startswith("nativesdk-"):
99 return
100
101 import oe.classextend
102
103 clsextend = oe.classextend.NativesdkClassExtender("nativesdk", d)
104 clsextend.rename_packages()
105 clsextend.rename_package_variables((d.getVar("PACKAGEVARS") or "").split())
106
107 clsextend.map_depends_variable("DEPENDS")
108 clsextend.map_packagevars()
109 clsextend.map_variable("PROVIDES")
110 clsextend.map_regexp_variable("PACKAGES_DYNAMIC")
111 d.setVar("LIBCEXTENSION", "")
112 d.setVar("ABIEXTENSION", "")
113}
114
115addhandler nativesdk_virtclass_handler
116nativesdk_virtclass_handler[eventmask] = "bb.event.RecipePreFinalise"
117
118do_packagedata[stamp-extra-info] = ""
119
120USE_NLS = "${SDKUSE_NLS}"
121
122OLDEST_KERNEL = "${SDK_OLDEST_KERNEL}"
123
124PATH:prepend = "${COREBASE}/scripts/nativesdk-intercept:"