poky/meta/classes/waf.bbclass
Amanda Brindle b6b6e006f7 waf.bbclass: Throw error if waf doesn't exist
Before, waf.bbclass would fail to catch FileNotFoundError. Now, it will
catch this error and say that waf doesn't exist.

Fixes [YOCTO 12553]

(From OE-Core rev: f8321dedec7abe392f7e49ff8eee0640463adae5)

Signed-off-by: Amanda Brindle <amanda.r.brindle@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-03-25 09:40:42 +01:00

38 lines
1.2 KiB
Plaintext

# avoids build breaks when using no-static-libs.inc
DISABLE_STATIC = ""
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() {
${S}/waf configure --prefix=${prefix} ${WAF_EXTRA_CONF} ${EXTRA_OECONF}
}
do_compile[progress] = "outof:^\[\s*(\d+)/\s*(\d+)\]\s+"
waf_do_compile() {
${S}/waf build ${@oe.utils.parallel_make_argument(d, '-j%d', limit=64)}
}
waf_do_install() {
${S}/waf install --destdir=${D}
}
EXPORT_FUNCTIONS do_configure do_compile do_install