summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorRoss Burton <ross@burtonini.com>2020-10-16 10:21:21 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-10-17 23:22:19 +0100
commit85b6301c6190a1d1823de9bfe7285f7a7d15a46f (patch)
tree5a3f918b5328933725f34d7bf65a77d3a5a846bb /meta/classes
parent2b5c0c68a3983fbe8bc27cc02866f13920bc7eb0 (diff)
downloadpoky-85b6301c6190a1d1823de9bfe7285f7a7d15a46f.tar.gz
waf: don't assume the waf intepretter is good
Waf typically uses `python` as the intepretter but inside a task this does not exist. Typically this is solved by patching waf (see the glmark2 recipe) but not all versionf of Waf support Python 3 so we can't assume a specific interpretter. Instead, create a new variable WAF_PYTHON for the correct interpretter, and default this to `python3`. If the user has a recipe that needs Python 2 then this can be changed in the recipe. (From OE-Core rev: 802e80d35e6374b9b80f89068d00b84fe2d04ca1) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/waf.bbclass13
1 files changed, 9 insertions, 4 deletions
diff --git a/meta/classes/waf.bbclass b/meta/classes/waf.bbclass
index 309f625a40..8fa5063645 100644
--- a/meta/classes/waf.bbclass
+++ b/meta/classes/waf.bbclass
@@ -1,6 +1,10 @@
1# avoids build breaks when using no-static-libs.inc 1# avoids build breaks when using no-static-libs.inc
2DISABLE_STATIC = "" 2DISABLE_STATIC = ""
3 3
4# What Python interpretter to use. Defaults to Python 3 but can be
5# overridden if required.
6WAF_PYTHON ?= "python3"
7
4B = "${WORKDIR}/build" 8B = "${WORKDIR}/build"
5 9
6EXTRA_OECONF_append = " ${PACKAGECONFIG_CONFARGS}" 10EXTRA_OECONF_append = " ${PACKAGECONFIG_CONFARGS}"
@@ -40,9 +44,10 @@ python waf_preconfigure() {
40 import subprocess 44 import subprocess
41 from distutils.version import StrictVersion 45 from distutils.version import StrictVersion
42 subsrcdir = d.getVar('S') 46 subsrcdir = d.getVar('S')
47 python = d.getVar('WAF_PYTHON')
43 wafbin = os.path.join(subsrcdir, 'waf') 48 wafbin = os.path.join(subsrcdir, 'waf')
44 try: 49 try:
45 result = subprocess.check_output([wafbin, '--version'], cwd=subsrcdir, stderr=subprocess.STDOUT) 50 result = subprocess.check_output([python, wafbin, '--version'], cwd=subsrcdir, stderr=subprocess.STDOUT)
46 version = result.decode('utf-8').split()[1] 51 version = result.decode('utf-8').split()[1]
47 if StrictVersion(version) >= StrictVersion("1.8.7"): 52 if StrictVersion(version) >= StrictVersion("1.8.7"):
48 d.setVar("WAF_EXTRA_CONF", "--bindir=${bindir} --libdir=${libdir}") 53 d.setVar("WAF_EXTRA_CONF", "--bindir=${bindir} --libdir=${libdir}")
@@ -55,16 +60,16 @@ python waf_preconfigure() {
55do_configure[prefuncs] += "waf_preconfigure" 60do_configure[prefuncs] += "waf_preconfigure"
56 61
57waf_do_configure() { 62waf_do_configure() {
58 (cd ${S} && ./waf configure -o ${B} --prefix=${prefix} ${WAF_EXTRA_CONF} ${EXTRA_OECONF}) 63 (cd ${S} && ${WAF_PYTHON} ./waf configure -o ${B} --prefix=${prefix} ${WAF_EXTRA_CONF} ${EXTRA_OECONF})
59} 64}
60 65
61do_compile[progress] = "outof:^\[\s*(\d+)/\s*(\d+)\]\s+" 66do_compile[progress] = "outof:^\[\s*(\d+)/\s*(\d+)\]\s+"
62waf_do_compile() { 67waf_do_compile() {
63 (cd ${S} && ./waf build ${@oe.utils.parallel_make_argument(d, '-j%d', limit=64)} ${EXTRA_OEWAF_BUILD}) 68 (cd ${S} && ${WAF_PYTHON} ./waf build ${@oe.utils.parallel_make_argument(d, '-j%d', limit=64)} ${EXTRA_OEWAF_BUILD})
64} 69}
65 70
66waf_do_install() { 71waf_do_install() {
67 (cd ${S} && ./waf install --destdir=${D} ${EXTRA_OEWAF_INSTALL}) 72 (cd ${S} && ${WAF_PYTHON} ./waf install --destdir=${D} ${EXTRA_OEWAF_INSTALL})
68} 73}
69 74
70EXPORT_FUNCTIONS do_configure do_compile do_install 75EXPORT_FUNCTIONS do_configure do_compile do_install