summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2022-09-30 17:09:57 +1000
committerChris Johns <chrisj@rtems.org>2022-09-30 17:09:57 +1000
commit369b60a0b4ed961eba8da634d09691841e67e3de (patch)
treebf897d194298d4d59357318bda61086669f7de63
parentsb/set-bulder: Fix installing builds when a single buildset (diff)
downloadrtems-source-builder-369b60a0b4ed961eba8da634d09691841e67e3de.tar.bz2
rtems/bsps: Optionally support arch/bsp if used
Updates #4717
-rw-r--r--rtems/config/rtems-bsp.cfg55
1 files changed, 41 insertions, 14 deletions
diff --git a/rtems/config/rtems-bsp.cfg b/rtems/config/rtems-bsp.cfg
index 801cd5c..af9ad3d 100644
--- a/rtems/config/rtems-bsp.cfg
+++ b/rtems/config/rtems-bsp.cfg
@@ -40,6 +40,44 @@
%{pkgconfig filter-flags yes}
#
+# We need a BSP from the user.
+#
+%ifn %{defined with_rtems_bsp}
+ %if %{rtems_bsp_error}
+ %error No RTEMS BSP specified: --with-rtems-bsp=bsp
+ %endif
+ %define with_rtems_bsp sparc/erc32
+%endif
+%define rtems_bsp %{with_rtems_bsp}
+
+#
+# If the BSP(s) have a '/' it is the arch/bsp notation.
+#
+%define is_arch_bsp %(echo %{rtems_bsp} | sed -e 's/.*\/.*/yes/g')
+%if %{is_arch_bsp} == yes
+ %define rtems_ab_bsps \
+ %(x=''; \
+ for b in %{rtems_bsp}; do x="$x "$(echo $b | sed -e 's/.*\///g'); done; \
+ echo $x)
+ %define rtems_ab_archs \
+ %(x=''; \
+ for b in %{rtems_bsp}; do x="$x "$(echo $b | sed -e 's/\/.*//g'); done; \
+ echo $x | tr ' ' '\n' | sort | uniq)
+ %define rtems_arch_count %(echo %{rtems_ab_archs} | tr ' ' '\n' | wc -l)
+ %if %{rtems_arch_count} != 1
+ %error Invalid BSP architecture count
+ %endif
+ %define rtems_bsp %{rtems_ab_bsps}
+ %define rtems_target %{rtems_ab_archs}-rtems%{rtems_version}
+ %define rtems_host %{rtems_target}
+%endif
+
+%define rtems_bsp_count %(echo %{rtems_bsp} | tr ' ' '\n' | wc -l)
+%if %{rtems_bsp_count} != 1
+ %error Building packages with more than one BSP is not supported
+%endif
+
+#
# We need a host from the user to specifiy the RTEMS architecture and major
# version. It can be defined in rtems_host.
#
@@ -53,17 +91,6 @@
%endif
#
-# We need a BSP from the user.
-#
-%ifn %{defined with_rtems_bsp}
- %if %{rtems_bsp_error}
- %error No RTEMS BSP specified: --with-rtems-bsp=bsp
- %endif
- %define with_rtems_bsp sparc/erc32
-%endif
-%define rtems_bsp %{with_rtems_bsp}
-
-#
# If no tools or RTEMS provided use the prefix. If staging use the staging
# root.
#
@@ -215,14 +242,14 @@
#
# Note: default BSP flags include the standard RTEMS libraries.
#
-%define rtems-dep-check %(%{_sbdir}/sb/rtems-build-dep -c %{with_tools}/bin/%{rtems_bsp_cc}
+%define rtems-dep-check %{_sbdir}/sb/rtems-build-dep -c %{with_tools}/bin/%{rtems_bsp_cc}
-%define rtems-libbsd %{rtems-dep-check} -L %{rtems_bsp_libpath} -l libbsd.a)
+%define rtems-libbsd %(%{rtems-dep-check} -L %{rtems_bsp_libpath} -l libbsd.a)
%if %{rtems-libbsd} == found
%define rtems_bsp_libs %{rtems_bsp_libs} -lbsd -lm -lz
%endif
-%define rtems-defaultconfig %{rtems-dep-check} -L %{rtems_bsp_libpath} -l librtemsdefaultconfig.a)
+%define rtems-defaultconfig %(%{rtems-dep-check} -L %{rtems_bsp_libpath} -l librtemsdefaultconfig.a)
%if %{rtems-defaultconfig} == found
%define rtems_bsp_libs %{rtems_bsp_libs} -lrtemsdefaultconfig
%endif