Skip to content
This repository has been archived by the owner on Feb 9, 2022. It is now read-only.

Commit

Permalink
waf: don't assume the waf intepretter is good
Browse files Browse the repository at this point in the history
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)

(From OE-Core rev: 3ad272ba25c4eba063f372f3bf8c1d3e94e2a966)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 85b6301)
[Fixes build issue on Ubuntu 20 with mvp
openembedded/meta-openembedded#304 ]
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
  • Loading branch information
rossburton authored and rpurdie committed Jan 21, 2021
1 parent 04481e7 commit 6b78a17
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions meta/classes/waf.bbclass
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# avoids build breaks when using no-static-libs.inc
DISABLE_STATIC = ""

# What Python interpretter to use. Defaults to Python 3 but can be
# overridden if required.
WAF_PYTHON ?= "python3"

B = "${WORKDIR}/build"

EXTRA_OECONF_append = " ${PACKAGECONFIG_CONFARGS}"
Expand Down Expand Up @@ -40,9 +44,10 @@ python waf_preconfigure() {
import subprocess
from distutils.version import StrictVersion
subsrcdir = d.getVar('S')
python = d.getVar('WAF_PYTHON')
wafbin = os.path.join(subsrcdir, 'waf')
try:
result = subprocess.check_output([wafbin, '--version'], cwd=subsrcdir, stderr=subprocess.STDOUT)
result = subprocess.check_output([python, 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}")
Expand All @@ -55,16 +60,16 @@ python waf_preconfigure() {
do_configure[prefuncs] += "waf_preconfigure"

waf_do_configure() {
(cd ${S} && ./waf configure -o ${B} --prefix=${prefix} ${WAF_EXTRA_CONF} ${EXTRA_OECONF})
(cd ${S} && ${WAF_PYTHON} ./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)} ${EXTRA_OEWAF_BUILD})
(cd ${S} && ${WAF_PYTHON} ./waf build ${@oe.utils.parallel_make_argument(d, '-j%d', limit=64)} ${EXTRA_OEWAF_BUILD})
}

waf_do_install() {
(cd ${S} && ./waf install --destdir=${D} ${EXTRA_OEWAF_INSTALL})
(cd ${S} && ${WAF_PYTHON} ./waf install --destdir=${D} ${EXTRA_OEWAF_INSTALL})
}

EXPORT_FUNCTIONS do_configure do_compile do_install

0 comments on commit 6b78a17

Please sign in to comment.