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

Update #4452
This commit is contained in:
Jan Sommer 2021-06-09 17:45:01 +02:00
parent a2bc8eba46
commit 9edb1201f6
2 changed files with 18 additions and 11 deletions

View File

@ -135,6 +135,7 @@ _defaults = {
('freebsd/sys/dev/mii', '**/*.h', 'dev/mii'), ('freebsd/sys/dev/mii', '**/*.h', 'dev/mii'),
('freebsd/sys/dev/pci', '**/*.h', 'dev/pci'), ('freebsd/sys/dev/pci', '**/*.h', 'dev/pci'),
('freebsd/sys/dev/nvme', '**/*.h', 'dev/nvme'), ('freebsd/sys/dev/nvme', '**/*.h', 'dev/nvme'),
('freebsd/sys/@CPU@/include', '**/*.h', ''),
('linux/include', '**/*.h', ''), ('linux/include', '**/*.h', ''),
('mDNSResponder/mDNSCore', 'mDNSDebug.h', ''), ('mDNSResponder/mDNSCore', 'mDNSDebug.h', ''),
('mDNSResponder/mDNSCore', 'mDNSEmbeddedAPI.h', ''), ('mDNSResponder/mDNSCore', 'mDNSEmbeddedAPI.h', ''),
@ -1443,7 +1444,6 @@ class dev_nic(builder.Module):
[ [
'sys/arm/include/cpufunc.h', 'sys/arm/include/cpufunc.h',
'sys/i386/include/md_var.h', 'sys/i386/include/md_var.h',
'sys/i386/include/intr_machdep.h',
'sys/i386/include/cpufunc.h', 'sys/i386/include/cpufunc.h',
'sys/x86/include/intr_machdep.h', 'sys/x86/include/intr_machdep.h',
'sys/x86/include/specialreg.h', 'sys/x86/include/specialreg.h',

View File

@ -495,12 +495,19 @@ class Builder(builder.ModuleManager):
if 'header-paths' in config: if 'header-paths' in config:
headerPaths = config['header-paths'] headerPaths = config['header-paths']
cpu = bld.get_env()['RTEMS_ARCH'] cpu = bld.get_env()['RTEMS_ARCH']
if cpu == "i386":
cpu = 'x86'
for headers in headerPaths: for headers in headerPaths:
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 # Get the dest path
ipath = os.path.join(arch_inc_path, headers[2]) ipath = os.path.join(arch_inc_path, headers[2])
start_dir = bld.path.find_dir(headers[0].replace('@CPU@', cpu)) start_dir = bld.path.find_dir(hp)
if start_dir != None: if start_dir != None:
bld.install_files("${PREFIX}/" + ipath, bld.install_files("${PREFIX}/" + ipath,
start_dir.ant_glob(headers[1]), start_dir.ant_glob(headers[1]),