blob: e9f6c740abb8e987c39b596b1e7d8840449bfa18 [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
8PACKAGES = ""
9PACKAGES_class-native = ""
10PACKAGES_DYNAMIC = ""
11PACKAGES_DYNAMIC_class-native = ""
12PACKAGE_ARCH = "${BUILD_ARCH}"
13
14# used by cmake class
15OECMAKE_RPATH = "${libdir}"
16OECMAKE_RPATH_class-native = "${libdir}"
17
18# When this class has packaging enabled, setting
19# RPROVIDES becomes unnecessary.
20RPROVIDES = "${PN}"
21
22TARGET_ARCH = "${BUILD_ARCH}"
23TARGET_OS = "${BUILD_OS}"
24TARGET_VENDOR = "${BUILD_VENDOR}"
25TARGET_PREFIX = "${BUILD_PREFIX}"
26TARGET_CC_ARCH = "${BUILD_CC_ARCH}"
27TARGET_LD_ARCH = "${BUILD_LD_ARCH}"
28TARGET_AS_ARCH = "${BUILD_AS_ARCH}"
29TARGET_CPPFLAGS = "${BUILD_CPPFLAGS}"
30TARGET_CFLAGS = "${BUILD_CFLAGS}"
31TARGET_CXXFLAGS = "${BUILD_CXXFLAGS}"
32TARGET_LDFLAGS = "${BUILD_LDFLAGS}"
33TARGET_FPU = ""
34
35HOST_ARCH = "${BUILD_ARCH}"
36HOST_OS = "${BUILD_OS}"
37HOST_VENDOR = "${BUILD_VENDOR}"
38HOST_PREFIX = "${BUILD_PREFIX}"
39HOST_CC_ARCH = "${BUILD_CC_ARCH}"
40HOST_LD_ARCH = "${BUILD_LD_ARCH}"
41HOST_AS_ARCH = "${BUILD_AS_ARCH}"
42
43CPPFLAGS = "${BUILD_CPPFLAGS}"
44CFLAGS = "${BUILD_CFLAGS}"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050045CXXFLAGS = "${BUILD_CXXFLAGS}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050046LDFLAGS = "${BUILD_LDFLAGS}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050047
48STAGING_BINDIR = "${STAGING_BINDIR_NATIVE}"
49STAGING_BINDIR_CROSS = "${STAGING_BINDIR_NATIVE}"
50
51# native pkg doesn't need the TOOLCHAIN_OPTIONS.
52TOOLCHAIN_OPTIONS = ""
53
Patrick Williamsc124f4f2015-09-15 14:41:29 -050054# Don't build ptest natively
55PTEST_ENABLED = "0"
56
57# Don't use site files for native builds
58export CONFIG_SITE = "${COREBASE}/meta/site/native"
59
60# set the compiler as well. It could have been set to something else
61export CC = "${BUILD_CC}"
62export CXX = "${BUILD_CXX}"
63export FC = "${BUILD_FC}"
64export CPP = "${BUILD_CPP}"
65export LD = "${BUILD_LD}"
66export CCLD = "${BUILD_CCLD}"
67export AR = "${BUILD_AR}"
68export AS = "${BUILD_AS}"
69export RANLIB = "${BUILD_RANLIB}"
70export STRIP = "${BUILD_STRIP}"
71export NM = "${BUILD_NM}"
72
73# Path prefixes
74base_prefix = "${STAGING_DIR_NATIVE}"
75prefix = "${STAGING_DIR_NATIVE}${prefix_native}"
76exec_prefix = "${STAGING_DIR_NATIVE}${prefix_native}"
77
78bindir = "${STAGING_BINDIR_NATIVE}"
79sbindir = "${STAGING_SBINDIR_NATIVE}"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080080base_libdir = "${STAGING_LIBDIR_NATIVE}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050081libdir = "${STAGING_LIBDIR_NATIVE}"
82includedir = "${STAGING_INCDIR_NATIVE}"
83sysconfdir = "${STAGING_ETCDIR_NATIVE}"
84datadir = "${STAGING_DATADIR_NATIVE}"
85
86baselib = "lib"
87
Patrick Williamsc0f7c042017-02-23 20:41:17 -060088export lt_cv_sys_lib_dlsearch_path_spec = "${libdir} ${base_libdir} /lib /lib64 /usr/lib /usr/lib64"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050089
90NATIVE_PACKAGE_PATH_SUFFIX ?= ""
91bindir .= "${NATIVE_PACKAGE_PATH_SUFFIX}"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080092base_libdir .= "${NATIVE_PACKAGE_PATH_SUFFIX}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050093libdir .= "${NATIVE_PACKAGE_PATH_SUFFIX}"
94libexecdir .= "${NATIVE_PACKAGE_PATH_SUFFIX}"
95
96do_populate_sysroot[sstate-inputdirs] = "${SYSROOT_DESTDIR}/${STAGING_DIR_NATIVE}/"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050097do_populate_sysroot[sstate-outputdirs] = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/${PN}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050098
99# Since we actually install these into situ there is no staging prefix
100STAGING_DIR_HOST = ""
101STAGING_DIR_TARGET = ""
102PKG_CONFIG_DIR = "${libdir}/pkgconfig"
103
104EXTRA_NATIVE_PKGCONFIG_PATH ?= ""
105PKG_CONFIG_PATH .= "${EXTRA_NATIVE_PKGCONFIG_PATH}"
106PKG_CONFIG_SYSROOT_DIR = ""
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500107PKG_CONFIG_SYSTEM_LIBRARY_PATH[unexport] = "1"
108PKG_CONFIG_SYSTEM_INCLUDE_PATH[unexport] = "1"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500109
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500110# we dont want libc-*libc to kick in for native recipes
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500111LIBCOVERRIDE = ""
112CLASSOVERRIDE = "class-native"
113MACHINEOVERRIDES = ""
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500114MACHINE_FEATURES = ""
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500115
116PATH_prepend = "${COREBASE}/scripts/native-intercept:"
117
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500118# This class encodes staging paths into its scripts data so can only be
119# reused if we manipulate the paths.
120SSTATE_SCAN_CMD ?= "${SSTATE_SCAN_CMD_NATIVE}"
121
Brad Bishop19323692019-04-05 15:28:33 -0400122# No strip sysroot when DEBUG_BUILD is enabled
123INHIBIT_SYSROOT_STRIP ?= "${@oe.utils.vartrue('DEBUG_BUILD', '1', '', d)}"
124
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500125python native_virtclass_handler () {
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500126 pn = e.data.getVar("PN")
127 if not pn.endswith("-native"):
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500128 return
129
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500130 # Set features here to prevent appends and distro features backfill
131 # from modifying native distro features
132 features = set(d.getVar("DISTRO_FEATURES_NATIVE").split())
133 filtered = set(bb.utils.filter("DISTRO_FEATURES", d.getVar("DISTRO_FEATURES_FILTER_NATIVE"), d).split())
134 d.setVar("DISTRO_FEATURES", " ".join(sorted(features | filtered)))
135
136 classextend = e.data.getVar('BBCLASSEXTEND') or ""
137 if "native" not in classextend:
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500138 return
139
140 def map_dependencies(varname, d, suffix = ""):
141 if suffix:
142 varname = varname + "_" + suffix
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500143 deps = d.getVar(varname)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500144 if not deps:
145 return
146 deps = bb.utils.explode_deps(deps)
147 newdeps = []
148 for dep in deps:
149 if dep == pn:
150 continue
151 elif "-cross-" in dep:
152 newdeps.append(dep.replace("-cross", "-native"))
153 elif not dep.endswith("-native"):
154 newdeps.append(dep + "-native")
155 else:
156 newdeps.append(dep)
157 d.setVar(varname, " ".join(newdeps))
158
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500159 map_dependencies("DEPENDS", e.data)
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500160 for pkg in [e.data.getVar("PN"), "", "${PN}"]:
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500161 map_dependencies("RDEPENDS", e.data, pkg)
162 map_dependencies("RRECOMMENDS", e.data, pkg)
163 map_dependencies("RSUGGESTS", e.data, pkg)
164 map_dependencies("RPROVIDES", e.data, pkg)
165 map_dependencies("RREPLACES", e.data, pkg)
166
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500167 provides = e.data.getVar("PROVIDES")
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500168 nprovides = []
169 for prov in provides.split():
170 if prov.find(pn) != -1:
171 nprovides.append(prov)
172 elif not prov.endswith("-native"):
173 nprovides.append(prov.replace(prov, prov + "-native"))
174 else:
175 nprovides.append(prov)
176 e.data.setVar("PROVIDES", ' '.join(nprovides))
177
178
179}
180
181addhandler native_virtclass_handler
182native_virtclass_handler[eventmask] = "bb.event.RecipePreFinalise"
183
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500184python do_addto_recipe_sysroot () {
185 bb.build.exec_func("extend_recipe_sysroot", d)
186}
187addtask addto_recipe_sysroot after do_populate_sysroot
188
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500189inherit nopackages
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500190
191do_packagedata[stamp-extra-info] = ""
192do_populate_sysroot[stamp-extra-info] = ""
193
194USE_NLS = "no"
Brad Bishop19323692019-04-05 15:28:33 -0400195
196RECIPERDEPTASK = "do_populate_sysroot"
197do_populate_sysroot[rdeptask] = "${RECIPERDEPTASK}"