[rtems-libbsd commit] waf_libbsd.py: Apply path-mappings to header-paths

Jan Sommer jan at rtems.org
Wed Jun 9 15:25:44 UTC 2021


Module:    rtems-libbsd
Branch:    master
Commit:    d5d7e545797ff6a36ae209d0ff999f3fc4be784d
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=d5d7e545797ff6a36ae209d0ff999f3fc4be784d

Author:    Jan Sommer <jan.sommer at dlr.de>
Date:      Thu Jun  3 10:35:09 2021 +0200

waf_libbsd.py: Apply path-mappings to header-paths

---

 libbsd.py     |  2 +-
 waf_libbsd.py | 27 +++++++++++++++++----------
 2 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/libbsd.py b/libbsd.py
index add91e5..c915190 100644
--- a/libbsd.py
+++ b/libbsd.py
@@ -144,6 +144,7 @@ _defaults = {
      ('freebsd/sys/dev/pci',                    '**/*.h',                          'dev/pci'),
      ('freebsd/sys/dev/nvme',                   '**/*.h',                          'dev/nvme'),
      ('freebsd/sys/dev/evdev',                  '**/*.h',                          'dev/evdev'),
+     ('freebsd/sys/@CPU@/include',              '**/*.h',                          ''),
      ('linux/include',                          '**/*.h',                          ''),
      ('mDNSResponder/mDNSCore',                 'mDNSDebug.h',                     ''),
      ('mDNSResponder/mDNSCore',                 'mDNSEmbeddedAPI.h',               ''),
@@ -1585,7 +1586,6 @@ class dev_nic(builder.Module):
                 'sys/arm64/include/cpu.h',
                 'sys/arm/include/cpufunc.h',
                 'sys/i386/include/md_var.h',
-                'sys/i386/include/intr_machdep.h',
                 'sys/x86/include/intr_machdep.h',
                 'sys/i386/include/cpufunc.h',
                 'sys/x86/include/intr_machdep.h',
diff --git a/waf_libbsd.py b/waf_libbsd.py
index 070d3ea..0bd4fd3 100644
--- a/waf_libbsd.py
+++ b/waf_libbsd.py
@@ -538,17 +538,24 @@ class Builder(builder.ModuleManager):
         if 'header-paths' in config:
             headerPaths = config['header-paths']
             cpu = bld.get_env()['RTEMS_ARCH']
-            if cpu == "i386":
-                cpu = 'x86'
             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)
+                paths = [headers[0].replace('@CPU@', cpu)]
+                # Apply the path mappings
+                for source, targets in config['path-mappings']:
+                    if source in paths:
+                        i = paths.index(source)
+                        paths.remove(source)
+                        paths[i:i] = targets
+
+                for hp in paths:
+                    # Get the dest path
+                    ipath = os.path.join(arch_inc_path, headers[2])
+                    start_dir = bld.path.find_dir(hp)
+                    if start_dir != None:
+                        bld.install_files("${PREFIX}/" + ipath,
+                                        start_dir.ant_glob(headers[1]),
+                                        cwd=start_dir,
+                                        relative_trick=True)
 
         bld.install_files(os.path.join("${PREFIX}", arch_inc_path,
                                        module_header_path),



More information about the vc mailing list