I have a waf build script and need to invoke a program which is not officially supported.
#file wscript
def configure(conf):
conf.env.LIB = ['c', 'd']
conf.env.INCLUDES = ['include']
conf.env.LIB_xml2 = ['xml2']
conf.env.INCLUDES_xml2 = ['/usr/include/libxml2']
def build(bld):
bld(rule="dstep ${SRC} -o ${TGT} ${LIB_ST:LIB} ${DINC_ST:INCLUDES}",
use="xml2",
source="header.h",
target="target.d",
)
This expands to dstep header.h -o target.d -lc -ld -I/usr/include/libxml2
, so only the global LIB variable works, the use parameter seems to entirely ignored.
How can I make it respect the use parameter?
For waf to process the use
keyword, you must add the use
feature to your task generator. You also need to add a "compile" aware feature like c, d or cxx. Like this:
def build(bld):
bld(
rule="dstep ${SRC} -o ${TGT} ${LIB_ST:LIB} ${DINC_ST:INCLUDES}",
features = ["use", "c"],
use="xml2",
source="header.h",
target="target.d",
)
You can also program specifics for your dstep (You have to define a dstep
feature and define the USELIB_VARS["dstep"]
)
Note: See ccroot.py
in waf code.