blob: a911f2aebdbdb6706a2513936365472fccbf5d4e [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}"
47LDFLAGS_build-darwin = "-L${STAGING_LIBDIR_NATIVE} "
48
49STAGING_BINDIR = "${STAGING_BINDIR_NATIVE}"
50STAGING_BINDIR_CROSS = "${STAGING_BINDIR_NATIVE}"
51
52# native pkg doesn't need the TOOLCHAIN_OPTIONS.
53TOOLCHAIN_OPTIONS = ""
54
Patrick Williamsc124f4f2015-09-15 14:41:29 -050055# Don't build ptest natively
56PTEST_ENABLED = "0"
57
58# Don't use site files for native builds
59export CONFIG_SITE = "${COREBASE}/meta/site/native"
60
61# set the compiler as well. It could have been set to something else
62export CC = "${BUILD_CC}"
63export CXX = "${BUILD_CXX}"
64export FC = "${BUILD_FC}"
65export CPP = "${BUILD_CPP}"
66export LD = "${BUILD_LD}"
67export CCLD = "${BUILD_CCLD}"
68export AR = "${BUILD_AR}"
69export AS = "${BUILD_AS}"
70export RANLIB = "${BUILD_RANLIB}"
71export STRIP = "${BUILD_STRIP}"
72export NM = "${BUILD_NM}"
73
74# Path prefixes
75base_prefix = "${STAGING_DIR_NATIVE}"
76prefix = "${STAGING_DIR_NATIVE}${prefix_native}"
77exec_prefix = "${STAGING_DIR_NATIVE}${prefix_native}"
78
79bindir = "${STAGING_BINDIR_NATIVE}"
80sbindir = "${STAGING_SBINDIR_NATIVE}"
81libdir = "${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}"
92libdir .= "${NATIVE_PACKAGE_PATH_SUFFIX}"
93libexecdir .= "${NATIVE_PACKAGE_PATH_SUFFIX}"
94
95do_populate_sysroot[sstate-inputdirs] = "${SYSROOT_DESTDIR}/${STAGING_DIR_NATIVE}/"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050096do_populate_sysroot[sstate-outputdirs] = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/${PN}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050097
98# Since we actually install these into situ there is no staging prefix
99STAGING_DIR_HOST = ""
100STAGING_DIR_TARGET = ""
101PKG_CONFIG_DIR = "${libdir}/pkgconfig"
102
103EXTRA_NATIVE_PKGCONFIG_PATH ?= ""
104PKG_CONFIG_PATH .= "${EXTRA_NATIVE_PKGCONFIG_PATH}"
105PKG_CONFIG_SYSROOT_DIR = ""
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500106PKG_CONFIG_SYSTEM_LIBRARY_PATH[unexport] = "1"
107PKG_CONFIG_SYSTEM_INCLUDE_PATH[unexport] = "1"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500108
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500109# we dont want libc-*libc to kick in for native recipes
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500110LIBCOVERRIDE = ""
111CLASSOVERRIDE = "class-native"
112MACHINEOVERRIDES = ""
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500113MACHINE_FEATURES = ""
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500114
115PATH_prepend = "${COREBASE}/scripts/native-intercept:"
116
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500117# This class encodes staging paths into its scripts data so can only be
118# reused if we manipulate the paths.
119SSTATE_SCAN_CMD ?= "${SSTATE_SCAN_CMD_NATIVE}"
120
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500121python native_virtclass_handler () {
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500122 pn = e.data.getVar("PN")
123 if not pn.endswith("-native"):
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500124 return
125
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500126 # Set features here to prevent appends and distro features backfill
127 # from modifying native distro features
128 features = set(d.getVar("DISTRO_FEATURES_NATIVE").split())
129 filtered = set(bb.utils.filter("DISTRO_FEATURES", d.getVar("DISTRO_FEATURES_FILTER_NATIVE"), d).split())
130 d.setVar("DISTRO_FEATURES", " ".join(sorted(features | filtered)))
131
132 classextend = e.data.getVar('BBCLASSEXTEND') or ""
133 if "native" not in classextend:
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500134 return
135
136 def map_dependencies(varname, d, suffix = ""):
137 if suffix:
138 varname = varname + "_" + suffix
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500139 deps = d.getVar(varname)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500140 if not deps:
141 return
142 deps = bb.utils.explode_deps(deps)
143 newdeps = []
144 for dep in deps:
145 if dep == pn:
146 continue
147 elif "-cross-" in dep:
148 newdeps.append(dep.replace("-cross", "-native"))
149 elif not dep.endswith("-native"):
150 newdeps.append(dep + "-native")
151 else:
152 newdeps.append(dep)
153 d.setVar(varname, " ".join(newdeps))
154
155 e.data.setVar("OVERRIDES", e.data.getVar("OVERRIDES", False) + ":virtclass-native")
156
157 map_dependencies("DEPENDS", e.data)
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500158 for pkg in [e.data.getVar("PN"), "", "${PN}"]:
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500159 map_dependencies("RDEPENDS", e.data, pkg)
160 map_dependencies("RRECOMMENDS", e.data, pkg)
161 map_dependencies("RSUGGESTS", e.data, pkg)
162 map_dependencies("RPROVIDES", e.data, pkg)
163 map_dependencies("RREPLACES", e.data, pkg)
164
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500165 provides = e.data.getVar("PROVIDES")
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500166 nprovides = []
167 for prov in provides.split():
168 if prov.find(pn) != -1:
169 nprovides.append(prov)
170 elif not prov.endswith("-native"):
171 nprovides.append(prov.replace(prov, prov + "-native"))
172 else:
173 nprovides.append(prov)
174 e.data.setVar("PROVIDES", ' '.join(nprovides))
175
176
177}
178
179addhandler native_virtclass_handler
180native_virtclass_handler[eventmask] = "bb.event.RecipePreFinalise"
181
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500182python do_addto_recipe_sysroot () {
183 bb.build.exec_func("extend_recipe_sysroot", d)
184}
185addtask addto_recipe_sysroot after do_populate_sysroot
186
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500187inherit nopackages
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500188
189do_packagedata[stamp-extra-info] = ""
190do_populate_sysroot[stamp-extra-info] = ""
191
192USE_NLS = "no"