build: add a check_program check

This wraps waf's find_program in our own check boilerplate code so that it
can be used in the declarative dependencies section of the wscript.

Can be used like this:

    }, {
        'name': 'sed',
        'desc': 'sed program',
        'func': check_program('sed', 'SED'),
    }, {

First argument is the program name, and the second is the waf variable name
where the program path will be stored. In this example we will be able to
refer to sed with ${{SED}} when creating waf Tasks in wscript_build.

/cc @giselher: I think you need this for wayland-scanner.
This commit is contained in:
Stefano Pigozzi 2014-09-03 23:44:38 +02:00
parent fc68c9269d
commit 7b0de4aa0e
1 changed files with 6 additions and 1 deletions

View File

@ -6,7 +6,7 @@ from waflib import Utils
__all__ = [
"check_pkg_config", "check_cc", "check_statement", "check_libs",
"check_headers", "compose_checks", "check_true", "any_version",
"load_fragment", "check_stub", "check_ctx_vars"]
"load_fragment", "check_stub", "check_ctx_vars", "check_program"]
any_version = None
@ -29,6 +29,11 @@ def _filter_cc_arguments(ctx, opts):
opts['execute'] = False
return opts
def check_program(name, var):
def fn(ctx, dependency_identifier):
return ctx.find_program(name, var=var, mandatory=False)
return fn
def check_libs(libs, function):
libs = [None] + libs
def fn(ctx, dependency_identifier):