mirror of
https://git.yoctoproject.org/poky
synced 2026-03-02 05:19:40 +01:00
Here we set SRC_URI to blank, however doing so means that the function
that is called when you expand the default value of SRCPV
(i.e. bb.fetch2.get_srcrev()) will fail, so any recipe that references
SRCPV in PV couldn't previously be used with externalsrc.
(At some point we may fix the function to work in the externalsrc case,
but then we would also need to ensure that ${B} did not change as a
result of PV changing any time the HEAD revision changes in the external
source tree, or you'll lose any intermediate build artifacts.)
(From OE-Core rev: 26f8060c3475ec988194b2163e422ba4e776fd8b)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
75 lines
3.0 KiB
Plaintext
75 lines
3.0 KiB
Plaintext
# Copyright (C) 2012 Linux Foundation
|
|
# Author: Richard Purdie
|
|
# Some code and influence taken from srctree.bbclass:
|
|
# Copyright (C) 2009 Chris Larson <clarson@kergoth.com>
|
|
# Released under the MIT license (see COPYING.MIT for the terms)
|
|
#
|
|
# externalsrc.bbclass enables use of an existing source tree, usually external to
|
|
# the build system to build a piece of software rather than the usual fetch/unpack/patch
|
|
# process.
|
|
#
|
|
# To use, add externalsrc to the global inherit and set EXTERNALSRC to point at the
|
|
# directory you want to use containing the sources e.g. from local.conf for a recipe
|
|
# called "myrecipe" you would do:
|
|
#
|
|
# INHERIT += "externalsrc"
|
|
# EXTERNALSRC_pn-myrecipe = "/path/to/my/source/tree"
|
|
#
|
|
# In order to make this class work for both target and native versions (or with
|
|
# multilibs/cross or other BBCLASSEXTEND variants), B is set to point to a separate
|
|
# directory under the work directory (split source and build directories). This is
|
|
# the default, but the build directory can be set to the source directory if
|
|
# circumstances dictate by setting EXTERNALSRC_BUILD to the same value, e.g.:
|
|
#
|
|
# EXTERNALSRC_BUILD_pn-myrecipe = "/path/to/my/source/tree"
|
|
#
|
|
|
|
SRCTREECOVEREDTASKS ?= "do_patch do_unpack do_fetch"
|
|
|
|
python () {
|
|
externalsrc = d.getVar('EXTERNALSRC', True)
|
|
if externalsrc:
|
|
d.setVar('S', externalsrc)
|
|
externalsrcbuild = d.getVar('EXTERNALSRC_BUILD', True)
|
|
if externalsrcbuild:
|
|
d.setVar('B', externalsrcbuild)
|
|
else:
|
|
d.setVar('B', '${WORKDIR}/${BPN}-${PV}/')
|
|
d.setVar('SRC_URI', '')
|
|
|
|
if '{SRCPV}' in d.getVar('PV', False):
|
|
# Dummy value because the default function can't be called with blank SRC_URI
|
|
d.setVar('SRCPV', '999')
|
|
|
|
tasks = filter(lambda k: d.getVarFlag(k, "task"), d.keys())
|
|
|
|
for task in tasks:
|
|
if task.endswith("_setscene"):
|
|
# sstate is never going to work for external source trees, disable it
|
|
bb.build.deltask(task, d)
|
|
else:
|
|
# Since configure will likely touch ${S}, ensure only we lock so one task has access at a time
|
|
d.appendVarFlag(task, "lockfiles", "${S}/singletask.lock")
|
|
|
|
# We do not want our source to be wiped out, ever (kernel.bbclass does this for do_clean)
|
|
cleandirs = d.getVarFlag(task, 'cleandirs', False)
|
|
if cleandirs:
|
|
cleandirs = cleandirs.split()
|
|
setvalue = False
|
|
if '${S}' in cleandirs:
|
|
cleandirs.remove('${S}')
|
|
setvalue = True
|
|
if externalsrcbuild == externalsrc and '${B}' in cleandirs:
|
|
cleandirs.remove('${B}')
|
|
setvalue = True
|
|
if setvalue:
|
|
d.setVarFlag(task, 'cleandirs', ' '.join(cleandirs))
|
|
|
|
for task in d.getVar("SRCTREECOVEREDTASKS", True).split():
|
|
bb.build.deltask(task, d)
|
|
|
|
# Ensure compilation happens every time
|
|
d.setVarFlag('do_compile', 'nostamp', '1')
|
|
}
|
|
|