diff options
Diffstat (limited to 'meta/classes-global/base.bbclass')
-rw-r--r-- | meta/classes-global/base.bbclass | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass index 8215969c7b..6be1f5c2df 100644 --- a/meta/classes-global/base.bbclass +++ b/meta/classes-global/base.bbclass | |||
@@ -19,6 +19,22 @@ PACKAGECONFIG_CONFARGS ??= "" | |||
19 | 19 | ||
20 | inherit metadata_scm | 20 | inherit metadata_scm |
21 | 21 | ||
22 | PREFERRED_TOOLCHAIN_TARGET ??= "gcc" | ||
23 | PREFERRED_TOOLCHAIN_NATIVE ??= "gcc" | ||
24 | PREFERRED_TOOLCHAIN_SDK ??= "gcc" | ||
25 | |||
26 | PREFERRED_TOOLCHAIN = "${PREFERRED_TOOLCHAIN_TARGET}" | ||
27 | PREFERRED_TOOLCHAIN:class-native = "${PREFERRED_TOOLCHAIN_NATIVE}" | ||
28 | PREFERRED_TOOLCHAIN:class-cross = "${PREFERRED_TOOLCHAIN_NATIVE}" | ||
29 | PREFERRED_TOOLCHAIN:class-crosssdk = "${PREFERRED_TOOLCHAIN_SDK}" | ||
30 | PREFERRED_TOOLCHAIN:class-nativesdk = "${PREFERRED_TOOLCHAIN_SDK}" | ||
31 | |||
32 | TOOLCHAIN ??= "${PREFERRED_TOOLCHAIN}" | ||
33 | TOOLCHAIN_NATIVE ??= "${PREFERRED_TOOLCHAIN_NATIVE}" | ||
34 | |||
35 | inherit_defer toolchain/${TOOLCHAIN_NATIVE}-native | ||
36 | inherit_defer toolchain/${TOOLCHAIN} | ||
37 | |||
22 | def lsb_distro_identifier(d): | 38 | def lsb_distro_identifier(d): |
23 | adjust = d.getVar('LSB_DISTRO_ADJUST') | 39 | adjust = d.getVar('LSB_DISTRO_ADJUST') |
24 | adjust_func = None | 40 | adjust_func = None |
@@ -139,6 +155,7 @@ do_fetch[file-checksums] = "${@bb.fetch.get_checksum_file_list(d)}" | |||
139 | do_fetch[file-checksums] += " ${@get_lic_checksum_file_list(d)}" | 155 | do_fetch[file-checksums] += " ${@get_lic_checksum_file_list(d)}" |
140 | do_fetch[prefuncs] += "fetcher_hashes_dummyfunc" | 156 | do_fetch[prefuncs] += "fetcher_hashes_dummyfunc" |
141 | do_fetch[network] = "1" | 157 | do_fetch[network] = "1" |
158 | do_fetch[umask] = "${OE_SHARED_UMASK}" | ||
142 | python base_do_fetch() { | 159 | python base_do_fetch() { |
143 | 160 | ||
144 | src_uri = (d.getVar('SRC_URI') or "").split() | 161 | src_uri = (d.getVar('SRC_URI') or "").split() |
@@ -168,23 +185,16 @@ python base_do_unpack() { | |||
168 | 185 | ||
169 | basedir = None | 186 | basedir = None |
170 | unpackdir = d.getVar('UNPACKDIR') | 187 | unpackdir = d.getVar('UNPACKDIR') |
171 | workdir = d.getVar('WORKDIR') | 188 | if sourcedir.startswith(unpackdir): |
172 | if sourcedir.startswith(workdir) and not sourcedir.startswith(unpackdir): | 189 | basedir = sourcedir.replace(unpackdir, '').strip("/").split('/')[0] |
173 | basedir = sourcedir.replace(workdir, '').strip("/").split('/')[0] | ||
174 | if basedir: | 190 | if basedir: |
175 | bb.utils.remove(workdir + '/' + basedir, True) | 191 | d.setVar("SOURCE_BASEDIR", unpackdir + '/' + basedir) |
176 | d.setVar("SOURCE_BASEDIR", workdir + '/' + basedir) | ||
177 | 192 | ||
178 | try: | 193 | try: |
179 | fetcher = bb.fetch2.Fetch(src_uri, d) | 194 | fetcher = bb.fetch2.Fetch(src_uri, d) |
180 | fetcher.unpack(d.getVar('UNPACKDIR')) | 195 | fetcher.unpack(d.getVar('UNPACKDIR')) |
181 | except bb.fetch2.BBFetchException as e: | 196 | except bb.fetch2.BBFetchException as e: |
182 | bb.fatal("Bitbake Fetcher Error: " + repr(e)) | 197 | bb.fatal("Bitbake Fetcher Error: " + repr(e)) |
183 | |||
184 | if basedir and os.path.exists(unpackdir + '/' + basedir): | ||
185 | # Compatibility magic to ensure ${WORKDIR}/git and ${WORKDIR}/${BP} | ||
186 | # as often used in S work as expected. | ||
187 | shutil.move(unpackdir + '/' + basedir, workdir + '/' + basedir) | ||
188 | } | 198 | } |
189 | 199 | ||
190 | SSTATETASKS += "do_deploy_source_date_epoch" | 200 | SSTATETASKS += "do_deploy_source_date_epoch" |
@@ -267,10 +277,19 @@ def buildcfg_neededvars(d): | |||
267 | bb.fatal('The following variable(s) were not set: %s\nPlease set them directly, or choose a MACHINE or DISTRO that sets them.' % ', '.join(pesteruser)) | 277 | bb.fatal('The following variable(s) were not set: %s\nPlease set them directly, or choose a MACHINE or DISTRO that sets them.' % ', '.join(pesteruser)) |
268 | 278 | ||
269 | addhandler base_eventhandler | 279 | addhandler base_eventhandler |
270 | base_eventhandler[eventmask] = "bb.event.ConfigParsed bb.event.MultiConfigParsed bb.event.BuildStarted bb.event.RecipePreFinalise bb.event.RecipeParsed" | 280 | base_eventhandler[eventmask] = "bb.event.ConfigParsed bb.event.MultiConfigParsed bb.event.BuildStarted bb.event.RecipePreFinalise bb.event.RecipeParsed bb.event.RecipePreDeferredInherits" |
271 | python base_eventhandler() { | 281 | python base_eventhandler() { |
272 | import bb.runqueue | 282 | import bb.runqueue |
273 | 283 | ||
284 | if isinstance(e, bb.event.RecipePreDeferredInherits): | ||
285 | # Use this to snoop on class extensions and set these up before the deferred inherits | ||
286 | # are processed which allows overrides on conditional variables. | ||
287 | for c in ['native', 'nativesdk', 'crosssdk', 'cross']: | ||
288 | if c in e.inherits: | ||
289 | d.setVar('CLASSOVERRIDE', 'class-' + c) | ||
290 | break | ||
291 | return | ||
292 | |||
274 | if isinstance(e, bb.event.ConfigParsed): | 293 | if isinstance(e, bb.event.ConfigParsed): |
275 | if not d.getVar("NATIVELSBSTRING", False): | 294 | if not d.getVar("NATIVELSBSTRING", False): |
276 | d.setVar("NATIVELSBSTRING", lsb_distro_identifier(d)) | 295 | d.setVar("NATIVELSBSTRING", lsb_distro_identifier(d)) |