diff options
Diffstat (limited to 'meta/classes-global/base.bbclass')
-rw-r--r-- | meta/classes-global/base.bbclass | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass index 8215969c7b..ac145d9fd6 100644 --- a/meta/classes-global/base.bbclass +++ b/meta/classes-global/base.bbclass | |||
@@ -19,6 +19,21 @@ 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 | |||
34 | inherit toolchain/gcc-native | ||
35 | inherit_defer toolchain/${TOOLCHAIN} | ||
36 | |||
22 | def lsb_distro_identifier(d): | 37 | def lsb_distro_identifier(d): |
23 | adjust = d.getVar('LSB_DISTRO_ADJUST') | 38 | adjust = d.getVar('LSB_DISTRO_ADJUST') |
24 | adjust_func = None | 39 | adjust_func = None |
@@ -139,6 +154,7 @@ do_fetch[file-checksums] = "${@bb.fetch.get_checksum_file_list(d)}" | |||
139 | do_fetch[file-checksums] += " ${@get_lic_checksum_file_list(d)}" | 154 | do_fetch[file-checksums] += " ${@get_lic_checksum_file_list(d)}" |
140 | do_fetch[prefuncs] += "fetcher_hashes_dummyfunc" | 155 | do_fetch[prefuncs] += "fetcher_hashes_dummyfunc" |
141 | do_fetch[network] = "1" | 156 | do_fetch[network] = "1" |
157 | do_fetch[umask] = "${OE_SHARED_UMASK}" | ||
142 | python base_do_fetch() { | 158 | python base_do_fetch() { |
143 | 159 | ||
144 | src_uri = (d.getVar('SRC_URI') or "").split() | 160 | src_uri = (d.getVar('SRC_URI') or "").split() |
@@ -168,23 +184,16 @@ python base_do_unpack() { | |||
168 | 184 | ||
169 | basedir = None | 185 | basedir = None |
170 | unpackdir = d.getVar('UNPACKDIR') | 186 | unpackdir = d.getVar('UNPACKDIR') |
171 | workdir = d.getVar('WORKDIR') | 187 | if sourcedir.startswith(unpackdir): |
172 | if sourcedir.startswith(workdir) and not sourcedir.startswith(unpackdir): | 188 | basedir = sourcedir.replace(unpackdir, '').strip("/").split('/')[0] |
173 | basedir = sourcedir.replace(workdir, '').strip("/").split('/')[0] | ||
174 | if basedir: | 189 | if basedir: |
175 | bb.utils.remove(workdir + '/' + basedir, True) | 190 | d.setVar("SOURCE_BASEDIR", unpackdir + '/' + basedir) |
176 | d.setVar("SOURCE_BASEDIR", workdir + '/' + basedir) | ||
177 | 191 | ||
178 | try: | 192 | try: |
179 | fetcher = bb.fetch2.Fetch(src_uri, d) | 193 | fetcher = bb.fetch2.Fetch(src_uri, d) |
180 | fetcher.unpack(d.getVar('UNPACKDIR')) | 194 | fetcher.unpack(d.getVar('UNPACKDIR')) |
181 | except bb.fetch2.BBFetchException as e: | 195 | except bb.fetch2.BBFetchException as e: |
182 | bb.fatal("Bitbake Fetcher Error: " + repr(e)) | 196 | 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 | } | 197 | } |
189 | 198 | ||
190 | SSTATETASKS += "do_deploy_source_date_epoch" | 199 | SSTATETASKS += "do_deploy_source_date_epoch" |
@@ -267,10 +276,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)) | 276 | 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 | 277 | ||
269 | addhandler base_eventhandler | 278 | addhandler base_eventhandler |
270 | base_eventhandler[eventmask] = "bb.event.ConfigParsed bb.event.MultiConfigParsed bb.event.BuildStarted bb.event.RecipePreFinalise bb.event.RecipeParsed" | 279 | 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() { | 280 | python base_eventhandler() { |
272 | import bb.runqueue | 281 | import bb.runqueue |
273 | 282 | ||
283 | if isinstance(e, bb.event.RecipePreDeferredInherits): | ||
284 | # Use this to snoop on class extensions and set these up before the deferred inherits | ||
285 | # are processed which allows overrides on conditional variables. | ||
286 | for c in ['native', 'nativesdk', 'crosssdk', 'cross']: | ||
287 | if c in e.inherits: | ||
288 | d.setVar('CLASSOVERRIDE', 'class-' + c) | ||
289 | break | ||
290 | return | ||
291 | |||
274 | if isinstance(e, bb.event.ConfigParsed): | 292 | if isinstance(e, bb.event.ConfigParsed): |
275 | if not d.getVar("NATIVELSBSTRING", False): | 293 | if not d.getVar("NATIVELSBSTRING", False): |
276 | d.setVar("NATIVELSBSTRING", lsb_distro_identifier(d)) | 294 | d.setVar("NATIVELSBSTRING", lsb_distro_identifier(d)) |