blob: a0838e41b97efe85e31cbb4ace545155e6ad33e0 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001# We want native packages to be relocatable
2inherit relocatable
3
4# Native packages are built indirectly via dependency,
5# no need for them to be a direct target of 'world'
6EXCLUDE_FROM_WORLD = "1"
7
Patrick Williamsc124f4f2015-09-15 14:41:29 -05008PACKAGE_ARCH = "${BUILD_ARCH}"
9
10# used by cmake class
11OECMAKE_RPATH = "${libdir}"
12OECMAKE_RPATH_class-native = "${libdir}"
13
Patrick Williamsc124f4f2015-09-15 14:41:29 -050014TARGET_ARCH = "${BUILD_ARCH}"
15TARGET_OS = "${BUILD_OS}"
16TARGET_VENDOR = "${BUILD_VENDOR}"
17TARGET_PREFIX = "${BUILD_PREFIX}"
18TARGET_CC_ARCH = "${BUILD_CC_ARCH}"
19TARGET_LD_ARCH = "${BUILD_LD_ARCH}"
20TARGET_AS_ARCH = "${BUILD_AS_ARCH}"
21TARGET_CPPFLAGS = "${BUILD_CPPFLAGS}"
22TARGET_CFLAGS = "${BUILD_CFLAGS}"
23TARGET_CXXFLAGS = "${BUILD_CXXFLAGS}"
24TARGET_LDFLAGS = "${BUILD_LDFLAGS}"
25TARGET_FPU = ""
26
27HOST_ARCH = "${BUILD_ARCH}"
28HOST_OS = "${BUILD_OS}"
29HOST_VENDOR = "${BUILD_VENDOR}"
30HOST_PREFIX = "${BUILD_PREFIX}"
31HOST_CC_ARCH = "${BUILD_CC_ARCH}"
32HOST_LD_ARCH = "${BUILD_LD_ARCH}"
33HOST_AS_ARCH = "${BUILD_AS_ARCH}"
34
35CPPFLAGS = "${BUILD_CPPFLAGS}"
36CFLAGS = "${BUILD_CFLAGS}"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050037CXXFLAGS = "${BUILD_CXXFLAGS}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050038LDFLAGS = "${BUILD_LDFLAGS}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050039
40STAGING_BINDIR = "${STAGING_BINDIR_NATIVE}"
41STAGING_BINDIR_CROSS = "${STAGING_BINDIR_NATIVE}"
42
43# native pkg doesn't need the TOOLCHAIN_OPTIONS.
44TOOLCHAIN_OPTIONS = ""
45
Patrick Williamsc124f4f2015-09-15 14:41:29 -050046# Don't build ptest natively
47PTEST_ENABLED = "0"
48
49# Don't use site files for native builds
50export CONFIG_SITE = "${COREBASE}/meta/site/native"
51
52# set the compiler as well. It could have been set to something else
53export CC = "${BUILD_CC}"
54export CXX = "${BUILD_CXX}"
55export FC = "${BUILD_FC}"
56export CPP = "${BUILD_CPP}"
57export LD = "${BUILD_LD}"
58export CCLD = "${BUILD_CCLD}"
59export AR = "${BUILD_AR}"
60export AS = "${BUILD_AS}"
61export RANLIB = "${BUILD_RANLIB}"
62export STRIP = "${BUILD_STRIP}"
63export NM = "${BUILD_NM}"
64
65# Path prefixes
66base_prefix = "${STAGING_DIR_NATIVE}"
67prefix = "${STAGING_DIR_NATIVE}${prefix_native}"
68exec_prefix = "${STAGING_DIR_NATIVE}${prefix_native}"
69
70bindir = "${STAGING_BINDIR_NATIVE}"
71sbindir = "${STAGING_SBINDIR_NATIVE}"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080072base_libdir = "${STAGING_LIBDIR_NATIVE}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050073libdir = "${STAGING_LIBDIR_NATIVE}"
74includedir = "${STAGING_INCDIR_NATIVE}"
75sysconfdir = "${STAGING_ETCDIR_NATIVE}"
76datadir = "${STAGING_DATADIR_NATIVE}"
77
78baselib = "lib"
79
Patrick Williamsc0f7c042017-02-23 20:41:17 -060080export lt_cv_sys_lib_dlsearch_path_spec = "${libdir} ${base_libdir} /lib /lib64 /usr/lib /usr/lib64"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050081
82NATIVE_PACKAGE_PATH_SUFFIX ?= ""
83bindir .= "${NATIVE_PACKAGE_PATH_SUFFIX}"
Brad Bishopc342db32019-05-15 21:57:59 -040084sbindir .= "${NATIVE_PACKAGE_PATH_SUFFIX}"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080085base_libdir .= "${NATIVE_PACKAGE_PATH_SUFFIX}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050086libdir .= "${NATIVE_PACKAGE_PATH_SUFFIX}"
87libexecdir .= "${NATIVE_PACKAGE_PATH_SUFFIX}"
88
89do_populate_sysroot[sstate-inputdirs] = "${SYSROOT_DESTDIR}/${STAGING_DIR_NATIVE}/"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050090do_populate_sysroot[sstate-outputdirs] = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/${PN}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050091
92# Since we actually install these into situ there is no staging prefix
93STAGING_DIR_HOST = ""
94STAGING_DIR_TARGET = ""
95PKG_CONFIG_DIR = "${libdir}/pkgconfig"
96
97EXTRA_NATIVE_PKGCONFIG_PATH ?= ""
98PKG_CONFIG_PATH .= "${EXTRA_NATIVE_PKGCONFIG_PATH}"
99PKG_CONFIG_SYSROOT_DIR = ""
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500100PKG_CONFIG_SYSTEM_LIBRARY_PATH[unexport] = "1"
101PKG_CONFIG_SYSTEM_INCLUDE_PATH[unexport] = "1"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500102
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500103# we dont want libc-*libc to kick in for native recipes
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500104LIBCOVERRIDE = ""
105CLASSOVERRIDE = "class-native"
106MACHINEOVERRIDES = ""
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500107MACHINE_FEATURES = ""
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500108
109PATH_prepend = "${COREBASE}/scripts/native-intercept:"
110
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500111# This class encodes staging paths into its scripts data so can only be
112# reused if we manipulate the paths.
113SSTATE_SCAN_CMD ?= "${SSTATE_SCAN_CMD_NATIVE}"
114
Brad Bishop19323692019-04-05 15:28:33 -0400115# No strip sysroot when DEBUG_BUILD is enabled
116INHIBIT_SYSROOT_STRIP ?= "${@oe.utils.vartrue('DEBUG_BUILD', '1', '', d)}"
117
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500118python native_virtclass_handler () {
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500119 pn = e.data.getVar("PN")
120 if not pn.endswith("-native"):
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500121 return
122
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500123 # Set features here to prevent appends and distro features backfill
124 # from modifying native distro features
125 features = set(d.getVar("DISTRO_FEATURES_NATIVE").split())
126 filtered = set(bb.utils.filter("DISTRO_FEATURES", d.getVar("DISTRO_FEATURES_FILTER_NATIVE"), d).split())
127 d.setVar("DISTRO_FEATURES", " ".join(sorted(features | filtered)))
128
129 classextend = e.data.getVar('BBCLASSEXTEND') or ""
130 if "native" not in classextend:
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500131 return
132
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600133 def map_dependencies(varname, d, suffix = "", selfref=True):
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500134 if suffix:
135 varname = varname + "_" + suffix
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500136 deps = d.getVar(varname)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500137 if not deps:
138 return
139 deps = bb.utils.explode_deps(deps)
140 newdeps = []
141 for dep in deps:
142 if dep == pn:
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600143 if not selfref:
144 continue
145 newdeps.append(dep)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500146 elif "-cross-" in dep:
147 newdeps.append(dep.replace("-cross", "-native"))
148 elif not dep.endswith("-native"):
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600149 newdeps.append(dep.replace("-native", "") + "-native")
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500150 else:
151 newdeps.append(dep)
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600152 d.setVar(varname, " ".join(newdeps), parsing=True)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500153
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600154 map_dependencies("DEPENDS", e.data, selfref=False)
155 for pkg in e.data.getVar("PACKAGES", False).split():
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500156 map_dependencies("RDEPENDS", e.data, pkg)
157 map_dependencies("RRECOMMENDS", e.data, pkg)
158 map_dependencies("RSUGGESTS", e.data, pkg)
159 map_dependencies("RPROVIDES", e.data, pkg)
160 map_dependencies("RREPLACES", e.data, pkg)
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600161 map_dependencies("PACKAGES", e.data)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500162
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500163 provides = e.data.getVar("PROVIDES")
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500164 nprovides = []
165 for prov in provides.split():
166 if prov.find(pn) != -1:
167 nprovides.append(prov)
168 elif not prov.endswith("-native"):
169 nprovides.append(prov.replace(prov, prov + "-native"))
170 else:
171 nprovides.append(prov)
172 e.data.setVar("PROVIDES", ' '.join(nprovides))
173
174
175}
176
177addhandler native_virtclass_handler
178native_virtclass_handler[eventmask] = "bb.event.RecipePreFinalise"
179
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500180python do_addto_recipe_sysroot () {
181 bb.build.exec_func("extend_recipe_sysroot", d)
182}
183addtask addto_recipe_sysroot after do_populate_sysroot
Andrew Geissler82c905d2020-04-13 13:39:40 -0500184do_addto_recipe_sysroot[deptask] = "do_populate_sysroot"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500185
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500186inherit nopackages
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500187
188do_packagedata[stamp-extra-info] = ""
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500189
190USE_NLS = "no"
Brad Bishop19323692019-04-05 15:28:33 -0400191
192RECIPERDEPTASK = "do_populate_sysroot"
193do_populate_sysroot[rdeptask] = "${RECIPERDEPTASK}"