mirror of
https://git.yoctoproject.org/poky
synced 2026-01-29 21:08:42 +01:00
Waf requires that the current working directory be ${S} (the location of
the wscript) when building. Most of the time, this was true only because
B defaults to S. However, anything that changed that behavior (notably,
using externalsrc) would break the recipe. Remedy this by explicitly
changing cwd to ${S} when running waf commands. As a happy side effect,
B can be set up for "out of tree" builds to keep the source directory
clean.
(From OE-Core rev: 62dffb71ce22222c635bd90eaa47dd01f70f9c0f)
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
40 lines
1.3 KiB
Plaintext
40 lines
1.3 KiB
Plaintext
# avoids build breaks when using no-static-libs.inc
|
|
DISABLE_STATIC = ""
|
|
|
|
B = "${WORKDIR}/build"
|
|
|
|
EXTRA_OECONF_append = " ${PACKAGECONFIG_CONFARGS}"
|
|
|
|
python waf_preconfigure() {
|
|
import subprocess
|
|
from distutils.version import StrictVersion
|
|
subsrcdir = d.getVar('S')
|
|
wafbin = os.path.join(subsrcdir, 'waf')
|
|
try:
|
|
result = subprocess.check_output([wafbin, '--version'], cwd=subsrcdir, stderr=subprocess.STDOUT)
|
|
version = result.decode('utf-8').split()[1]
|
|
if StrictVersion(version) >= StrictVersion("1.8.7"):
|
|
d.setVar("WAF_EXTRA_CONF", "--bindir=${bindir} --libdir=${libdir}")
|
|
except subprocess.CalledProcessError as e:
|
|
bb.warn("Unable to execute waf --version, exit code %d. Assuming waf version without bindir/libdir support." % e.returncode)
|
|
except FileNotFoundError:
|
|
bb.fatal("waf does not exist in %s" % subsrcdir)
|
|
}
|
|
|
|
do_configure[prefuncs] += "waf_preconfigure"
|
|
|
|
waf_do_configure() {
|
|
(cd ${S} && ./waf configure -o ${B} --prefix=${prefix} ${WAF_EXTRA_CONF} ${EXTRA_OECONF})
|
|
}
|
|
|
|
do_compile[progress] = "outof:^\[\s*(\d+)/\s*(\d+)\]\s+"
|
|
waf_do_compile() {
|
|
(cd ${S} && ./waf build ${@oe.utils.parallel_make_argument(d, '-j%d', limit=64)})
|
|
}
|
|
|
|
waf_do_install() {
|
|
(cd ${S} && ./waf install --destdir=${D})
|
|
}
|
|
|
|
EXPORT_FUNCTIONS do_configure do_compile do_install
|