blob: 6b7f3dd76ead442008c6a1c38c1109394173435d [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
55DEPENDS_GETTEXT = "gettext-native"
56
57# Don't build ptest natively
58PTEST_ENABLED = "0"
59
60# Don't use site files for native builds
61export CONFIG_SITE = "${COREBASE}/meta/site/native"
62
63# set the compiler as well. It could have been set to something else
64export CC = "${BUILD_CC}"
65export CXX = "${BUILD_CXX}"
66export FC = "${BUILD_FC}"
67export CPP = "${BUILD_CPP}"
68export LD = "${BUILD_LD}"
69export CCLD = "${BUILD_CCLD}"
70export AR = "${BUILD_AR}"
71export AS = "${BUILD_AS}"
72export RANLIB = "${BUILD_RANLIB}"
73export STRIP = "${BUILD_STRIP}"
74export NM = "${BUILD_NM}"
75
76# Path prefixes
77base_prefix = "${STAGING_DIR_NATIVE}"
78prefix = "${STAGING_DIR_NATIVE}${prefix_native}"
79exec_prefix = "${STAGING_DIR_NATIVE}${prefix_native}"
80
81bindir = "${STAGING_BINDIR_NATIVE}"
82sbindir = "${STAGING_SBINDIR_NATIVE}"
83libdir = "${STAGING_LIBDIR_NATIVE}"
84includedir = "${STAGING_INCDIR_NATIVE}"
85sysconfdir = "${STAGING_ETCDIR_NATIVE}"
86datadir = "${STAGING_DATADIR_NATIVE}"
87
88baselib = "lib"
89
Patrick Williamsc0f7c042017-02-23 20:41:17 -060090export lt_cv_sys_lib_dlsearch_path_spec = "${libdir} ${base_libdir} /lib /lib64 /usr/lib /usr/lib64"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050091
92NATIVE_PACKAGE_PATH_SUFFIX ?= ""
93bindir .= "${NATIVE_PACKAGE_PATH_SUFFIX}"
94libdir .= "${NATIVE_PACKAGE_PATH_SUFFIX}"
95libexecdir .= "${NATIVE_PACKAGE_PATH_SUFFIX}"
96
97do_populate_sysroot[sstate-inputdirs] = "${SYSROOT_DESTDIR}/${STAGING_DIR_NATIVE}/"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050098do_populate_sysroot[sstate-outputdirs] = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/${PN}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050099
100# Since we actually install these into situ there is no staging prefix
101STAGING_DIR_HOST = ""
102STAGING_DIR_TARGET = ""
103PKG_CONFIG_DIR = "${libdir}/pkgconfig"
104
105EXTRA_NATIVE_PKGCONFIG_PATH ?= ""
106PKG_CONFIG_PATH .= "${EXTRA_NATIVE_PKGCONFIG_PATH}"
107PKG_CONFIG_SYSROOT_DIR = ""
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500108PKG_CONFIG_SYSTEM_LIBRARY_PATH[unexport] = "1"
109PKG_CONFIG_SYSTEM_INCLUDE_PATH[unexport] = "1"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500110
111# we dont want libc-uclibc or libc-glibc to kick in for native recipes
112LIBCOVERRIDE = ""
113CLASSOVERRIDE = "class-native"
114MACHINEOVERRIDES = ""
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500115MACHINE_FEATURES = ""
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500116
117PATH_prepend = "${COREBASE}/scripts/native-intercept:"
118
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500119# This class encodes staging paths into its scripts data so can only be
120# reused if we manipulate the paths.
121SSTATE_SCAN_CMD ?= "${SSTATE_SCAN_CMD_NATIVE}"
122
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500123python native_virtclass_handler () {
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500124 pn = e.data.getVar("PN")
125 if not pn.endswith("-native"):
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500126 return
127
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500128 # Set features here to prevent appends and distro features backfill
129 # from modifying native distro features
130 features = set(d.getVar("DISTRO_FEATURES_NATIVE").split())
131 filtered = set(bb.utils.filter("DISTRO_FEATURES", d.getVar("DISTRO_FEATURES_FILTER_NATIVE"), d).split())
132 d.setVar("DISTRO_FEATURES", " ".join(sorted(features | filtered)))
133
134 classextend = e.data.getVar('BBCLASSEXTEND') or ""
135 if "native" not in classextend:
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500136 return
137
138 def map_dependencies(varname, d, suffix = ""):
139 if suffix:
140 varname = varname + "_" + suffix
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500141 deps = d.getVar(varname)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500142 if not deps:
143 return
144 deps = bb.utils.explode_deps(deps)
145 newdeps = []
146 for dep in deps:
147 if dep == pn:
148 continue
149 elif "-cross-" in dep:
150 newdeps.append(dep.replace("-cross", "-native"))
151 elif not dep.endswith("-native"):
152 newdeps.append(dep + "-native")
153 else:
154 newdeps.append(dep)
155 d.setVar(varname, " ".join(newdeps))
156
157 e.data.setVar("OVERRIDES", e.data.getVar("OVERRIDES", False) + ":virtclass-native")
158
159 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"