Browse Source

waf: don't fail on missing pkg-config

Also remove unneeded wrapper method and use standard waf
master
Francisco Ferreira 7 years ago committed by Andrew Tridgell
parent
commit
2e3b4df47e
  1. 2
      Tools/ardupilotwaf/boards.py
  2. 7
      Tools/ardupilotwaf/build_summary.py
  3. 26
      Tools/ardupilotwaf/toolchain.py

2
Tools/ardupilotwaf/boards.py

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

7
Tools/ardupilotwaf/build_summary.py

@ -214,7 +214,12 @@ information about the first %d targets will be printed.
''' % MAX_TARGETS) ''' % MAX_TARGETS)
def configure(cfg): 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: if not cfg.env.BUILD_SUMMARY_HEADER:
cfg.env.BUILD_SUMMARY_HEADER = [ cfg.env.BUILD_SUMMARY_HEADER = [

26
Tools/ardupilotwaf/toolchain.py

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

Loading…
Cancel
Save