[rtems-source-builder commit] rtems/bsps: Fix building 3rd party packages with various options
Chris Johns
chrisj at rtems.org
Tue Mar 3 02:01:22 UTC 2020
Module: rtems-source-builder
Branch: master
Commit: abd98a2440e24f264681cbac0618a41a46ca2b56
Changeset: http://git.rtems.org/rtems-source-builder/commit/?id=abd98a2440e24f264681cbac0618a41a46ca2b56
Author: Chris Johns <chrisj at rtems.org>
Date: Tue Mar 3 11:11:17 2020 +1100
rtems/bsps: Fix building 3rd party packages with various options
- Fix locating valid tools and BSP. If either is found in the
staging area use that else use the specific --with-* option
and if not present use the --prefix.
- Locate the tools by checking if the arch's C compiler is a valid
file. No other checks are made on the tools.
- Locate a BSB by checking for a valid pkgconfig file for the
BSP.
- Only filter flags if the BSP is in the staging area
Closes #3893
---
rtems/config/rtems-bsp.cfg | 53 +++++++++++++++++++++++++++++++++-------------
1 file changed, 38 insertions(+), 15 deletions(-)
diff --git a/rtems/config/rtems-bsp.cfg b/rtems/config/rtems-bsp.cfg
index 8c8a512..d50615e 100644
--- a/rtems/config/rtems-bsp.cfg
+++ b/rtems/config/rtems-bsp.cfg
@@ -10,10 +10,10 @@
# Keeping the package's installed path in the RTEMS install path and separate
# to the tools lets the tools version vary independently.
#
-# Provide the path to the RTEMS tools is not in the prefix with the
+# Provide the path to the RTEMS tools if not in the prefix with the
# --with-tools option. If --with-tools is not provided use the prefix.
#
-# Provide the path to the installed RTEMS kernel is not in the prefix with the
+# Provide the path to the installed RTEMS kernel if not in the prefix with the
# --with-rtems option. If --with-rtems is not provided use the prefix.
#
# Note, only a single path (--with-rtems) for the RTEMS kernel and any other
@@ -32,6 +32,14 @@
%endif
#
+# Set up how we manage pkgconfig. Enable support when crosscompiling,
+# and filter specific optimisation and warning from the flags that
+# RTEMS exports.
+#
+%{pkgconfig crosscompile yes}
+%{pkgconfig filter-flags yes}
+
+#
# We need a host from the user to specifiy the RTEMS architecture and major
# version. It can be defined in rtems_host.
#
@@ -60,10 +68,13 @@
# root.
#
%ifn %{defined with_tools}
- %if %{install_mode} == staging
+ %if %{install_mode} == staging && \
+ %{path check isfile %{stagingroot}/bin/%{_host}-%{_host_cc}}
+ %define rtems_tools_staged 1
%define with_tools %{stagingroot}
%define rtems_waf_tools --rtems-tools=%{with_tools}
%else
+ %define rtems_tools_staged 1
%define with_tools %{_prefix}
%define rtems_waf_tools %{nil}
%endif
@@ -71,11 +82,20 @@
%define rtems_waf_tools --rtems-tools=%{with_tools}
%endif
+%define rtems_host_cc_valid \
+ %{path check isfile %{with_tools}/bin/%{_host}-%{_host_cc}}
+%if !%{rtems_host_cc_valid} && %{rtems_bsp_error} && !%{_rsb_getting_source}
+ %error RTEMS tools not found (%{_host}-%{_host_cc}) found; Please check the --with-tools option or --prefix.
+%endif
+
%ifn %{defined with_rtems}
- %if %{install_mode} == staging
+ %{pkgconfig prefix %{stagingroot}/lib/pkgconfig}
+ %if %{install_mode} == staging && %{pkgconfig check %{_host}-%{rtems_bsp}}
+ %define rtems_bsp_staged 1
%define with_rtems %{stagingroot}
%define rtems_waf_rtems --rtems=%{with_rtems}
%else
+ %define rtems_bsp_staged 0
%define with_rtems %{_prefix}
%define rtems_waf_rtems %{nil}
%endif
@@ -84,6 +104,18 @@
%endif
#
+# Set the pkgconfig prefix path to the RTEMS prefix.
+#
+%{pkgconfig prefix %{with_rtems}/lib/pkgconfig}
+
+#
+# Check we can find the BSP's pkgconfig file.
+#
+%if !%{pkgconfig check %{_host}-%{rtems_bsp}} && %{rtems_bsp_error} && !%{_rsb_getting_source}
+ %error RTEMS BSP not found (%{_host}-%{rtems_bsp}.pc); Please check the --with-rtems option or --prefix.
+%endif
+
+#
# Set the path to the tools.
#
%{path prepend %{with_tools}/bin}
@@ -112,15 +144,6 @@
%define _localstatedir %{_exec_prefix}/var
#
-# Set up how we manage pkgconfig. Set the prefix path to the RTEMS prefix,
-# enable support when crosscompiling, and filter specific optimisation and
-# warning from the flags that RTEMS exports.
-#
-%{pkgconfig prefix %{with_rtems}/lib/pkgconfig}
-%{pkgconfig crosscompile yes}
-%{pkgconfig filter-flags yes}
-
-#
# The RTEMS BSP Flags
#
%define rtems_bsp_includes -I%{_includedir}
@@ -155,9 +178,9 @@
#
# Filter the flags converting any prefix to the staging path if this is a
-# staging build.
+# staging build of the BSP.
#
-%if %{install_mode} == staging
+%if %{rtems_bsp_staged}
%define staging_filter sed -e 's|%{_prefix}|%{stagingroot}|g'
%define rtems_bsp_prefix $(echo %{rtems_bsp_prefix} | %{staging_filter})
%define rtems_bsp_includes $(echo %{rtems_bsp_includes} | %{staging_filter})
More information about the vc
mailing list