diff options
Diffstat (limited to 'meta/classes-recipe/native.bbclass')
| -rw-r--r-- | meta/classes-recipe/native.bbclass | 229 |
1 files changed, 0 insertions, 229 deletions
diff --git a/meta/classes-recipe/native.bbclass b/meta/classes-recipe/native.bbclass deleted file mode 100644 index 7d1fe343fa..0000000000 --- a/meta/classes-recipe/native.bbclass +++ /dev/null | |||
| @@ -1,229 +0,0 @@ | |||
| 1 | # | ||
| 2 | # Copyright OpenEmbedded Contributors | ||
| 3 | # | ||
| 4 | # SPDX-License-Identifier: MIT | ||
| 5 | # | ||
| 6 | |||
| 7 | # We want native packages to be relocatable | ||
| 8 | inherit relocatable | ||
| 9 | |||
| 10 | # Native packages are built indirectly via dependency, | ||
| 11 | # no need for them to be a direct target of 'world' | ||
| 12 | EXCLUDE_FROM_WORLD = "1" | ||
| 13 | |||
| 14 | PACKAGE_ARCH = "${BUILD_ARCH}" | ||
| 15 | |||
| 16 | # used by cmake class | ||
| 17 | OECMAKE_RPATH = "${libdir}" | ||
| 18 | OECMAKE_RPATH:class-native = "${libdir}" | ||
| 19 | |||
| 20 | TARGET_ARCH = "${BUILD_ARCH}" | ||
| 21 | TARGET_OS = "${BUILD_OS}" | ||
| 22 | TARGET_VENDOR = "${BUILD_VENDOR}" | ||
| 23 | TARGET_PREFIX = "${BUILD_PREFIX}" | ||
| 24 | TARGET_CC_ARCH = "${BUILD_CC_ARCH}" | ||
| 25 | TARGET_LD_ARCH = "${BUILD_LD_ARCH}" | ||
| 26 | TARGET_AS_ARCH = "${BUILD_AS_ARCH}" | ||
| 27 | TARGET_CPPFLAGS = "${BUILD_CPPFLAGS}" | ||
| 28 | TARGET_CFLAGS = "${BUILD_CFLAGS}" | ||
| 29 | TARGET_CXXFLAGS = "${BUILD_CXXFLAGS}" | ||
| 30 | TARGET_LDFLAGS = "${BUILD_LDFLAGS}" | ||
| 31 | TARGET_FPU = "" | ||
| 32 | TUNE_FEATURES = "" | ||
| 33 | ABIEXTENSION = "" | ||
| 34 | |||
| 35 | HOST_ARCH = "${BUILD_ARCH}" | ||
| 36 | HOST_OS = "${BUILD_OS}" | ||
| 37 | HOST_VENDOR = "${BUILD_VENDOR}" | ||
| 38 | HOST_PREFIX = "${BUILD_PREFIX}" | ||
| 39 | HOST_CC_ARCH = "${BUILD_CC_ARCH}" | ||
| 40 | HOST_LD_ARCH = "${BUILD_LD_ARCH}" | ||
| 41 | HOST_AS_ARCH = "${BUILD_AS_ARCH}" | ||
| 42 | |||
| 43 | STAGING_BINDIR = "${STAGING_BINDIR_NATIVE}" | ||
| 44 | STAGING_BINDIR_CROSS = "${STAGING_BINDIR_NATIVE}" | ||
| 45 | |||
| 46 | # native pkg doesn't need the TOOLCHAIN_OPTIONS. | ||
| 47 | TOOLCHAIN_OPTIONS = "" | ||
| 48 | |||
| 49 | # Don't build ptest natively | ||
| 50 | PTEST_ENABLED = "0" | ||
| 51 | |||
| 52 | # Don't use site files for native builds | ||
| 53 | export CONFIG_SITE = "${COREBASE}/meta/site/native" | ||
| 54 | |||
| 55 | # set the compiler as well. It could have been set to something else | ||
| 56 | CC = "${BUILD_CC}" | ||
| 57 | CXX = "${BUILD_CXX}" | ||
| 58 | FC = "${BUILD_FC}" | ||
| 59 | CPP = "${BUILD_CPP}" | ||
| 60 | LD = "${BUILD_LD}" | ||
| 61 | CCLD = "${BUILD_CCLD}" | ||
| 62 | AR = "${BUILD_AR}" | ||
| 63 | AS = "${BUILD_AS}" | ||
| 64 | RANLIB = "${BUILD_RANLIB}" | ||
| 65 | STRIP = "${BUILD_STRIP}" | ||
| 66 | NM = "${BUILD_NM}" | ||
| 67 | OBJCOPY = "${BUILD_OBJCOPY}" | ||
| 68 | OBJDUMP = "${BUILD_OBJDUMP}" | ||
| 69 | READELF = "${BUILD_READELF}" | ||
| 70 | |||
| 71 | # Path prefixes | ||
| 72 | base_prefix = "${STAGING_DIR_NATIVE}" | ||
| 73 | prefix = "${STAGING_DIR_NATIVE}${prefix_native}" | ||
| 74 | exec_prefix = "${STAGING_DIR_NATIVE}${prefix_native}" | ||
| 75 | |||
| 76 | bindir = "${STAGING_BINDIR_NATIVE}" | ||
| 77 | sbindir = "${STAGING_SBINDIR_NATIVE}" | ||
| 78 | base_libdir = "${STAGING_BASE_LIBDIR_NATIVE}" | ||
| 79 | libdir = "${STAGING_LIBDIR_NATIVE}" | ||
| 80 | includedir = "${STAGING_INCDIR_NATIVE}" | ||
| 81 | sysconfdir = "${STAGING_ETCDIR_NATIVE}" | ||
| 82 | datadir = "${STAGING_DATADIR_NATIVE}" | ||
| 83 | |||
| 84 | baselib = "lib" | ||
| 85 | |||
| 86 | export lt_cv_sys_lib_dlsearch_path_spec = "${libdir} ${base_libdir} /lib /lib64 /usr/lib /usr/lib64" | ||
| 87 | |||
| 88 | NATIVE_PACKAGE_PATH_SUFFIX ?= "" | ||
| 89 | bindir .= "${NATIVE_PACKAGE_PATH_SUFFIX}" | ||
| 90 | sbindir .= "${NATIVE_PACKAGE_PATH_SUFFIX}" | ||
| 91 | base_libdir .= "${NATIVE_PACKAGE_PATH_SUFFIX}" | ||
| 92 | libdir .= "${NATIVE_PACKAGE_PATH_SUFFIX}" | ||
| 93 | libexecdir .= "${NATIVE_PACKAGE_PATH_SUFFIX}" | ||
| 94 | |||
| 95 | do_populate_sysroot[sstate-inputdirs] = "${SYSROOT_DESTDIR}/${STAGING_DIR_NATIVE}/" | ||
| 96 | do_populate_sysroot[sstate-outputdirs] = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/${PN}" | ||
| 97 | |||
| 98 | # Since we actually install these into situ there is no staging prefix | ||
| 99 | STAGING_DIR_HOST = "" | ||
| 100 | STAGING_DIR_TARGET = "" | ||
| 101 | PKG_CONFIG_DIR = "${libdir}/pkgconfig" | ||
| 102 | |||
| 103 | EXTRA_NATIVE_PKGCONFIG_PATH ?= "" | ||
| 104 | PKG_CONFIG_PATH .= "${EXTRA_NATIVE_PKGCONFIG_PATH}" | ||
| 105 | PKG_CONFIG_SYSROOT_DIR = "" | ||
| 106 | PKG_CONFIG_SYSTEM_LIBRARY_PATH[unexport] = "1" | ||
| 107 | PKG_CONFIG_SYSTEM_INCLUDE_PATH[unexport] = "1" | ||
| 108 | |||
| 109 | # we dont want libc-*libc to kick in for native recipes | ||
| 110 | LIBCOVERRIDE = "" | ||
| 111 | CLASSOVERRIDE = "class-native" | ||
| 112 | MACHINEOVERRIDES = "" | ||
| 113 | MACHINE_FEATURES = "" | ||
| 114 | |||
| 115 | PATH:prepend = "${COREBASE}/scripts/native-intercept:" | ||
| 116 | |||
| 117 | # This class encodes staging paths into its scripts data so can only be | ||
| 118 | # reused if we manipulate the paths. | ||
| 119 | SSTATE_SCAN_CMD ?= "${SSTATE_SCAN_CMD_NATIVE}" | ||
| 120 | |||
| 121 | # No strip sysroot when DEBUG_BUILD is enabled | ||
| 122 | INHIBIT_SYSROOT_STRIP ?= "${@oe.utils.vartrue('DEBUG_BUILD', '1', '', d)}" | ||
| 123 | |||
| 124 | python native_virtclass_handler () { | ||
| 125 | import re | ||
| 126 | pn = e.data.getVar("PN") | ||
| 127 | if not pn.endswith("-native"): | ||
| 128 | return | ||
| 129 | bpn = e.data.getVar("BPN") | ||
| 130 | |||
| 131 | # Set features here to prevent appends and distro features backfill | ||
| 132 | # from modifying native distro features | ||
| 133 | features = set(d.getVar("DISTRO_FEATURES_NATIVE").split()) | ||
| 134 | filtered = set(bb.utils.filter("DISTRO_FEATURES", d.getVar("DISTRO_FEATURES_FILTER_NATIVE"), d).split()) | ||
| 135 | d.setVar("DISTRO_FEATURES", " ".join(sorted(features | filtered))) | ||
| 136 | |||
| 137 | classextend = e.data.getVar('BBCLASSEXTEND') or "" | ||
| 138 | if "native" not in classextend: | ||
| 139 | return | ||
| 140 | |||
| 141 | def map_dependencies(varname, d, suffix, selfref=True, regex=False): | ||
| 142 | varname = varname + ":" + suffix | ||
| 143 | # Handle ${PN}-xxx -> ${BPN}-xxx-native | ||
| 144 | if suffix != "${PN}" and "${PN}" in suffix: | ||
| 145 | output_varname = varname.replace("${PN}", "${BPN}") + "-native" | ||
| 146 | d.renameVar(varname, output_varname) | ||
| 147 | |||
| 148 | d.setVarFilter("DEPENDS", "native_filter(val, '" + pn + "', '" + bpn + "', selfref=False)") | ||
| 149 | |||
| 150 | for varname in ["RDEPENDS", "RRECOMMENDS", "RSUGGESTS", "RPROVIDES", "RREPLACES"]: | ||
| 151 | d.setVarFilter(varname, "native_filter(val, '" + pn + "', '" + bpn + "')") | ||
| 152 | |||
| 153 | # We need to handle things like ${@bb.utils.contains('PTEST_ENABLED', '1', '${PN}-ptest', '', d)} | ||
| 154 | # and not pass ${PN}-test since in the native case it would be ignored. This does mean we ignore | ||
| 155 | # anonymous python derived PACKAGES entries. | ||
| 156 | for pkg in re.split(r"\${@(?:{.*?}|.)+?}|\s", d.getVar("PACKAGES", False)): | ||
| 157 | if not pkg: | ||
| 158 | continue | ||
| 159 | map_dependencies("RDEPENDS", e.data, pkg) | ||
| 160 | map_dependencies("RRECOMMENDS", e.data, pkg) | ||
| 161 | map_dependencies("RSUGGESTS", e.data, pkg) | ||
| 162 | map_dependencies("RPROVIDES", e.data, pkg) | ||
| 163 | map_dependencies("RREPLACES", e.data, pkg) | ||
| 164 | |||
| 165 | d.setVarFilter("PACKAGES", "native_filter(val, '" + pn + "', '" + bpn + "')") | ||
| 166 | d.setVarFilter("PACKAGES_DYNAMIC", "native_filter(val, '" + pn + "', '" + bpn + "', regex=True)") | ||
| 167 | |||
| 168 | provides = e.data.getVar("PROVIDES") | ||
| 169 | nprovides = [] | ||
| 170 | for prov in provides.split(): | ||
| 171 | if prov.find(pn) != -1: | ||
| 172 | nprovides.append(prov) | ||
| 173 | elif not prov.endswith("-native"): | ||
| 174 | nprovides.append(prov + "-native") | ||
| 175 | else: | ||
| 176 | nprovides.append(prov) | ||
| 177 | e.data.setVar("PROVIDES", ' '.join(nprovides)) | ||
| 178 | |||
| 179 | |||
| 180 | } | ||
| 181 | |||
| 182 | addhandler native_virtclass_handler | ||
| 183 | native_virtclass_handler[eventmask] = "bb.event.RecipePreFinalise" | ||
| 184 | |||
| 185 | python do_addto_recipe_sysroot () { | ||
| 186 | bb.build.exec_func("extend_recipe_sysroot", d) | ||
| 187 | } | ||
| 188 | addtask addto_recipe_sysroot after do_populate_sysroot | ||
| 189 | do_addto_recipe_sysroot[deptask] = "do_populate_sysroot" | ||
| 190 | |||
| 191 | inherit nopackages | ||
| 192 | |||
| 193 | do_packagedata[stamp-extra-info] = "" | ||
| 194 | |||
| 195 | USE_NLS = "no" | ||
| 196 | |||
| 197 | RECIPERDEPTASK = "do_populate_sysroot" | ||
| 198 | do_populate_sysroot[rdeptask] = "${RECIPERDEPTASK}" | ||
| 199 | |||
| 200 | # | ||
| 201 | # Native task outputs are directly run on the target (host) system after being | ||
| 202 | # built. Even if the output of this recipe doesn't change, a change in one of | ||
| 203 | # its dependencies may cause a change in the output it generates (e.g. rpm | ||
| 204 | # output depends on the output of its dependent zstd library). | ||
| 205 | # | ||
| 206 | # This can cause poor interactions with hash equivalence, since this recipes | ||
| 207 | # output-changing dependency is "hidden" and downstream task only see that this | ||
| 208 | # recipe has the same outhash and therefore is equivalent. This can result in | ||
| 209 | # different output in different cases. | ||
| 210 | # | ||
| 211 | # To resolve this, unhide the output-changing dependency by adding its unihash | ||
| 212 | # to this tasks outhash calculation. Unfortunately, don't know specifically | ||
| 213 | # know which dependencies are output-changing, so we have to add all of them. | ||
| 214 | # | ||
| 215 | python native_add_do_populate_sysroot_deps () { | ||
| 216 | current_task = "do_" + d.getVar("BB_CURRENTTASK") | ||
| 217 | if current_task != "do_populate_sysroot": | ||
| 218 | return | ||
| 219 | |||
| 220 | taskdepdata = d.getVar("BB_TASKDEPDATA", False) | ||
| 221 | pn = d.getVar("PN") | ||
| 222 | deps = { | ||
| 223 | dep[0]:dep[6] for dep in taskdepdata.values() if | ||
| 224 | dep[1] == current_task and dep[0] != pn | ||
| 225 | } | ||
| 226 | |||
| 227 | d.setVar("HASHEQUIV_EXTRA_SIGDATA", "\n".join("%s: %s" % (k, deps[k]) for k in sorted(deps.keys()))) | ||
| 228 | } | ||
| 229 | SSTATECREATEFUNCS += "native_add_do_populate_sysroot_deps" | ||
