waf: don't fail on missing pkg-config

Also remove unneeded wrapper method and use standard waf
This commit is contained in:
Francisco Ferreira 2018-09-02 18:05:27 +01:00 committed by Andrew Tridgell
parent 389a9ee88b
commit 2e3b4df47e
3 changed files with 20 additions and 15 deletions

View File

@ -481,8 +481,6 @@ class linux(Board):
def configure_env(self, cfg, env):
super(linux, self).configure_env(cfg, env)
cfg.find_toolchain_program('pkg-config', var='PKGCONFIG')
env.DEFINES.update(
CONFIG_HAL_BOARD = 'HAL_BOARD_LINUX',
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_NONE',

View File

@ -214,7 +214,12 @@ information about the first %d targets will be printed.
''' % MAX_TARGETS)
def configure(cfg):
cfg.find_toolchain_program('size', mandatory=False)
size_name = 'size'
if cfg.env.TOOLCHAIN != 'native':
size_name = cfg.env.TOOLCHAIN + '-' + size_name
cfg.find_program(size_name, var='SIZE', mandatory=False)
if not cfg.env.BUILD_SUMMARY_HEADER:
cfg.env.BUILD_SUMMARY_HEADER = [

View File

@ -16,6 +16,7 @@ from waflib import Errors, Context, Utils
from waflib.Configure import conf
from waflib.Tools import compiler_c, compiler_cxx
from waflib.Tools import clang, clangxx, gcc, gxx
from waflib.Tools import c_config
from waflib import Logs
import os
@ -112,19 +113,19 @@ def _filter_supported_cxx_compilers(*compilers):
l = compiler_cxx.cxx_compiler[k]
compiler_cxx.cxx_compiler[k] = [c for c in compilers if c in l]
@conf
def find_toolchain_program(cfg, filename, **kw):
filename = Utils.to_list(filename)
def _set_pkgconfig_crosscompilation_wrapper(cfg):
original_validatecfg = cfg.validate_cfg
if not kw.get('var', ''):
# just copy from the original implementation
kw['var'] = re.sub(r'[-.]', '_', filename[0].upper())
@conf
def new_validate_cfg(kw):
if not 'path' in kw:
if not cfg.env.PKGCONFIG:
cfg.find_program('%s-pkg-config' % cfg.env.TOOLCHAIN, var='PKGCONFIG')
kw['path'] = cfg.env.PKGCONFIG
if cfg.env.TOOLCHAIN != 'native':
for i, name in enumerate(filename):
filename[i] = '%s-%s' % (cfg.env.TOOLCHAIN, name)
original_validatecfg(kw)
return cfg.find_program(filename, **kw)
cfg.validate_cfg = new_validate_cfg
def configure(cfg):
_filter_supported_c_compilers('gcc', 'clang')
@ -138,9 +139,10 @@ def configure(cfg):
return
cfg.find_toolchain_program('ar')
cfg.msg('Using toolchain', cfg.env.TOOLCHAIN)
_set_pkgconfig_crosscompilation_wrapper(cfg)
cfg.find_program('%s-ar' % cfg.env.TOOLCHAIN, var='AR', quiet=True)
cfg.load('compiler_cxx compiler_c')
if not cfg.options.disable_gccdeps: