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 @@ -31,6 +31,14 @@ %define rtems_bsp_error 1 %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 @@ -83,6 +103,18 @@ %define rtems_waf_rtems --rtems=%{with_rtems} %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. # @@ -111,15 +143,6 @@ %define _localedir %{_datadir}/locale %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 # @@ -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})