Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | # We want native packages to be relocatable |
| 2 | inherit relocatable |
| 3 | |
| 4 | # Native packages are built indirectly via dependency, |
| 5 | # no need for them to be a direct target of 'world' |
| 6 | EXCLUDE_FROM_WORLD = "1" |
| 7 | |
| 8 | PACKAGES = "" |
| 9 | PACKAGES_class-native = "" |
| 10 | PACKAGES_DYNAMIC = "" |
| 11 | PACKAGES_DYNAMIC_class-native = "" |
| 12 | PACKAGE_ARCH = "${BUILD_ARCH}" |
| 13 | |
| 14 | # used by cmake class |
| 15 | OECMAKE_RPATH = "${libdir}" |
| 16 | OECMAKE_RPATH_class-native = "${libdir}" |
| 17 | |
| 18 | # When this class has packaging enabled, setting |
| 19 | # RPROVIDES becomes unnecessary. |
| 20 | RPROVIDES = "${PN}" |
| 21 | |
| 22 | TARGET_ARCH = "${BUILD_ARCH}" |
| 23 | TARGET_OS = "${BUILD_OS}" |
| 24 | TARGET_VENDOR = "${BUILD_VENDOR}" |
| 25 | TARGET_PREFIX = "${BUILD_PREFIX}" |
| 26 | TARGET_CC_ARCH = "${BUILD_CC_ARCH}" |
| 27 | TARGET_LD_ARCH = "${BUILD_LD_ARCH}" |
| 28 | TARGET_AS_ARCH = "${BUILD_AS_ARCH}" |
| 29 | TARGET_CPPFLAGS = "${BUILD_CPPFLAGS}" |
| 30 | TARGET_CFLAGS = "${BUILD_CFLAGS}" |
| 31 | TARGET_CXXFLAGS = "${BUILD_CXXFLAGS}" |
| 32 | TARGET_LDFLAGS = "${BUILD_LDFLAGS}" |
| 33 | TARGET_FPU = "" |
| 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 | CPPFLAGS = "${BUILD_CPPFLAGS}" |
| 44 | CFLAGS = "${BUILD_CFLAGS}" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 45 | CXXFLAGS = "${BUILD_CXXFLAGS}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 46 | LDFLAGS = "${BUILD_LDFLAGS}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 47 | |
| 48 | STAGING_BINDIR = "${STAGING_BINDIR_NATIVE}" |
| 49 | STAGING_BINDIR_CROSS = "${STAGING_BINDIR_NATIVE}" |
| 50 | |
| 51 | # native pkg doesn't need the TOOLCHAIN_OPTIONS. |
| 52 | TOOLCHAIN_OPTIONS = "" |
| 53 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 54 | # Don't build ptest natively |
| 55 | PTEST_ENABLED = "0" |
| 56 | |
| 57 | # Don't use site files for native builds |
| 58 | export CONFIG_SITE = "${COREBASE}/meta/site/native" |
| 59 | |
| 60 | # set the compiler as well. It could have been set to something else |
| 61 | export CC = "${BUILD_CC}" |
| 62 | export CXX = "${BUILD_CXX}" |
| 63 | export FC = "${BUILD_FC}" |
| 64 | export CPP = "${BUILD_CPP}" |
| 65 | export LD = "${BUILD_LD}" |
| 66 | export CCLD = "${BUILD_CCLD}" |
| 67 | export AR = "${BUILD_AR}" |
| 68 | export AS = "${BUILD_AS}" |
| 69 | export RANLIB = "${BUILD_RANLIB}" |
| 70 | export STRIP = "${BUILD_STRIP}" |
| 71 | export NM = "${BUILD_NM}" |
| 72 | |
| 73 | # Path prefixes |
| 74 | base_prefix = "${STAGING_DIR_NATIVE}" |
| 75 | prefix = "${STAGING_DIR_NATIVE}${prefix_native}" |
| 76 | exec_prefix = "${STAGING_DIR_NATIVE}${prefix_native}" |
| 77 | |
| 78 | bindir = "${STAGING_BINDIR_NATIVE}" |
| 79 | sbindir = "${STAGING_SBINDIR_NATIVE}" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 80 | base_libdir = "${STAGING_LIBDIR_NATIVE}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 81 | libdir = "${STAGING_LIBDIR_NATIVE}" |
| 82 | includedir = "${STAGING_INCDIR_NATIVE}" |
| 83 | sysconfdir = "${STAGING_ETCDIR_NATIVE}" |
| 84 | datadir = "${STAGING_DATADIR_NATIVE}" |
| 85 | |
| 86 | baselib = "lib" |
| 87 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 88 | export lt_cv_sys_lib_dlsearch_path_spec = "${libdir} ${base_libdir} /lib /lib64 /usr/lib /usr/lib64" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 89 | |
| 90 | NATIVE_PACKAGE_PATH_SUFFIX ?= "" |
| 91 | bindir .= "${NATIVE_PACKAGE_PATH_SUFFIX}" |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 92 | sbindir .= "${NATIVE_PACKAGE_PATH_SUFFIX}" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 93 | base_libdir .= "${NATIVE_PACKAGE_PATH_SUFFIX}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 94 | libdir .= "${NATIVE_PACKAGE_PATH_SUFFIX}" |
| 95 | libexecdir .= "${NATIVE_PACKAGE_PATH_SUFFIX}" |
| 96 | |
| 97 | do_populate_sysroot[sstate-inputdirs] = "${SYSROOT_DESTDIR}/${STAGING_DIR_NATIVE}/" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 98 | do_populate_sysroot[sstate-outputdirs] = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/${PN}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 99 | |
| 100 | # Since we actually install these into situ there is no staging prefix |
| 101 | STAGING_DIR_HOST = "" |
| 102 | STAGING_DIR_TARGET = "" |
| 103 | PKG_CONFIG_DIR = "${libdir}/pkgconfig" |
| 104 | |
| 105 | EXTRA_NATIVE_PKGCONFIG_PATH ?= "" |
| 106 | PKG_CONFIG_PATH .= "${EXTRA_NATIVE_PKGCONFIG_PATH}" |
| 107 | PKG_CONFIG_SYSROOT_DIR = "" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 108 | PKG_CONFIG_SYSTEM_LIBRARY_PATH[unexport] = "1" |
| 109 | PKG_CONFIG_SYSTEM_INCLUDE_PATH[unexport] = "1" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 110 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 111 | # we dont want libc-*libc to kick in for native recipes |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 112 | LIBCOVERRIDE = "" |
| 113 | CLASSOVERRIDE = "class-native" |
| 114 | MACHINEOVERRIDES = "" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 115 | MACHINE_FEATURES = "" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 116 | |
| 117 | PATH_prepend = "${COREBASE}/scripts/native-intercept:" |
| 118 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 119 | # This class encodes staging paths into its scripts data so can only be |
| 120 | # reused if we manipulate the paths. |
| 121 | SSTATE_SCAN_CMD ?= "${SSTATE_SCAN_CMD_NATIVE}" |
| 122 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 123 | # No strip sysroot when DEBUG_BUILD is enabled |
| 124 | INHIBIT_SYSROOT_STRIP ?= "${@oe.utils.vartrue('DEBUG_BUILD', '1', '', d)}" |
| 125 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 126 | python native_virtclass_handler () { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 127 | pn = e.data.getVar("PN") |
| 128 | if not pn.endswith("-native"): |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 129 | return |
| 130 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 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: |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 139 | return |
| 140 | |
| 141 | def map_dependencies(varname, d, suffix = ""): |
| 142 | if suffix: |
| 143 | varname = varname + "_" + suffix |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 144 | deps = d.getVar(varname) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 145 | if not deps: |
| 146 | return |
| 147 | deps = bb.utils.explode_deps(deps) |
| 148 | newdeps = [] |
| 149 | for dep in deps: |
| 150 | if dep == pn: |
| 151 | continue |
| 152 | elif "-cross-" in dep: |
| 153 | newdeps.append(dep.replace("-cross", "-native")) |
| 154 | elif not dep.endswith("-native"): |
| 155 | newdeps.append(dep + "-native") |
| 156 | else: |
| 157 | newdeps.append(dep) |
| 158 | d.setVar(varname, " ".join(newdeps)) |
| 159 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 160 | map_dependencies("DEPENDS", e.data) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 161 | for pkg in [e.data.getVar("PN"), "", "${PN}"]: |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 162 | map_dependencies("RDEPENDS", e.data, pkg) |
| 163 | map_dependencies("RRECOMMENDS", e.data, pkg) |
| 164 | map_dependencies("RSUGGESTS", e.data, pkg) |
| 165 | map_dependencies("RPROVIDES", e.data, pkg) |
| 166 | map_dependencies("RREPLACES", e.data, pkg) |
| 167 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 168 | provides = e.data.getVar("PROVIDES") |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 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.replace(prov, 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 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 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 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 190 | inherit nopackages |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 191 | |
| 192 | do_packagedata[stamp-extra-info] = "" |
| 193 | do_populate_sysroot[stamp-extra-info] = "" |
| 194 | |
| 195 | USE_NLS = "no" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 196 | |
| 197 | RECIPERDEPTASK = "do_populate_sysroot" |
| 198 | do_populate_sysroot[rdeptask] = "${RECIPERDEPTASK}" |