[PATCH rtems-lwip] lwip.py: Allow lwIP to build against stale install

Kinsey Moore kinsey.moore at oarcorp.com
Sun Sep 11 13:30:21 UTC 2022


On 9/10/2022 20:22, Chris Johns wrote:
> On 10/9/2022 12:07 pm, Kinsey Moore wrote:
>> This removes the default BSP include path from environment variables so
>> that rtems-lwip can build even when there's a stale version with
>> outdated headers installed in the BSP.
>
> I am not following what this does and what problem you are attempting 
> to solve?
>
> I am not comfortable seeing rtems_waf being overridden like this.
>
> Chris
>
This is approximately the same change that you did for libbsd that 
shuffles the include paths so that lwip builds against local headers 
first and isn't broken by a stale install of rtems-lwip in the BSP 
install directory.

Kinsey

>> ---
>>   lwip.py | 22 ++++++++++++++++------
>>   1 file changed, 16 insertions(+), 6 deletions(-)
>>
>> diff --git a/lwip.py b/lwip.py
>> index 84eef2c..3d9cb29 100644
>> --- a/lwip.py
>> +++ b/lwip.py
>> @@ -99,6 +99,9 @@ def build(bld):
>>       drv_incl = []
>>       arch_lib_path = rtems.arch_bsp_lib_path(bld.env.RTEMS_VERSION,
>> bld.env.RTEMS_ARCH_BSP)
>> +    bsp_incl = os.path.relpath(
>> +        os.path.join(bld.env.PREFIX, arch_lib_path, 'include')
>> +    )
>>       with open('file-import.json', 'r') as cf:
>>           files = json.load(cf)
>>           for f in files['files-to-import']:
>> @@ -155,6 +158,7 @@ def build(bld):
>>       lwip_obj_incl.extend(drv_incl)
>>       lwip_obj_incl.extend(bsd_compat_incl)
>>       lwip_obj_incl.extend(common_includes)
>> +    lwip_obj_incl.append(bsp_incl)
>>         bld(features='c',
>>           target='lwip_obj',
>> @@ -166,9 +170,7 @@ def build(bld):
>>       drv_obj_incl = []
>>       drv_obj_incl.extend(drv_incl)
>>       drv_obj_incl.extend(common_includes)
>> -    drv_obj_incl.append(os.path.relpath(
>> -        os.path.join(bld.env.PREFIX, arch_lib_path, 'include')
>> -    ))
>> +    drv_obj_incl.append(bsp_incl)
>>         bld(features='c',
>>           target='driver_obj',
>> @@ -203,9 +205,7 @@ def build(bld):
>>       test_app_incl.extend(drv_incl)
>>       test_app_incl.extend(common_includes)
>>       test_app_incl.append('rtemslwip/test/')
>> -    test_app_incl.append(
>> -        os.path.relpath(os.path.join(arch_lib_path, 'include'))
>> -    )
>> +    test_app_incl.append(bsp_incl)
>>       bld.program(features='c',
>>                   target='networking01.exe',
>> source='rtemslwip/test/networking01/sample_app.c',
>> @@ -235,8 +235,18 @@ def add_flags(flags, new_flags):
>>               flags.append(flag)
>>     +def strip_bsp_include(bsp_include_path, current_flags):
>> +    # this does not handle quted strings; maybe needed
>> +    for bsp_path in bsp_include_path:
>> +        current_flags = [flag for flag in current_flags if flag != 
>> bsp_path]
>> +    return current_flags
>> +
>> +
>>   def bsp_configure(conf, arch_bsp):
>>       conf.env.LIB += ['m']
>>       section_flags = ["-fdata-sections", "-ffunction-sections"]
>>       add_flags(conf.env.CFLAGS, section_flags)
>>       add_flags(conf.env.CXXFLAGS, section_flags)
>> +    conf.env.CFLAGS = strip_bsp_include(conf.env.IFLAGS, 
>> conf.env.CFLAGS)
>> +    conf.env.CXXFLAGS = strip_bsp_include(conf.env.IFLAGS, 
>> conf.env.CXXFLAGS)
>> +    conf.env.LINKFLAGS = strip_bsp_include(conf.env.IFLAGS, 
>> conf.env.LINKFLAGS)


More information about the devel mailing list