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