summaryrefslogtreecommitdiffstats
path: root/meta/classes/waf.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/waf.bbclass')
-rw-r--r--meta/classes/waf.bbclass76
1 files changed, 0 insertions, 76 deletions
diff --git a/meta/classes/waf.bbclass b/meta/classes/waf.bbclass
deleted file mode 100644
index 188119f356..0000000000
--- a/meta/classes/waf.bbclass
+++ /dev/null
@@ -1,76 +0,0 @@
1# avoids build breaks when using no-static-libs.inc
2DISABLE_STATIC = ""
3
4# What Python interpretter to use. Defaults to Python 3 but can be
5# overridden if required.
6WAF_PYTHON ?= "python3"
7
8B = "${WORKDIR}/build"
9do_configure[cleandirs] += "${B}"
10
11EXTRA_OECONF_append = " ${PACKAGECONFIG_CONFARGS}"
12
13EXTRA_OEWAF_BUILD ??= ""
14# In most cases, you want to pass the same arguments to `waf build` and `waf
15# install`, but you can override it if necessary
16EXTRA_OEWAF_INSTALL ??= "${EXTRA_OEWAF_BUILD}"
17
18def waflock_hash(d):
19 # Calculates the hash used for the waf lock file. This should include
20 # all of the user controllable inputs passed to waf configure. Note
21 # that the full paths for ${B} and ${S} are used; this is OK and desired
22 # because a change to either of these should create a unique lock file
23 # to prevent collisions.
24 import hashlib
25 h = hashlib.sha512()
26 def update(name):
27 val = d.getVar(name)
28 if val is not None:
29 h.update(val.encode('utf-8'))
30 update('S')
31 update('B')
32 update('prefix')
33 update('EXTRA_OECONF')
34 return h.hexdigest()
35
36# Use WAFLOCK to specify a separate lock file. The build is already
37# sufficiently isolated by setting the output directory, this ensures that
38# bitbake won't step on toes of any other configured context in the source
39# directory (e.g. if the source is coming from externalsrc and was previously
40# configured elsewhere).
41export WAFLOCK = ".lock-waf_oe_${@waflock_hash(d)}_build"
42BB_HASHBASE_WHITELIST += "WAFLOCK"
43
44python waf_preconfigure() {
45 import subprocess
46 from distutils.version import StrictVersion
47 subsrcdir = d.getVar('S')
48 python = d.getVar('WAF_PYTHON')
49 wafbin = os.path.join(subsrcdir, 'waf')
50 try:
51 result = subprocess.check_output([python, wafbin, '--version'], cwd=subsrcdir, stderr=subprocess.STDOUT)
52 version = result.decode('utf-8').split()[1]
53 if StrictVersion(version) >= StrictVersion("1.8.7"):
54 d.setVar("WAF_EXTRA_CONF", "--bindir=${bindir} --libdir=${libdir}")
55 except subprocess.CalledProcessError as e:
56 bb.warn("Unable to execute waf --version, exit code %d. Assuming waf version without bindir/libdir support." % e.returncode)
57 except FileNotFoundError:
58 bb.fatal("waf does not exist in %s" % subsrcdir)
59}
60
61do_configure[prefuncs] += "waf_preconfigure"
62
63waf_do_configure() {
64 (cd ${S} && ${WAF_PYTHON} ./waf configure -o ${B} --prefix=${prefix} ${WAF_EXTRA_CONF} ${EXTRA_OECONF})
65}
66
67do_compile[progress] = "outof:^\[\s*(\d+)/\s*(\d+)\]\s+"
68waf_do_compile() {
69 (cd ${S} && ${WAF_PYTHON} ./waf build ${@oe.utils.parallel_make_argument(d, '-j%d', limit=64)} ${EXTRA_OEWAF_BUILD})
70}
71
72waf_do_install() {
73 (cd ${S} && ${WAF_PYTHON} ./waf install --destdir=${D} ${EXTRA_OEWAF_INSTALL})
74}
75
76EXPORT_FUNCTIONS do_configure do_compile do_install