[PATCH v2 1/2] waf: Support building from libbsd.py directly from waf.

Christian Mauderer christian.mauderer at embedded-brains.de
Mon Mar 26 10:08:09 UTC 2018


Hello Chris,

thanks for that great support for #3351. Like I already said there, I
started to work on something similar on Friday. But your solution is
quite a bit advanced compared to mine one. I haven't started to move any
configuration yet.

This patches will make it a lot easier to understand and maintain the
build system.

While looking at the patches, I noted that they don't apply on master
but only a few patches behind it. But I think that shouldn't be a big
problem.

I added a few comments for the waf_libbsd.py in the (shortened) patch below.

If you want, I can have a look at the documentation files (libbsd.txt,
README.waf, ...) and update them with this new information.

Best regards

Christian

Am 26.03.2018 um 06:14 schrieb Chris Johns:
> Remove the need to generate a waf script.
> 
> Move various pieces of data from the builder code to libbsd.py and make
> it configuration data.
> 
> Update #3351
> ---
>  builder.py          |  158 +--
>  freebsd-to-rtems.py |   18 +-
>  libbsd.py           |  319 ++++--
>  libbsd.txt          |   13 +-
>  libbsd_waf.py       | 3084 ---------------------------------------------------
>  waf_generator.py    |  693 ------------
>  waf_libbsd.py       |  645 +++++++++++
>  wscript             |   28 +-
>  8 files changed, 919 insertions(+), 4039 deletions(-)
>  delete mode 100644 libbsd_waf.py
>  delete mode 100755 waf_generator.py
>  create mode 100644 waf_libbsd.py
> 

[...]
> diff --git a/waf_libbsd.py b/waf_libbsd.py
> new file mode 100644
> index 00000000..8f5340ba
> --- /dev/null
> +++ b/waf_libbsd.py
> @@ -0,0 +1,645 @@

[...]

> +
> +        #
> +        # Include paths
> +        #
> +        includes = []
> +        if 'cpu-include-paths' in config:
> +            cpu = bld.get_env()['RTEMS_ARCH']
> +            if cpu == "i386":
> +                cpu = 'x86'
> +            for i in config['cpu-include-paths']:
> +                includes += [i.replace('@CPU@', cpu)]


I'm not sure whether that does the same as before. In the old
libbsd_waf.py that looked like follows:

    for i in ['-Irtemsbsd/@CPU@/include', '-Ifreebsd/sys/@CPU@/include']:
        includes += ["%s" % (i[2:].replace("@CPU@",
bld.get_env()["RTEMS_ARCH"]))]
    if bld.get_env()["RTEMS_ARCH"] == "i386":
        for i in ['-Irtemsbsd/@CPU@/include',
'-Ifreebsd/sys/@CPU@/include']:
            includes += ["%s" % (i[2:].replace("@CPU@", "x86"))]

So for the i386 we had i386 and x86 paths. Now we only have x86 paths.
Is that really correct?

> +        if 'include-paths' in config:
> +            includes += config['include-paths']
> +        if 'build-include-path' in config:
> +            includes += config['build-include-path']
> +
> +        #
> +        # Collect the libbsd uses
> +        #
> +        libbsd_use = []
> +
> +        #
> +        # Network test configuration
> +        #
> +        if not os.path.exists(bld.env.NET_CONFIG):
> +            bld.fatal('network configuraiton \'%s\' not found' % (bld.env.NET_CONFIG))
> +        tags = [ 'NET_CFG_SELF_IP',
> +                 'NET_CFG_NETMASK',
> +                 'NET_CFG_PEER_IP',
> +                 'NET_CFG_GATEWAY_IP',
> +                 'NET_TAP_INTERFACE' ]

The NET_TAP_INTERFACE is unused and wouldn't even work in the old python
code or in this one because it doesn't start with 'NET_CFG_'. The patch
that I recently sent has removed it.

> +        try:
> +            net_cfg_lines = open(bld.env.NET_CONFIG).readlines()
> +        except:
> +            bld.fatal('network configuraiton \'%s\' read failed' % (bld.env.NET_CONFIG))
> +        lc = 0

[...]

> +        #
> +        # Installs.
> +        #
> +        # Header file collector.
> +        #
> +        arch_lib_path = rtems.arch_bsp_lib_path(bld.env.RTEMS_VERSION,
> +                                                bld.env.RTEMS_ARCH_BSP)
> +        arch_inc_path = rtems.arch_bsp_include_path(bld.env.RTEMS_VERSION,
> +                                                    bld.env.RTEMS_ARCH_BSP)
> +
> +        bld.install_files("${PREFIX}/" + arch_lib_path, ["libbsd.a"])
> +
> +        if 'header-paths' in config:
> +            headerPaths = config['header-paths']
> +            cpu = bld.get_env()['RTEMS_ARCH']
> +            if cpu == "i386":
> +                cpu = 'x86'

I'm not really sure here: Are you sure that this is the same behavior
like before? I think we had two paths for i386 before.

> +            for headers in headerPaths:
> +                # Get the dest path
> +                ipath = os.path.join(arch_inc_path, headers[2])
> +                start_dir = bld.path.find_dir(headers[0].replace('@CPU@', cpu))
> +                if start_dir != None:
> +                    bld.install_files("${PREFIX}/" + ipath,
> +                                      start_dir.ant_glob(headers[1]),
> +                                      cwd = start_dir,
> +                                      relative_trick = True)
> +

[...]

> 

-- 
--------------------------------------------
embedded brains GmbH
Herr Christian Mauderer
Dornierstr. 4
D-82178 Puchheim
Germany
email: christian.mauderer at embedded-brains.de
Phone: +49-89-18 94 741 - 18
Fax:   +49-89-18 94 741 - 08
PGP: Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the devel mailing list