[PATCHv2 rtems_waf] Allow vendor field in toolchain target triplet

Martin Erik Werner martinerikwerner.aac at gmail.com
Wed May 24 18:13:10 UTC 2023


Rework the splitting of arch and bsp to rely on the last field in the
arch section starting with "rtems", instead of relying on the arch being
exactly two fields in size.

This makes sure that toolchains with a vendor field in their target
triplet can be used with this build system.

Toolchains produced by the RTEMS source builder tend to omit the vendor
field, but for example the SPARC LEON/ERC32 toolchain provided by
Gaisler through the RCC package does include a vendor field.
---

v2 fixes an off-by-one error in list indexing compared to v1.

 rtems.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/rtems.py b/rtems.py
index 0b24645..c65a7d2 100644
--- a/rtems.py
+++ b/rtems.py
@@ -858,11 +858,15 @@ def _check_arch_bsps(req, config, path, archs, version):
 
 
 def _arch_from_arch_bsp(arch_bsp):
-    return '-'.join(arch_bsp.split('-')[:2])
+    fields = arch_bsp.split('-')
+    rtems_field_index = next(i for i, field in enumerate(fields) if field.startswith('rtems'))
+    return '-'.join(fields[:(rtems_field_index + 1)])
 
 
 def _bsp_from_arch_bsp(arch_bsp):
-    return '-'.join(arch_bsp.split('-')[2:])
+    fields = arch_bsp.split('-')
+    rtems_field_index = next(i for i, field in enumerate(fields) if field.startswith('rtems'))
+    return '-'.join(fields[(rtems_field_index + 1):])
 
 
 def _pkgconfig_path(path):
-- 
2.30.2



More information about the devel mailing list