@ -16,6 +16,7 @@ from waflib import Errors, Context, Utils
@@ -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):
@@ -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):
@@ -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 :