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 = "" |
| 18 | MACHINE_FEATURES = "" |
| 19 | |
| 20 | MULTILIBS = "" |
| 21 | |
| 22 | # we need consistent staging dir whether or not multilib is enabled |
| 23 | STAGING_DIR_HOST = "${WORKDIR}/recipe-sysroot" |
| 24 | STAGING_DIR_TARGET = "${WORKDIR}/recipe-sysroot" |
| 25 | RECIPE_SYSROOT = "${WORKDIR}/recipe-sysroot" |
| 26 | |
| 27 | # |
| 28 | # Update PACKAGE_ARCH and PACKAGE_ARCHS |
| 29 | # |
| 30 | PACKAGE_ARCH = "${SDK_ARCH}-${SDKPKGSUFFIX}" |
| 31 | PACKAGE_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 | # |
| 37 | DEPENDS:append = " chrpath-replacement-native" |
| 38 | EXTRANATIVEPATH += "chrpath-native" |
| 39 | |
| 40 | PKGDATA_DIR = "${PKGDATA_DIR_SDK}" |
| 41 | |
| 42 | HOST_ARCH = "${SDK_ARCH}" |
| 43 | HOST_VENDOR = "${SDK_VENDOR}" |
| 44 | HOST_OS = "${SDK_OS}" |
| 45 | HOST_PREFIX = "${SDK_PREFIX}" |
| 46 | HOST_CC_ARCH = "${SDK_CC_ARCH}" |
| 47 | HOST_LD_ARCH = "${SDK_LD_ARCH}" |
| 48 | HOST_AS_ARCH = "${SDK_AS_ARCH}" |
| 49 | #HOST_SYS = "${HOST_ARCH}${TARGET_VENDOR}-${HOST_OS}" |
| 50 | |
| 51 | TARGET_ARCH = "${SDK_ARCH}" |
| 52 | TARGET_VENDOR = "${SDK_VENDOR}" |
| 53 | TARGET_OS = "${SDK_OS}" |
| 54 | TARGET_PREFIX = "${SDK_PREFIX}" |
| 55 | TARGET_CC_ARCH = "${SDK_CC_ARCH}" |
| 56 | TARGET_LD_ARCH = "${SDK_LD_ARCH}" |
| 57 | TARGET_AS_ARCH = "${SDK_AS_ARCH}" |
| 58 | TARGET_CPPFLAGS = "${BUILDSDK_CPPFLAGS}" |
| 59 | TARGET_CFLAGS = "${BUILDSDK_CFLAGS}" |
| 60 | TARGET_CXXFLAGS = "${BUILDSDK_CXXFLAGS}" |
| 61 | TARGET_LDFLAGS = "${BUILDSDK_LDFLAGS}" |
| 62 | TARGET_FPU = "" |
| 63 | EXTRA_OECONF_GCC_FLOAT = "" |
| 64 | TUNE_FEATURES = "" |
| 65 | |
| 66 | CPPFLAGS = "${BUILDSDK_CPPFLAGS}" |
| 67 | CFLAGS = "${BUILDSDK_CFLAGS}" |
| 68 | CXXFLAGS = "${BUILDSDK_CXXFLAGS}" |
| 69 | LDFLAGS = "${BUILDSDK_LDFLAGS}" |
| 70 | |
| 71 | # Change to place files in SDKPATH |
| 72 | base_prefix = "${SDKPATHNATIVE}" |
| 73 | prefix = "${SDKPATHNATIVE}${prefix_nativesdk}" |
| 74 | exec_prefix = "${SDKPATHNATIVE}${prefix_nativesdk}" |
| 75 | baselib = "lib" |
| 76 | sbindir = "${bindir}" |
| 77 | |
| 78 | export PKG_CONFIG_DIR = "${STAGING_DIR_HOST}${libdir}/pkgconfig" |
| 79 | export PKG_CONFIG_SYSROOT_DIR = "${STAGING_DIR_HOST}" |
| 80 | |
| 81 | python 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 | |
| 96 | python () { |
| 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 | |
| 115 | addhandler nativesdk_virtclass_handler |
| 116 | nativesdk_virtclass_handler[eventmask] = "bb.event.RecipePreFinalise" |
| 117 | |
| 118 | do_packagedata[stamp-extra-info] = "" |
| 119 | |
| 120 | USE_NLS = "${SDKUSE_NLS}" |
| 121 | |
| 122 | OLDEST_KERNEL = "${SDK_OLDEST_KERNEL}" |
| 123 | |
| 124 | PATH:prepend = "${COREBASE}/scripts/nativesdk-intercept:" |