[rtems-net-legacy commit] waf: Generate a version header called rtems-net-legacy.h

Gedare Bloom gedare at rtems.org
Fri Apr 14 14:06:14 UTC 2023


On Thu, Apr 13, 2023 at 11:59 PM Chris Johns <chrisj at rtems.org> wrote:
>
> Module:    rtems-net-legacy
> Branch:    main
> Commit:    bef50b9ff76d3f6231e3c92bb35d47ee5bc7f0cb
> Changeset: http://git.rtems.org/rtems-net-legacy/commit/?id=bef50b9ff76d3f6231e3c92bb35d47ee5bc7f0cb
>
> Author:    Chris Johns <chrisj at rtems.org>
> Date:      Thu Apr 13 18:28:47 2023 -1000
>
> waf: Generate a version header called rtems-net-legacy.h
>
> ---
>
>  include/rtems/rtems-net-legacy.h.in | 42 +++++++++++++++++++++++++++++++++++++
>  netlegacy.py                        | 35 ++++++++++++++++++++++++++++---
>  rtems_waf                           |  2 +-
>  3 files changed, 75 insertions(+), 4 deletions(-)
>
> diff --git a/include/rtems/rtems-net-legacy.h.in b/include/rtems/rtems-net-legacy.h.in
> new file mode 100755
> index 0000000..a17ec21
> --- /dev/null
> +++ b/include/rtems/rtems-net-legacy.h.in
> @@ -0,0 +1,42 @@
> +/**
> + * @file
> + *
> + * @ingroup rtems_net_legacy
> + *
> + * @brief This file is generated
> + */
> +
> +/*
> + * Copyright (c) 2023. Chris Johns <chrisj at rtems.org>. All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in the
> + *    documentation and/or other materials provided with the distribution.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
> + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> + * SUCH DAMAGE.
> + */
> +
> +#ifndef _RTEMS_NET_LGEACY_H_
typo in the header guard

> +#define _RTEMS_NET_LEGACY_H_
> +
> +#define RTEMS_NET_LEGACY_VERSION  @RTEMS_NET_LEGACY_VERSION@
> +
> +#define RTEMS_NET_LEGACY_MAJOR    @RTEMS_NET_LEGACY_MAJOR@
> +#define RTEMS_NET_LEGACY_REVISION @RTEMS_NET_LEGACY_REVISION@
> +
> +#endif /* _RTEMS_NET_LGEACY_H_ */
> diff --git a/netlegacy.py b/netlegacy.py
> index 60775dc..9f27ffc 100644
> --- a/netlegacy.py
> +++ b/netlegacy.py
> @@ -29,12 +29,31 @@
>  import os
>  import os.path
>
> +from rtems_waf import git
>  from rtems_waf import rtems
> +from rtems_waf import version
>
>  import bsp_drivers
>  import netsources
>
>
> +def version_header(bld):
> +    versions = {
> +        'RTEMS_NET_LEGACY_VERSION':
> +        '"' + bld.env.RTEMS_NET_LEGACY_VERSION + '"',
> +        'RTEMS_NET_LEGACY_MAJOR': bld.env.RTEMS_NET_LEGACY_MAJOR,
> +        'RTEMS_NET_LEGACY_REVISION':
> +        '"' + bld.env.RTEMS_NET_LEGACY_REVISION + '"',
> +    }
> +    sed = 'sed '
> +    for cfg in versions:
> +        sed += "-e 's/@%s@/%s/' " % (cfg, versions[cfg])
> +    bld(target='include/rtems/rtems-net-legacy.h',
> +        source='include/rtems/rtems-net-legacy.h.in',
> +        rule=sed + ' < ${SRC} > ${TGT}',
> +        update_outputs=True)
> +
> +
>  def net_config_header(bld):
>      if not os.path.exists(bld.env.NET_CONFIG):
>          bld.fatal('network configuraiton \'%s\' not found' %
> @@ -88,7 +107,14 @@ def options(opt):
>
>
>  def bsp_configure(conf, arch_bsp, mandatory=True):
> -    ab = rtems.arch(arch_bsp) + '/' + rtems.bsp(arch_bsp)
> +    conf.start_msg('Checking version')
> +    version.load_rtems_version_header(conf, conf.env.RTEMS_VERSION, arch_bsp,
> +                                      conf.env.IFLAGS)
> +    conf.env.RTEMS_NET_LEGACY_VERSION = version.string(conf)
> +    conf.env.RTEMS_NET_LEGACY_MAJOR = version.version(conf)
> +    conf.env.RTEMS_NET_LEGACY_REVISION = version.revision(conf)
> +    conf.end_msg(conf.env.RTEMS_NET_LEGACY_VERSION)
> +    ab = rtems.arch_bsp_name(arch_bsp)
>      includes = [
>          '.',
>          'include',
> @@ -125,9 +151,9 @@ def bsp_configure(conf, arch_bsp, mandatory=True):
>
>
>  def build(bld):
> -    arch_bsp = bld.env.RTEMS_ARCH_BSP
> -    ab = rtems.arch(arch_bsp) + '/' + rtems.bsp(arch_bsp)
> +    ab = rtems.arch_bsp_name(bld.env.RTEMS_ARCH_BSP)
>
> +    version_header(bld)
>      net_config_header(bld)
>
>      if ab in bsp_drivers.source:
> @@ -173,3 +199,6 @@ def build(bld):
>              bld.install_as(
>                  os.path.join(bld.env.PREFIX, arch_inc_path, inc_dir, hname),
>                  header)
> +    bld.install_as(
> +        os.path.join(bld.env.PREFIX, arch_inc_path, 'rtems',
> +                     'rtems-net-legacy.h'), 'include/rtems/rtems-net-legacy.h')
> diff --git a/rtems_waf b/rtems_waf
> index 1a118bb..2c15b90 160000
> --- a/rtems_waf
> +++ b/rtems_waf
> @@ -1 +1 @@
> -Subproject commit 1a118bbcd52138dbdc3236e64bc23fd430a064b1
> +Subproject commit 2c15b90de5c369aa78cd2252a50bba677e9b13f3
>
> _______________________________________________
> vc mailing list
> vc at rtems.org
> http://lists.rtems.org/mailman/listinfo/vc


More information about the devel mailing list